diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2014-07-04 07:59:43 +0200 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2014-07-08 13:08:47 +0200 |
commit | f5f186474335ac385def69564542e6e4c6a3a8bd (patch) | |
tree | a76bfdb686f2aab83da0cb0af43ee6fa67af4e66 | |
parent | ceph: pass proper page offset to copy_page_to_iter() (diff) | |
download | linux-f5f186474335ac385def69564542e6e4c6a3a8bd.tar.xz linux-f5f186474335ac385def69564542e6e4c6a3a8bd.zip |
ceph: properly apply umask when ACL is enabled
when ACL is enabled, posix_acl_create() may change inode's mode
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r-- | fs/ceph/acl.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 469f2e8657e8..cebf2ebefb55 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c @@ -172,14 +172,24 @@ out: 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); |