aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-02-03 17:13:45 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-02-03 17:13:45 -0500
commit88a78a912ee059467ae6db7429a6efe4654620a5 (patch)
treef6ac63e297102d1532601548e6d939a7104356c6 /fs
parent20b9a9024540a775395d5d1f41eec0ec6ec41f9b (diff)
parent789b663ae3d427ea9c50505339a13276e7228c9d (diff)
Merge branch 'acl_fixes' into linux-next
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs3acl.c34
-rw-r--r--fs/posix_acl.c18
2 files changed, 24 insertions, 28 deletions
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 9a5ca03fa539..871d6eda8dba 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -80,7 +80,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
80 } 80 }
81 81
82 if (res.acl_access != NULL) { 82 if (res.acl_access != NULL) {
83 if (posix_acl_equiv_mode(res.acl_access, NULL) || 83 if ((posix_acl_equiv_mode(res.acl_access, NULL) == 0) ||
84 res.acl_access->a_count == 0) { 84 res.acl_access->a_count == 0) {
85 posix_acl_release(res.acl_access); 85 posix_acl_release(res.acl_access);
86 res.acl_access = NULL; 86 res.acl_access = NULL;
@@ -113,7 +113,7 @@ getout:
113 return ERR_PTR(status); 113 return ERR_PTR(status);
114} 114}
115 115
116int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, 116static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
117 struct posix_acl *dfacl) 117 struct posix_acl *dfacl)
118{ 118{
119 struct nfs_server *server = NFS_SERVER(inode); 119 struct nfs_server *server = NFS_SERVER(inode);
@@ -198,6 +198,15 @@ out:
198 return status; 198 return status;
199} 199}
200 200
201int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
202 struct posix_acl *dfacl)
203{
204 int ret;
205 ret = __nfs3_proc_setacls(inode, acl, dfacl);
206 return (ret == -EOPNOTSUPP) ? 0 : ret;
207
208}
209
201int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type) 210int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
202{ 211{
203 struct posix_acl *alloc = NULL, *dfacl = NULL; 212 struct posix_acl *alloc = NULL, *dfacl = NULL;
@@ -225,7 +234,7 @@ int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
225 if (IS_ERR(alloc)) 234 if (IS_ERR(alloc))
226 goto fail; 235 goto fail;
227 } 236 }
228 status = nfs3_proc_setacls(inode, acl, dfacl); 237 status = __nfs3_proc_setacls(inode, acl, dfacl);
229 posix_acl_release(alloc); 238 posix_acl_release(alloc);
230 return status; 239 return status;
231 240
@@ -233,25 +242,6 @@ fail:
233 return PTR_ERR(alloc); 242 return PTR_ERR(alloc);
234} 243}
235 244
236int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode,
237 umode_t mode)
238{
239 struct posix_acl *default_acl, *acl;
240 int error;
241
242 error = posix_acl_create(dir, &mode, &default_acl, &acl);
243 if (error)
244 return (error == -EOPNOTSUPP) ? 0 : error;
245
246 error = nfs3_proc_setacls(inode, acl, default_acl);
247
248 if (acl)
249 posix_acl_release(acl);
250 if (default_acl)
251 posix_acl_release(default_acl);
252 return error;
253}
254
255const struct xattr_handler *nfs3_xattr_handlers[] = { 245const struct xattr_handler *nfs3_xattr_handlers[] = {
256 &posix_acl_access_xattr_handler, 246 &posix_acl_access_xattr_handler,
257 &posix_acl_default_xattr_handler, 247 &posix_acl_default_xattr_handler,
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 38bae5a0ea25..11c54fd51e16 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -521,8 +521,11 @@ posix_acl_chmod(struct inode *inode, umode_t mode)
521 return -EOPNOTSUPP; 521 return -EOPNOTSUPP;
522 522
523 acl = get_acl(inode, ACL_TYPE_ACCESS); 523 acl = get_acl(inode, ACL_TYPE_ACCESS);
524 if (IS_ERR_OR_NULL(acl)) 524 if (IS_ERR_OR_NULL(acl)) {
525 if (acl == ERR_PTR(-EOPNOTSUPP))
526 return 0;
525 return PTR_ERR(acl); 527 return PTR_ERR(acl);
528 }
526 529
527 ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); 530 ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
528 if (ret) 531 if (ret)
@@ -544,14 +547,15 @@ posix_acl_create(struct inode *dir, umode_t *mode,
544 goto no_acl; 547 goto no_acl;
545 548
546 p = get_acl(dir, ACL_TYPE_DEFAULT); 549 p = get_acl(dir, ACL_TYPE_DEFAULT);
547 if (IS_ERR(p)) 550 if (IS_ERR(p)) {
551 if (p == ERR_PTR(-EOPNOTSUPP))
552 goto apply_umask;
548 return PTR_ERR(p); 553 return PTR_ERR(p);
549
550 if (!p) {
551 *mode &= ~current_umask();
552 goto no_acl;
553 } 554 }
554 555
556 if (!p)
557 goto apply_umask;
558
555 *acl = posix_acl_clone(p, GFP_NOFS); 559 *acl = posix_acl_clone(p, GFP_NOFS);
556 if (!*acl) 560 if (!*acl)
557 return -ENOMEM; 561 return -ENOMEM;
@@ -575,6 +579,8 @@ posix_acl_create(struct inode *dir, umode_t *mode,
575 } 579 }
576 return 0; 580 return 0;
577 581
582apply_umask:
583 *mode &= ~current_umask();
578no_acl: 584no_acl:
579 *default_acl = NULL; 585 *default_acl = NULL;
580 *acl = NULL; 586 *acl = NULL;