ceph: add acl for cephfs
Signed-off-by: Guangliang Zhao <lucienchao@gmail.com> Reviewed-by: Li Wang <li.wang@ubuntykylin.com> Reviewed-by: Zheng Yan <zheng.z.yan@intel.com>
This commit is contained in:
committed by
Ilya Dryomov
parent
61f6881621
commit
7221fe4c2e
@ -95,6 +95,7 @@ const struct inode_operations ceph_file_iops = {
|
||||
.getxattr = ceph_getxattr,
|
||||
.listxattr = ceph_listxattr,
|
||||
.removexattr = ceph_removexattr,
|
||||
.get_acl = ceph_get_acl,
|
||||
};
|
||||
|
||||
|
||||
@ -680,6 +681,7 @@ static int fill_inode(struct inode *inode,
|
||||
memcpy(ci->i_xattrs.blob->vec.iov_base,
|
||||
iinfo->xattr_data, iinfo->xattr_len);
|
||||
ci->i_xattrs.version = le64_to_cpu(info->xattr_version);
|
||||
ceph_forget_all_cached_acls(inode);
|
||||
xattr_blob = NULL;
|
||||
}
|
||||
|
||||
@ -1612,6 +1614,7 @@ static const struct inode_operations ceph_symlink_iops = {
|
||||
.getxattr = ceph_getxattr,
|
||||
.listxattr = ceph_listxattr,
|
||||
.removexattr = ceph_removexattr,
|
||||
.get_acl = ceph_get_acl,
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1685,6 +1688,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
dirtied |= CEPH_CAP_AUTH_EXCL;
|
||||
} else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 ||
|
||||
attr->ia_mode != inode->i_mode) {
|
||||
inode->i_mode = attr->ia_mode;
|
||||
req->r_args.setattr.mode = cpu_to_le32(attr->ia_mode);
|
||||
mask |= CEPH_SETATTR_MODE;
|
||||
release |= CEPH_CAP_AUTH_SHARED;
|
||||
@ -1800,6 +1804,12 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
if (inode_dirty_flags)
|
||||
__mark_inode_dirty(inode, inode_dirty_flags);
|
||||
|
||||
if (ia_valid & ATTR_MODE) {
|
||||
err = ceph_acl_chmod(dentry, inode);
|
||||
if (err)
|
||||
goto out_put;
|
||||
}
|
||||
|
||||
if (mask) {
|
||||
req->r_inode = inode;
|
||||
ihold(inode);
|
||||
@ -1819,6 +1829,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
return err;
|
||||
out:
|
||||
spin_unlock(&ci->i_ceph_lock);
|
||||
out_put:
|
||||
ceph_mdsc_put_request(req);
|
||||
return err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user