From 3b0ba3ba99b8a3af0fb532bf264629436b1abd84 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 18 Oct 2016 23:49:23 +0000 Subject: Linux 4.9 compat: inode_change_ok() renamed setattr_prepare() In torvalds/linux@31051c8 the inode_change_ok() function was renamed setattr_prepare() and updated to take a dentry ratheri than an inode. Update the code to call the setattr_prepare() and add a wrapper function which call inode_change_ok() for older kernels. Signed-off-by: Brian Behlendorf Signed-off-by: Chunwei Chen Requires-spl: refs/pull/581/head --- config/kernel-setattr-prepare.m4 | 23 +++++++++++++++++++++++ config/kernel.m4 | 1 + 2 files changed, 24 insertions(+) create mode 100644 config/kernel-setattr-prepare.m4 (limited to 'config') diff --git a/config/kernel-setattr-prepare.m4 b/config/kernel-setattr-prepare.m4 new file mode 100644 index 000000000..32f7deb77 --- /dev/null +++ b/config/kernel-setattr-prepare.m4 @@ -0,0 +1,23 @@ +dnl # +dnl # 4.9 API change +dnl # The inode_change_ok() function has been renamed setattr_prepare() +dnl # and updated to take a dentry rather than an inode. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], + [AC_MSG_CHECKING([whether setattr_prepare() is available]) + ZFS_LINUX_TRY_COMPILE_SYMBOL([ + #include + ], [ + struct dentry *dentry = NULL; + struct iattr *attr = NULL; + int error; + + error = setattr_prepare(dentry, attr); + ], [setattr_prepare], [fs/attr.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SETATTR_PREPARE, 1, + [setattr_prepare() is available]) + ], [ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel.m4 b/config/kernel.m4 index 66e97c250..44a20f213 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -74,6 +74,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE ZFS_AC_KERNEL_COMMIT_METADATA ZFS_AC_KERNEL_CLEAR_INODE + ZFS_AC_KERNEL_SETATTR_PREPARE ZFS_AC_KERNEL_INSERT_INODE_LOCKED ZFS_AC_KERNEL_D_MAKE_ROOT ZFS_AC_KERNEL_D_OBTAIN_ALIAS -- cgit v1.2.3