xfs
[Top] [All Lists]

Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy proble

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH 4/5] xfstests: sync before umount to avoid device busy problems
From: Stefan Behrens <sbehrens@xxxxxxxxxxxxxxxx>
Date: Fri, 13 Apr 2012 12:26:05 +0200
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1334312763; l=2276; s=domk; d=giantdisaster.de; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References: Subject:To:MIME-Version:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=GwXFO4KGG+yATOsp4U02TPgtkP8=; b=OSkkjGtFdiTJhgU8T2YxuKYJin/xLEqERjSKYQvV5pZvMsk+VPelFvND1t15cvHb3DV oEZ11Apw/ofbdfSnr4Zzuh+dAxvVcBVYQtDGNyaSv7wCNhx3/yELzR5cSwWhXwLzY/q3K 1N6BqNfdfTmCK2el0gyRkZcf3Fje0jbdtVQ=
In-reply-to: <1334310586-2281-4-git-send-email-tmarek@xxxxxxxxxx>
References: <1334310586-2281-1-git-send-email-tmarek@xxxxxxxxxx> <1334310586-2281-4-git-send-email-tmarek@xxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
On 4/13/2012 11:49 AM, tmarek@xxxxxxxxxx wrote:
> From: Tom Marek <tmarek@xxxxxxxxxx>
> 
> Some tests might fail because of 'device or resource busy' when unmounting
> either the SCRATCH or the TEST device. The reason this happenes is that
> some processes might not have time to finish properly, or they are still
> waiting for IO. The sync command was added before unmount into
> _scratch_unmount() and umount_or_remount_ro which should help processes to
> finish before unmounting takes place and thus it solves the problem.
> This fixes for example tests 226 and 247.
> 
> Test 226 uses plain umount command which suffers from exactly the same problem
> as described above. Use fixed _scratch_unmount() instead of plain umount fixes
> this problem.
> 
> Signed-off-by: Tom Marek <tmarek@xxxxxxxxxx>
> 
> Reviewed-by: Lukas Czerner <lczerner@xxxxxxxxxx>
> ---
>  226       |    4 ++--
>  common.rc |    5 +++++
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/226 b/226
> index 6f28ac9..f8847c6 100755
> --- a/226
> +++ b/226
> @@ -61,7 +61,7 @@ for I in `seq 1 $loops`; do
>  done
>  
>  echo
> -umount $SCRATCH_DEV
> +_scratch_unmount
>  _scratch_mount
>  
>  echo "--> $loops direct 64m writes in a loop"
> @@ -73,7 +73,7 @@ for I in `seq 1 $loops`; do
>  done
>  
>  echo
> -umount $SCRATCH_DEV
> +_scratch_unmount
>  
>  status=0
>  exit
> diff --git a/common.rc b/common.rc
> index cab0b64..e56e5bc 100644
> --- a/common.rc
> +++ b/common.rc
> @@ -255,6 +255,8 @@ _scratch_mount()
>  
>  _scratch_unmount()
>  {
> +    # Run sync to give processes some time to finish before unmount
> +    sync
>      $UMOUNT_PROG $SCRATCH_DEV
>  }
>  
> @@ -1051,6 +1053,9 @@ _umount_or_remount_ro()
>      device=$1
>      mountpoint=`_is_mounted $device`
>  
> +    # Run sync to give processes some time to finish before unmount
> +    sync
> +
>      if [ $USE_REMOUNT -eq 0 ]; then
>          $UMOUNT_PROG $device
>      else

If a xfstest process is still running when _scratch_umount() is called,
that xfstest is wrong and needs to be fixed IMO.
If a system or filesystem thread is still running and umount fails to
handle it, the system or filesystem needs to be fixed IMO.

xfstests shall uncover issues, not hide them.

sync before umount should never be required.

<Prev in Thread] Current Thread [Next in Thread>