diff options
Diffstat (limited to 'fs/gfs2/ops_inode.c')
-rw-r--r-- | fs/gfs2/ops_inode.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index ce4f1dfb533f..98a94cfc2bb2 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -471,18 +471,15 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
471 | if (!gfs2_assert_withdraw(sdp, !error)) { | 471 | if (!gfs2_assert_withdraw(sdp, !error)) { |
472 | struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; | 472 | struct gfs2_dinode *di = (struct gfs2_dinode *)dibh->b_data; |
473 | struct gfs2_dirent *dent = (struct gfs2_dirent *)(di+1); | 473 | struct gfs2_dirent *dent = (struct gfs2_dirent *)(di+1); |
474 | struct qstr str; | ||
475 | 474 | ||
476 | gfs2_str2qstr(&str, "."); | ||
477 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 475 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
478 | gfs2_qstr2dirent(&str, GFS2_DIRENT_SIZE(str.len), dent); | 476 | gfs2_qstr2dirent(&gfs2_qdot, GFS2_DIRENT_SIZE(gfs2_qdot.len), dent); |
479 | dent->de_inum = di->di_num; /* already GFS2 endian */ | 477 | dent->de_inum = di->di_num; /* already GFS2 endian */ |
480 | dent->de_type = cpu_to_be16(DT_DIR); | 478 | dent->de_type = cpu_to_be16(DT_DIR); |
481 | di->di_entries = cpu_to_be32(1); | 479 | di->di_entries = cpu_to_be32(1); |
482 | 480 | ||
483 | gfs2_str2qstr(&str, ".."); | ||
484 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); | 481 | dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1)); |
485 | gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); | 482 | gfs2_qstr2dirent(&gfs2_qdotdot, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent); |
486 | 483 | ||
487 | gfs2_inum_out(dip, dent); | 484 | gfs2_inum_out(dip, dent); |
488 | dent->de_type = cpu_to_be16(DT_DIR); | 485 | dent->de_type = cpu_to_be16(DT_DIR); |
@@ -523,7 +520,6 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
523 | static int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | 520 | static int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, |
524 | struct gfs2_inode *ip) | 521 | struct gfs2_inode *ip) |
525 | { | 522 | { |
526 | struct qstr dotname; | ||
527 | int error; | 523 | int error; |
528 | 524 | ||
529 | if (ip->i_entries != 2) { | 525 | if (ip->i_entries != 2) { |
@@ -540,13 +536,11 @@ static int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name, | |||
540 | if (error) | 536 | if (error) |
541 | return error; | 537 | return error; |
542 | 538 | ||
543 | gfs2_str2qstr(&dotname, "."); | 539 | error = gfs2_dir_del(ip, &gfs2_qdot); |
544 | error = gfs2_dir_del(ip, &dotname); | ||
545 | if (error) | 540 | if (error) |
546 | return error; | 541 | return error; |
547 | 542 | ||
548 | gfs2_str2qstr(&dotname, ".."); | 543 | error = gfs2_dir_del(ip, &gfs2_qdotdot); |
549 | error = gfs2_dir_del(ip, &dotname); | ||
550 | if (error) | 544 | if (error) |
551 | return error; | 545 | return error; |
552 | 546 | ||
@@ -695,11 +689,8 @@ static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to) | |||
695 | struct inode *dir = &to->i_inode; | 689 | struct inode *dir = &to->i_inode; |
696 | struct super_block *sb = dir->i_sb; | 690 | struct super_block *sb = dir->i_sb; |
697 | struct inode *tmp; | 691 | struct inode *tmp; |
698 | struct qstr dotdot; | ||
699 | int error = 0; | 692 | int error = 0; |
700 | 693 | ||
701 | gfs2_str2qstr(&dotdot, ".."); | ||
702 | |||
703 | igrab(dir); | 694 | igrab(dir); |
704 | 695 | ||
705 | for (;;) { | 696 | for (;;) { |
@@ -712,7 +703,7 @@ static int gfs2_ok_to_move(struct gfs2_inode *this, struct gfs2_inode *to) | |||
712 | break; | 703 | break; |
713 | } | 704 | } |
714 | 705 | ||
715 | tmp = gfs2_lookupi(dir, &dotdot, 1); | 706 | tmp = gfs2_lookupi(dir, &gfs2_qdotdot, 1); |
716 | if (IS_ERR(tmp)) { | 707 | if (IS_ERR(tmp)) { |
717 | error = PTR_ERR(tmp); | 708 | error = PTR_ERR(tmp); |
718 | break; | 709 | break; |
@@ -921,9 +912,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
921 | } | 912 | } |
922 | 913 | ||
923 | if (dir_rename) { | 914 | if (dir_rename) { |
924 | struct qstr name; | ||
925 | gfs2_str2qstr(&name, ".."); | ||
926 | |||
927 | error = gfs2_change_nlink(ndip, +1); | 915 | error = gfs2_change_nlink(ndip, +1); |
928 | if (error) | 916 | if (error) |
929 | goto out_end_trans; | 917 | goto out_end_trans; |
@@ -931,7 +919,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry, | |||
931 | if (error) | 919 | if (error) |
932 | goto out_end_trans; | 920 | goto out_end_trans; |
933 | 921 | ||
934 | error = gfs2_dir_mvino(ip, &name, ndip, DT_DIR); | 922 | error = gfs2_dir_mvino(ip, &gfs2_qdotdot, ndip, DT_DIR); |
935 | if (error) | 923 | if (error) |
936 | goto out_end_trans; | 924 | goto out_end_trans; |
937 | } else { | 925 | } else { |