]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux 4.9 compat: remove iops->{set,get,remove}xattr
authorChunwei Chen <david.chen@osnexus.com>
Wed, 19 Oct 2016 18:19:17 +0000 (11:19 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 20 Oct 2016 16:39:09 +0000 (09:39 -0700)
In Linux 4.9, torvalds/linux@fd50eca, iops->{set,get,remove}xattr and
generic_{set,get,remove}xattr are removed. xattr operations will directly
go through sb->s_xattr.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
config/kernel-xattr-handler.m4
config/kernel.m4
module/zfs/zpl_inode.c

index ce18eaf9caf633c9752a6c07b9f94267023a1dc7..300cb0ba8ea4650df507646aadbe551f18c6b1cc 100644 (file)
@@ -57,6 +57,31 @@ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
        ])
 ])
 
+dnl #
+dnl # 4.9 API change,
+dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
+dnl # removed. xattr operations will directly go through sb->s_xattr.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR], [
+       AC_MSG_CHECKING([whether generic_setxattr() exists])
+       ZFS_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+               #include <linux/xattr.h>
+
+               static const struct inode_operations
+                   iops __attribute__ ((unused)) = {
+                       .setxattr = generic_setxattr
+               };
+       ],[
+       ],[
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
+                   [generic_setxattr() exists])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+])
+
 dnl #
 dnl # Supported xattr handler get() interfaces checked newest to oldest.
 dnl #
index 37635256b322298804933a34b5f0c951cbc20d45..66e97c250bcc40bdc4b2d1627cbabbf7ffd2c5d1 100644 (file)
@@ -104,6 +104,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
        ZFS_AC_KERNEL_KUID_HELPERS
        ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
        ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
+       ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
 
        AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
                KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
index 113885ead7eb483d87455dca4182cdd0abd47ff4..f59f2df97b428fb2491e93a60adb569beb21f804 100644 (file)
@@ -664,9 +664,11 @@ zpl_revalidate(struct dentry *dentry, unsigned int flags)
 const struct inode_operations zpl_inode_operations = {
        .setattr        = zpl_setattr,
        .getattr        = zpl_getattr,
+#ifdef HAVE_GENERIC_SETXATTR
        .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .removexattr    = generic_removexattr,
+#endif
        .listxattr      = zpl_xattr_list,
 #ifdef HAVE_INODE_TRUNCATE_RANGE
        .truncate_range = zpl_truncate_range,
@@ -701,9 +703,11 @@ const struct inode_operations zpl_dir_inode_operations = {
 #endif
        .setattr        = zpl_setattr,
        .getattr        = zpl_getattr,
+#ifdef HAVE_GENERIC_SETXATTR
        .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .removexattr    = generic_removexattr,
+#endif
        .listxattr      = zpl_xattr_list,
 #if defined(CONFIG_FS_POSIX_ACL)
 #if defined(HAVE_GET_ACL)
@@ -728,18 +732,22 @@ const struct inode_operations zpl_symlink_inode_operations = {
 #endif
        .setattr        = zpl_setattr,
        .getattr        = zpl_getattr,
+#ifdef HAVE_GENERIC_SETXATTR
        .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .removexattr    = generic_removexattr,
+#endif
        .listxattr      = zpl_xattr_list,
 };
 
 const struct inode_operations zpl_special_inode_operations = {
        .setattr        = zpl_setattr,
        .getattr        = zpl_getattr,
+#ifdef HAVE_GENERIC_SETXATTR
        .setxattr       = generic_setxattr,
        .getxattr       = generic_getxattr,
        .removexattr    = generic_removexattr,
+#endif
        .listxattr      = zpl_xattr_list,
 #if defined(CONFIG_FS_POSIX_ACL)
 #if defined(HAVE_GET_ACL)