aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2012-05-04 09:33:06 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2012-05-04 09:33:06 -0400
commitf9425ad4e5c8f8f9f6297d0358dc44ca058ffe47 (patch)
tree5fad05178af7a4e2ccd21d63938a3559a60a353f /fs
parentc0752aa7e4d48cc19e167ccb0092bea8e5b6ca3a (diff)
GFS2: Fix sgid propagation when using ACLs
This cleans up the mode setting code when creating inodes. The SGID bit was being reset by setattr_copy() when the user creating a subdirectory was not in the owning group. When ACLs are in use this SGID bit should have been propagated if the ACL allows creation of a subdirectory. GFS2's behaviour now matches that of the other ACL supporting filesystems in this regard. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/acl.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 230eb0f005b6..bd4a5892c93c 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -73,12 +73,8 @@ static int gfs2_set_mode(struct inode *inode, umode_t mode)
73 int error = 0; 73 int error = 0;
74 74
75 if (mode != inode->i_mode) { 75 if (mode != inode->i_mode) {
76 struct iattr iattr; 76 inode->i_mode = mode;
77 77 mark_inode_dirty(inode);
78 iattr.ia_valid = ATTR_MODE;
79 iattr.ia_mode = mode;
80
81 error = gfs2_setattr_simple(inode, &iattr);
82 } 78 }
83 79
84 return error; 80 return error;
@@ -126,9 +122,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode)
126 return PTR_ERR(acl); 122 return PTR_ERR(acl);
127 if (!acl) { 123 if (!acl) {
128 mode &= ~current_umask(); 124 mode &= ~current_umask();
129 if (mode != inode->i_mode) 125 return gfs2_set_mode(inode, mode);
130 error = gfs2_set_mode(inode, mode);
131 return error;
132 } 126 }
133 127
134 if (S_ISDIR(inode->i_mode)) { 128 if (S_ISDIR(inode->i_mode)) {