Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 2024 14:00:44 GMT
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d3459fe7f737 - stable/14 - zfsd: replace vdevs with the AUX faulted state
Message-ID:  <202410311400.49VE0ij5040581@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by asomers:

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

commit d3459fe7f737f7168992e833fdad7d3aa1f01bc9
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-10-03 21:54:28 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-10-31 14:00:32 +0000

    zfsd: replace vdevs with the AUX faulted state
    
    Without this patch, vdevs faulted via AUX state would not be replaced
    once the appropriate drive is replaced.  ZFS does not internally use
    that state, but a drive can be manually forced into such a state with a
    command like zinject.
    
    Submitted by:   Goran Mekić <meka@tilda.center>
    Sponsored by:   ConnectWise
    Differential Revision: https://reviews.freebsd.org/D46866
    
    (cherry picked from commit 618ae939b7f95a197a0518cbb390a572bb90c6d0)
---
 cddl/usr.sbin/zfsd/case_file.cc                    |  2 +-
 tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib          |  2 +-
 .../zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh    | 26 +++++++++++++---------
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/cddl/usr.sbin/zfsd/case_file.cc b/cddl/usr.sbin/zfsd/case_file.cc
index f9fd84da7277..7adfb08b75c6 100644
--- a/cddl/usr.sbin/zfsd/case_file.cc
+++ b/cddl/usr.sbin/zfsd/case_file.cc
@@ -288,7 +288,7 @@ CaseFile::ReEvaluate(const string &devPath, const string &physPath, Vdev *vdev)
 		return (/*consumed*/false);
 	}
 
-	if (VdevState() > VDEV_STATE_CANT_OPEN) {
+	if (VdevState() > VDEV_STATE_FAULTED) {
 		/*
 		 * For now, newly discovered devices only help for
 		 * devices that are missing.  In the future, we might
diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib b/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib
index a4a7ef80ed9f..6369387ba069 100644
--- a/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib
+++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib
@@ -52,7 +52,7 @@ function wait_for_pool_dev_state_change
 function wait_for_pool_removal
 {
 	typeset -i timeout=$1
-	wait_for_pool_dev_state_change $timeout $REMOVAL_DISK "REMOVED|UNAVAIL"
+	wait_for_pool_dev_state_change $timeout $REMOVAL_DISK "REMOVED|UNAVAIL|FAULTED"
 }
 
 function wait_until_scrubbed
diff --git a/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh b/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh
index 4eb04d60809e..7ad7a9113402 100644
--- a/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh
+++ b/tests/sys/cddl/zfs/tests/zfsd/zfsd_autoreplace_003_pos.ksh
@@ -83,19 +83,25 @@ typeset SPARE_NOP=${DISK4}.nop
 typeset OTHER_DISKS="${DISK1} ${DISK2}"
 typeset OTHER_NOPS=${OTHER_DISKS//~(E)([[:space:]]+|$)/.nop\1}
 set -A MY_KEYWORDS "mirror" "raidz1" "raidz2"
+set -A MY_FAILURES "FAULTED" "REMOVED"
 ensure_zfsd_running
 log_must create_gnops $OTHER_DISKS $SPARE_DISK
-for keyword in "${MY_KEYWORDS[@]}" ; do
-	log_must create_gnop $REMOVAL_DISK $PHYSPATH
-	log_must create_pool $TESTPOOL $keyword $REMOVAL_NOP $OTHER_NOPS spare $SPARE_NOP
-	log_must $ZPOOL set autoreplace=on $TESTPOOL
+for failure in "${MY_FAILURES[@]}" ; do
+	for keyword in "${MY_KEYWORDS[@]}" ; do
+		log_must create_gnop $REMOVAL_DISK $PHYSPATH
+		log_must create_pool $TESTPOOL $keyword $REMOVAL_NOP $OTHER_NOPS spare $SPARE_NOP
+		log_must $ZPOOL set autoreplace=on $TESTPOOL
 
-	log_must destroy_gnop $REMOVAL_DISK
-	log_must wait_for_pool_removal 20
-	log_must create_gnop $NEW_DISK $PHYSPATH
-	verify_assertion
-	destroy_pool "$TESTPOOL"
-	log_must destroy_gnop $NEW_DISK
+		if [ $failure = "FAULTED" ]; then
+			log_must zinject -d $REMOVAL_NOP -A fault $TESTPOOL
+		fi
+		log_must destroy_gnop $REMOVAL_DISK
+		log_must wait_for_pool_removal 20
+		log_must create_gnop $NEW_DISK $PHYSPATH
+		verify_assertion
+		destroy_pool "$TESTPOOL"
+		log_must destroy_gnop $NEW_DISK
+	done
 done
 
 log_pass



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