diff options
author | Sage Weil <sage@inktank.com> | 2014-01-29 09:22:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-29 19:05:28 -0500 |
commit | 72466d0b92e04a7e0e5abf74c86eb352225346e4 (patch) | |
tree | e165c2b610135f801489f13c7d8e3cbc3acfd3fc | |
parent | 0e47c969c65e213421450c31043353ebe3c67e0c (diff) |
ceph: fix posix ACL hooks
The merge of commit 7221fe4c2ed7 ("ceph: add acl for cephfs") raced with
upstream changes in the generic POSIX ACL code (eg commit 2aeccbe957d0
"fs: add generic xattr_acl handlers" and others).
Some of the fallout was fixed in commit 4db658ea0ca ("ceph: Fix up after
semantic merge conflict"), but it was incomplete: the set_acl
inode_operation wasn't getting set, and the prototype needed to be
adjusted a bit (it doesn't take a dentry anymore).
Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ceph/acl.c | 9 | ||||
-rw-r--r-- | fs/ceph/dir.c | 1 | ||||
-rw-r--r-- | fs/ceph/inode.c | 2 | ||||
-rw-r--r-- | fs/ceph/super.h | 3 |
4 files changed, 10 insertions, 5 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index f6911284c9bd..66d377a12f7c 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c | |||
@@ -107,14 +107,14 @@ struct posix_acl *ceph_get_acl(struct inode *inode, int type) | |||
107 | return acl; | 107 | return acl; |
108 | } | 108 | } |
109 | 109 | ||
110 | static int ceph_set_acl(struct dentry *dentry, struct inode *inode, | 110 | int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
111 | struct posix_acl *acl, int type) | ||
112 | { | 111 | { |
113 | int ret = 0, size = 0; | 112 | int ret = 0, size = 0; |
114 | const char *name = NULL; | 113 | const char *name = NULL; |
115 | char *value = NULL; | 114 | char *value = NULL; |
116 | struct iattr newattrs; | 115 | struct iattr newattrs; |
117 | umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; | 116 | umode_t new_mode = inode->i_mode, old_mode = inode->i_mode; |
117 | struct dentry *dentry = d_find_alias(inode); | ||
118 | 118 | ||
119 | if (acl) { | 119 | if (acl) { |
120 | ret = posix_acl_valid(acl); | 120 | ret = posix_acl_valid(acl); |
@@ -208,8 +208,7 @@ int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) | |||
208 | 208 | ||
209 | if (IS_POSIXACL(dir) && acl) { | 209 | if (IS_POSIXACL(dir) && acl) { |
210 | if (S_ISDIR(inode->i_mode)) { | 210 | if (S_ISDIR(inode->i_mode)) { |
211 | ret = ceph_set_acl(dentry, inode, acl, | 211 | ret = ceph_set_acl(inode, acl, ACL_TYPE_DEFAULT); |
212 | ACL_TYPE_DEFAULT); | ||
213 | if (ret) | 212 | if (ret) |
214 | goto out_release; | 213 | goto out_release; |
215 | } | 214 | } |
@@ -217,7 +216,7 @@ int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) | |||
217 | if (ret < 0) | 216 | if (ret < 0) |
218 | goto out; | 217 | goto out; |
219 | else if (ret > 0) | 218 | else if (ret > 0) |
220 | ret = ceph_set_acl(dentry, inode, acl, ACL_TYPE_ACCESS); | 219 | ret = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); |
221 | else | 220 | else |
222 | cache_no_acl(inode); | 221 | cache_no_acl(inode); |
223 | } else { | 222 | } else { |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 619616d585b0..6da4df84ba30 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1303,6 +1303,7 @@ const struct inode_operations ceph_dir_iops = { | |||
1303 | .listxattr = ceph_listxattr, | 1303 | .listxattr = ceph_listxattr, |
1304 | .removexattr = ceph_removexattr, | 1304 | .removexattr = ceph_removexattr, |
1305 | .get_acl = ceph_get_acl, | 1305 | .get_acl = ceph_get_acl, |
1306 | .set_acl = ceph_set_acl, | ||
1306 | .mknod = ceph_mknod, | 1307 | .mknod = ceph_mknod, |
1307 | .symlink = ceph_symlink, | 1308 | .symlink = ceph_symlink, |
1308 | .mkdir = ceph_mkdir, | 1309 | .mkdir = ceph_mkdir, |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 8b8b506636cc..32d519d8a2e2 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -97,6 +97,7 @@ const struct inode_operations ceph_file_iops = { | |||
97 | .listxattr = ceph_listxattr, | 97 | .listxattr = ceph_listxattr, |
98 | .removexattr = ceph_removexattr, | 98 | .removexattr = ceph_removexattr, |
99 | .get_acl = ceph_get_acl, | 99 | .get_acl = ceph_get_acl, |
100 | .set_acl = ceph_set_acl, | ||
100 | }; | 101 | }; |
101 | 102 | ||
102 | 103 | ||
@@ -1616,6 +1617,7 @@ static const struct inode_operations ceph_symlink_iops = { | |||
1616 | .listxattr = ceph_listxattr, | 1617 | .listxattr = ceph_listxattr, |
1617 | .removexattr = ceph_removexattr, | 1618 | .removexattr = ceph_removexattr, |
1618 | .get_acl = ceph_get_acl, | 1619 | .get_acl = ceph_get_acl, |
1620 | .set_acl = ceph_set_acl, | ||
1619 | }; | 1621 | }; |
1620 | 1622 | ||
1621 | /* | 1623 | /* |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 345933948b6e..aa260590f615 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -718,6 +718,7 @@ extern void ceph_queue_writeback(struct inode *inode); | |||
718 | extern int ceph_do_getattr(struct inode *inode, int mask); | 718 | extern int ceph_do_getattr(struct inode *inode, int mask); |
719 | extern int ceph_permission(struct inode *inode, int mask); | 719 | extern int ceph_permission(struct inode *inode, int mask); |
720 | extern int ceph_setattr(struct dentry *dentry, struct iattr *attr); | 720 | extern int ceph_setattr(struct dentry *dentry, struct iattr *attr); |
721 | extern int ceph_setattr(struct dentry *dentry, struct iattr *attr); | ||
721 | extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | 722 | extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, |
722 | struct kstat *stat); | 723 | struct kstat *stat); |
723 | 724 | ||
@@ -741,12 +742,14 @@ extern const struct xattr_handler *ceph_xattr_handlers[]; | |||
741 | #ifdef CONFIG_CEPH_FS_POSIX_ACL | 742 | #ifdef CONFIG_CEPH_FS_POSIX_ACL |
742 | 743 | ||
743 | struct posix_acl *ceph_get_acl(struct inode *, int); | 744 | struct posix_acl *ceph_get_acl(struct inode *, int); |
745 | int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type); | ||
744 | int ceph_init_acl(struct dentry *, struct inode *, struct inode *); | 746 | int ceph_init_acl(struct dentry *, struct inode *, struct inode *); |
745 | void ceph_forget_all_cached_acls(struct inode *inode); | 747 | void ceph_forget_all_cached_acls(struct inode *inode); |
746 | 748 | ||
747 | #else | 749 | #else |
748 | 750 | ||
749 | #define ceph_get_acl NULL | 751 | #define ceph_get_acl NULL |
752 | #define ceph_set_acl NULL | ||
750 | 753 | ||
751 | static inline int ceph_init_acl(struct dentry *dentry, struct inode *inode, | 754 | static inline int ceph_init_acl(struct dentry *dentry, struct inode *inode, |
752 | struct inode *dir) | 755 | struct inode *dir) |