]> granicus.if.org Git - zfs/commitdiff
Use -F to export pools so as not to dirty up device labels
authorRudd-O <rudd-o@rudd-o.com>
Sun, 16 Oct 2016 03:30:53 +0000 (03:30 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sun, 16 Oct 2016 03:30:53 +0000 (20:30 -0700)
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Manuel Amador (Rudd-O) <rudd-o@rudd-o.com>
Closes #5228
Closes #5238

contrib/dracut/90zfs/export-zfs.sh.in
contrib/dracut/90zfs/module-setup.sh.in
contrib/dracut/90zfs/mount-zfs.sh.in
contrib/dracut/90zfs/zfs-lib.sh.in

index 393753fbf6abe8017f4e476c79a86745136fa889..8747c1cbce79405ec9f4409a15a5eb553d7e188f 100755 (executable)
@@ -4,18 +4,19 @@
 
 _do_zpool_export() {
        local ret=0
+       local errs=""
        local final="${1}"
-       local opts=""
 
-       if [ "x${final}" != "x" ]; then
-               opts="-f"
+       info "ZFS: Exporting ZFS storage pools..."
+       errs=$(export_all -F 2>&1)
+       ret=$?
+       [ -z "${errs}" ] || echo "${errs}" | vwarn
+       if [ "x${ret}" != "x0" ]; then
+               info "ZFS: There was a problem exporting pools."
        fi
 
-       info "Exporting ZFS storage pools."
-       export_all ${opts} || ret=$?
-
        if [ "x${final}" != "x" ]; then
-               info "zpool list"
+               info "ZFS: pool list"
                zpool list 2>&1 | vinfo
        fi
 
index 9c88b324514f7a9d64731db9c479058faab73966..240847a77c7280298fb581364225ec3515366fcc 100755 (executable)
@@ -58,7 +58,7 @@ install() {
                inst_script "${moddir}/zfs-generator.sh" "$systemdutildir"/system-generators/dracut-zfs-generator
        fi
        inst_hook mount 98 "${moddir}/mount-zfs.sh"
-       inst_hook shutdown 30 "${moddir}/export-zfs.sh"
+       inst_hook shutdown 20 "${moddir}/export-zfs.sh"
 
        inst_simple "${moddir}/zfs-lib.sh" "/lib/dracut-zfs-lib.sh"
        if [ -e @sysconfdir@/zfs/zpool.cache ]; then
index 3b6be314cde5b7612a54528659d8b548a3642086..db5ccddf2d9093cf503649808f2495a0ffc4be4e 100755 (executable)
@@ -44,7 +44,7 @@ if [ "${root}" = "zfs:AUTO" ] ; then
                ZFS_DATASET="$(find_bootfs)"
                if [ $? -ne 0 ] ; then
                        warn "ZFS: No bootfs attribute found in importable pools."
-                       export_all || export_all "-f"
+                       export_all -F
 
                        rootok=0
                        return 1
index c822ddb9d740488f05d75633f2e6b39e6991aa40..c988dfe606a53c2c7acaa70c83e0d38f6827b0d4 100755 (executable)
@@ -90,7 +90,7 @@ mount_dataset() {
 # export_all OPTS
 #   exports all imported zfs pools.
 export_all() {
-       local opts="${1}"
+       local opts="${@}"
        local ret=0
 
        IFS="${NEWLINE}"