All of lore.kernel.org
 help / color / mirror / Atom feed
From: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
To: Zorro Lang <zlang@redhat.com>
Cc: "fstests@vger.kernel.org" <fstests@vger.kernel.org>
Subject: Re: [PATCH] xfs/298: Add 100ms sleep before scratch_umount
Date: Tue, 10 May 2022 01:38:11 +0000	[thread overview]
Message-ID: <6279D03B.20605@fujitsu.com> (raw)
In-Reply-To: <20220509134241.2jfkh2rkmcaxnhc3@zlang-mailbox>

on 2022/5/9 21:42, Zorro Lang wrote:
> On Mon, May 09, 2022 at 02:56:57PM +0800, Yang Xu wrote:
>> When testing this case on my machine, it reports the following error:
>> umount: /mnt/xfstests/scratch: target is busy.
>> xfs_db: /dev/sda11 contains a mounted filesystem
>>
>> scratch_unmount failed, so  _scratch_xfs_db reports scratch_dev is a
>> mounted filesystem. It seems filesystem has something to be doing.
>>
>> To avoid this, just add a 100ms sleep before scratch_umount.
>>
>> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
>> ---
>>   tests/xfs/298 | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/tests/xfs/298 b/tests/xfs/298
>> index b0153ebf..17510379 100755
>> --- a/tests/xfs/298
>> +++ b/tests/xfs/298
>> @@ -51,6 +51,7 @@ while [ $SIZE -lt 1024 ];do
>>   	rm $SYMLINK_FILE
>>   # umount and check the number of extents on the inode. Should be 0.
>>   	cd /
>> +	sleep 0.1
>
> Hi
>
> Actually I was wondering if we can add a while loop trying in _scratch_unmount,
> to avoid some random "device busy" problem, likes:
>
> Change _scratch_unmount to __scratch_unmount, then:
>
> _scratch_unmount()
> {
> 	local n
> 	local is_unmounted=1
>
> 	__scratch_unmount>  $tmp.scratch_unmount.err 2>&1
> 	if [ $? -ne 0 -a "$MULTI_SCRATCH_UNMOUNT" = "yes" ];then
> 		for ((n=0; n<5; n++));do
> 			sleep 0.1
> 			__scratch_unmount>>  $tmp.scratch_unmount.err 2>&1
> 			if [ $? -eq 0 ];then
> 				is_unmounted=0
> 				break
> 			fi
> 		done
> 	else
> 		is_unmounted=0
> 	fi
> 	if [ $is_unmounted -ne 0 ];then
> 		cat $tmp.scratch_unmount.err
> 	fi
> 	rm -f $tmp.scratch_unmount.err
> 	return $is_unmounted
> }
>
> This's just an idea out of my head, hope to hear more suggestions from other
> forks.

Another way is that introdued a environment variable, so people can 
enable this functionality in _scratch_unmount when meet ebusy problem.
By default, _scratch_unmount work as it did before.

Best Regards
Yang Xu
>
> Thanks,
> Zorro
>
>>   	_scratch_unmount>/dev/null 2>&1
>>   	_scratch_xfs_db  -c "inode $inode" -c "p core.nextents"
>>
>> --
>> 2.23.0
>>

  parent reply	other threads:[~2022-05-10  1:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  6:56 [PATCH] xfs/298: Add 100ms sleep before scratch_umount Yang Xu
2022-05-09 13:42 ` Zorro Lang
2022-05-10  1:26   ` xuyang2018.jy
2022-05-10  1:38   ` xuyang2018.jy [this message]
2022-05-11  5:29 ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6279D03B.20605@fujitsu.com \
    --to=xuyang2018.jy@fujitsu.com \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.