aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/lustre/files/0003-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch')
-rw-r--r--sys-cluster/lustre/files/0003-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch159
1 files changed, 159 insertions, 0 deletions
diff --git a/sys-cluster/lustre/files/0003-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch b/sys-cluster/lustre/files/0003-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch
new file mode 100644
index 000000000..9f05db0cb
--- /dev/null
+++ b/sys-cluster/lustre/files/0003-LU-2850-compat-posix_acl_-to-from-_xattr-take-user_n.patch
@@ -0,0 +1,159 @@
+From 3050d2c9cccb51ce521bdbecd471cb6ce18f77b8 Mon Sep 17 00:00:00 2001
+From: Jeff Mahoney <jeffm@suse.com>
+Date: Wed, 20 Mar 2013 17:33:17 -0400
+Subject: [PATCH 3/8] LU-2850 compat: posix_acl_{to,from}_xattr take
+ user_namespace
+
+Commit 5f3a4a28 (v3.7) added a struct user_namespace argument to
+posix_acl_{to,from}_xattr. Pretty much every caller just uses
+&init_user_ns. We mask it off in user mode so we don't need to
+create a fake structure only to ignore it.
+
+Signed-off-by: Jeff Mahoney <jeffm@suse.com>
+Change-Id: I558a06941b364f241fd4423720957beeaf1d3cea
+---
+ libcfs/include/libcfs/darwin/darwin-fs.h | 6 ++++--
+ libcfs/include/libcfs/linux/linux-fs.h | 10 ++++++++++
+ lustre/autoconf/lustre-core.m4 | 21 +++++++++++++++++++++
+ lustre/include/liblustre.h | 4 ++++
+ lustre/llite/xattr.c | 2 +-
+ lustre/mdc/mdc_request.c | 3 ++-
+ 6 files changed, 42 insertions(+), 4 deletions(-)
+
+diff --git a/libcfs/include/libcfs/darwin/darwin-fs.h b/libcfs/include/libcfs/darwin/darwin-fs.h
+index 998823b..9f71d6a 100644
+--- a/libcfs/include/libcfs/darwin/darwin-fs.h
++++ b/libcfs/include/libcfs/darwin/darwin-fs.h
+@@ -171,11 +171,13 @@ struct posix_acl {
+ };
+
+ struct posix_acl *posix_acl_alloc(int count, int flags);
+-static inline struct posix_acl *posix_acl_from_xattr(const void *value,
++static inline struct posix_acl *posix_acl_from_xattr(const void *value,
+ size_t size)
+-{
++{
+ return posix_acl_alloc(0, 0);
+ }
++#define posix_acl_from_xattr(a,b,c) posix_acl_from_xattr(b,c)
++
+ static inline void posix_acl_release(struct posix_acl *acl) {};
+ static inline int posix_acl_valid(const struct posix_acl *acl) { return 0; }
+ static inline struct posix_acl * posix_acl_dup(struct posix_acl *acl)
+diff --git a/libcfs/include/libcfs/linux/linux-fs.h b/libcfs/include/libcfs/linux/linux-fs.h
+index 53975ab..fa4e4d4 100644
+--- a/libcfs/include/libcfs/linux/linux-fs.h
++++ b/libcfs/include/libcfs/linux/linux-fs.h
+@@ -53,6 +53,7 @@
+ #include <linux/stat.h>
+ #include <linux/mount.h>
+ #include <linux/backing-dev.h>
++#include <linux/posix_acl_xattr.h>
+
+ #define filp_size(f) \
+ (i_size_read((f)->f_dentry->d_inode))
+@@ -102,4 +103,13 @@ ssize_t filp_user_write(struct file *filp, const void *buf, size_t count,
+ #define DTTOIF(dirtype) ((dirtype) << IFSHIFT)
+ #endif
+
++#ifndef HAVE_POSIXACL_USER_NS
++/*
++ * Mask out &init_user_ns so we don't jump
++ * through hoops to define it somehow only
++ * to have it ignored anyway.
++ */
++#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
+ #endif
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index 601155c..125bde7 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -2233,6 +2233,25 @@ LB_LINUX_TRY_COMPILE([
+ ])
+
+ #
++# 3.7 posix_acl_{to,from}_xattr take struct user_namespace
++#
++AC_DEFUN([LC_HAVE_POSIXACL_USER_NS],
++[AC_MSG_CHECKING([if posix_acl_to_xattr takes struct user_namespace])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/fs.h>
++ #include <linux/posix_acl_xattr.h>
++],[
++ posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
++],[
++ AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
++ [posix_acl_to_xattr takes struct user_namespace])
++ AC_MSG_RESULT([yes])
++],[
++ AC_MSG_RESULT([no])
++])
++])
++
++#
+ # LC_PROG_LINUX
+ #
+ # Lustre linux kernel checks
+@@ -2414,6 +2433,8 @@ AC_DEFUN([LC_PROG_LINUX],
+ LC_DENTRY_OPEN_USE_PATH
+ LC_HAVE_IOP_ATOMIC_OPEN
+
++ # 3.7
++ LC_HAVE_POSIXACL_USER_NS
+ #
+ if test x$enable_server = xyes ; then
+ AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
+diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h
+index 14f3ef6..eb62458 100644
+--- a/lustre/include/liblustre.h
++++ b/lustre/include/liblustre.h
+@@ -458,6 +458,10 @@ struct posix_acl * posix_acl_from_xattr(const void *value, size_t size)
+ return NULL;
+ }
+
++/* The kernel version takes 3 arguments, so strip that off first. */
++#define posix_acl_from_xattr(a,b,c) posix_acl_from_xattr(b,c)
++#define posix_acl_to_xattr(a,b,c) posix_acl_to_xattr(b,c)
++
+ static inline
+ int posix_acl_valid(const struct posix_acl *acl)
+ {
+diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c
+index f9e425d..7e3eb53 100644
+--- a/lustre/llite/xattr.c
++++ b/lustre/llite/xattr.c
+@@ -345,7 +345,7 @@ int ll_getxattr_common(struct inode *inode, const char *name,
+ if (!acl)
+ RETURN(-ENODATA);
+
+- rc = posix_acl_to_xattr(acl, buffer, size);
++ rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
+ posix_acl_release(acl);
+ RETURN(rc);
+ }
+diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c
+index 9f3dea4..c9aa7a0 100644
+--- a/lustre/mdc/mdc_request.c
++++ b/lustre/mdc/mdc_request.c
+@@ -41,6 +41,7 @@
+ # include <linux/pagemap.h>
+ # include <linux/miscdevice.h>
+ # include <linux/init.h>
++# include <linux/utsname.h>
+ #else
+ # include <liblustre.h>
+ #endif
+@@ -465,7 +466,7 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md)
+ if (!buf)
+ RETURN(-EPROTO);
+
+- acl = posix_acl_from_xattr(buf, body->aclsize);
++ acl = posix_acl_from_xattr(&init_user_ns, buf, body->aclsize);
+ if (IS_ERR(acl)) {
+ rc = PTR_ERR(acl);
+ CERROR("convert xattr to acl: %d\n", rc);
+--
+1.8.1.5
+