3
0
Fork 0
forked from mirrors/nixpkgs

zfs: Update to 0.6.5

This commit is contained in:
William A. Kennington III 2015-09-11 17:37:14 -07:00
parent 9cb93e7966
commit 6727f76739
6 changed files with 6 additions and 441 deletions

View file

@ -1,29 +0,0 @@
From e80da86447174b583e4b6cebedae2956fac926ee Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Tue, 14 Jul 2015 14:15:13 -0700
Subject: [PATCH] Linux 4.2 compat: bdi_setup_and_register()
The vfs_compat.h header should include the linux/backing-dev.h header
because it depends on the bdi_* functions defined there. In previous
kernels this header was being indirectly included which prevented a
build failure.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Closes #3596
---
include/linux/vfs_compat.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
index e8f8448..40832d9 100644
--- a/include/linux/vfs_compat.h
+++ b/include/linux/vfs_compat.h
@@ -28,6 +28,7 @@
#define _ZFS_VFS_H
#include <sys/taskq.h>
+#include <linux/backing-dev.h>
/*
* 2.6.28 API change,

View file

@ -1,38 +0,0 @@
From 7eb333fbdde32dbebdcc88c35610159e207237c9 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Tue, 14 Jul 2015 14:57:55 -0700
Subject: [PATCH] Linux 4.2 compat: remove bio->bi_cnt access
Linux 4.2 commit torvalds/linux@dac5621 renamed bio->bi_cnt to
bio->__bi_cnt. Because this value is only used once in a block of
debug code it simplest just to remove the PANIC. To my knowledge
this debugging has never been hit or proved useful so this is no
great loss.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Closes #3596
---
module/zfs/vdev_disk.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c
index 9cfc080..eb77c26 100644
--- a/module/zfs/vdev_disk.c
+++ b/module/zfs/vdev_disk.c
@@ -426,15 +426,6 @@ BIO_END_IO_PROTO(vdev_disk_physio_completion, bio, size, error)
dio_request_t *dr = bio->bi_private;
int rc;
- /* Fatal error but print some useful debugging before asserting */
- if (dr == NULL)
- PANIC("dr == NULL, bio->bi_private == NULL\n"
- "bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d\n"
- "bi_idx: %d, bi_size: %d, bi_end_io: %p, bi_cnt: %d\n",
- bio->bi_next, bio->bi_flags, bio->bi_rw, bio->bi_vcnt,
- BIO_BI_IDX(bio), BIO_BI_SIZE(bio), bio->bi_end_io,
- atomic_read(&bio->bi_cnt));
-
#ifndef HAVE_2ARGS_BIO_END_IO_T
if (BIO_BI_SIZE(bio))
return (1);

View file

@ -1,214 +0,0 @@
From bd29109f1ac5be68f7f7c8bcb49e1b706fe899f0 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Wed, 15 Jul 2015 10:54:26 -0700
Subject: [PATCH] Linux 4.2 compat: follow_link() / put_link()
As of Linux 4.2 the kernel has completely retired the nameidata
structure. One of the few remaining consumers of this interface
were the follow_link() and put_link() callbacks.
This patch adds the required checks to configure to detect the
interface change and updates the functions accordingly. Migrating
to the simple_follow_link() interface was considered but was decided
against ironically due to the increased complexity.
It also should be noted that the kernel follow_link() and put_link()
interfaces changes several times after 4.1 and but before 4.2. This
means there is a narrow range of kernel commits which never appear
in an official tag of the Linux kernel which ZoL will not build.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Issue #3596
---
config/kernel-create-nameidata.m4 | 4 ++--
config/kernel-follow-link-nameidata.m4 | 24 ++++++++++++++++++++++++
config/kernel-lookup-nameidata.m4 | 4 ++--
config/kernel-put-link-nameidata.m4 | 23 +++++++++++++++++++++++
config/kernel.m4 | 2 ++
module/zfs/zpl_inode.c | 31 +++++++++++++++++++++++++++----
6 files changed, 80 insertions(+), 8 deletions(-)
create mode 100644 config/kernel-follow-link-nameidata.m4
create mode 100644 config/kernel-put-link-nameidata.m4
diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4
index 9aad46f..a71490a 100644
--- a/config/kernel-create-nameidata.m4
+++ b/config/kernel-create-nameidata.m4
@@ -2,7 +2,7 @@ dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->create() takes struct nameidata])
+ AC_MSG_CHECKING([whether iops->create() passes nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
@@ -22,7 +22,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CREATE_NAMEIDATA, 1,
- [iops->create() operation takes nameidata])
+ [iops->create() passes nameidata])
],[
AC_MSG_RESULT(no)
])
diff --git a/config/kernel-follow-link-nameidata.m4 b/config/kernel-follow-link-nameidata.m4
new file mode 100644
index 0000000..88c85ac
--- /dev/null
+++ b/config/kernel-follow-link-nameidata.m4
@@ -0,0 +1,24 @@
+dnl #
+dnl # 4.2 API change
+dnl # This kernel retired the nameidata structure which forced the
+dnl # restructuring of the follow_link() prototype and how it is called.
+dnl # We check for the new interface rather than detecting the old one.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [
+ AC_MSG_CHECKING([whether iops->follow_link() passes nameidata])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ const char *follow_link(struct dentry *de, void **cookie)
+ { return "symlink"; }
+ static struct inode_operations iops __attribute__ ((unused)) = {
+ .follow_link = follow_link,
+ };
+ ],[
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1,
+ [iops->follow_link() nameidata])
+ ])
+])
diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4
index 6455603..43f5fb4 100644
--- a/config/kernel-lookup-nameidata.m4
+++ b/config/kernel-lookup-nameidata.m4
@@ -2,7 +2,7 @@ dnl #
dnl # 3.6 API change
dnl #
AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
- AC_MSG_CHECKING([whether iops->lookup() takes struct nameidata])
+ AC_MSG_CHECKING([whether iops->lookup() passes nameidata])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
@@ -18,7 +18,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LOOKUP_NAMEIDATA, 1,
- [iops->lookup() operation takes nameidata])
+ [iops->lookup() passes nameidata])
],[
AC_MSG_RESULT(no)
])
diff --git a/config/kernel-put-link-nameidata.m4 b/config/kernel-put-link-nameidata.m4
new file mode 100644
index 0000000..0181ae5
--- /dev/null
+++ b/config/kernel-put-link-nameidata.m4
@@ -0,0 +1,23 @@
+dnl #
+dnl # 4.2 API change
+dnl # This kernel retired the nameidata structure which forced the
+dnl # restructuring of the put_link() prototype and how it is called.
+dnl # We check for the new interface rather than detecting the old one.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_PUT_LINK], [
+ AC_MSG_CHECKING([whether iops->put_link() passes nameidata])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ void put_link(struct inode *ip, void *cookie) { return; }
+ static struct inode_operations iops __attribute__ ((unused)) = {
+ .put_link = put_link,
+ };
+ ],[
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PUT_LINK_NAMEIDATA, 1,
+ [iops->put_link() nameidata])
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 806c574..5c97659 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -70,6 +70,8 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_MKDIR_UMODE_T
ZFS_AC_KERNEL_LOOKUP_NAMEIDATA
ZFS_AC_KERNEL_CREATE_NAMEIDATA
+ ZFS_AC_KERNEL_FOLLOW_LINK
+ ZFS_AC_KERNEL_PUT_LINK
ZFS_AC_KERNEL_TRUNCATE_RANGE
ZFS_AC_KERNEL_AUTOMOUNT
ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index 31251e7..70b5e12 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -348,8 +348,13 @@ zpl_symlink(struct inode *dir, struct dentry *dentry, const char *name)
return (error);
}
+#ifdef HAVE_FOLLOW_LINK_NAMEIDATA
static void *
zpl_follow_link(struct dentry *dentry, struct nameidata *nd)
+#else
+const char *
+zpl_follow_link(struct dentry *dentry, void **symlink_cookie)
+#endif
{
cred_t *cr = CRED();
struct inode *ip = dentry->d_inode;
@@ -372,17 +377,28 @@ zpl_follow_link(struct dentry *dentry, struct nameidata *nd)
cookie = spl_fstrans_mark();
error = -zfs_readlink(ip, &uio, cr);
spl_fstrans_unmark(cookie);
- if (error) {
+
+ if (error)
kmem_free(link, MAXPATHLEN);
+
+ crfree(cr);
+
+#ifdef HAVE_FOLLOW_LINK_NAMEIDATA
+ if (error)
nd_set_link(nd, ERR_PTR(error));
- } else {
+ else
nd_set_link(nd, link);
- }
- crfree(cr);
return (NULL);
+#else
+ if (error)
+ return (ERR_PTR(error));
+ else
+ return (*symlink_cookie = link);
+#endif
}
+#ifdef HAVE_PUT_LINK_NAMEIDATA
static void
zpl_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
{
@@ -391,6 +407,13 @@ zpl_put_link(struct dentry *dentry, struct nameidata *nd, void *ptr)
if (!IS_ERR(link))
kmem_free(link, MAXPATHLEN);
}
+#else
+static void
+zpl_put_link(struct inode *unused, void *symlink_cookie)
+{
+ kmem_free(symlink_cookie, MAXPATHLEN);
+}
+#endif
static int
zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)

View file

@ -1,19 +1,14 @@
{ callPackage, fetchFromGitHub, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "0.6.4.2";
version = "0.6.5";
src = fetchFromGitHub {
owner = "zfsonlinux";
repo = "zfs";
rev = "zfs-${version}";
sha256 = "192x4z5am5wgrr4hb5skshyr5a6af52xpnk6pni4hs4pxvlpcs37";
sha256 = "1jqm2a9mldp4km5m454zszsw6p8hrqd7xrbf52pgp82kf5w3d6wz";
};
patches = [
./nix-build.patch
./compat-4.2-1.patch
./compat-4.2-2.patch
./compat-4.2-3.patch
];
patches = [ ./nix-build.patch ];
})

View file

@ -1,13 +1,13 @@
{ callPackage, stdenv, fetchFromGitHub, spl_git, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "2015-08-30";
version = "2015-09-11";
src = fetchFromGitHub {
owner = "zfsonlinux";
repo = "zfs";
rev = "c6a3a222d3a1d2af94205a218c0ba455200fb945";
sha256 = "0alzkngw36ik4vpw0z8nnk5qysh2z6v231c23rw7jlcqfdd8ji8p";
rev = "7a27ad00ae142b38d4aef8cc0af7a72b4c0e44fe";
sha256 = "1jqm2a9mldp4km5m454zszsw6p8hrqd7xrbf52pgp82kf5w3d6wz";
};
patches = [ ./nix-build.patch ];

View file

@ -1,149 +0,0 @@
diff --git a/config/kernel-vfs-rw-iterate.m4 b/config/kernel-vfs-rw-iterate.m4
new file mode 100644
index 0000000..f8dc422
--- /dev/null
+++ b/config/kernel-vfs-rw-iterate.m4
@@ -0,0 +1,27 @@
+dnl #
+dnl # Linux 4.1.x API
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE],
+ [AC_MSG_CHECKING([whether fops->read/write_iter() are available])
+ ZFS_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+
+ ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
+ { return 0; }
+ ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
+ { return 0; }
+
+ static const struct file_operations
+ fops __attribute__ ((unused)) = {
+ .read_iter = test_read,
+ .write_iter = test_write,
+ };
+ ],[
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
+ [fops->read/write_iter() are available])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index a9f2f58..fe42e17 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -96,6 +96,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_5ARG_SGET
ZFS_AC_KERNEL_LSEEK_EXECUTE
ZFS_AC_KERNEL_VFS_ITERATE
+ ZFS_AC_KERNEL_VFS_RW_ITERATE
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c
index 66db113..5471140 100644
--- a/module/zfs/zpl_file.c
+++ b/module/zfs/zpl_file.c
@@ -196,8 +196,7 @@ zpl_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
static int
zpl_aio_fsync(struct kiocb *kiocb, int datasync)
{
- return (zpl_fsync(kiocb->ki_filp, kiocb->ki_pos,
- kiocb->ki_pos + kiocb->ki_nbytes, datasync));
+ return (zpl_fsync(kiocb->ki_filp, kiocb->ki_pos, -1, datasync));
}
#else
#error "Unsupported fops->fsync() implementation"
@@ -261,12 +260,11 @@ zpl_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
}
static ssize_t
-zpl_aio_read(struct kiocb *kiocb, const struct iovec *iovp,
- unsigned long nr_segs, loff_t pos)
+zpl_iter_read_common(struct kiocb *kiocb, const struct iovec *iovp,
+ unsigned long nr_segs, size_t count)
{
cred_t *cr = CRED();
struct file *filp = kiocb->ki_filp;
- size_t count = kiocb->ki_nbytes;
ssize_t read;
size_t alloc_size = sizeof (struct iovec) * nr_segs;
struct iovec *iov_tmp = kmem_alloc(alloc_size, KM_SLEEP);
@@ -284,6 +282,22 @@ zpl_aio_read(struct kiocb *kiocb, const struct iovec *iovp,
return (read);
}
+#if defined(HAVE_VFS_RW_ITERATE)
+static ssize_t
+zpl_iter_read(struct kiocb *kiocb, struct iov_iter *to)
+{
+ return (zpl_iter_read_common(kiocb, to->iov, to->nr_segs,
+ iov_iter_count(to)));
+}
+#else
+static ssize_t
+zpl_aio_read(struct kiocb *kiocb, const struct iovec *iovp,
+ unsigned long nr_segs, loff_t pos)
+{
+ return (zpl_iter_read_common(kiocb, iovp, nr_segs, kiocb->ki_nbytes));
+}
+#endif /* HAVE_VFS_RW_ITERATE */
+
static inline ssize_t
zpl_write_common_iovec(struct inode *ip, const struct iovec *iovp, size_t count,
unsigned long nr_segs, loff_t *ppos, uio_seg_t segment,
@@ -344,12 +358,11 @@ zpl_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos)
}
static ssize_t
-zpl_aio_write(struct kiocb *kiocb, const struct iovec *iovp,
- unsigned long nr_segs, loff_t pos)
+zpl_iter_write_common(struct kiocb *kiocb, const struct iovec *iovp,
+ unsigned long nr_segs, size_t count)
{
cred_t *cr = CRED();
struct file *filp = kiocb->ki_filp;
- size_t count = kiocb->ki_nbytes;
ssize_t wrote;
size_t alloc_size = sizeof (struct iovec) * nr_segs;
struct iovec *iov_tmp = kmem_alloc(alloc_size, KM_SLEEP);
@@ -367,6 +380,22 @@ zpl_aio_write(struct kiocb *kiocb, const struct iovec *iovp,
return (wrote);
}
+#if defined(HAVE_VFS_RW_ITERATE)
+static ssize_t
+zpl_iter_write(struct kiocb *kiocb, struct iov_iter *from)
+{
+ return (zpl_iter_write_common(kiocb, from->iov, from->nr_segs,
+ iov_iter_count(from)));
+}
+#else
+static ssize_t
+zpl_aio_write(struct kiocb *kiocb, const struct iovec *iovp,
+ unsigned long nr_segs, loff_t pos)
+{
+ return (zpl_iter_write_common(kiocb, iovp, nr_segs, kiocb->ki_nbytes));
+}
+#endif /* HAVE_VFS_RW_ITERATE */
+
static loff_t
zpl_llseek(struct file *filp, loff_t offset, int whence)
{
@@ -778,8 +807,13 @@ const struct file_operations zpl_file_operations = {
.llseek = zpl_llseek,
.read = zpl_read,
.write = zpl_write,
+#ifdef HAVE_VFS_RW_ITERATE
+ .read_iter = zpl_iter_read,
+ .write_iter = zpl_iter_write,
+#else
.aio_read = zpl_aio_read,
.aio_write = zpl_aio_write,
+#endif
.mmap = zpl_mmap,
.fsync = zpl_fsync,
.aio_fsync = zpl_aio_fsync,