Commit f9425ad4 authored by Steven Whitehouse's avatar Steven Whitehouse

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: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent c0752aa7
...@@ -73,12 +73,8 @@ static int gfs2_set_mode(struct inode *inode, umode_t mode) ...@@ -73,12 +73,8 @@ static int gfs2_set_mode(struct inode *inode, umode_t mode)
int error = 0; int error = 0;
if (mode != inode->i_mode) { if (mode != inode->i_mode) {
struct iattr iattr; inode->i_mode = mode;
mark_inode_dirty(inode);
iattr.ia_valid = ATTR_MODE;
iattr.ia_mode = mode;
error = gfs2_setattr_simple(inode, &iattr);
} }
return error; return error;
...@@ -126,9 +122,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode) ...@@ -126,9 +122,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct inode *inode)
return PTR_ERR(acl); return PTR_ERR(acl);
if (!acl) { if (!acl) {
mode &= ~current_umask(); mode &= ~current_umask();
if (mode != inode->i_mode) return gfs2_set_mode(inode, mode);
error = gfs2_set_mode(inode, mode);
return error;
} }
if (S_ISDIR(inode->i_mode)) { if (S_ISDIR(inode->i_mode)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment