public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Xiao Yang <yangx.jy@cn.fujitsu.com>
Cc: fstests@vger.kernel.org, guaneryu@gmail.com
Subject: Re: [PATCH] generic/085: Call $UDEV_SETTLE_PROG before "dmsetup remove"
Date: Wed, 27 Jun 2018 17:54:35 +1000	[thread overview]
Message-ID: <20180627075435.GL13748@dastard> (raw)
In-Reply-To: <1530010750-16516-1-git-send-email-yangx.jy@cn.fujitsu.com>

On Tue, Jun 26, 2018 at 06:59:10PM +0800, Xiao Yang wrote:
> cleanup_dmdev() may fail to remove dm device because of EBUSY
> and cause subsequent tests to fail.  Make sure dm device is
> fully settled before removing it.
> 
> PS: I am not sure whether calling "dmsetup remove --retry" is
> better or not.
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  tests/generic/085 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/generic/085 b/tests/generic/085
> index bed1e0d..bdc4dba 100755
> --- a/tests/generic/085
> +++ b/tests/generic/085
> @@ -32,6 +32,9 @@ cleanup_dmdev()
>  	$DMSETUP_PROG resume $lvdev >/dev/null 2>&1
>  	$UMOUNT_PROG $lvdev >/dev/null 2>&1
>  
> +	# wait for device to be fully settled so that
> +	# 'dmsetup remove' doesn't fail due to EBUSY
> +	$UDEV_SETTLE_PROG >/dev/null 2>&1
>  	$DMSETUP_PROG remove $node >>$seqres.full 2>&1

This, along with Dave's next patch that requires mknodes to be
be run after a create or remove operation makes me think we need
some wrapper functions. i.e.

_dmsetup_remove()
{
	$UDEV_SETTLE_PROG >/dev/null 2>&1
	$DMSETUP_PROG remove $* >>$seqres.full 2>&1
	$DMSETUP_PROG mknodes >/dev/null 2>&1
}

_dmsetup_create()
{
	$DMSETUP_PROG create $* >>$seqres.full 2>&1
	$DMSETUP_PROG mknodes >/dev/null 2>&1
	$UDEV_SETTLE_PROG >/dev/null 2>&1
}

And replace all the open coded create/remove operations with the
above functions...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2018-06-27  7:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 10:59 [PATCH] generic/085: Call $UDEV_SETTLE_PROG before "dmsetup remove" Xiao Yang
2018-06-27  7:54 ` Dave Chinner [this message]
2018-06-27 10:54   ` [PATCH v2] common: Add _dmsetup_create and _dmsetup_remove helpers Xiao Yang
2018-06-27 12:10     ` David Sterba
2018-06-28  1:45       ` [PATCH v3] " Xiao Yang
2018-06-28  1:42     ` [PATCH v2] " Xiao Yang

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=20180627075435.GL13748@dastard \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=yangx.jy@cn.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox