Commit f5f18647 authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: properly apply umask when ACL is enabled

when ACL is enabled, posix_acl_create() may change inode's mode
Signed-off-by: default avatarYan, Zheng <zheng.z.yan@intel.com>
parent 5aaa432a
...@@ -172,14 +172,24 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -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) int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir)
{ {
struct posix_acl *default_acl, *acl; struct posix_acl *default_acl, *acl;
umode_t new_mode = inode->i_mode;
int error; 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) if (error)
return error; return error;
if (!default_acl && !acl) if (!default_acl && !acl) {
cache_no_acl(inode); 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) { if (default_acl) {
error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT);
......
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