Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Feb 2018 20:56:12 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r329081 - projects/zfsd/head/tests/sys/cddl/zfs/tests/hotspare
Message-ID:  <201802092056.w19KuCwC074867@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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."



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