diff --git a/pkgs/os-specific/linux/zfs/bc151f7b312dea09c6ec5b9a320e65140789643a.patch b/pkgs/os-specific/linux/zfs/bc151f7b312dea09c6ec5b9a320e65140789643a.patch deleted file mode 100644 index 382c8ce63eea..000000000000 --- a/pkgs/os-specific/linux/zfs/bc151f7b312dea09c6ec5b9a320e65140789643a.patch +++ /dev/null @@ -1,84 +0,0 @@ -From bc151f7b312dea09c6ec5b9a320e65140789643a Mon Sep 17 00:00:00 2001 -From: Ned Bass -Date: Thu, 16 Oct 2014 13:52:56 -0700 -Subject: [PATCH] Remove checks for mandatory locks - -The Linux VFS handles mandatory locks generically so we shouldn't -need to check for conflicting locks in zfs_read(), zfs_write(), or -zfs_freesp(). Linux 3.18 removed the lock_may_read() and -lock_may_write() interfaces which we were relying on for this -purpose. Rather than emulating those interfaces we remove the -redundant checks. - -Signed-off-by: Ned Bass -Signed-off-by: Brian Behlendorf -Closes #2804 ---- - module/zfs/zfs_vnops.c | 18 ------------------ - module/zfs/zfs_znode.c | 10 ---------- - 2 files changed, 28 deletions(-) - -diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c -index 33f9e0e..2f55e56 100644 ---- a/module/zfs/zfs_vnops.c -+++ b/module/zfs/zfs_vnops.c -@@ -474,15 +474,6 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) - } - - /* -- * Check for mandatory locks -- */ -- if (mandatory_lock(ip) && -- !lock_may_read(ip, uio->uio_loffset, uio->uio_resid)) { -- ZFS_EXIT(zsb); -- return (SET_ERROR(EAGAIN)); -- } -- -- /* - * If we're in FRSYNC mode, sync out this znode before reading it. - */ - if (ioflag & FRSYNC || zsb->z_os->os_sync == ZFS_SYNC_ALWAYS) -@@ -651,15 +642,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) - } - - /* -- * Check for mandatory locks before calling zfs_range_lock() -- * in order to prevent a deadlock with locks set via fcntl(). -- */ -- if (mandatory_lock(ip) && !lock_may_write(ip, woff, n)) { -- ZFS_EXIT(zsb); -- return (SET_ERROR(EAGAIN)); -- } -- -- /* - * Pre-fault the pages to ensure slow (eg NFS) pages - * don't hold up txg. - * Skip this if uio contains loaned arc_buf. -diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c -index 90dbfd3..f02c021 100644 ---- a/module/zfs/zfs_znode.c -+++ b/module/zfs/zfs_znode.c -@@ -1546,7 +1546,6 @@ zfs_trunc(znode_t *zp, uint64_t end) - int - zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log) - { -- struct inode *ip = ZTOI(zp); - dmu_tx_t *tx; - zfs_sb_t *zsb = ZTOZSB(zp); - zilog_t *zilog = zsb->z_log; -@@ -1567,15 +1566,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log) - goto out; - } - -- /* -- * Check for any locks in the region to be freed. -- */ -- if (ip->i_flock && mandatory_lock(ip)) { -- uint64_t length = (len ? len : zp->z_size - off); -- if (!lock_may_write(ip, off, length)) -- return (SET_ERROR(EAGAIN)); -- } -- - if (len == 0) { - error = zfs_trunc(zp, off); - } else { diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix index 3661137fc295..a893154b9365 100644 --- a/pkgs/os-specific/linux/zfs/default.nix +++ b/pkgs/os-specific/linux/zfs/default.nix @@ -33,6 +33,7 @@ stdenv.mkDerivation rec { substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc" substituteInPlace ./cmd/zed/Makefile.am --replace "\$(sysconfdir)" "$out/etc" + substituteInPlace ./module/Makefile.in --replace "/bin/cp" "cp" ./autogen.sh ''; diff --git a/pkgs/os-specific/linux/zfs/git.nix b/pkgs/os-specific/linux/zfs/git.nix index fde5310deed2..21a580136d56 100644 --- a/pkgs/os-specific/linux/zfs/git.nix +++ b/pkgs/os-specific/linux/zfs/git.nix @@ -1,15 +1,17 @@ { stdenv, fetchgit, kernel, spl_git, perl, autoconf, automake, libtool, zlib, libuuid, coreutils, utillinux }: stdenv.mkDerivation { - name = "zfs-0.6.3-${kernel.version}"; + name = "zfs-0.6.4-${kernel.version}"; src = fetchgit { url = git://github.com/zfsonlinux/zfs.git; - rev = "07dabd234dd51a1e5adc5bd21cddf5b5fdc70732"; - sha256 = "1yqsfdhyzh33aisfvwqd692n5kfgnlz7yjixd2gqn8vx9bv0dz0b"; + rev = "74328ee18f94d27f9c802d29fdd311018dab2adf"; + sha256 = "0ayyqbb2crki1xvibfmscav5j7g0z77ys83dx10430ljamvylwb0"; }; - patches = [ ./mount_zfs_prefix.patch ./nix-build.patch ./bc151f7b312dea09c6ec5b9a320e65140789643a.patch ]; + patches = [ + ./nix-build-git.patch + ]; buildInputs = [ spl_git perl autoconf automake libtool zlib libuuid coreutils ]; @@ -28,6 +30,7 @@ stdenv.mkDerivation { substituteInPlace ./config/zfs-build.m4 --replace "\$sysconfdir/init.d" "$out/etc/init.d" substituteInPlace ./etc/zfs/Makefile.am --replace "\$(sysconfdir)" "$out/etc" substituteInPlace ./cmd/zed/Makefile.am --replace "\$(sysconfdir)" "$out/etc" + substituteInPlace ./module/Makefile.in --replace "/bin/cp" "cp" ./autogen.sh ''; @@ -41,6 +44,7 @@ stdenv.mkDerivation { "--with-udevdir=$(out)/lib/udev" "--with-systemdunitdir=$(out)/etc/systemd/system" "--with-systemdpresetdir=$(out)/etc/systemd/system-preset" + "--with-mounthelperdir=$(out)/sbin" "--sysconfdir=/etc" "--localstatedir=/var" ]; diff --git a/pkgs/os-specific/linux/zfs/nix-build-git.patch b/pkgs/os-specific/linux/zfs/nix-build-git.patch new file mode 100644 index 000000000000..ae8e82f703af --- /dev/null +++ b/pkgs/os-specific/linux/zfs/nix-build-git.patch @@ -0,0 +1,133 @@ +diff --git a/Makefile.am b/Makefile.am +index 49b417a..f4af44d 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -12,10 +12,10 @@ endif + if CONFIG_KERNEL + SUBDIRS += module + +-extradir = @prefix@/src/zfs-$(VERSION) ++extradir = @prefix@/libexec/zfs-$(VERSION) + extra_HEADERS = zfs.release.in zfs_config.h.in + +-kerneldir = @prefix@/src/zfs-$(VERSION)/$(LINUX_VERSION) ++kerneldir = @prefix@/zfs-$(VERSION)/$(LINUX_VERSION) + nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS) + endif + +diff --git a/include/Makefile.am b/include/Makefile.am +index a94cad5..a160fe2 100644 +--- a/include/Makefile.am ++++ b/include/Makefile.am +@@ -29,6 +29,6 @@ libzfs_HEADERS = $(COMMON_H) $(USER_H) + endif + + if CONFIG_KERNEL +-kerneldir = @prefix@/src/zfs-$(VERSION)/include ++kerneldir = @prefix@/include + kernel_HEADERS = $(COMMON_H) $(KERNEL_H) + endif +diff --git a/include/linux/Makefile.am b/include/linux/Makefile.am +index d00b1c8..3242d2e 100644 +--- a/include/linux/Makefile.am ++++ b/include/linux/Makefile.am +@@ -17,6 +17,6 @@ libzfs_HEADERS = $(COMMON_H) $(USER_H) + endif + + if CONFIG_KERNEL +-kerneldir = @prefix@/src/zfs-$(VERSION)/include/linux ++kerneldir = @prefix@/include/linux + kernel_HEADERS = $(COMMON_H) $(KERNEL_H) + endif +diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am +index 7ddace0..8da3870 100644 +--- a/include/sys/Makefile.am ++++ b/include/sys/Makefile.am +@@ -102,6 +102,6 @@ libzfs_HEADERS = $(COMMON_H) $(USER_H) + endif + + if CONFIG_KERNEL +-kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys ++kerneldir = @prefix@/include/sys + kernel_HEADERS = $(COMMON_H) $(KERNEL_H) + endif +diff --git a/include/sys/fm/Makefile.am b/include/sys/fm/Makefile.am +index 8bca5d8..a5eafcd 100644 +--- a/include/sys/fm/Makefile.am ++++ b/include/sys/fm/Makefile.am +@@ -16,6 +16,6 @@ libzfs_HEADERS = $(COMMON_H) $(USER_H) + endif + + if CONFIG_KERNEL +-kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/fm ++kerneldir = @prefix@/include/sys/fm + kernel_HEADERS = $(COMMON_H) $(KERNEL_H) + endif +diff --git a/include/sys/fm/fs/Makefile.am b/include/sys/fm/fs/Makefile.am +index fdc9eb5..807c47c 100644 +--- a/include/sys/fm/fs/Makefile.am ++++ b/include/sys/fm/fs/Makefile.am +@@ -13,6 +13,6 @@ libzfs_HEADERS = $(COMMON_H) $(USER_H) + endif + + if CONFIG_KERNEL +-kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/fm/fs ++kerneldir = @prefix@/include/sys/fm/fs + kernel_HEADERS = $(COMMON_H) $(KERNEL_H) + endif +diff --git a/include/sys/fs/Makefile.am b/include/sys/fs/Makefile.am +index 0859b9f..b0c6eec 100644 +--- a/include/sys/fs/Makefile.am ++++ b/include/sys/fs/Makefile.am +@@ -13,6 +13,6 @@ libzfs_HEADERS = $(COMMON_H) $(USER_H) + endif + + if CONFIG_KERNEL +-kerneldir = @prefix@/src/zfs-$(VERSION)/include/sys/fs ++kerneldir = @prefix@/include/sys/fs + kernel_HEADERS = $(COMMON_H) $(KERNEL_H) + endif +diff --git a/module/Makefile.in b/module/Makefile.in +index 686402b..9cbf598 100644 +--- a/module/Makefile.in ++++ b/module/Makefile.in +@@ -18,9 +18,9 @@ modules: + @# installed devel headers, or they may be in the module + @# subdirectory when building against the spl source tree. + @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \ +- /bin/cp @SPL_OBJ@/@SPL_SYMBOLS@ .; \ ++ cp @SPL_OBJ@/@SPL_SYMBOLS@ .; \ + elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \ +- /bin/cp @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \ ++ cp @SPL_OBJ@/module/@SPL_SYMBOLS@ .; \ + else \ + echo -e "\n" \ + "*** Missing spl symbols ensure you have built the spl:\n" \ +@@ -28,6 +28,8 @@ modules: + "*** - @SPL_OBJ@/module/@SPL_SYMBOLS@\n"; \ + exit 1; \ + fi ++ @# when copying a file out of the nix store, we need to make it writable again. ++ chmod +w @SPL_SYMBOLS@ + $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ CONFIG_ZFS=m $@ + + clean: +@@ -42,15 +44,15 @@ clean: + modules_install: + @# Install the kernel modules + $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` $@ \ +- INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH) \ ++ INSTALL_MOD_PATH=@prefix@/$(INSTALL_MOD_PATH) \ + INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \ + KERNELRELEASE=@LINUX_VERSION@ + @# Remove extraneous build products when packaging +- kmoddir=$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ ++ kmoddir=@prefix@/$(INSTALL_MOD_PATH)/lib/modules/@LINUX_VERSION@; \ + if [ -n $$kmoddir ]; then \ + find $$kmoddir -name 'modules.*' | xargs $(RM); \ + fi +- sysmap=$(DESTDIR)$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \ ++ sysmap=@prefix@/$(INSTALL_MOD_PATH)/boot/System.map-@LINUX_VERSION@; \ + if [ -f $$sysmap ]; then \ + depmod -ae -F $$sysmap @LINUX_VERSION@; \ + fi diff --git a/pkgs/os-specific/linux/zfs/remove-lock-checks.patch b/pkgs/os-specific/linux/zfs/remove-lock-checks.patch deleted file mode 100644 index 1261b49ee1d4..000000000000 --- a/pkgs/os-specific/linux/zfs/remove-lock-checks.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c -index 33f9e0e..2f55e56 100644 ---- a/module/zfs/zfs_vnops.c -+++ b/module/zfs/zfs_vnops.c -@@ -474,15 +474,6 @@ zfs_read(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) - } - - /* -- * Check for mandatory locks -- */ -- if (mandatory_lock(ip) && -- !lock_may_read(ip, uio->uio_loffset, uio->uio_resid)) { -- ZFS_EXIT(zsb); -- return (SET_ERROR(EAGAIN)); -- } -- -- /* - * If we're in FRSYNC mode, sync out this znode before reading it. - */ - if (ioflag & FRSYNC || zsb->z_os->os_sync == ZFS_SYNC_ALWAYS) -@@ -651,15 +642,6 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr) - } - - /* -- * Check for mandatory locks before calling zfs_range_lock() -- * in order to prevent a deadlock with locks set via fcntl(). -- */ -- if (mandatory_lock(ip) && !lock_may_write(ip, woff, n)) { -- ZFS_EXIT(zsb); -- return (SET_ERROR(EAGAIN)); -- } -- -- /* - * Pre-fault the pages to ensure slow (eg NFS) pages - * don't hold up txg. - * Skip this if uio contains loaned arc_buf. -diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c -index 90dbfd3..f02c021 100644 ---- a/module/zfs/zfs_znode.c -+++ b/module/zfs/zfs_znode.c -@@ -1546,7 +1546,6 @@ zfs_trunc(znode_t *zp, uint64_t end) - int - zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log) - { -- struct inode *ip = ZTOI(zp); - dmu_tx_t *tx; - zfs_sb_t *zsb = ZTOZSB(zp); - zilog_t *zilog = zsb->z_log; -@@ -1567,15 +1566,6 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log) - goto out; - } - -- /* -- * Check for any locks in the region to be freed. -- */ -- if (ip->i_flock && mandatory_lock(ip)) { -- uint64_t length = (len ? len : zp->z_size - off); -- if (!lock_may_write(ip, off, length)) -- return (SET_ERROR(EAGAIN)); -- } -- - if (len == 0) { - error = zfs_trunc(zp, off); - } else {