From 9bfd67457883a122714dbd862299f6a8325b4326 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sat, 25 Mar 2017 22:05:24 +0100 Subject: [PATCH] - up to 0.6.5.9 --- linux-4.9.patch | 408 ------------------------------------------ setattr_prepare.patch | 96 ---------- zfs.spec | 10 +- 3 files changed, 3 insertions(+), 511 deletions(-) delete mode 100644 linux-4.9.patch delete mode 100644 setattr_prepare.patch diff --git a/linux-4.9.patch b/linux-4.9.patch deleted file mode 100644 index 7a001eb..0000000 --- a/linux-4.9.patch +++ /dev/null @@ -1,408 +0,0 @@ -From b8d9e26440ade0edebfa98af8cb9371810c1aeaf Mon Sep 17 00:00:00 2001 -From: Chunwei Chen -Date: Wed, 19 Oct 2016 11:19:01 -0700 -Subject: [PATCH] Linux 4.9 compat: iops->rename() wants flags - -In Linux 4.9, torvalds/linux@2773bf0, iops->rename() and iops->rename2() are -merged together into iops->rename(), it now wants flags. - -Signed-off-by: Chunwei Chen ---- - config/kernel-rename.m4 | 25 +++++++++++++++++++++++++ - config/kernel.m4 | 1 + - module/zfs/zpl_ctldir.c | 23 ++++++++++++++++++++--- - module/zfs/zpl_inode.c | 21 +++++++++++++++++++-- - 4 files changed, 65 insertions(+), 5 deletions(-) - create mode 100644 config/kernel-rename.m4 - -diff --git a/config/kernel-rename.m4 b/config/kernel-rename.m4 -new file mode 100644 -index 0000000..9f894fb ---- /dev/null -+++ b/config/kernel-rename.m4 -@@ -0,0 +1,25 @@ -+dnl # -+dnl # 4.9 API change, -+dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants -+dnl # flags. -+dnl # -+AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [ -+ AC_MSG_CHECKING([whether iops->rename() wants flags]) -+ ZFS_LINUX_TRY_COMPILE([ -+ #include -+ int rename_fn(struct inode *sip, struct dentry *sdp, -+ struct inode *tip, struct dentry *tdp, -+ unsigned int flags) { return 0; } -+ -+ static const struct inode_operations -+ iops __attribute__ ((unused)) = { -+ .rename = rename_fn, -+ }; -+ ],[ -+ ],[ -+ AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, [iops->rename() wants flags]) -+ ],[ -+ AC_MSG_RESULT(no) -+ ]) -+]) -diff --git a/config/kernel.m4 b/config/kernel.m4 -index c53e611..3763525 100644 ---- a/config/kernel.m4 -+++ b/config/kernel.m4 -@@ -103,6 +103,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ - ZFS_AC_KERNEL_FOLLOW_DOWN_ONE - ZFS_AC_KERNEL_MAKE_REQUEST_FN - ZFS_AC_KERNEL_GENERIC_IO_ACCT -+ ZFS_AC_KERNEL_RENAME_WANTS_FLAGS - - AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ - KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" -diff --git a/module/zfs/zpl_ctldir.c b/module/zfs/zpl_ctldir.c -index 7c4fcea..cdd6668 100644 ---- a/module/zfs/zpl_ctldir.c -+++ b/module/zfs/zpl_ctldir.c -@@ -301,13 +301,17 @@ zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir) - } - #endif /* HAVE_VFS_ITERATE */ - --int --zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry, -- struct inode *tdip, struct dentry *tdentry) -+static int -+zpl_snapdir_rename2(struct inode *sdip, struct dentry *sdentry, -+ struct inode *tdip, struct dentry *tdentry, unsigned int flags) - { - cred_t *cr = CRED(); - int error; - -+ /* We probably don't want to support renameat2(2) in ctldir */ -+ if (flags) -+ return (-EINVAL); -+ - crhold(cr); - error = -zfsctl_snapdir_rename(sdip, dname(sdentry), - tdip, dname(tdentry), cr, 0); -@@ -317,6 +321,15 @@ zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry, - return (error); - } - -+#ifndef HAVE_RENAME_WANTS_FLAGS -+static int -+zpl_snapdir_rename(struct inode *sdip, struct dentry *sdentry, -+ struct inode *tdip, struct dentry *tdentry) -+{ -+ return (zpl_snapdir_rename2(sdip, sdentry, tdip, tdentry, 0)); -+} -+#endif -+ - static int - zpl_snapdir_rmdir(struct inode *dip, struct dentry *dentry) - { -@@ -405,7 +418,11 @@ const struct file_operations zpl_fops_snapdir = { - const struct inode_operations zpl_ops_snapdir = { - .lookup = zpl_snapdir_lookup, - .getattr = zpl_snapdir_getattr, -+#ifdef HAVE_RENAME_WANTS_FLAGS -+ .rename = zpl_snapdir_rename2, -+#else - .rename = zpl_snapdir_rename, -+#endif - .rmdir = zpl_snapdir_rmdir, - .mkdir = zpl_snapdir_mkdir, - }; -diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c -index d26193f..113885e 100644 ---- a/module/zfs/zpl_inode.c -+++ b/module/zfs/zpl_inode.c -@@ -356,13 +356,17 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia) - } - - static int --zpl_rename(struct inode *sdip, struct dentry *sdentry, -- struct inode *tdip, struct dentry *tdentry) -+zpl_rename2(struct inode *sdip, struct dentry *sdentry, -+ struct inode *tdip, struct dentry *tdentry, unsigned int flags) - { - cred_t *cr = CRED(); - int error; - fstrans_cookie_t cookie; - -+ /* We don't have renameat2(2) support */ -+ if (flags) -+ return (-EINVAL); -+ - crhold(cr); - cookie = spl_fstrans_mark(); - error = -zfs_rename(sdip, dname(sdentry), tdip, dname(tdentry), cr, 0); -@@ -373,6 +377,15 @@ zpl_rename(struct inode *sdip, struct dentry *sdentry, - return (error); - } - -+#ifndef HAVE_RENAME_WANTS_FLAGS -+static int -+zpl_rename(struct inode *sdip, struct dentry *sdentry, -+ struct inode *tdip, struct dentry *tdentry) -+{ -+ return (zpl_rename2(sdip, sdentry, tdip, tdentry, 0)); -+} -+#endif -+ - static int - zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name) - { -@@ -662,7 +662,11 @@ - .mkdir = zpl_mkdir, - .rmdir = zpl_rmdir, - .mknod = zpl_mknod, -+#ifdef HAVE_RENAME_WANTS_FLAGS -+ .rename = zpl_rename2, -+#else - .rename = zpl_rename, -+#endif - .setattr = zpl_setattr, - .getattr = zpl_getattr, - #ifdef HAVE_GENERIC_SETXATTR -@@ -681,7 +694,11 @@ const struct inode_operations zpl_dir_inode_operations = { - .mkdir = zpl_mkdir, - .rmdir = zpl_rmdir, - .mknod = zpl_mknod, -+#ifdef HAVE_RENAME_WANTS_FLAGS -+ .rename = zpl_rename2, -+#else - .rename = zpl_rename, -+#endif - .setattr = zpl_setattr, - .getattr = zpl_getattr, - .setxattr = generic_setxattr, -From 0fedeedd309eca62d15fffd8bd811e2b12660e21 Mon Sep 17 00:00:00 2001 -From: Chunwei Chen -Date: Wed, 19 Oct 2016 11:19:17 -0700 -Subject: [PATCH] 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 ---- - config/kernel-xattr-handler.m4 | 25 +++++++++++++++++++++++++ - config/kernel.m4 | 1 + - module/zfs/zpl_inode.c | 8 ++++++++ - 3 files changed, 34 insertions(+) - -diff --git a/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4 -index ce18eaf..300cb0b 100644 ---- a/config/kernel-xattr-handler.m4 -+++ b/config/kernel-xattr-handler.m4 -@@ -58,6 +58,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 -+ #include -+ -+ 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 # - AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [ -diff --git a/config/kernel.m4 b/config/kernel.m4 -index 3763525..66e97c2 100644 ---- a/config/kernel.m4 -+++ b/config/kernel.m4 -@@ -104,6 +104,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ - ZFS_AC_KERNEL_MAKE_REQUEST_FN - ZFS_AC_KERNEL_GENERIC_IO_ACCT - 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" -diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c -index 113885e..f59f2df9 100644 ---- a/module/zfs/zpl_inode.c -+++ b/module/zfs/zpl_inode.c -@@ -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) -From 7ca25051b6470e8471b4ed454d8c66ff21338de3 Mon Sep 17 00:00:00 2001 -From: DeHackEd -Date: Tue, 15 Nov 2016 12:20:46 -0500 -Subject: [PATCH] Kernel 4.9 compat: file_operations->aio_fsync removal - -Linux kernel commit 723c038475b78 removed this field. - -Reviewed-by: Brian Behlendorf -Signed-off-by: DHE -Closes #5393 ---- - config/kernel-aio-fsync.m4 | 21 +++++++++++++++++++++ - config/kernel.m4 | 1 + - module/zfs/zpl_file.c | 11 +++++++++++ - 3 files changed, 33 insertions(+) - create mode 100644 config/kernel-aio-fsync.m4 - -diff --git a/config/kernel-aio-fsync.m4 b/config/kernel-aio-fsync.m4 -new file mode 100644 -index 0000000..41b7a98a ---- /dev/null -+++ b/config/kernel-aio-fsync.m4 -@@ -0,0 +1,21 @@ -+dnl # -+dnl # Linux 4.9-rc5+ ABI, removal of the .aio_fsync field -+dnl # -+AC_DEFUN([ZFS_AC_KERNEL_AIO_FSYNC], [ -+ AC_MSG_CHECKING([whether fops->aio_fsync() exists]) -+ ZFS_LINUX_TRY_COMPILE([ -+ #include -+ -+ static const struct file_operations -+ fops __attribute__ ((unused)) = { -+ .aio_fsync = NULL, -+ }; -+ ],[ -+ ],[ -+ AC_MSG_RESULT(yes) -+ AC_DEFINE(HAVE_FILE_AIO_FSYNC, 1, [fops->aio_fsync() exists]) -+ ],[ -+ AC_MSG_RESULT(no) -+ ]) -+]) -+ -diff --git a/config/kernel.m4 b/config/kernel.m4 -index af59451..b66631a 100644 ---- a/config/kernel.m4 -+++ b/config/kernel.m4 -@@ -66,6 +66,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ - ZFS_AC_KERNEL_NR_CACHED_OBJECTS - ZFS_AC_KERNEL_FREE_CACHED_OBJECTS - ZFS_AC_KERNEL_FALLOCATE -+ ZFS_AC_KERNEL_AIO_FSYNC - ZFS_AC_KERNEL_MKDIR_UMODE_T - ZFS_AC_KERNEL_LOOKUP_NAMEIDATA - ZFS_AC_KERNEL_CREATE_NAMEIDATA -diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c -index 2c84d70..a225220 100644 ---- a/module/zfs/zpl_file.c -+++ b/module/zfs/zpl_file.c -@@ -130,12 +130,15 @@ zpl_fsync(struct file *filp, struct dentry *dentry, int datasync) - return (error); - } - -+#ifdef HAVE_FILE_AIO_FSYNC - static int - zpl_aio_fsync(struct kiocb *kiocb, int datasync) - { - struct file *filp = kiocb->ki_filp; - return (zpl_fsync(filp, filp->f_path.dentry, datasync)); - } -+#endif -+ - #elif defined(HAVE_FSYNC_WITHOUT_DENTRY) - /* - * Linux 2.6.35 - 3.0 API, -@@ -161,11 +164,14 @@ zpl_fsync(struct file *filp, int datasync) - return (error); - } - -+#ifdef HAVE_FILE_AIO_FSYNC - static int - zpl_aio_fsync(struct kiocb *kiocb, int datasync) - { - return (zpl_fsync(kiocb->ki_filp, datasync)); - } -+#endif -+ - #elif defined(HAVE_FSYNC_RANGE) - /* - * Linux 3.1 - 3.x API, -@@ -196,11 +202,14 @@ zpl_fsync(struct file *filp, loff_t start, loff_t end, int datasync) - return (error); - } - -+#ifdef HAVE_FILE_AIO_FSYNC - static int - zpl_aio_fsync(struct kiocb *kiocb, int datasync) - { - return (zpl_fsync(kiocb->ki_filp, kiocb->ki_pos, -1, datasync)); - } -+#endif -+ - #else - #error "Unsupported fops->fsync() implementation" - #endif -@@ -838,7 +847,9 @@ const struct file_operations zpl_file_operations = { - #endif - .mmap = zpl_mmap, - .fsync = zpl_fsync, -+#ifdef HAVE_FILE_AIO_FSYNC - .aio_fsync = zpl_aio_fsync, -+#endif - #ifdef HAVE_FILE_FALLOCATE - .fallocate = zpl_fallocate, - #endif /* HAVE_FILE_FALLOCATE */ diff --git a/setattr_prepare.patch b/setattr_prepare.patch deleted file mode 100644 index 153f9ad..0000000 --- a/setattr_prepare.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 3b0ba3ba99b8a3af0fb532bf264629436b1abd84 Mon Sep 17 00:00:00 2001 -From: Brian Behlendorf -Date: Tue, 18 Oct 2016 23:49:23 +0000 -Subject: [PATCH] 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 + - 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 -+ ], [ -+ 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); - diff --git a/zfs.spec b/zfs.spec index be6d09e..6024ddc 100644 --- a/zfs.spec +++ b/zfs.spec @@ -26,21 +26,19 @@ exit 1 %define _duplicate_files_terminate_build 0 -%define rel 5 +%define rel 1 %define pname zfs Summary: Native Linux port of the ZFS filesystem Summary(pl.UTF-8): Natywny linuksowy port systemu plików ZFS Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} -Version: 0.6.5.8 +Version: 0.6.5.9 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} License: CDDL (ZFS), GPL v2+ (ZPIOS) Group: Applications/System Source0: https://github.com/zfsonlinux/zfs/releases/download/zfs-%{version}/%{pname}-%{version}.tar.gz -# Source0-md5: ffc51dcf5260d3c7e747fe78f8ae307c +# Source0-md5: 9dceb3930be4e1a8cf35bcc40e48e527 Patch0: %{pname}-link.patch Patch1: x32.patch -Patch2: setattr_prepare.patch -Patch3: linux-4.9.patch URL: http://zfsonlinux.org/ BuildRequires: autoconf >= 2.50 BuildRequires: automake @@ -221,8 +219,6 @@ p=`pwd`\ %setup -q -n %{pname}-%{version} %patch0 -p1 %patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build %{__libtoolize} -- 2.44.0