Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Apr 2021 16:30:28 GMT
From:      Chuck Tuffli <chuck@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f30f11f878fe - main - wait for device mounts in zpool and dumpon
Message-ID:  <202104051630.135GUSKM050550@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by chuck:

URL: https://cgit.FreeBSD.org/src/commit/?id=f30f11f878fe2aa535cd286810d31c92793a3d95

commit f30f11f878fe2aa535cd286810d31c92793a3d95
Author:     Chuck Tuffli <chuck@FreeBSD.org>
AuthorDate: 2021-03-05 16:13:23 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2021-04-05 16:25:04 +0000

    wait for device mounts in zpool and dumpon
    
    If the root file system is composed from multiple devices, wait for
    devices to be ready before running zpool and dumpon rc scripts.
    
    An example of this is if the bulk of the root file system exists on a
    fast device (e.g. NVMe) but the /var directory comes from a ZFS dataset
    on a slower device (e.g. SATA). In this case, it is possible that the
    zpool import may run before the slower device has finished being probed,
    leaving the system in an intermediate state.
    
    Fix is to add root_hold_wait to the zpool and dumpon (which has a
    similar issue) rc scripts.
    
    PR:             242189
    Reported by:    osidorkin@gmail.com
    Reviewed by:    allanjude
    MFC after:      1 month
    Differential Revision:  https://reviews.freebsd.org/D29101
---
 libexec/rc/rc.d/dumpon | 2 ++
 libexec/rc/rc.d/zpool  | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/libexec/rc/rc.d/dumpon b/libexec/rc/rc.d/dumpon
index dddbf2af01cc..752f52315f49 100755
--- a/libexec/rc/rc.d/dumpon
+++ b/libexec/rc/rc.d/dumpon
@@ -42,6 +42,7 @@ dumpon_start()
 	[Nn][Oo] | '')
 		;;
 	[Aa][Uu][Tt][Oo])
+		root_hold_wait
 		dev=$(/bin/kenv -q dumpdev)
 		if [ -n "${dev}" ] ; then
 			dumpon_try "${dev}"
@@ -56,6 +57,7 @@ dumpon_start()
 		return 1
 		;;
 	*)
+		root_hold_wait
 		dumpon_try "${dumpdev}"
 		;;
 	esac
diff --git a/libexec/rc/rc.d/zpool b/libexec/rc/rc.d/zpool
index f98693f2cb13..e73c2b7e5b73 100755
--- a/libexec/rc/rc.d/zpool
+++ b/libexec/rc/rc.d/zpool
@@ -22,7 +22,14 @@ zpool_start()
 
 	for cachefile in /etc/zfs/zpool.cache /boot/zfs/zpool.cache; do
 		if [ -r $cachefile ]; then
-			zpool import -c $cachefile -a -N && break
+			zpool import -c $cachefile -a -N
+			if [ $? -ne 0 ]; then
+				echo "Import of zpool cache ${cachefile} failed," \
+				    "will retry after root mount hold release"
+				root_hold_wait
+				zpool import -c $cachefile -a -N
+			fi
+			break
 		fi
 	done
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104051630.135GUSKM050550>