diff options
Diffstat (limited to 'posix_acl-Add-set_posix_acl.patch')
-rw-r--r-- | posix_acl-Add-set_posix_acl.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/posix_acl-Add-set_posix_acl.patch b/posix_acl-Add-set_posix_acl.patch new file mode 100644 index 000000000..c067f7b85 --- /dev/null +++ b/posix_acl-Add-set_posix_acl.patch @@ -0,0 +1,55 @@ +From c463b51e8ea1ae47a7bb8cc2777eb550ad3273e2 Mon Sep 17 00:00:00 2001 +From: Andreas Gruenbacher <agruenba@redhat.com> +Date: Wed, 22 Jun 2016 23:57:25 +0200 +Subject: [PATCH] posix_acl: Add set_posix_acl + +Factor out part of posix_acl_xattr_set into a common function that takes +a posix_acl, which nfsd can also call. + +The prototype already exists in include/linux/posix_acl.h. + +Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> +Cc: stable@vger.kernel.org +Cc: Christoph Hellwig <hch@infradead.org> +Cc: Al Viro <viro@zeniv.linux.org.uk> +Signed-off-by: J. Bruce Fields <bfields@redhat.com> +--- + fs/posix_acl.c | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/fs/posix_acl.c b/fs/posix_acl.c +index 711dd5170376..f30caace5b84 100644 +--- a/fs/posix_acl.c ++++ b/fs/posix_acl.c +@@ -786,6 +786,28 @@ posix_acl_xattr_get(const struct xattr_handler *handler, + return error; + } + ++int ++set_posix_acl(struct inode *inode, int type, struct posix_acl *acl) ++{ ++ if (!IS_POSIXACL(inode)) ++ return -EOPNOTSUPP; ++ if (!inode->i_op->set_acl) ++ return -EOPNOTSUPP; ++ ++ if (type == ACL_TYPE_DEFAULT && !S_ISDIR(inode->i_mode)) ++ return acl ? -EACCES : 0; ++ if (!inode_owner_or_capable(inode)) ++ return -EPERM; ++ ++ if (acl) { ++ int ret = posix_acl_valid(acl); ++ if (ret) ++ return ret; ++ } ++ return inode->i_op->set_acl(inode, acl, type); ++} ++EXPORT_SYMBOL(set_posix_acl); ++ + static int + posix_acl_xattr_set(const struct xattr_handler *handler, + struct dentry *dentry, const char *name, +-- +2.5.5 + |