diff options
author | Guangliang Zhao <lucienchao@gmail.com> | 2013-11-11 02:18:03 -0500 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-31 13:32:01 -0500 |
commit | 7221fe4c2ed72804b28633c8e0217d65abb0023f (patch) | |
tree | 70b02b121258635837f2db4b339a5fdcc014392a /fs/ceph/inode.c | |
parent | 61f68816211ee4b884dc0dda8dd4d977548f4865 (diff) |
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>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index d37b2dc01d3f..a808bfb8d8d8 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -95,6 +95,7 @@ const struct inode_operations ceph_file_iops = { | |||
95 | .getxattr = ceph_getxattr, | 95 | .getxattr = ceph_getxattr, |
96 | .listxattr = ceph_listxattr, | 96 | .listxattr = ceph_listxattr, |
97 | .removexattr = ceph_removexattr, | 97 | .removexattr = ceph_removexattr, |
98 | .get_acl = ceph_get_acl, | ||
98 | }; | 99 | }; |
99 | 100 | ||
100 | 101 | ||
@@ -680,6 +681,7 @@ static int fill_inode(struct inode *inode, | |||
680 | memcpy(ci->i_xattrs.blob->vec.iov_base, | 681 | memcpy(ci->i_xattrs.blob->vec.iov_base, |
681 | iinfo->xattr_data, iinfo->xattr_len); | 682 | iinfo->xattr_data, iinfo->xattr_len); |
682 | ci->i_xattrs.version = le64_to_cpu(info->xattr_version); | 683 | ci->i_xattrs.version = le64_to_cpu(info->xattr_version); |
684 | ceph_forget_all_cached_acls(inode); | ||
683 | xattr_blob = NULL; | 685 | xattr_blob = NULL; |
684 | } | 686 | } |
685 | 687 | ||
@@ -1612,6 +1614,7 @@ static const struct inode_operations ceph_symlink_iops = { | |||
1612 | .getxattr = ceph_getxattr, | 1614 | .getxattr = ceph_getxattr, |
1613 | .listxattr = ceph_listxattr, | 1615 | .listxattr = ceph_listxattr, |
1614 | .removexattr = ceph_removexattr, | 1616 | .removexattr = ceph_removexattr, |
1617 | .get_acl = ceph_get_acl, | ||
1615 | }; | 1618 | }; |
1616 | 1619 | ||
1617 | /* | 1620 | /* |
@@ -1685,6 +1688,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1685 | dirtied |= CEPH_CAP_AUTH_EXCL; | 1688 | dirtied |= CEPH_CAP_AUTH_EXCL; |
1686 | } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || | 1689 | } else if ((issued & CEPH_CAP_AUTH_SHARED) == 0 || |
1687 | attr->ia_mode != inode->i_mode) { | 1690 | attr->ia_mode != inode->i_mode) { |
1691 | inode->i_mode = attr->ia_mode; | ||
1688 | req->r_args.setattr.mode = cpu_to_le32(attr->ia_mode); | 1692 | req->r_args.setattr.mode = cpu_to_le32(attr->ia_mode); |
1689 | mask |= CEPH_SETATTR_MODE; | 1693 | mask |= CEPH_SETATTR_MODE; |
1690 | release |= CEPH_CAP_AUTH_SHARED; | 1694 | release |= CEPH_CAP_AUTH_SHARED; |
@@ -1800,6 +1804,12 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1800 | if (inode_dirty_flags) | 1804 | if (inode_dirty_flags) |
1801 | __mark_inode_dirty(inode, inode_dirty_flags); | 1805 | __mark_inode_dirty(inode, inode_dirty_flags); |
1802 | 1806 | ||
1807 | if (ia_valid & ATTR_MODE) { | ||
1808 | err = ceph_acl_chmod(dentry, inode); | ||
1809 | if (err) | ||
1810 | goto out_put; | ||
1811 | } | ||
1812 | |||
1803 | if (mask) { | 1813 | if (mask) { |
1804 | req->r_inode = inode; | 1814 | req->r_inode = inode; |
1805 | ihold(inode); | 1815 | ihold(inode); |
@@ -1819,6 +1829,7 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr) | |||
1819 | return err; | 1829 | return err; |
1820 | out: | 1830 | out: |
1821 | spin_unlock(&ci->i_ceph_lock); | 1831 | spin_unlock(&ci->i_ceph_lock); |
1832 | out_put: | ||
1822 | ceph_mdsc_put_request(req); | 1833 | ceph_mdsc_put_request(req); |
1823 | return err; | 1834 | return err; |
1824 | } | 1835 | } |