Skip to contentSkip to conversation

generic/648: dmerror must be unmounted

PATCH Superseded Zorro Lang 2 participants 4 messages Oct 16, 2021 – Oct 18, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH 1/1 generic/648: dmerror must be unmounted

Sometimes g/648 fail to unmount dmerror with this error:

umount: /mnt/xfstests/scratch: target is busy.

Even worse, it will cause all later test cases fail as:

mount: bad usage
Try 'mount --help' for more information.
check: failed to mount $SCRATCH_DEV using specified options Interrupted!

So we shouldn't _fail directly if dmerror_unmount fails, use a while loop to try to make sure it's unmounted.

---
 tests/generic/648 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/generic/648 +6 -2
index 83dd111d..218f207b 100755
@@ -104,7 +104,7 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 		wait > /dev/null 2>&1
 		ps -e | grep fsstress > /dev/null 2>&1
 	done
-	for ((i = 0; i < 10; i++)); do
+	for ((j = 0; j < 10; j++)); do
 		test -e "$snap_aliveflag" || break
 		sleep 1
 	done
@@ -112,7 +112,11 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 	# Mount again to replay log after loading working table, so we have a
 	# consistent fs after test.
 	$UMOUNT_PROG $loopmnt
-	_dmerror_unmount || _fail "iteration $i scratch unmount failed"
+	_dmerror_unmount > /dev/null 2>&1
+	while [ $? -ne 0 ]; do
+		sleep 1
+		_dmerror_unmount > /dev/null 2>&1
+	done
 	_dmerror_load_working_table
 	if ! _dmerror_mount; then
 		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
Signature · 1 line
2.31.1
#1 lore raw
Quoted 6 lines · Zorro Lang

Sometimes g/648 fail to unmount dmerror with this error:

umount: /mnt/xfstests/scratch: target is busy.

Even worse, it will cause all later test cases fail as:

Quoted 7 lines

mount: bad usage
Try 'mount --help' for more information.
check: failed to mount $SCRATCH_DEV using specified options Interrupted!

So we shouldn't _fail directly if dmerror_unmount fails, use a while loop to try to make sure it's unmounted.

Can we preserve the "iteration XXX scratch unmount failed" message, please?

--D

Quoted 34 lines
---
 tests/generic/648 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/generic/648 +6 -2
index 83dd111d..218f207b 100755
@@ -104,7 +104,7 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 		wait > /dev/null 2>&1
 		ps -e | grep fsstress > /dev/null 2>&1
 	done
-	for ((i = 0; i < 10; i++)); do
+	for ((j = 0; j < 10; j++)); do
 		test -e "$snap_aliveflag" || break
 		sleep 1
 	done
@@ -112,7 +112,11 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 	# Mount again to replay log after loading working table, so we have a
 	# consistent fs after test.
 	$UMOUNT_PROG $loopmnt
-	_dmerror_unmount || _fail "iteration $i scratch unmount failed"
+	_dmerror_unmount > /dev/null 2>&1
+	while [ $? -ne 0 ]; do
+		sleep 1
+		_dmerror_unmount > /dev/null 2>&1
+	done
 	_dmerror_load_working_table
 	if ! _dmerror_mount; then
 		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
Signature · 1 line
2.31.1
author
#2 lore raw
Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Zorro Lang

Sometimes g/648 fail to unmount dmerror with this error:

umount: /mnt/xfstests/scratch: target is busy.

Even worse, it will cause all later test cases fail as:

mount: bad usage
Try 'mount --help' for more information.
check: failed to mount $SCRATCH_DEV using specified options Interrupted!

Quoted 5 lines
Quoted 2 lines

So we shouldn't _fail directly if dmerror_unmount fails, use a while loop to try to make sure it's unmounted.

Can we preserve the "iteration XXX scratch unmount failed" message, please?

Sure, how about this:
- _dmerror_unmount || _fail "iteration $i scratch unmount failed"
+ _dmerror_unmount >> $seqres.full 2>&1
+ while [ $? -ne 0 ]; do
+ echo "iteration $i scratch unmount failed" >> $seqres.full
+ sleep 1
+ _dmerror_unmount >> $seqres.full 2>&1
+ done

Or this (if you don't like the infinite while loop).

+ is_unmounted=1
+ for ((j = 0; j < 50; j++)); do

 +              sleep 1
 +              _dmerror_unmount > $tmp.unmount.err 2>&1
 +              if [ $? -eq 0 ];then

+ is_unmounted=0
+ break
+ fi
+ done
+ if [ $is_unmounted -ne 0 ];then
+ cat $tmp.unmount.err
+ _fail "iteration $i scratch unmount failed"
+ fi

Or other suggestions you have :)

Thanks,
Zorro

Quoted 38 lines

--D

Quoted 34 lines
---
 tests/generic/648 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/generic/648 +6 -2
index 83dd111d..218f207b 100755
@@ -104,7 +104,7 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 		wait > /dev/null 2>&1
 		ps -e | grep fsstress > /dev/null 2>&1
 	done
-	for ((i = 0; i < 10; i++)); do
+	for ((j = 0; j < 10; j++)); do
 		test -e "$snap_aliveflag" || break
 		sleep 1
 	done
@@ -112,7 +112,11 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 	# Mount again to replay log after loading working table, so we have a
 	# consistent fs after test.
 	$UMOUNT_PROG $loopmnt
-	_dmerror_unmount || _fail "iteration $i scratch unmount failed"
+	_dmerror_unmount > /dev/null 2>&1
+	while [ $? -ne 0 ]; do
+		sleep 1
+		_dmerror_unmount > /dev/null 2>&1
+	done
 	_dmerror_load_working_table
 	if ! _dmerror_mount; then
 		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
Signature · 1 line
2.31.1
#3 lore raw
Quoted 44 lines · Zorro Lang
Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Zorro Lang

Sometimes g/648 fail to unmount dmerror with this error:

umount: /mnt/xfstests/scratch: target is busy.

Even worse, it will cause all later test cases fail as:

mount: bad usage
Try 'mount --help' for more information.
check: failed to mount $SCRATCH_DEV using specified options Interrupted!

Quoted 5 lines
Quoted 2 lines

So we shouldn't _fail directly if dmerror_unmount fails, use a while loop to try to make sure it's unmounted.

Can we preserve the "iteration XXX scratch unmount failed" message, please?

Sure, how about this:
- _dmerror_unmount || _fail "iteration $i scratch unmount failed"
+ _dmerror_unmount >> $seqres.full 2>&1
+ while [ $? -ne 0 ]; do
+ echo "iteration $i scratch unmount failed" >> $seqres.full
+ sleep 1
+ _dmerror_unmount >> $seqres.full 2>&1
+ done

Or this (if you don't like the infinite while loop).

+ is_unmounted=1
+ for ((j = 0; j < 50; j++)); do

 +              sleep 1
 +              _dmerror_unmount > $tmp.unmount.err 2>&1
 +              if [ $? -eq 0 ];then

+ is_unmounted=0
+ break
+ fi
+ done
+ if [ $is_unmounted -ne 0 ];then
+ cat $tmp.unmount.err
+ _fail "iteration $i scratch unmount failed"
+ fi

Quoted 1 line

Or other suggestions you have :)

I like the second one. FWIW the reason for "iteration XXX umount failed" is that reviewers asked for that diagnostic capability so that it would be easier to figure out how much progress the test made before something broke.

--D

Quoted 43 lines

Thanks,
Zorro

Quoted 38 lines

--D

Quoted 34 lines
---
 tests/generic/648 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
tests/generic/648 +6 -2
index 83dd111d..218f207b 100755
@@ -104,7 +104,7 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 		wait > /dev/null 2>&1
 		ps -e | grep fsstress > /dev/null 2>&1
 	done
-	for ((i = 0; i < 10; i++)); do
+	for ((j = 0; j < 10; j++)); do
 		test -e "$snap_aliveflag" || break
 		sleep 1
 	done
@@ -112,7 +112,11 @@ for i in $(seq 1 $((25 * TIME_FACTOR)) ); do
 	# Mount again to replay log after loading working table, so we have a
 	# consistent fs after test.
 	$UMOUNT_PROG $loopmnt
-	_dmerror_unmount || _fail "iteration $i scratch unmount failed"
+	_dmerror_unmount > /dev/null 2>&1
+	while [ $? -ne 0 ]; do
+		sleep 1
+		_dmerror_unmount > /dev/null 2>&1
+	done
 	_dmerror_load_working_table
 	if ! _dmerror_mount; then
 		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
Signature · 1 line
2.31.1