diff --git a/sys-fs/zfs/Manifest b/sys-fs/zfs/Manifest index 9f2be8c..a4a5476 100644 --- a/sys-fs/zfs/Manifest +++ b/sys-fs/zfs/Manifest @@ -1,6 +1,7 @@ AUX zfs-0.6.0-includedir.patch 586 RMD160 eb4cc6a9d66721e70c932b1dd640abd852d5470d SHA1 c673e057008b4cb7d4c45b936533e9bceff2443c SHA256 047a0cec35bcc5f8050fa80f8203ea020bf148375297c64300a9607f062cec2d +AUX zfs-0.6.0-kernel-3.1-compat.patch 13773 RMD160 8fc8d5c5a3650c775fd2b6c954dc4a9a66a24bd8 SHA1 57d82b8ff26847f0eb202eccdc26eafa1ddbc270 SHA256 348c0b1a46490d63061478898c88c4164f20ce687eeb3af898578263e4329c2e AUX zfs-9999-includedir.patch 601 RMD160 a75d2aca63f0b94a88003a9361c54cf54e77b533 SHA1 f0c60696b6bdfb349897c9b936ffb33b48a70cbf SHA256 d13c30e83548482cde91fb3366ab3d53bc5d0a554270c15a213e2dd15ec937ce AUX zfs.initd 2052 RMD160 3636ead94d4b7200cc221b9e9646b85a5c3acc1a SHA1 d59d5b475c3dc335bf70a24a7af80ef7a38df347 SHA256 ad5e5aa282f2942b23364b5dcb43b4edea5c3923559d18d624ca9bcb51218476 DIST zfs-0.6.0-rc6.tar.gz 1936503 RMD160 c5bcaa967fe70f5c72863f9e230850b37d76b8ce SHA1 70e6d4a6c97281df52e9c91ae577d15637804934 SHA256 b4f72580307d8b81fa9568fd46dccc993367402bf085adb9eca4dd1a24f323e0 -EBUILD zfs-0.6.0_rc6.ebuild 1581 RMD160 f2792e1dd837425ba509176abbbcc34d9badc937 SHA1 bb98600e0b6944d2c77183da7ae7c4b6b760eb8c SHA256 0dbfc7ea982d4e8d243b8dc8c4b5a2aa430c9c846baba42f6a819126e87d2713 +EBUILD zfs-0.6.0_rc6-r1.ebuild 1690 RMD160 e0e50f6aed9a5ec69166c7787e60cac9263b4c3a SHA1 37e25488c24b19dfc705528c279f4fbf6a043ca1 SHA256 7811f99cb2ea15b82f85a334b26bcfc90310ce01ce401495fc86ca67cb07b4fc EBUILD zfs-9999.ebuild 1478 RMD160 74c3c243479e0a5e648c8d20122bfe7802438c8a SHA1 245a203a145160d9fcb7a349fe12b28f291e836a SHA256 d94e9a20286df8ed2f407b08e3d71a29b24d8af5fbba20869a8bc7f7505f296c diff --git a/sys-fs/zfs/files/zfs-0.6.0-kernel-3.1-compat.patch b/sys-fs/zfs/files/zfs-0.6.0-kernel-3.1-compat.patch new file mode 100644 index 0000000..7440118 --- /dev/null +++ b/sys-fs/zfs/files/zfs-0.6.0-kernel-3.1-compat.patch @@ -0,0 +1,581 @@ +diff --git a/config/kernel-fsync.m4 b/config/kernel-fsync.m4 +index 3f93842..862b897 100644 +--- a/config/kernel-fsync.m4 ++++ b/config/kernel-fsync.m4 +@@ -1,20 +1,63 @@ + dnl # +-dnl # 2.6.35 API change +-dnl # The dentry argument was deamed unused and dropped in 2.6.36. ++dnl # Linux 2.6.x - 2.6.34 API + dnl # +-AC_DEFUN([ZFS_AC_KERNEL_FSYNC_2ARGS], [ +- AC_MSG_CHECKING([whether fops->fsync() wants 2 args]) ++AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITH_DENTRY], [ + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ +- int (*fsync) (struct file *, int datasync) = NULL; ++ int (*fsync) (struct file *, struct dentry *, int) = NULL; + struct file_operations fops __attribute__ ((unused)); + + fops.fsync = fsync; + ],[ +- AC_MSG_RESULT(yes) +- AC_DEFINE(HAVE_2ARGS_FSYNC, 1, [fops->fsync() want 2 args]) ++ AC_MSG_RESULT([dentry]) ++ AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1, ++ [fops->fsync() with dentry]) + ],[ +- AC_MSG_RESULT(no) + ]) + ]) ++ ++dnl # ++dnl # Linux 2.6.35 - Linux 3.0 API ++dnl # ++AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY], [ ++ ZFS_LINUX_TRY_COMPILE([ ++ #include ++ ],[ ++ int (*fsync) (struct file *, int) = NULL; ++ struct file_operations fops __attribute__ ((unused)); ++ ++ fops.fsync = fsync; ++ ],[ ++ AC_MSG_RESULT([no dentry]) ++ AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1, ++ [fops->fsync() without dentry]) ++ ],[ ++ ]) ++]) ++ ++dnl # ++dnl # Linux 3.1 -x 3.x API ++dnl # ++AC_DEFUN([ZFS_AC_KERNEL_FSYNC_RANGE], [ ++ ZFS_LINUX_TRY_COMPILE([ ++ #include ++ ],[ ++ int (*fsync) (struct file *, loff_t, loff_t, int) = NULL; ++ struct file_operations fops __attribute__ ((unused)); ++ ++ fops.fsync = fsync; ++ ],[ ++ AC_MSG_RESULT([range]) ++ AC_DEFINE(HAVE_FSYNC_RANGE, 1, ++ [fops->fsync() with range]) ++ ],[ ++ ]) ++]) ++ ++AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [ ++ AC_MSG_CHECKING([whether fops->fsync() wants]) ++ ZFS_AC_KERNEL_FSYNC_WITH_DENTRY ++ ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY ++ ZFS_AC_KERNEL_FSYNC_RANGE ++]) +diff --git a/config/kernel.m4 b/config/kernel.m4 +index fec157a..8cfbccf 100644 +--- a/config/kernel.m4 ++++ b/config/kernel.m4 +@@ -32,7 +32,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ + ZFS_AC_KERNEL_CONST_XATTR_HANDLER + ZFS_AC_KERNEL_XATTR_HANDLER_GET + ZFS_AC_KERNEL_XATTR_HANDLER_SET +- ZFS_AC_KERNEL_FSYNC_2ARGS ++ ZFS_AC_KERNEL_FSYNC + ZFS_AC_KERNEL_EVICT_INODE + ZFS_AC_KERNEL_INSERT_INODE_LOCKED + ZFS_AC_KERNEL_D_OBTAIN_ALIAS +diff --git a/configure b/configure +index e70651f..89596d9 100755 +--- a/configure ++++ b/configure +@@ -14418,8 +14418,9 @@ fi + + + +- { $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants 2 args" >&5 +-$as_echo_n "checking whether fops->fsync() wants 2 args... " >&6; } ++ { $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants" >&5 ++$as_echo_n "checking whether fops->fsync() wants... " >&6; } ++ + + + cat confdefs.h - <<_ACEOF >conftest.c +@@ -14436,7 +14437,7 @@ int + main (void) + { + +- int (*fsync) (struct file *, int datasync) = NULL; ++ int (*fsync) (struct file *, struct dentry *, int) = NULL; + struct file_operations fops __attribute__ ((unused)); + + fops.fsync = fsync; +@@ -14462,11 +14463,75 @@ _ACEOF + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +- { $as_echo "$as_me:$LINENO: result: yes" >&5 +-$as_echo "yes" >&6; } ++ { $as_echo "$as_me:$LINENO: result: dentry" >&5 ++$as_echo "dentry" >&6; } + + cat >>confdefs.h <<\_ACEOF +-#define HAVE_2ARGS_FSYNC 1 ++#define HAVE_FSYNC_WITH_DENTRY 1 ++_ACEOF ++ ++ ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ++ ++ ++fi ++ ++ rm -Rf build ++ ++ ++ ++ ++ ++ ++cat confdefs.h - <<_ACEOF >conftest.c ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++ ++ #include ++ ++int ++main (void) ++{ ++ ++ int (*fsync) (struct file *, int) = NULL; ++ struct file_operations fops __attribute__ ((unused)); ++ ++ fops.fsync = fsync; ++ ++ ; ++ return 0; ++} ++ ++_ACEOF ++ ++ ++ rm -Rf build && mkdir -p build ++ echo "obj-m := conftest.o" >build/Makefile ++ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ { $as_echo "$as_me:$LINENO: result: no dentry" >&5 ++$as_echo "no dentry" >&6; } ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_FSYNC_WITHOUT_DENTRY 1 + _ACEOF + + +@@ -14474,8 +14539,6 @@ else + $as_echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + +- { $as_echo "$as_me:$LINENO: result: no" >&5 +-$as_echo "no" >&6; } + + + +@@ -14486,6 +14549,71 @@ fi + + + ++ ++ ++cat confdefs.h - <<_ACEOF >conftest.c ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++ ++ #include ++ ++int ++main (void) ++{ ++ ++ int (*fsync) (struct file *, loff_t, loff_t, int) = NULL; ++ struct file_operations fops __attribute__ ((unused)); ++ ++ fops.fsync = fsync; ++ ++ ; ++ return 0; ++} ++ ++_ACEOF ++ ++ ++ rm -Rf build && mkdir -p build ++ echo "obj-m := conftest.o" >build/Makefile ++ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ { $as_echo "$as_me:$LINENO: result: range" >&5 ++$as_echo "range" >&6; } ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_FSYNC_RANGE 1 ++_ACEOF ++ ++ ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ++ ++ ++fi ++ ++ rm -Rf build ++ ++ ++ ++ ++ + { $as_echo "$as_me:$LINENO: checking whether sops->evict_inode() exists" >&5 + $as_echo_n "checking whether sops->evict_inode() exists... " >&6; } + +@@ -19027,8 +19155,9 @@ fi + + + +- { $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants 2 args" >&5 +-$as_echo_n "checking whether fops->fsync() wants 2 args... " >&6; } ++ { $as_echo "$as_me:$LINENO: checking whether fops->fsync() wants" >&5 ++$as_echo_n "checking whether fops->fsync() wants... " >&6; } ++ + + + cat confdefs.h - <<_ACEOF >conftest.c +@@ -19045,7 +19174,7 @@ int + main (void) + { + +- int (*fsync) (struct file *, int datasync) = NULL; ++ int (*fsync) (struct file *, struct dentry *, int) = NULL; + struct file_operations fops __attribute__ ((unused)); + + fops.fsync = fsync; +@@ -19071,11 +19200,75 @@ _ACEOF + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +- { $as_echo "$as_me:$LINENO: result: yes" >&5 +-$as_echo "yes" >&6; } ++ { $as_echo "$as_me:$LINENO: result: dentry" >&5 ++$as_echo "dentry" >&6; } + + cat >>confdefs.h <<\_ACEOF +-#define HAVE_2ARGS_FSYNC 1 ++#define HAVE_FSYNC_WITH_DENTRY 1 ++_ACEOF ++ ++ ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ++ ++ ++fi ++ ++ rm -Rf build ++ ++ ++ ++ ++ ++ ++cat confdefs.h - <<_ACEOF >conftest.c ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++ ++ #include ++ ++int ++main (void) ++{ ++ ++ int (*fsync) (struct file *, int) = NULL; ++ struct file_operations fops __attribute__ ((unused)); ++ ++ fops.fsync = fsync; ++ ++ ; ++ return 0; ++} ++ ++_ACEOF ++ ++ ++ rm -Rf build && mkdir -p build ++ echo "obj-m := conftest.o" >build/Makefile ++ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ { $as_echo "$as_me:$LINENO: result: no dentry" >&5 ++$as_echo "no dentry" >&6; } ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_FSYNC_WITHOUT_DENTRY 1 + _ACEOF + + +@@ -19083,8 +19276,6 @@ else + $as_echo "$as_me: failed program was:" >&5 + sed 's/^/| /' conftest.$ac_ext >&5 + +- { $as_echo "$as_me:$LINENO: result: no" >&5 +-$as_echo "no" >&6; } + + + +@@ -19095,6 +19286,71 @@ fi + + + ++ ++ ++cat confdefs.h - <<_ACEOF >conftest.c ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++ ++ ++ #include ++ ++int ++main (void) ++{ ++ ++ int (*fsync) (struct file *, loff_t, loff_t, int) = NULL; ++ struct file_operations fops __attribute__ ((unused)); ++ ++ fops.fsync = fsync; ++ ++ ; ++ return 0; ++} ++ ++_ACEOF ++ ++ ++ rm -Rf build && mkdir -p build ++ echo "obj-m := conftest.o" >build/Makefile ++ if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ ++ { $as_echo "$as_me:$LINENO: result: range" >&5 ++$as_echo "range" >&6; } ++ ++cat >>confdefs.h <<\_ACEOF ++#define HAVE_FSYNC_RANGE 1 ++_ACEOF ++ ++ ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ++ ++ ++fi ++ ++ rm -Rf build ++ ++ ++ ++ ++ + { $as_echo "$as_me:$LINENO: checking whether sops->evict_inode() exists" >&5 + $as_echo_n "checking whether sops->evict_inode() exists... " >&6; } + +diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c +index 298c0b6..0ef2c15 100644 +--- a/module/zfs/zpl_file.c ++++ b/module/zfs/zpl_file.c +@@ -76,37 +76,78 @@ zpl_readdir(struct file *filp, void *dirent, filldir_t filldir) + return (error); + } + ++#if defined(HAVE_FSYNC_WITH_DENTRY) + /* +- * 2.6.35 API change, +- * As of 2.6.35 the dentry argument to the .fsync() vfs hook was deemed ++ * Linux 2.6.x - 2.6.34 API, ++ * Through 2.6.34 the nfsd kernel server would pass a NULL 'file struct *' ++ * to the fops->fsync() hook. For this reason, we must be careful not to ++ * use filp unconditionally. ++ */ ++static int ++zpl_fsync(struct file *filp, struct dentry *dentry, int datasync) ++{ ++ cred_t *cr = CRED(); ++ int error; ++ ++ crhold(cr); ++ error = -zfs_fsync(dentry->d_inode, datasync, cr); ++ crfree(cr); ++ ASSERT3S(error, <=, 0); ++ ++ return (error); ++} ++ ++#elif defined(HAVE_FSYNC_WITHOUT_DENTRY) ++/* ++ * Linux 2.6.35 - 3.0 API, ++ * As of 2.6.35 the dentry argument to the fops->fsync() hook was deemed + * redundant. The dentry is still accessible via filp->f_path.dentry, + * and we are guaranteed that filp will never be NULL. +- * +- * 2.6.34 API change, +- * Prior to 2.6.34 the nfsd kernel server would pass a NULL file struct * +- * to the .fsync() hook. For this reason, we must be careful not to use +- * filp unconditionally in the 3 argument case. + */ +-#ifdef HAVE_2ARGS_FSYNC + static int + zpl_fsync(struct file *filp, int datasync) + { +- struct dentry *dentry = filp->f_path.dentry; +-#else ++ struct inode *inode = filp->f_mapping->host; ++ cred_t *cr = CRED(); ++ int error; ++ ++ crhold(cr); ++ error = -zfs_fsync(inode, datasync, cr); ++ crfree(cr); ++ ASSERT3S(error, <=, 0); ++ ++ return (error); ++} ++ ++#elif defined(HAVE_FSYNC_RANGE) ++/* ++ * Linux 3.1 - 3.x API, ++ * As of 3.1 the responsibility to call filemap_write_and_wait_range() has ++ * been pushed down in to the .fsync() vfs hook. Additionally, the i_mutex ++ * lock is no longer held by the caller, for zfs we don't require the lock ++ * to be held so we don't acquire it. ++ */ + static int +-zpl_fsync(struct file *filp, struct dentry *dentry, int datasync) ++zpl_fsync(struct file *filp, loff_t start, loff_t end, int datasync) + { +-#endif /* HAVE_2ARGS_FSYNC */ ++ struct inode *inode = filp->f_mapping->host; + cred_t *cr = CRED(); + int error; + ++ error = filemap_write_and_wait_range(inode->i_mapping, start, end); ++ if (error) ++ return (error); ++ + crhold(cr); +- error = -zfs_fsync(dentry->d_inode, datasync, cr); ++ error = -zfs_fsync(inode, datasync, cr); + crfree(cr); + ASSERT3S(error, <=, 0); + + return (error); + } ++#else ++#error "Unsupported fops->fsync() implementation" ++#endif + + ssize_t + zpl_read_common(struct inode *ip, const char *buf, size_t len, loff_t pos, +diff --git a/zfs_config.h.in b/zfs_config.h.in +index 6f18dca..41d7ab1 100644 +--- a/zfs_config.h.in ++++ b/zfs_config.h.in +@@ -6,9 +6,6 @@ + /* bio_end_io_t wants 2 args */ + #undef HAVE_2ARGS_BIO_END_IO_T + +-/* fops->fsync() want 2 args */ +-#undef HAVE_2ARGS_FSYNC +- + /* security_inode_init_security wants 6 args */ + #undef HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY + +@@ -93,6 +90,15 @@ + /* kernel defines fmode_t */ + #undef HAVE_FMODE_T + ++/* fops->fsync() with range */ ++#undef HAVE_FSYNC_RANGE ++ ++/* fops->fsync() without dentry */ ++#undef HAVE_FSYNC_WITHOUT_DENTRY ++ ++/* fops->fsync() with dentry */ ++#undef HAVE_FSYNC_WITH_DENTRY ++ + /* blk_disk_ro() is available */ + #undef HAVE_GET_DISK_RO + diff --git a/sys-fs/zfs/zfs-0.6.0_rc6.ebuild b/sys-fs/zfs/zfs-0.6.0_rc6-r1.ebuild similarity index 93% rename from sys-fs/zfs/zfs-0.6.0_rc6.ebuild rename to sys-fs/zfs/zfs-0.6.0_rc6-r1.ebuild index 3075666..7a3559e 100644 --- a/sys-fs/zfs/zfs-0.6.0_rc6.ebuild +++ b/sys-fs/zfs/zfs-0.6.0_rc6-r1.ebuild @@ -40,6 +40,9 @@ pkg_setup() { src_prepare() { epatch "${FILESDIR}/${PN}-0.6.0-includedir.patch" + # Pinkbyte: patch for kernel 3.1 compatibility + epatch "${FILESDIR}/${PN}-0.6.0-kernel-3.1-compat.patch" + # eautoreconf }