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

+16 -41
+16 -40
fs/ceph/acl.c
··· 66 66 char *value = NULL; 67 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 69 switch (type) { 77 70 case ACL_TYPE_ACCESS: 78 71 name = POSIX_ACL_XATTR_ACCESS; ··· 183 190 184 191 int ceph_init_acl(struct dentry *dentry, struct inode *inode, struct inode *dir) 185 192 { 186 - struct posix_acl *acl = NULL; 187 - int ret = 0; 193 + struct posix_acl *default_acl, *acl; 194 + int error; 188 195 189 - if (!S_ISLNK(inode->i_mode)) { 190 - if (IS_POSIXACL(dir)) { 191 - acl = ceph_get_acl(dir, ACL_TYPE_DEFAULT); 192 - if (IS_ERR(acl)) { 193 - ret = PTR_ERR(acl); 194 - goto out; 195 - } 196 - } 196 + error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); 197 + if (error) 198 + return error; 197 199 198 - if (!acl) 199 - inode->i_mode &= ~current_umask(); 200 - } 201 - 202 - if (IS_POSIXACL(dir) && acl) { 203 - if (S_ISDIR(inode->i_mode)) { 204 - ret = ceph_set_acl(inode, acl, ACL_TYPE_DEFAULT); 205 - if (ret) 206 - goto out_release; 207 - } 208 - ret = __posix_acl_create(&acl, GFP_NOFS, &inode->i_mode); 209 - if (ret < 0) 210 - goto out; 211 - else if (ret > 0) 212 - ret = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); 213 - else 214 - cache_no_acl(inode); 215 - } else { 200 + if (!default_acl && !acl) 216 201 cache_no_acl(inode); 217 - } 218 202 219 - out_release: 220 - posix_acl_release(acl); 221 - out: 222 - return ret; 203 + if (default_acl) { 204 + error = ceph_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); 205 + posix_acl_release(default_acl); 206 + } 207 + if (acl) { 208 + if (!error) 209 + error = ceph_set_acl(inode, acl, ACL_TYPE_ACCESS); 210 + posix_acl_release(acl); 211 + } 212 + return error; 223 213 }
-1
fs/ceph/super.h
··· 718 718 extern int ceph_do_getattr(struct inode *inode, int mask); 719 719 extern int ceph_permission(struct inode *inode, int mask); 720 720 extern int ceph_setattr(struct dentry *dentry, struct iattr *attr); 721 - extern int ceph_setattr(struct dentry *dentry, struct iattr *attr); 722 721 extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry, 723 722 struct kstat *stat); 724 723