git: 9e8fbb95b36f - main - stress2: A unmount of a unionfs file system may return EBUSY.

From: Peter Holm <pho_at_FreeBSD.org>
Date: Tue, 15 Mar 2022 08:36:20 UTC
The branch main has been updated by pho:

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

commit 9e8fbb95b36f14cdcba8aaace0523811a8eef3ec
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2022-03-15 08:35:22 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2022-03-15 08:35:22 +0000

    stress2: A unmount of a unionfs file system may return EBUSY.
---
 tools/test/stress2/misc/unionfs13.sh | 5 ++++-
 tools/test/stress2/misc/unionfs4.sh  | 5 ++++-
 tools/test/stress2/misc/unionfs5.sh  | 7 +++++--
 tools/test/stress2/misc/unionfs6.sh  | 5 ++++-
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/tools/test/stress2/misc/unionfs13.sh b/tools/test/stress2/misc/unionfs13.sh
index 69690d91e7d3..9c2d57425053 100755
--- a/tools/test/stress2/misc/unionfs13.sh
+++ b/tools/test/stress2/misc/unionfs13.sh
@@ -64,7 +64,10 @@ done
 [ $s ] && echo "Failed in loop #$i"
 df -i $mp2 | tail -1
 
-umount $mp2	# The unionfs mount
+while mount | grep -Eq "on $mp2 .*unionfs"; do
+	umount $mp2 && break
+	sleep 5
+done
 umount $mp2
 umount $mp1
 mdconfig -d -u $md2
diff --git a/tools/test/stress2/misc/unionfs4.sh b/tools/test/stress2/misc/unionfs4.sh
index 557cead66389..2355005c1f8b 100755
--- a/tools/test/stress2/misc/unionfs4.sh
+++ b/tools/test/stress2/misc/unionfs4.sh
@@ -67,7 +67,10 @@ export runRUNTIME=2m
 (cd ..; ./run.sh marcus.cfg)
 
 ../tools/killall.sh
-umount $mp2	# The unionfs mount
+while mount | grep -Eq "on $mp2 .*unionfs"; do
+	umount $mp2 && break
+	sleep 5
+done
 umount $mp2
 n=`find $mp1/stressX | wc -l`
 [ $n -eq 1 ] && s=0 || { find $mp1/stressX -ls | head -12; s=1; }
diff --git a/tools/test/stress2/misc/unionfs5.sh b/tools/test/stress2/misc/unionfs5.sh
index ba00fa2b5258..5e12ffbf5abd 100755
--- a/tools/test/stress2/misc/unionfs5.sh
+++ b/tools/test/stress2/misc/unionfs5.sh
@@ -72,8 +72,11 @@ export runRUNTIME=2m
 
 (cd ../testcases/mkdir; ./mkdir -t 2m -i 20)
 
-find $RUNDIR -ls
-umount $mp2	# The unionfs mount
+find $RUNDIR -ls | head -5
+while mount | grep -Eq "on $mp2 .*unionfs"; do
+	umount $mp2 && break
+	sleep 5
+done
 umount $mp2
 n=`find $mp1/stressX | wc -l`
 [ $n -eq 1 ] && s=0 || s=1
diff --git a/tools/test/stress2/misc/unionfs6.sh b/tools/test/stress2/misc/unionfs6.sh
index 21620f3f39b6..7291a6f61fd8 100755
--- a/tools/test/stress2/misc/unionfs6.sh
+++ b/tools/test/stress2/misc/unionfs6.sh
@@ -87,7 +87,10 @@ chmod 777 $mp2
 su $testuser -c \
 	'(cd ..; ./testcases/run/run $TESTPROGS)'
 
-umount $mp2	# The unionfs mount
+while mount | grep -Eq "on $mp2 .*unionfs"; do
+	umount $mp2 && break
+	sleep 5
+done
 umount $mp2
 n=`find $mp1/stressX | wc -l`
 [ $n -eq 1 ] && s=0 || { find $mp1/stressX -ls | head -12; s=1; }