]> git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/patches/0334-Use-F-to-export-pools-so-as-not-to-dirty-up-device-l.patch
Cherry picks for root zpool with dracut (Closes: #849969)
[mirror_zfs-debian.git] / debian / patches / 0334-Use-F-to-export-pools-so-as-not-to-dirty-up-device-l.patch
1 From 7e8a2d0b755ea67291d3f576069706e43abc5e31 Mon Sep 17 00:00:00 2001
2 From: Rudd-O <rudd-o@rudd-o.com>
3 Date: Sun, 16 Oct 2016 03:30:53 +0000
4 Subject: [PATCH 334/530] Use -F to export pools so as not to dirty up device
5 labels
6
7 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
8 Signed-off-by: Manuel Amador (Rudd-O) <rudd-o@rudd-o.com>
9 Closes #5228
10 Closes #5238
11 ---
12 contrib/dracut/90zfs/export-zfs.sh.in | 15 ++++++++-------
13 contrib/dracut/90zfs/module-setup.sh.in | 2 +-
14 contrib/dracut/90zfs/mount-zfs.sh.in | 2 +-
15 contrib/dracut/90zfs/zfs-lib.sh.in | 2 +-
16 4 files changed, 11 insertions(+), 10 deletions(-)
17
18 diff --git a/contrib/dracut/90zfs/export-zfs.sh.in b/contrib/dracut/90zfs/export-zfs.sh.in
19 index 393753f..8747c1c 100755
20 --- a/contrib/dracut/90zfs/export-zfs.sh.in
21 +++ b/contrib/dracut/90zfs/export-zfs.sh.in
22 @@ -4,18 +4,19 @@
23
24 _do_zpool_export() {
25 local ret=0
26 + local errs=""
27 local final="${1}"
28 - local opts=""
29
30 - if [ "x${final}" != "x" ]; then
31 - opts="-f"
32 + info "ZFS: Exporting ZFS storage pools..."
33 + errs=$(export_all -F 2>&1)
34 + ret=$?
35 + [ -z "${errs}" ] || echo "${errs}" | vwarn
36 + if [ "x${ret}" != "x0" ]; then
37 + info "ZFS: There was a problem exporting pools."
38 fi
39
40 - info "Exporting ZFS storage pools."
41 - export_all ${opts} || ret=$?
42 -
43 if [ "x${final}" != "x" ]; then
44 - info "zpool list"
45 + info "ZFS: pool list"
46 zpool list 2>&1 | vinfo
47 fi
48
49 diff --git a/contrib/dracut/90zfs/module-setup.sh.in b/contrib/dracut/90zfs/module-setup.sh.in
50 index 9c88b32..240847a 100755
51 --- a/contrib/dracut/90zfs/module-setup.sh.in
52 +++ b/contrib/dracut/90zfs/module-setup.sh.in
53 @@ -58,7 +58,7 @@ install() {
54 inst_script "${moddir}/zfs-generator.sh" "$systemdutildir"/system-generators/dracut-zfs-generator
55 fi
56 inst_hook mount 98 "${moddir}/mount-zfs.sh"
57 - inst_hook shutdown 30 "${moddir}/export-zfs.sh"
58 + inst_hook shutdown 20 "${moddir}/export-zfs.sh"
59
60 inst_simple "${moddir}/zfs-lib.sh" "/lib/dracut-zfs-lib.sh"
61 if [ -e @sysconfdir@/zfs/zpool.cache ]; then
62 diff --git a/contrib/dracut/90zfs/mount-zfs.sh.in b/contrib/dracut/90zfs/mount-zfs.sh.in
63 index 3b6be31..db5ccdd 100755
64 --- a/contrib/dracut/90zfs/mount-zfs.sh.in
65 +++ b/contrib/dracut/90zfs/mount-zfs.sh.in
66 @@ -44,7 +44,7 @@ if [ "${root}" = "zfs:AUTO" ] ; then
67 ZFS_DATASET="$(find_bootfs)"
68 if [ $? -ne 0 ] ; then
69 warn "ZFS: No bootfs attribute found in importable pools."
70 - export_all || export_all "-f"
71 + export_all -F
72
73 rootok=0
74 return 1
75 diff --git a/contrib/dracut/90zfs/zfs-lib.sh.in b/contrib/dracut/90zfs/zfs-lib.sh.in
76 index c822ddb..c988dfe 100755
77 --- a/contrib/dracut/90zfs/zfs-lib.sh.in
78 +++ b/contrib/dracut/90zfs/zfs-lib.sh.in
79 @@ -90,7 +90,7 @@ mount_dataset() {
80 # export_all OPTS
81 # exports all imported zfs pools.
82 export_all() {
83 - local opts="${1}"
84 + local opts="${@}"
85 local ret=0
86
87 IFS="${NEWLINE}"
88 --
89 2.1.4
90