Linux 4.9 compat: remove iops->{set,get,remove}xattr

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>
This commit is contained in:
Chunwei Chen 2016-10-19 11:19:17 -07:00 committed by Brian Behlendorf
parent 28172e8aa7
commit 670508f080
3 changed files with 34 additions and 0 deletions

View 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 #
dnl # Supported xattr handler get() interfaces checked newest to oldest. dnl # Supported xattr handler get() interfaces checked newest to oldest.
dnl # dnl #

View File

@ -100,6 +100,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_MAKE_REQUEST_FN ZFS_AC_KERNEL_MAKE_REQUEST_FN
ZFS_AC_KERNEL_GENERIC_IO_ACCT ZFS_AC_KERNEL_GENERIC_IO_ACCT
ZFS_AC_KERNEL_RENAME_WANTS_FLAGS ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"

View File

@ -661,9 +661,11 @@ zpl_revalidate(struct dentry *dentry, unsigned int flags)
const struct inode_operations zpl_inode_operations = { const struct inode_operations zpl_inode_operations = {
.setattr = zpl_setattr, .setattr = zpl_setattr,
.getattr = zpl_getattr, .getattr = zpl_getattr,
#ifdef HAVE_GENERIC_SETXATTR
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif
.listxattr = zpl_xattr_list, .listxattr = zpl_xattr_list,
#ifdef HAVE_INODE_TRUNCATE_RANGE #ifdef HAVE_INODE_TRUNCATE_RANGE
.truncate_range = zpl_truncate_range, .truncate_range = zpl_truncate_range,
@ -698,9 +700,11 @@ const struct inode_operations zpl_dir_inode_operations = {
#endif #endif
.setattr = zpl_setattr, .setattr = zpl_setattr,
.getattr = zpl_getattr, .getattr = zpl_getattr,
#ifdef HAVE_GENERIC_SETXATTR
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif
.listxattr = zpl_xattr_list, .listxattr = zpl_xattr_list,
#if defined(CONFIG_FS_POSIX_ACL) #if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_GET_ACL) #if defined(HAVE_GET_ACL)
@ -725,18 +729,22 @@ const struct inode_operations zpl_symlink_inode_operations = {
#endif #endif
.setattr = zpl_setattr, .setattr = zpl_setattr,
.getattr = zpl_getattr, .getattr = zpl_getattr,
#ifdef HAVE_GENERIC_SETXATTR
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif
.listxattr = zpl_xattr_list, .listxattr = zpl_xattr_list,
}; };
const struct inode_operations zpl_special_inode_operations = { const struct inode_operations zpl_special_inode_operations = {
.setattr = zpl_setattr, .setattr = zpl_setattr,
.getattr = zpl_getattr, .getattr = zpl_getattr,
#ifdef HAVE_GENERIC_SETXATTR
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif
.listxattr = zpl_xattr_list, .listxattr = zpl_xattr_list,
#if defined(CONFIG_FS_POSIX_ACL) #if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_GET_ACL) #if defined(HAVE_GET_ACL)