diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 23:02:51 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 23:02:51 -0500 |
commit | 271bf66d4c0c8db29764d241e4e46883d9c0a198 (patch) | |
tree | 321c2fdda67bf5db87d12f11cde3c41492bbf213 | |
parent | aa2e7100e38880db7907cb2b7ec6267b2b243771 (diff) | |
parent | 758582361976e9640a1cb9516c0af10cdf8e4753 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
Pull some further ceph acl cleanups from Sage Weil:
"I do have a couple patches on top of what's in your tree, though, that
clean up a couple duplicated lines in your fix and apply Christoph's
cleanup"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
ceph: simplify ceph_{get,init}_acl
ceph: remove duplicate declaration of ceph_setattr
-rw-r--r-- | fs/ceph/acl.c | 56 | ||||
-rw-r--r-- | fs/ceph/super.h | 1 |
2 files changed, 16 insertions, 41 deletions
diff --git a/fs/ceph/acl.c b/fs/ceph/acl.c index 66d377a12f7c..9ab312e49637 100644 --- a/fs/ceph/acl.c +++ b/fs/ceph/acl.c | |||
@@ -66,13 +66,6 @@ struct posix_acl *ceph_get_acl(struct inode *inode, int type) | |||
66 | char *value = NULL; | 66 | char *value = NULL; |
67 | struct posix_acl *acl; | 67 | struct posix_acl *acl; |
68 | 68 | ||
69 | if (!IS_POSIXACL(inode)) | ||
70 | return NULL; | ||
71 | |||
72 | acl = ceph_get_cached_acl(inode, type); | ||
73 | if (acl != ACL_NOT_CACHED) | ||
74 | return acl; | ||
75 | |||
76 | switch (type) { | 69 | switch (type) { |
77 | case ACL_TYPE_ACCESS: | 70 | case ACL_TYPE_ACCESS: |
78 | name = POSIX_ACL_XATTR_ACCESS; | 71 | name = POSIX_ACL_XATTR_ACCESS; |
@@ -190,41 +183,24 @@ out: | |||
190 | 183 | ||
191 | int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) | 184 | int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) |
192 | { | 185 | { |
193 | struct posix_acl *acl = NULL; | 186 | struct posix_acl *default_acl, *acl; |
194 | int ret = 0; | 187 | int error; |
195 | |||
196 | if (!S_ISLNK(inode->i_mode)) { | ||
197 | if (IS_POSIXACL(dir)) { | ||
198 | acl = ceph_get_acl(dir, ACL_TYPE_DEFAULT); | ||
199 | if (IS_ERR(acl)) { | ||
200 | ret = PTR_ERR(acl); | ||
201 | goto out; | ||
202 | } | ||
203 | } | ||
204 | 188 | ||
205 | if (!acl) | 189 | error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); |
206 | inode->i_mode &= ~current_umask(); | 190 | if (error) |
207 | } | 191 | return error; |
208 | 192 | ||
209 | if (IS_POSIXACL(dir) && acl) { | 193 | if (!default_acl && !acl) |
210 | if (S_ISDIR(inode->i_mode)) { | ||
211 | ret = ceph_set_acl(inode, acl, ACL_TYPE_DEFAULT); | ||
212 | if (ret) | ||
213 | goto out_release; | ||
214 | } | ||
215 | ret = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode); | ||
216 | if (ret < 0) | ||
217 | goto out; | ||
218 | else if (ret > 0) | ||
219 | ret = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); | ||
220 | else | ||
221 | cache_no_acl(inode); | ||
222 | } else { | ||
223 | cache_no_acl(inode); | 194 | cache_no_acl(inode); |
224 | } | ||
225 | 195 | ||
226 | out_release: | 196 | if (default_acl) { |
227 | posix_acl_release(acl); | 197 | error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); |
228 | out: | 198 | posix_acl_release(default_acl); |
229 | return ret; | 199 | } |
200 | if (acl) { | ||
201 | if (!error) | ||
202 | error = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); | ||
203 | posix_acl_release(acl); | ||
204 | } | ||
205 | return error; | ||
230 | } | 206 | } |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index aa260590f615..19793b56d0a7 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -718,7 +718,6 @@ 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); | ||
722 | extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, | 721 | extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, |
723 | struct kstat *stat); | 722 | struct kstat *stat); |
724 | 723 | ||