Skip to content

Commit 476af91

Browse files
committed
orangefs: posix acl fix...
Al Viro pointed out that I broke some acl functionality... * ACLs could not be fully removed * posix_acl_chmod would be called while the old ACL was still cached * new mode propagated to orangefs server before ACL. ... when I tried to make sure that modes that got changed as a result of ACL-sets would be sent back to the orangefs server. Not wanting to try and change the code without having some cases to test it with, I began to hunt for setfacl examples that were expressible in pure mode. Along the way I found examples like the following which confused me: user A had a file (/home/A/asdf) with mode 740 user B was in user A's group user C was not in user A's group setfacl -m u:C:rwx /home/A/asdf The above setfacl caused ls -l /home/A/asdf to show a mode of 770, making it appear that all users in user A's group now had full access to /home/A/asdf, however, user B still only had read acces. Madness. Anywho, I finally found that the above (whacky as it is) appears to be "posixly on purpose" and explained in acl(5): If the ACL has an ACL_MASK entry, the group permissions correspond to the permissions of the ACL_MASK entry. Signed-off-by: Mike Marshall <[email protected]>
1 parent 92ed301 commit 476af91

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

fs/orangefs/acl.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
122122
struct iattr iattr;
123123
int rc;
124124

125+
memset(&iattr, 0, sizeof iattr);
126+
125127
if (type == ACL_TYPE_ACCESS && acl) {
126128
/*
127129
* posix_acl_update_mode checks to see if the permissions
@@ -138,18 +140,17 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
138140
return error;
139141
}
140142

141-
if (acl) {
142-
rc = __orangefs_set_acl(inode, acl, type);
143-
} else {
143+
if (inode->i_mode != iattr.ia_mode)
144144
iattr.ia_valid = ATTR_MODE;
145-
rc = __orangefs_setattr(inode, &iattr);
146-
}
147145

148-
return rc;
149-
150-
} else {
151-
return -EINVAL;
152146
}
147+
148+
rc = __orangefs_set_acl(inode, acl, type);
149+
150+
if (!rc && (iattr.ia_valid == ATTR_MODE))
151+
rc = __orangefs_setattr(inode, &iattr);
152+
153+
return rc;
153154
}
154155

155156
int orangefs_init_acl(struct inode *inode, struct inode *dir)

0 commit comments

Comments
 (0)