Skip to content

Commit

Permalink
ceph: properly apply umask when ACL is enabled
Browse files Browse the repository at this point in the history
when ACL is enabled, posix_acl_create() may change inode's mode

Signed-off-by: Yan, Zheng <[email protected]>
  • Loading branch information
Yan, Zheng authored and idryomov committed Jul 8, 2014
1 parent 5aaa432 commit f5f1864
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fs/ceph/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,24 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir)
{
struct posix_acl *default_acl, *acl;
umode_t new_mode = inode->i_mode;
int error;

error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
error = posix_acl_create(dir, &new_mode, &default_acl, &acl);
if (error)
return error;

if (!default_acl && !acl)
if (!default_acl && !acl) {
cache_no_acl(inode);
if (new_mode != inode->i_mode) {
struct iattr newattrs = {
.ia_mode = new_mode,
.ia_valid = ATTR_MODE,
};
error = ceph_setattr(dentry, &newattrs);
}
return error;
}

if (default_acl) {
error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
Expand Down

0 comments on commit f5f1864

Please sign in to comment.