Whamcloud - gitweb
LU-9003 mdc: support posix_acl_valid with user namespace 07/25307/3
authorMichael Kuhn <michael.kuhn@informatik.uni-hamburg.de>
Tue, 7 Feb 2017 20:44:21 +0000 (21:44 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 16 Mar 2017 21:39:43 +0000 (21:39 +0000)
Starting with Linux 4.8, posix_acl_valid takes an additional struct
user_namespace argument. Use init_user_ns since no other namespace is
available at this point (based on Linux commit
0d4d717f25834134bb6f43284f84c8ccee5bbf2a).

Change-Id: I656cb32f632c7ee00bdc36b6f6d4b442fcb03fcc
Signed-off-by: Michael Kuhn <michael.kuhn@informatik.uni-hamburg.de>
Reviewed-on: https://review.whamcloud.com/25307
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/include/libcfs/linux/linux-fs.h
lustre/autoconf/lustre-core.m4
lustre/mdc/mdc_request.c

index ce001ca..59d9874 100644 (file)
@@ -95,4 +95,8 @@ static inline struct dentry *file_dentry(const struct file *file)
 #define posix_acl_from_xattr(a,b,c)    posix_acl_from_xattr(b,c)
 #define posix_acl_to_xattr(a,b,c,d)    posix_acl_to_xattr(b,c,d)
 #endif
 #define posix_acl_from_xattr(a,b,c)    posix_acl_from_xattr(b,c)
 #define posix_acl_to_xattr(a,b,c,d)    posix_acl_to_xattr(b,c,d)
 #endif
+
+#ifndef HAVE_POSIX_ACL_VALID_USER_NS
+#define posix_acl_valid(a,b) posix_acl_valid(b)
+#endif
 #endif
 #endif
index c8a6efb..818a4c9 100644 (file)
@@ -2274,6 +2274,24 @@ in_compat_syscall, [
 ]) # LC_HAVE_IN_COMPAT_SYSCALL
 
 #
 ]) # LC_HAVE_IN_COMPAT_SYSCALL
 
 #
+# LC_HAVE_POSIX_ACL_VALID_USER_NS
+#
+# 4.8 posix_acl_valid takes struct user_namespace
+#
+AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
+LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
+posix_acl_valid, [
+       #include <linux/fs.h>
+       #include <linux/posix_acl.h>
+],[
+       posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
+],[
+       AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
+               [posix_acl_valid takes struct user_namespace])
+])
+]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2461,6 +2479,9 @@ AC_DEFUN([LC_PROG_LINUX], [
        # 4.6
        LC_HAVE_IN_COMPAT_SYSCALL
 
        # 4.6
        LC_HAVE_IN_COMPAT_SYSCALL
 
+       # 4.8
+       LC_HAVE_POSIX_ACL_VALID_USER_NS
+
        #
        AS_IF([test "x$enable_server" != xno], [
                LC_FUNC_DEV_SET_RDONLY
        #
        AS_IF([test "x$enable_server" != xno], [
                LC_FUNC_DEV_SET_RDONLY
index d931848..f0b9e71 100644 (file)
@@ -431,7 +431,7 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md)
                 RETURN(rc);
         }
 
                 RETURN(rc);
         }
 
-        rc = posix_acl_valid(acl);
+        rc = posix_acl_valid(&init_user_ns, acl);
         if (rc) {
                 CERROR("validate acl: %d\n", rc);
                 posix_acl_release(acl);
         if (rc) {
                 CERROR("validate acl: %d\n", rc);
                 posix_acl_release(acl);