svn commit: r329081 - projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare

Alan Somers asomers at FreeBSD.org
Fri Feb 9 20:56:13 UTC 2018


Author: asomers
Date: Fri Feb  9 20:56:12 2018
New Revision: 329081
URL: https://svnweb.freebsd.org/changeset/base/329081

Log:
  Fix intermittency in zpool_import_001_pos
  
  Add multiple retries to pool export.
  
  Sponsored by:	Spectra Logic Corp

Modified:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare_import_001_pos.ksh

Modified: projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare_import_001_pos.ksh
==============================================================================
--- projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare_import_001_pos.ksh	Fri Feb  9 20:09:32 2018	(r329080)
+++ projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare/hotspare_import_001_pos.ksh	Fri Feb  9 20:56:12 2018	(r329081)
@@ -76,15 +76,25 @@ function verify_export_import #pool #file #chksum
 	typeset pool=$1
 	typeset file=$2
 	typeset checksum1=$3
+	typeset -i n=0
 
 	if ! $ZPOOL export $pool; then
 		# Rarely, this can fail with EBUSY if the pool's configuration
 		# has already changed within the same transaction group.  In
 		# that case, it is appropriate to retry.
-		$SYNC
-		log_must $ZPOOL export $POOL
+		while ((n < 3)); do
+			$SYNC
+			log_note "$ZPOOL busy, retrying export (${n})..."
+			if ((n == 2)); then
+				log_must $ZPOOL export $pool
+			else
+				$ZPOOL export $pool && break
+			fi
+			$SLEEP 1
+			n=$((n + 1))
+		done
 	fi
-	log_must $ZPOOL import -d $HOTSPARE_TMPDIR $POOL
+	log_must $ZPOOL import -d $HOTSPARE_TMPDIR $pool
 
 	[[ ! -e $file ]] && \
 		log_fail "$file missing after detach hotspare."


More information about the svn-src-projects mailing list