[packages/zfs] - inode_change_ok has been removed in 4.9 and 4.1.37 - rel 3

baggins baggins at pld-linux.org
Wed Dec 28 00:04:52 CET 2016


commit bb670c20bfcb49992bbc529d888d2c1cdc72bf9c
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Wed Dec 28 00:04:21 2016 +0100

    - inode_change_ok has been removed in 4.9 and 4.1.37
    - rel 3

 setattr_prepare.patch | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
 zfs.spec              |  3 +-
 2 files changed, 98 insertions(+), 1 deletion(-)
---
diff --git a/zfs.spec b/zfs.spec
index 6023f9f..e17f9c5 100644
--- a/zfs.spec
+++ b/zfs.spec
@@ -26,7 +26,7 @@ exit 1
 
 %define		_duplicate_files_terminate_build	0
 
-%define	rel	2
+%define	rel	3
 %define	pname	zfs
 Summary:	Native Linux port of the ZFS filesystem
 Summary(pl.UTF-8):	Natywny linuksowy port systemu plików ZFS
@@ -39,6 +39,7 @@ Source0:	https://github.com/zfsonlinux/zfs/releases/download/zfs-%{version}/%{pn
 # Source0-md5:	ffc51dcf5260d3c7e747fe78f8ae307c
 Patch0:		%{pname}-link.patch
 Patch1:		x32.patch
+Patch2:		setattr_prepare.patch
 URL:		http://zfsonlinux.org/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake
diff --git a/setattr_prepare.patch b/setattr_prepare.patch
new file mode 100644
index 0000000..153f9ad
--- /dev/null
+++ b/setattr_prepare.patch
@@ -0,0 +1,96 @@
+From 3b0ba3ba99b8a3af0fb532bf264629436b1abd84 Mon Sep 17 00:00:00 2001
+From: Brian Behlendorf <behlendorf1 at llnl.gov>
+Date: Tue, 18 Oct 2016 23:49:23 +0000
+Subject: [PATCH] Linux 4.9 compat: inode_change_ok() renamed setattr_prepare()
+
+In torvalds/linux at 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 <behlendorf1 at llnl.gov>
+Signed-off-by: Chunwei Chen <david.chen at osnexus.com>
+Requires-spl: refs/pull/581/head
+---
+ config/kernel-setattr-prepare.m4 | 23 +++++++++++++++++++++++
+ config/kernel.m4                 |  1 +
+ include/linux/vfs_compat.h       | 11 +++++++++++
+ module/zfs/zpl_inode.c           |  2 +-
+ 4 files changed, 36 insertions(+), 1 deletion(-)
+ create mode 100644 config/kernel-setattr-prepare.m4
+
+diff --git a/config/kernel-setattr-prepare.m4 b/config/kernel-setattr-prepare.m4
+new file mode 100644
+index 0000000..32f7deb
+--- /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 <linux/fs.h>
++	], [
++		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 66e97c2..44a20f2 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
+diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
+index 8a64cab..989c237 100644
+--- a/include/linux/vfs_compat.h
++++ b/include/linux/vfs_compat.h
+@@ -444,4 +444,15 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
+ #define	zpl_follow_up(path)			follow_up(path)
+ #endif
+ 
++/*
++ * 4.9 API change
++ */
++#ifndef HAVE_SETATTR_PREPARE
++static inline int
++setattr_prepare(struct dentry *dentry, struct iattr *ia)
++{
++	return (inode_change_ok(dentry->d_inode, ia));
++}
++#endif
++
+ #endif /* _ZFS_VFS_H */
+diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
+index f59f2df9..b8adda7 100644
+--- a/module/zfs/zpl_inode.c
++++ b/module/zfs/zpl_inode.c
+@@ -323,7 +323,7 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
+ 	int error;
+ 	fstrans_cookie_t cookie;
+ 
+-	error = inode_change_ok(ip, ia);
++	error = setattr_prepare(dentry, ia);
+ 	if (error)
+ 		return (error);
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zfs.git/commitdiff/bb670c20bfcb49992bbc529d888d2c1cdc72bf9c



More information about the pld-cvs-commit mailing list