mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
fs: get_acl() must be allowed to return EOPNOTSUPP
posix_acl_xattr_get requires get_acl() to return EOPNOTSUPP if the filesystem cannot support acls. This is needed for NFS, which can't know whether or not the server supports acls until it tries to get/set one. This patch converts posix_acl_chmod and posix_acl_create to deal with EOPNOTSUPP return values from get_acl(). Change-Id: I931423ae763a4950056c7b20938be6f1f4536e24 Reported-by: Russell King <linux@arm.linux.org.uk> Link: http://lkml.kernel.org/r/20140130140834.GW15937@n2100.arm.linux.org.uk Cc: Al Viro viro@zeniv.linux.org.uk> Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
280b400cff
commit
b8e7518373
1 changed files with 12 additions and 6 deletions
|
@ -484,8 +484,11 @@ posix_acl_chmod(struct inode *inode, umode_t mode)
|
|||
return -EOPNOTSUPP;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
|
||||
if (ret)
|
||||
|
@ -507,14 +510,15 @@ posix_acl_create(struct inode *dir, umode_t *mode,
|
|||
goto no_acl;
|
||||
|
||||
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);
|
||||
|
||||
if (!p) {
|
||||
*mode &= ~current_umask();
|
||||
goto no_acl;
|
||||
}
|
||||
|
||||
if (!p)
|
||||
goto apply_umask;
|
||||
|
||||
*acl = posix_acl_clone(p, GFP_NOFS);
|
||||
if (!*acl)
|
||||
return -ENOMEM;
|
||||
|
@ -538,6 +542,8 @@ posix_acl_create(struct inode *dir, umode_t *mode,
|
|||
}
|
||||
return 0;
|
||||
|
||||
apply_umask:
|
||||
*mode &= ~current_umask();
|
||||
no_acl:
|
||||
*default_acl = NULL;
|
||||
*acl = NULL;
|
||||
|
|
Loading…
Reference in a new issue