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
Reviewed-on: http://review.whamcloud.com/5768
Tested-by: Hudson
Reviewed-by: Alexey Shvetsov <alexxy@gentoo.org>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
};
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)
#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))
#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
])
#
+# 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
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])
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)
{
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);
}
# include <linux/pagemap.h>
# include <linux/miscdevice.h>
# include <linux/init.h>
+# include <linux/utsname.h>
#else
# include <liblustre.h>
#endif
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);