mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
Linux 4.8 compat: posix_acl_valid()
The posix_acl_valid() function has been updated to require a user namespace. Filesystem callers should normally provide the user_ns from the super block associcated with the ACL; the zpl_posix_acl_valid() wrapper has been added for this purpose. See https://github.com/torvalds/linux/commit/0d4d717f for complete details. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Closes #4922
This commit is contained in:
parent
e85a6396b0
commit
4b908d3220
@ -97,6 +97,30 @@ AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 4.8 API change,
|
||||
dnl # The function posix_acl_valid now must be passed a namespace.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
|
||||
AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
|
||||
ZFS_LINUX_TRY_COMPILE([
|
||||
#include <linux/fs.h>
|
||||
#include <linux/posix_acl.h>
|
||||
],[
|
||||
struct user_namespace *user_ns = NULL;
|
||||
const struct posix_acl *acl = NULL;
|
||||
int error;
|
||||
|
||||
error = posix_acl_valid(user_ns, acl);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
|
||||
[posix_acl_valid() wants user namespace])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.27 API change,
|
||||
dnl # Check if inode_operations contains the function permission
|
||||
|
@ -43,6 +43,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
|
||||
ZFS_AC_KERNEL_POSIX_ACL_RELEASE
|
||||
ZFS_AC_KERNEL_POSIX_ACL_CHMOD
|
||||
ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
|
||||
ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
|
||||
ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION
|
||||
ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA
|
||||
ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL
|
||||
|
@ -316,6 +316,18 @@ typedef umode_t zpl_equivmode_t;
|
||||
#else
|
||||
typedef mode_t zpl_equivmode_t;
|
||||
#endif /* HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T */
|
||||
|
||||
/*
|
||||
* 4.8 API change,
|
||||
* posix_acl_valid() now must be passed a namespace, the namespace from
|
||||
* from super block associated with the given inode is used for this purpose.
|
||||
*/
|
||||
#ifdef HAVE_POSIX_ACL_VALID_WITH_NS
|
||||
#define zpl_posix_acl_valid(ip, acl) posix_acl_valid(ip->i_sb->s_user_ns, acl)
|
||||
#else
|
||||
#define zpl_posix_acl_valid(ip, acl) posix_acl_valid(acl)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_FS_POSIX_ACL */
|
||||
|
||||
/*
|
||||
|
@ -1288,7 +1288,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name,
|
||||
if (IS_ERR(acl))
|
||||
return (PTR_ERR(acl));
|
||||
else if (acl) {
|
||||
error = posix_acl_valid(acl);
|
||||
error = zpl_posix_acl_valid(ip, acl);
|
||||
if (error) {
|
||||
zpl_posix_acl_release(acl);
|
||||
return (error);
|
||||
@ -1328,7 +1328,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name,
|
||||
if (IS_ERR(acl))
|
||||
return (PTR_ERR(acl));
|
||||
else if (acl) {
|
||||
error = posix_acl_valid(acl);
|
||||
error = zpl_posix_acl_valid(ip, acl);
|
||||
if (error) {
|
||||
zpl_posix_acl_release(acl);
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user