rebase patches on top of zfs-0.7.13

rebase done with import-patchqueue/export-patchqueue

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Stoiko Ivanov 2019-03-07 18:03:53 +01:00 committed by Thomas Lamprecht
parent c3ea9788ad
commit 00430d087a
13 changed files with 56 additions and 420 deletions

View File

@ -1,14 +1,15 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Debian ZFS on Linux maintainers From: Debian ZFS on Linux maintainers
<pkg-zfsonlinux-devel@alioth-lists.debian.net> <pkg-zfsonlinux-devel@alioth-lists.debian.net>
Date: Wed, 30 Jan 2019 15:12:04 +0100 Date: Wed, 30 Jan 2019 15:12:04 +0100
Subject: Check-for-META-and-DCH-consistency-in-autoconf Subject: [PATCH] Check-for-META-and-DCH-consistency-in-autoconf
--- ---
config/zfs-meta.m4 | 34 +++++++++++++++++++++++++++++----- config/zfs-meta.m4 | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-) 1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4 diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4
index 3e1429d..b8e26c4 100644 index 3e1429d99..b8e26c492 100644
--- a/config/zfs-meta.m4 --- a/config/zfs-meta.m4
+++ b/config/zfs-meta.m4 +++ b/config/zfs-meta.m4
@@ -1,9 +1,10 @@ @@ -1,9 +1,10 @@

View File

@ -1,7 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Debian ZFS on Linux maintainers From: Debian ZFS on Linux maintainers
<pkg-zfsonlinux-devel@alioth-lists.debian.net> <pkg-zfsonlinux-devel@alioth-lists.debian.net>
Date: Wed, 30 Jan 2019 15:12:04 +0100 Date: Wed, 30 Jan 2019 15:12:04 +0100
Subject: Add-libuutil-to-LIBADD-for-libzfs-and-libzfs_core Subject: [PATCH] Add-libuutil-to-LIBADD-for-libzfs-and-libzfs_core
--- ---
lib/libzfs/Makefile.am | 1 + lib/libzfs/Makefile.am | 1 +
@ -9,7 +10,7 @@ Subject: Add-libuutil-to-LIBADD-for-libzfs-and-libzfs_core
2 files changed, 3 insertions(+), 1 deletion(-) 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am
index f1260ea..5b07b9d 100644 index f1260ea71..5b07b9d9d 100644
--- a/lib/libzfs/Makefile.am --- a/lib/libzfs/Makefile.am
+++ b/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am
@@ -31,6 +31,7 @@ nodist_libzfs_la_SOURCES = \ @@ -31,6 +31,7 @@ nodist_libzfs_la_SOURCES = \
@ -21,7 +22,7 @@ index f1260ea..5b07b9d 100644
$(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libnvpair/libnvpair.la \
$(top_builddir)/lib/libzpool/libzpool.la $(top_builddir)/lib/libzpool/libzpool.la
diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am
index 5eafc25..10d6de3 100644 index 5eafc25c0..10d6de3d6 100644
--- a/lib/libzfs_core/Makefile.am --- a/lib/libzfs_core/Makefile.am
+++ b/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am
@@ -16,7 +16,8 @@ nodist_libzfs_core_la_SOURCES = \ @@ -16,7 +16,8 @@ nodist_libzfs_core_la_SOURCES = \

View File

@ -1,8 +1,9 @@
From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com> From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
Date: Mon, 4 Sep 2017 10:59:32 +0200 Date: Mon, 4 Sep 2017 10:59:32 +0200
Subject: add man page reference to systemd units Subject: [PATCH] add man page reference to systemd units
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
@ -14,7 +15,7 @@ Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 files changed, 4 insertions(+) 4 files changed, 4 insertions(+)
diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in
index 726c468..d5b4043 100644 index 97808dee7..cb4358fb4 100644
--- a/etc/systemd/system/zfs-import-cache.service.in --- a/etc/systemd/system/zfs-import-cache.service.in
+++ b/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -25,7 +26,7 @@ index 726c468..d5b4043 100644
Requires=systemd-udev-settle.service Requires=systemd-udev-settle.service
After=systemd-udev-settle.service After=systemd-udev-settle.service
diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in
index abc8e8e..fd66505 100644 index c097e3852..e7b1d8862 100644
--- a/etc/systemd/system/zfs-import-scan.service.in --- a/etc/systemd/system/zfs-import-scan.service.in
+++ b/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -36,7 +37,7 @@ index abc8e8e..fd66505 100644
Requires=systemd-udev-settle.service Requires=systemd-udev-settle.service
After=systemd-udev-settle.service After=systemd-udev-settle.service
diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in
index 728fc63..8a73716 100644 index 728fc630c..8a73716f5 100644
--- a/etc/systemd/system/zfs-mount.service.in --- a/etc/systemd/system/zfs-mount.service.in
+++ b/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -47,7 +48,7 @@ index 728fc63..8a73716 100644
After=systemd-udev-settle.service After=systemd-udev-settle.service
After=zfs-import.target After=zfs-import.target
diff --git a/etc/systemd/system/zfs-share.service.in b/etc/systemd/system/zfs-share.service.in diff --git a/etc/systemd/system/zfs-share.service.in b/etc/systemd/system/zfs-share.service.in
index 494f5cb..d0c93a3 100644 index 494f5cbef..d0c93a3e6 100644
--- a/etc/systemd/system/zfs-share.service.in --- a/etc/systemd/system/zfs-share.service.in
+++ b/etc/systemd/system/zfs-share.service.in +++ b/etc/systemd/system/zfs-share.service.in
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@

View File

@ -1,8 +1,9 @@
From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com> From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
Date: Fri, 19 Jan 2018 12:13:46 +0100 Date: Fri, 19 Jan 2018 12:13:46 +0100
Subject: always load ZFS module on boot Subject: [PATCH] always load ZFS module on boot
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
since zfs-import-scan.service is disabled by default, and since zfs-import-scan.service is disabled by default, and
@ -17,11 +18,11 @@ Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/modules-load.d/zfs.conf.in b/etc/modules-load.d/zfs.conf.in diff --git a/etc/modules-load.d/zfs.conf.in b/etc/modules-load.d/zfs.conf.in
index 8b41baa..59b058c 100644 index 44e1bb3ed..7509b03cb 100644
--- a/etc/modules-load.d/zfs.conf.in --- a/etc/modules-load.d/zfs.conf.in
+++ b/etc/modules-load.d/zfs.conf.in +++ b/etc/modules-load.d/zfs.conf.in
@@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
# Always load kernel modules at boot. The default behavior is to load the # The default behavior is to allow udev to load the kernel modules on demand.
# kernel modules in the zfs-import-*.service or when blkid(8) detects a pool. # Uncomment the following line to unconditionally load them at boot.
-#zfs -#zfs
+zfs +zfs

View File

@ -1,8 +1,9 @@
From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com> From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
Date: Thu, 12 Oct 2017 08:57:48 +0200 Date: Thu, 12 Oct 2017 08:57:48 +0200
Subject: fix install path of zpool.d scripts Subject: [PATCH] fix install path of zpool.d scripts
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
@ -11,7 +12,7 @@ Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
1 file changed, 3 insertions(+), 3 deletions(-) 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am
index d07f8d6..5d26f32 100644 index d07f8d616..5d26f326e 100644
--- a/cmd/zpool/Makefile.am --- a/cmd/zpool/Makefile.am
+++ b/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am
@@ -22,11 +22,11 @@ zpool_LDADD = \ @@ -22,11 +22,11 @@ zpool_LDADD = \

View File

@ -1,6 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com> From: Colin Ian King <colin.king@canonical.com>
Date: Mon, 17 Oct 2016 14:30:56 +0800 Date: Mon, 17 Oct 2016 14:30:56 +0800
Subject: Use python3 for arcstat.py, arc_summary.py & dbufstat.py Subject: [PATCH] Use python3 for arcstat.py, arc_summary.py & dbufstat.py
--- ---
cmd/arc_summary/arc_summary.py | 2 +- cmd/arc_summary/arc_summary.py | 2 +-
@ -9,7 +10,7 @@ Subject: Use python3 for arcstat.py, arc_summary.py & dbufstat.py
3 files changed, 3 insertions(+), 3 deletions(-) 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmd/arc_summary/arc_summary.py b/cmd/arc_summary/arc_summary.py diff --git a/cmd/arc_summary/arc_summary.py b/cmd/arc_summary/arc_summary.py
index f6dbb9b..723c2e5 100755 index f6dbb9bfb..723c2e5a6 100755
--- a/cmd/arc_summary/arc_summary.py --- a/cmd/arc_summary/arc_summary.py
+++ b/cmd/arc_summary/arc_summary.py +++ b/cmd/arc_summary/arc_summary.py
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
@ -19,7 +20,7 @@ index f6dbb9b..723c2e5 100755
# $Id: arc_summary.pl,v 388:e27800740aa2 2011-07-08 02:53:29Z jhell $ # $Id: arc_summary.pl,v 388:e27800740aa2 2011-07-08 02:53:29Z jhell $
# #
diff --git a/cmd/arcstat/arcstat.py b/cmd/arcstat/arcstat.py diff --git a/cmd/arcstat/arcstat.py b/cmd/arcstat/arcstat.py
index d7d3e9b..3a7a47d 100755 index d7d3e9b73..3a7a47d67 100755
--- a/cmd/arcstat/arcstat.py --- a/cmd/arcstat/arcstat.py
+++ b/cmd/arcstat/arcstat.py +++ b/cmd/arcstat/arcstat.py
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
@ -29,7 +30,7 @@ index d7d3e9b..3a7a47d 100755
# Print out ZFS ARC Statistics exported via kstat(1) # Print out ZFS ARC Statistics exported via kstat(1)
# For a definition of fields, or usage, use arctstat.pl -v # For a definition of fields, or usage, use arctstat.pl -v
diff --git a/cmd/dbufstat/dbufstat.py b/cmd/dbufstat/dbufstat.py diff --git a/cmd/dbufstat/dbufstat.py b/cmd/dbufstat/dbufstat.py
index 42bb0c7..73e02ca 100755 index 42bb0c7c7..73e02ca11 100755
--- a/cmd/dbufstat/dbufstat.py --- a/cmd/dbufstat/dbufstat.py
+++ b/cmd/dbufstat/dbufstat.py +++ b/cmd/dbufstat/dbufstat.py
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@

View File

@ -1,6 +1,7 @@
From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com> From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
Date: Mon, 6 Feb 2017 12:04:35 +0100 Date: Mon, 6 Feb 2017 12:04:35 +0100
Subject: Fix the path to the zed binary on the systemd unit. Subject: [PATCH] Fix the path to the zed binary on the systemd unit.
We install zed into /usr/sbin manually meanwhile the upstream default is We install zed into /usr/sbin manually meanwhile the upstream default is
installing it into /sbin. Ubuntu packages also install zed to /usr/sbin, but installing it into /sbin. Ubuntu packages also install zed to /usr/sbin, but
@ -10,7 +11,7 @@ they ship their own zfs-zed unit.
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/systemd/system/zfs-zed.service.in b/etc/systemd/system/zfs-zed.service.in diff --git a/etc/systemd/system/zfs-zed.service.in b/etc/systemd/system/zfs-zed.service.in
index e3dec3d..0b85f16 100644 index e3dec3dca..0b85f169a 100644
--- a/etc/systemd/system/zfs-zed.service.in --- a/etc/systemd/system/zfs-zed.service.in
+++ b/etc/systemd/system/zfs-zed.service.in +++ b/etc/systemd/system/zfs-zed.service.in
@@ -5,7 +5,7 @@ After=zfs-import-cache.service @@ -5,7 +5,7 @@ After=zfs-import-cache.service

View File

@ -1,6 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com> From: Colin Ian King <colin.king@canonical.com>
Date: Tue, 31 Oct 2017 19:12:42 +0800 Date: Tue, 31 Oct 2017 19:12:42 +0800
Subject: increase-default-zcmd-allocation-to-256K Subject: [PATCH] increase-default-zcmd-allocation-to-256K
Increase default zcmd allocation to 256K (LP: #567557) Increase default zcmd allocation to 256K (LP: #567557)
@ -60,10 +61,10 @@ Signed-off-by: Colin Ian King <colin.king@canonical.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c
index bc51a76..8580415 100644 index 9703f844f..0cfcf9c2f 100644
--- a/lib/libzfs/libzfs_util.c --- a/lib/libzfs/libzfs_util.c
+++ b/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c
@@ -1354,7 +1354,7 @@ int @@ -1355,7 +1355,7 @@ int
zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len) zcmd_alloc_dst_nvlist(libzfs_handle_t *hdl, zfs_cmd_t *zc, size_t len)
{ {
if (len == 0) if (len == 0)

View File

@ -1,8 +1,9 @@
From: =?utf-8?q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com> From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>
Date: Mon, 24 Oct 2016 13:47:06 +0200 Date: Mon, 24 Oct 2016 13:47:06 +0200
Subject: import with -d /dev/disk/by-id in scan service Subject: [PATCH] import with -d /dev/disk/by-id in scan service
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
@ -12,13 +13,13 @@ Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in
index fd66505..5cbfec8 100644 index e7b1d8862..060540f63 100644
--- a/etc/systemd/system/zfs-import-scan.service.in --- a/etc/systemd/system/zfs-import-scan.service.in
+++ b/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in
@@ -13,7 +13,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache @@ -12,7 +12,7 @@ ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
[Service]
Type=oneshot Type=oneshot
RemainAfterExit=yes RemainAfterExit=yes
ExecStartPre=-/sbin/modprobe zfs
-ExecStart=@sbindir@/zpool import -aN -o cachefile=none -ExecStart=@sbindir@/zpool import -aN -o cachefile=none
+ExecStart=@sbindir@/zpool import -aN -d /dev/disk/by-id -o cachefile=none +ExecStart=@sbindir@/zpool import -aN -d /dev/disk/by-id -o cachefile=none

View File

@ -1,6 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Rohan Puri <rohan.puri15@gmail.com> From: Rohan Puri <rohan.puri15@gmail.com>
Date: Sat, 28 Jul 2018 18:32:12 +0530 Date: Sat, 28 Jul 2018 18:32:12 +0530
Subject: Fix deadlock between zfs umount & snapentry_expire Subject: [PATCH] Fix deadlock between zfs umount & snapentry_expire
zfs umount -> zfsctl_destroy() takes the zfs_snapshot_lock as a zfs umount -> zfsctl_destroy() takes the zfs_snapshot_lock as a
writer and calls zfsctl_snapshot_unmount_cancel(), which waits writer and calls zfsctl_snapshot_unmount_cancel(), which waits
@ -27,7 +28,7 @@ Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
1 file changed, 5 insertions(+), 6 deletions(-) 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
index bf5a1d0..2964b65 100644 index bf5a1d059..2964b65a6 100644
--- a/module/zfs/zfs_ctldir.c --- a/module/zfs/zfs_ctldir.c
+++ b/module/zfs/zfs_ctldir.c +++ b/module/zfs/zfs_ctldir.c
@@ -358,8 +358,6 @@ snapentry_expire(void *data) @@ -358,8 +358,6 @@ snapentry_expire(void *data)

View File

@ -1,6 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Richard Laager <rlaager@wiktel.com> From: Richard Laager <rlaager@wiktel.com>
Date: Wed, 30 Jan 2019 15:12:04 +0100 Date: Wed, 30 Jan 2019 15:12:04 +0100
Subject: Enable zed emails Subject: [PATCH] Enable zed emails
The OpenZFS event daemon monitors pools. This patch enables the email sending The OpenZFS event daemon monitors pools. This patch enables the email sending
function by default (if zed is installed). This is consistent with the default function by default (if zed is installed). This is consistent with the default
@ -10,7 +11,7 @@ behavior of mdadm.
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/zed/zed.d/zed.rc b/cmd/zed/zed.d/zed.rc diff --git a/cmd/zed/zed.d/zed.rc b/cmd/zed/zed.d/zed.rc
index 35a4d12..c6c106b 100644 index 35a4d1275..c6c106b06 100644
--- a/cmd/zed/zed.d/zed.rc --- a/cmd/zed/zed.d/zed.rc
+++ b/cmd/zed/zed.d/zed.rc +++ b/cmd/zed/zed.d/zed.rc
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@

View File

@ -1,374 +0,0 @@
From: ilbsmart <wgqimut@gmail.com>
Date: Wed, 17 Oct 2018 02:11:24 +0800
Subject: deadlock between mm_sem and tx assign in zfs_write() and page fault
The bug time sequence:
1. thread #1, `zfs_write` assign a txg "n".
2. In a same process, thread #2, mmap page fault (which means the
`mm_sem` is hold) occurred, `zfs_dirty_inode` open a txg failed,
and wait previous txg "n" completed.
3. thread #1 call `uiomove` to write, however page fault is occurred
in `uiomove`, which means it need `mm_sem`, but `mm_sem` is hold by
thread #2, so it stuck and can't complete, then txg "n" will
not complete.
So thread #1 and thread #2 are deadlocked.
Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Grady Wong <grady.w@xtaotech.com>
Closes #7939
(backported from: zfs-upstream 779a6c0bf6df76e0dd92c1ccf81f48512b835bb0)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
include/sys/uio_impl.h | 2 +-
module/zcommon/zfs_uio.c | 31 ++++-
module/zfs/zfs_vnops.c | 24 +++-
tests/zfs-tests/cmd/mmapwrite/mmapwrite.c | 140 +++++++++++++++------
.../tests/functional/mmap/mmap_write_001_pos.ksh | 8 +-
5 files changed, 151 insertions(+), 54 deletions(-)
diff --git a/include/sys/uio_impl.h b/include/sys/uio_impl.h
index 37e283d..cfef0b9 100644
--- a/include/sys/uio_impl.h
+++ b/include/sys/uio_impl.h
@@ -42,7 +42,7 @@
#include <sys/uio.h>
extern int uiomove(void *, size_t, enum uio_rw, uio_t *);
-extern void uio_prefaultpages(ssize_t, uio_t *);
+extern int uio_prefaultpages(ssize_t, uio_t *);
extern int uiocopy(void *, size_t, enum uio_rw, uio_t *, size_t *);
extern void uioskip(uio_t *, size_t);
diff --git a/module/zcommon/zfs_uio.c b/module/zcommon/zfs_uio.c
index 7b4175b..8e969bb 100644
--- a/module/zcommon/zfs_uio.c
+++ b/module/zcommon/zfs_uio.c
@@ -50,6 +50,7 @@
#include <sys/types.h>
#include <sys/uio_impl.h>
#include <linux/kmap_compat.h>
+#include <linux/uaccess.h>
/*
* Move "n" bytes at byte address "p"; "rw" indicates the direction
@@ -77,8 +78,24 @@ uiomove_iov(void *p, size_t n, enum uio_rw rw, struct uio *uio)
if (copy_to_user(iov->iov_base+skip, p, cnt))
return (EFAULT);
} else {
- if (copy_from_user(p, iov->iov_base+skip, cnt))
- return (EFAULT);
+ if (uio->uio_fault_disable) {
+ if (!access_ok(VERIFY_READ,
+ (iov->iov_base + skip), cnt)) {
+ return (EFAULT);
+ }
+
+ pagefault_disable();
+ if (__copy_from_user_inatomic(p,
+ (iov->iov_base + skip), cnt)) {
+ pagefault_enable();
+ return (EFAULT);
+ }
+ pagefault_enable();
+ } else {
+ if (copy_from_user(p,
+ (iov->iov_base + skip), cnt))
+ return (EFAULT);
+ }
}
break;
case UIO_SYSSPACE:
@@ -156,7 +173,7 @@ EXPORT_SYMBOL(uiomove);
* error will terminate the process as this is only a best attempt to get
* the pages resident.
*/
-void
+int
uio_prefaultpages(ssize_t n, struct uio *uio)
{
const struct iovec *iov;
@@ -170,7 +187,7 @@ uio_prefaultpages(ssize_t n, struct uio *uio)
switch (uio->uio_segflg) {
case UIO_SYSSPACE:
case UIO_BVEC:
- return;
+ return (0);
case UIO_USERSPACE:
case UIO_USERISPACE:
break;
@@ -194,7 +211,7 @@ uio_prefaultpages(ssize_t n, struct uio *uio)
p = iov->iov_base + skip;
while (cnt) {
if (fuword8((uint8_t *)p, &tmp))
- return;
+ return (EFAULT);
incr = MIN(cnt, PAGESIZE);
p += incr;
cnt -= incr;
@@ -204,8 +221,10 @@ uio_prefaultpages(ssize_t n, struct uio *uio)
*/
p--;
if (fuword8((uint8_t *)p, &tmp))
- return;
+ return (EFAULT);
}
+
+ return (0);
}
EXPORT_SYMBOL(uio_prefaultpages);
diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c
index 5a2e55e..c866352 100644
--- a/module/zfs/zfs_vnops.c
+++ b/module/zfs/zfs_vnops.c
@@ -675,7 +675,10 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
xuio = (xuio_t *)uio;
else
#endif
- uio_prefaultpages(MIN(n, max_blksz), uio);
+ if (uio_prefaultpages(MIN(n, max_blksz), uio)) {
+ ZFS_EXIT(zfsvfs);
+ return (SET_ERROR(EFAULT));
+ }
/*
* If in append mode, set the io offset pointer to eof.
@@ -820,8 +823,19 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
if (abuf == NULL) {
tx_bytes = uio->uio_resid;
+ uio->uio_fault_disable = B_TRUE;
error = dmu_write_uio_dbuf(sa_get_db(zp->z_sa_hdl),
uio, nbytes, tx);
+ if (error == EFAULT) {
+ dmu_tx_commit(tx);
+ if (uio_prefaultpages(MIN(n, max_blksz), uio)) {
+ break;
+ }
+ continue;
+ } else if (error != 0) {
+ dmu_tx_commit(tx);
+ break;
+ }
tx_bytes -= uio->uio_resid;
} else {
tx_bytes = nbytes;
@@ -921,8 +935,12 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
ASSERT(tx_bytes == nbytes);
n -= nbytes;
- if (!xuio && n > 0)
- uio_prefaultpages(MIN(n, max_blksz), uio);
+ if (!xuio && n > 0) {
+ if (uio_prefaultpages(MIN(n, max_blksz), uio)) {
+ error = EFAULT;
+ break;
+ }
+ }
}
zfs_inode_update(zp);
diff --git a/tests/zfs-tests/cmd/mmapwrite/mmapwrite.c b/tests/zfs-tests/cmd/mmapwrite/mmapwrite.c
index 190d31a..b9915d5 100644
--- a/tests/zfs-tests/cmd/mmapwrite/mmapwrite.c
+++ b/tests/zfs-tests/cmd/mmapwrite/mmapwrite.c
@@ -31,74 +31,132 @@
#include <string.h>
#include <sys/mman.h>
#include <pthread.h>
+#include <errno.h>
+#include <err.h>
/*
* --------------------------------------------------------------------
- * Bug Id: 5032643
+ * Bug Issue Id: #7512
+ * The bug time sequence:
+ * 1. context #1, zfs_write assign a txg "n".
+ * 2. In the same process, context #2, mmap page fault (which means the mm_sem
+ * is hold) occurred, zfs_dirty_inode open a txg failed, and wait previous
+ * txg "n" completed.
+ * 3. context #1 call uiomove to write, however page fault is occurred in
+ * uiomove, which means it need mm_sem, but mm_sem is hold by
+ * context #2, so it stuck and can't complete, then txg "n" will not
+ * complete.
*
- * Simply writing to a file and mmaping that file at the same time can
- * result in deadlock. Nothing perverse like writing from the file's
- * own mapping is required.
+ * So context #1 and context #2 trap into the "dead lock".
* --------------------------------------------------------------------
*/
+#define NORMAL_WRITE_TH_NUM 2
+
static void *
-mapper(void *fdp)
+normal_writer(void *filename)
{
- void *addr;
- int fd = *(int *)fdp;
+ char *file_path = filename;
+ int fd = -1;
+ ssize_t write_num = 0;
+ int page_size = getpagesize();
- if ((addr =
- mmap(0, 8192, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) {
- perror("mmap");
- exit(1);
+ fd = open(file_path, O_RDWR | O_CREAT, 0777);
+ if (fd == -1) {
+ err(1, "failed to open %s", file_path);
}
- for (;;) {
- if (mmap(addr, 8192, PROT_READ,
- MAP_SHARED|MAP_FIXED, fd, 0) == MAP_FAILED) {
- perror("mmap");
- exit(1);
+
+ char *buf = malloc(1);
+ while (1) {
+ write_num = write(fd, buf, 1);
+ if (write_num == 0) {
+ err(1, "write failed!");
+ break;
}
+ lseek(fd, page_size, SEEK_CUR);
+ }
+
+ if (buf) {
+ free(buf);
}
- /* NOTREACHED */
- return ((void *)1);
}
-int
-main(int argc, char **argv)
+static void *
+map_writer(void *filename)
{
- int fd;
- char buf[1024];
- pthread_t tid;
+ int fd = -1;
+ int ret = 0;
+ char *buf = NULL;
+ int page_size = getpagesize();
+ int op_errno = 0;
+ char *file_path = filename;
- memset(buf, 'a', sizeof (buf));
+ while (1) {
+ ret = access(file_path, F_OK);
+ if (ret) {
+ op_errno = errno;
+ if (op_errno == ENOENT) {
+ fd = open(file_path, O_RDWR | O_CREAT, 0777);
+ if (fd == -1) {
+ err(1, "open file failed");
+ }
- if (argc != 2) {
- (void) printf("usage: %s <file name>\n", argv[0]);
- exit(1);
- }
+ ret = ftruncate(fd, page_size);
+ if (ret == -1) {
+ err(1, "truncate file failed");
+ }
+ } else {
+ err(1, "access file failed!");
+ }
+ } else {
+ fd = open(file_path, O_RDWR, 0777);
+ if (fd == -1) {
+ err(1, "open file failed");
+ }
+ }
- if ((fd = open(argv[1], O_RDWR|O_CREAT|O_TRUNC, 0666)) == -1) {
- perror("open");
- exit(1);
+ if ((buf = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
+ MAP_SHARED, fd, 0)) == MAP_FAILED) {
+ err(1, "map file failed");
+ }
+
+ if (fd != -1)
+ close(fd);
+
+ char s[10] = {0, };
+ memcpy(buf, s, 10);
+ ret = munmap(buf, page_size);
+ if (ret != 0) {
+ err(1, "unmap file failed");
+ }
}
+}
- (void) pthread_setconcurrency(2);
- if (pthread_create(&tid, NULL, mapper, &fd) != 0) {
- perror("pthread_create");
- close(fd);
+int
+main(int argc, char **argv)
+{
+ pthread_t map_write_tid;
+ pthread_t normal_write_tid[NORMAL_WRITE_TH_NUM];
+ int i = 0;
+
+ if (argc != 3) {
+ (void) printf("usage: %s <normal write file name>"
+ "<map write file name>\n", argv[0]);
exit(1);
}
- for (;;) {
- if (write(fd, buf, sizeof (buf)) == -1) {
- perror("write");
- close(fd);
- exit(1);
+
+ for (i = 0; i < NORMAL_WRITE_TH_NUM; i++) {
+ if (pthread_create(&normal_write_tid[i], NULL, normal_writer,
+ argv[1])) {
+ err(1, "pthread_create normal_writer failed.");
}
}
- close(fd);
+ if (pthread_create(&map_write_tid, NULL, map_writer, argv[2])) {
+ err(1, "pthread_create map_writer failed.");
+ }
/* NOTREACHED */
+ pthread_join(map_write_tid, NULL);
return (0);
}
diff --git a/tests/zfs-tests/tests/functional/mmap/mmap_write_001_pos.ksh b/tests/zfs-tests/tests/functional/mmap/mmap_write_001_pos.ksh
index 1eda971..24150b8 100755
--- a/tests/zfs-tests/tests/functional/mmap/mmap_write_001_pos.ksh
+++ b/tests/zfs-tests/tests/functional/mmap/mmap_write_001_pos.ksh
@@ -53,12 +53,14 @@ if ! is_mp; then
fi
log_must chmod 777 $TESTDIR
-mmapwrite $TESTDIR/test-write-file &
+mmapwrite $TESTDIR/normal_write_file $TESTDIR/map_write_file &
PID_MMAPWRITE=$!
-log_note "mmapwrite $TESTDIR/test-write-file pid: $PID_MMAPWRITE"
+log_note "mmapwrite $TESTDIR/normal_write_file $TESTDIR/map_write_file"\
+ "pid: $PID_MMAPWRITE"
log_must sleep 30
log_must kill -9 $PID_MMAPWRITE
-log_must ls -l $TESTDIR/test-write-file
+log_must ls -l $TESTDIR/normal_write_file
+log_must ls -l $TESTDIR/map_write_file
log_pass "write(2) a mmap(2)'ing file succeeded."

View File

@ -3,10 +3,9 @@
0003-add-man-page-reference-to-systemd-units.patch 0003-add-man-page-reference-to-systemd-units.patch
0004-always-load-ZFS-module-on-boot.patch 0004-always-load-ZFS-module-on-boot.patch
0005-fix-install-path-of-zpool.d-scripts.patch 0005-fix-install-path-of-zpool.d-scripts.patch
0006-cmd-python-exec-path.patch 0006-Use-python3-for-arcstat.py-arc_summary.py-dbufstat.p.patch
0007-zed-service-bindir.patch 0007-Fix-the-path-to-the-zed-binary-on-the-systemd-unit.patch
0008-increase-default-zcmd-allocation-to-256K.patch 0008-increase-default-zcmd-allocation-to-256K.patch
0009-import-with-d-dev-disk-by-id-in-scan-service.patch 0009-import-with-d-dev-disk-by-id-in-scan-service.patch
0010-Fix-deadlock-between-zfs-umount-snapentry_expire.patch 0010-Fix-deadlock-between-zfs-umount-snapentry_expire.patch
0011-deadlock-between-mm_sem-and-tx-assign-in-zfs_write-a.patch 0011-Enable-zed-emails.patch
0012-enable-zed.patch