Commit 88a78a91 authored by Trond Myklebust's avatar Trond Myklebust

Merge branch 'acl_fixes' into linux-next

parents 20b9a902 789b663a
...@@ -80,7 +80,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type) ...@@ -80,7 +80,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
} }
if (res.acl_access != NULL) { if (res.acl_access != NULL) {
if (posix_acl_equiv_mode(res.acl_access, NULL) || if ((posix_acl_equiv_mode(res.acl_access, NULL) == 0) ||
res.acl_access->a_count == 0) { res.acl_access->a_count == 0) {
posix_acl_release(res.acl_access); posix_acl_release(res.acl_access);
res.acl_access = NULL; res.acl_access = NULL;
...@@ -113,7 +113,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type) ...@@ -113,7 +113,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
return ERR_PTR(status); return ERR_PTR(status);
} }
int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
struct posix_acl *dfacl) struct posix_acl *dfacl)
{ {
struct nfs_server *server = NFS_SERVER(inode); struct nfs_server *server = NFS_SERVER(inode);
...@@ -198,6 +198,15 @@ int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, ...@@ -198,6 +198,15 @@ int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
return status; return status;
} }
int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
struct posix_acl *dfacl)
{
int ret;
ret = __nfs3_proc_setacls(inode, acl, dfacl);
return (ret == -EOPNOTSUPP) ? 0 : ret;
}
int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type) int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
{ {
struct posix_acl *alloc = NULL, *dfacl = NULL; 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,7 +234,7 @@ int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (IS_ERR(alloc)) if (IS_ERR(alloc))
goto fail; goto fail;
} }
status = nfs3_proc_setacls(inode, acl, dfacl); status = __nfs3_proc_setacls(inode, acl, dfacl);
posix_acl_release(alloc); posix_acl_release(alloc);
return status; return status;
...@@ -233,25 +242,6 @@ int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type) ...@@ -233,25 +242,6 @@ int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type)
return PTR_ERR(alloc); return PTR_ERR(alloc);
} }
int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode,
umode_t mode)
{
struct posix_acl *default_acl, *acl;
int error;
error = posix_acl_create(dir, &mode, &default_acl, &acl);
if (error)
return (error == -EOPNOTSUPP) ? 0 : error;
error = nfs3_proc_setacls(inode, acl, default_acl);
if (acl)
posix_acl_release(acl);
if (default_acl)
posix_acl_release(default_acl);
return error;
}
const struct xattr_handler *nfs3_xattr_handlers[] = { const struct xattr_handler *nfs3_xattr_handlers[] = {
&posix_acl_access_xattr_handler, &posix_acl_access_xattr_handler,
&posix_acl_default_xattr_handler, &posix_acl_default_xattr_handler,
......
...@@ -521,8 +521,11 @@ posix_acl_chmod(struct inode *inode, umode_t mode) ...@@ -521,8 +521,11 @@ posix_acl_chmod(struct inode *inode, umode_t mode)
return -EOPNOTSUPP; return -EOPNOTSUPP;
acl = get_acl(inode, ACL_TYPE_ACCESS); acl = get_acl(inode, ACL_TYPE_ACCESS);
if (IS_ERR_OR_NULL(acl)) if (IS_ERR_OR_NULL(acl)) {
if (acl == ERR_PTR(-EOPNOTSUPP))
return 0;
return PTR_ERR(acl); return PTR_ERR(acl);
}
ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
if (ret) if (ret)
...@@ -544,14 +547,15 @@ posix_acl_create(struct inode *dir, umode_t *mode, ...@@ -544,14 +547,15 @@ posix_acl_create(struct inode *dir, umode_t *mode,
goto no_acl; goto no_acl;
p = get_acl(dir, ACL_TYPE_DEFAULT); p = get_acl(dir, ACL_TYPE_DEFAULT);
if (IS_ERR(p)) if (IS_ERR(p)) {
if (p == ERR_PTR(-EOPNOTSUPP))
goto apply_umask;
return PTR_ERR(p); return PTR_ERR(p);
if (!p) {
*mode &= ~current_umask();
goto no_acl;
} }
if (!p)
goto apply_umask;
*acl = posix_acl_clone(p, GFP_NOFS); *acl = posix_acl_clone(p, GFP_NOFS);
if (!*acl) if (!*acl)
return -ENOMEM; return -ENOMEM;
...@@ -575,6 +579,8 @@ posix_acl_create(struct inode *dir, umode_t *mode, ...@@ -575,6 +579,8 @@ posix_acl_create(struct inode *dir, umode_t *mode,
} }
return 0; return 0;
apply_umask:
*mode &= ~current_umask();
no_acl: no_acl:
*default_acl = NULL; *default_acl = NULL;
*acl = NULL; *acl = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment