diff options
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index a99591956544..de466043c91a 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -51,7 +51,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip) | |||
51 | struct gfs2_dinode_host *di = &ip->i_di; | 51 | struct gfs2_dinode_host *di = &ip->i_di; |
52 | 52 | ||
53 | inode->i_ino = ip->i_num.no_addr; | 53 | inode->i_ino = ip->i_num.no_addr; |
54 | inode->i_mode = di->di_mode; | ||
55 | inode->i_nlink = di->di_nlink; | 54 | inode->i_nlink = di->di_nlink; |
56 | inode->i_uid = di->di_uid; | 55 | inode->i_uid = di->di_uid; |
57 | inode->i_gid = di->di_gid; | 56 | inode->i_gid = di->di_gid; |
@@ -88,9 +87,6 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip) | |||
88 | { | 87 | { |
89 | struct inode *inode = &ip->i_inode; | 88 | struct inode *inode = &ip->i_inode; |
90 | struct gfs2_dinode_host *di = &ip->i_di; | 89 | struct gfs2_dinode_host *di = &ip->i_di; |
91 | gfs2_assert_withdraw(GFS2_SB(inode), | ||
92 | (di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT)); | ||
93 | di->di_mode = inode->i_mode; | ||
94 | di->di_uid = inode->i_uid; | 90 | di->di_uid = inode->i_uid; |
95 | di->di_gid = inode->i_gid; | 91 | di->di_gid = inode->i_gid; |
96 | di->di_atime = inode->i_atime.tv_sec; | 92 | di->di_atime = inode->i_atime.tv_sec; |
@@ -210,9 +206,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
210 | if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) | 206 | if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) |
211 | return -ESTALE; | 207 | return -ESTALE; |
212 | 208 | ||
213 | di->di_mode = be32_to_cpu(str->di_mode); | 209 | ip->i_inode.i_mode = be32_to_cpu(str->di_mode); |
214 | ip->i_inode.i_rdev = 0; | 210 | ip->i_inode.i_rdev = 0; |
215 | switch (di->di_mode & S_IFMT) { | 211 | switch (ip->i_inode.i_mode & S_IFMT) { |
216 | case S_IFBLK: | 212 | case S_IFBLK: |
217 | case S_IFCHR: | 213 | case S_IFCHR: |
218 | ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major), | 214 | ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major), |
@@ -620,7 +616,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, | |||
620 | unsigned int *uid, unsigned int *gid) | 616 | unsigned int *uid, unsigned int *gid) |
621 | { | 617 | { |
622 | if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && | 618 | if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && |
623 | (dip->i_di.di_mode & S_ISUID) && dip->i_di.di_uid) { | 619 | (dip->i_inode.i_mode & S_ISUID) && dip->i_di.di_uid) { |
624 | if (S_ISDIR(*mode)) | 620 | if (S_ISDIR(*mode)) |
625 | *mode |= S_ISUID; | 621 | *mode |= S_ISUID; |
626 | else if (dip->i_di.di_uid != current->fsuid) | 622 | else if (dip->i_di.di_uid != current->fsuid) |
@@ -629,7 +625,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, | |||
629 | } else | 625 | } else |
630 | *uid = current->fsuid; | 626 | *uid = current->fsuid; |
631 | 627 | ||
632 | if (dip->i_di.di_mode & S_ISGID) { | 628 | if (dip->i_inode.i_mode & S_ISGID) { |
633 | if (S_ISDIR(*mode)) | 629 | if (S_ISDIR(*mode)) |
634 | *mode |= S_ISGID; | 630 | *mode |= S_ISGID; |
635 | *gid = dip->i_di.di_gid; | 631 | *gid = dip->i_di.di_gid; |
@@ -810,7 +806,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name, | |||
810 | goto fail_quota_locks; | 806 | goto fail_quota_locks; |
811 | } | 807 | } |
812 | 808 | ||
813 | error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_di.di_mode)); | 809 | error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_inode.i_mode)); |
814 | if (error) | 810 | if (error) |
815 | goto fail_end_trans; | 811 | goto fail_end_trans; |
816 | 812 | ||
@@ -1053,7 +1049,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
1053 | if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) | 1049 | if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) |
1054 | return -EPERM; | 1050 | return -EPERM; |
1055 | 1051 | ||
1056 | if ((dip->i_di.di_mode & S_ISVTX) && | 1052 | if ((dip->i_inode.i_mode & S_ISVTX) && |
1057 | dip->i_di.di_uid != current->fsuid && | 1053 | dip->i_di.di_uid != current->fsuid && |
1058 | ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) | 1054 | ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) |
1059 | return -EPERM; | 1055 | return -EPERM; |
@@ -1072,7 +1068,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
1072 | if (!gfs2_inum_equal(&inum, &ip->i_num)) | 1068 | if (!gfs2_inum_equal(&inum, &ip->i_num)) |
1073 | return -ENOENT; | 1069 | return -ENOENT; |
1074 | 1070 | ||
1075 | if (IF2DT(ip->i_di.di_mode) != type) { | 1071 | if (IF2DT(ip->i_inode.i_mode) != type) { |
1076 | gfs2_consist_inode(dip); | 1072 | gfs2_consist_inode(dip); |
1077 | return -EIO; | 1073 | return -EIO; |
1078 | } | 1074 | } |