public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] generic/648: dmerror must be unmounted
@ 2021-10-24 12:05 Zorro Lang
  2021-11-09  3:59 ` xuyang2018.jy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zorro Lang @ 2021-10-24 12:05 UTC (permalink / raw)
  To: fstests

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 unmount it enough times.

Signed-off-by: Zorro Lang <zlang@redhat.com>
---

As Darrick's review point, V2 brings the "iteration XXX scratch
unmount failed" _fail back.

Thanks,
Zorro

 tests/generic/648 | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/tests/generic/648 b/tests/generic/648
index 83dd111d..e5c743c5 100755
--- a/tests/generic/648
+++ b/tests/generic/648
@@ -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,21 @@ 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"
+	is_unmounted=1
+	# We must unmount dmerror at here, or whole later testing will crash.
+	# So try to umount enough times, before we have no choice.
+	for ((j = 0; j < 100; 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
 	_dmerror_load_working_table
 	if ! _dmerror_mount; then
 		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] generic/648: dmerror must be unmounted
  2021-10-24 12:05 [PATCH v2] generic/648: dmerror must be unmounted Zorro Lang
@ 2021-11-09  3:59 ` xuyang2018.jy
  2021-11-09  4:09 ` Zorro Lang
  2021-11-09 17:26 ` Darrick J. Wong
  2 siblings, 0 replies; 5+ messages in thread
From: xuyang2018.jy @ 2021-11-09  3:59 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests@vger.kernel.org

on 2021/10/24 20:05, Zorro Lang wrote:
> 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 unmount it enough times.
I also met EBUSY error when testing other cases(I need to filter about
60 cases for this reason and do signle test for them) that using dmerror
or dmflakey.

Can we add a umount_api for dmerror/dmflakey that use a while loop to
umount during enough time in xfstest layer?

Best Regards
Yang Xu
> 
> Signed-off-by: Zorro Lang<zlang@redhat.com>
> ---
> 
> As Darrick's review point, V2 brings the "iteration XXX scratch
> unmount failed" _fail back.
> 
> Thanks,
> Zorro
> 
>   tests/generic/648 | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/648 b/tests/generic/648
> index 83dd111d..e5c743c5 100755
> --- a/tests/generic/648
> +++ b/tests/generic/648
> @@ -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,21 @@ 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"
> +	is_unmounted=1
> +	# We must unmount dmerror at here, or whole later testing will crash.
> +	# So try to umount enough times, before we have no choice.
> +	for ((j = 0; j<  100; 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
>   	_dmerror_load_working_table
>   	if ! _dmerror_mount; then
>   		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] generic/648: dmerror must be unmounted
  2021-10-24 12:05 [PATCH v2] generic/648: dmerror must be unmounted Zorro Lang
  2021-11-09  3:59 ` xuyang2018.jy
@ 2021-11-09  4:09 ` Zorro Lang
  2021-11-14 10:44   ` Eryu Guan
  2021-11-09 17:26 ` Darrick J. Wong
  2 siblings, 1 reply; 5+ messages in thread
From: Zorro Lang @ 2021-11-09  4:09 UTC (permalink / raw)
  To: fstests

On Sun, Oct 24, 2021 at 08:05:12PM +0800, Zorro Lang wrote:
> 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 unmount it enough times.
> 
> Signed-off-by: Zorro Lang <zlang@redhat.com>
> ---

Ping, it's been 2+ weeks passed, any more review points about this?

Thanks,
Zorro

> 
> As Darrick's review point, V2 brings the "iteration XXX scratch
> unmount failed" _fail back.
> 
> Thanks,
> Zorro
> 
>  tests/generic/648 | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/648 b/tests/generic/648
> index 83dd111d..e5c743c5 100755
> --- a/tests/generic/648
> +++ b/tests/generic/648
> @@ -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,21 @@ 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"
> +	is_unmounted=1
> +	# We must unmount dmerror at here, or whole later testing will crash.
> +	# So try to umount enough times, before we have no choice.
> +	for ((j = 0; j < 100; 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
>  	_dmerror_load_working_table
>  	if ! _dmerror_mount; then
>  		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
> -- 
> 2.31.1
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] generic/648: dmerror must be unmounted
  2021-10-24 12:05 [PATCH v2] generic/648: dmerror must be unmounted Zorro Lang
  2021-11-09  3:59 ` xuyang2018.jy
  2021-11-09  4:09 ` Zorro Lang
@ 2021-11-09 17:26 ` Darrick J. Wong
  2 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2021-11-09 17:26 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests

On Sun, Oct 24, 2021 at 08:05:12PM +0800, Zorro Lang wrote:
> 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 unmount it enough times.
> 
> Signed-off-by: Zorro Lang <zlang@redhat.com>

Looks good to me now,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> 
> As Darrick's review point, V2 brings the "iteration XXX scratch
> unmount failed" _fail back.
> 
> Thanks,
> Zorro
> 
>  tests/generic/648 | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/generic/648 b/tests/generic/648
> index 83dd111d..e5c743c5 100755
> --- a/tests/generic/648
> +++ b/tests/generic/648
> @@ -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,21 @@ 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"
> +	is_unmounted=1
> +	# We must unmount dmerror at here, or whole later testing will crash.
> +	# So try to umount enough times, before we have no choice.
> +	for ((j = 0; j < 100; 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
>  	_dmerror_load_working_table
>  	if ! _dmerror_mount; then
>  		_metadump_dev $DMERROR_DEV $seqres.scratch.$i.md
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] generic/648: dmerror must be unmounted
  2021-11-09  4:09 ` Zorro Lang
@ 2021-11-14 10:44   ` Eryu Guan
  0 siblings, 0 replies; 5+ messages in thread
From: Eryu Guan @ 2021-11-14 10:44 UTC (permalink / raw)
  To: zlang; +Cc: fstests

On Tue, Nov 09, 2021 at 12:09:13PM +0800, Zorro Lang wrote:
> On Sun, Oct 24, 2021 at 08:05:12PM +0800, Zorro Lang wrote:
> > 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 unmount it enough times.
> > 
> > Signed-off-by: Zorro Lang <zlang@redhat.com>
> > ---
> 
> Ping, it's been 2+ weeks passed, any more review points about this?

Sorry, I lost it in my to-review queue.. Applied now.

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-14 10:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-24 12:05 [PATCH v2] generic/648: dmerror must be unmounted Zorro Lang
2021-11-09  3:59 ` xuyang2018.jy
2021-11-09  4:09 ` Zorro Lang
2021-11-14 10:44   ` Eryu Guan
2021-11-09 17:26 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox