From: fdmanana@kernel.org
To: fstests@vger.kernel.org
Subject: [PATCH] Pass --retry to dmsetup when removing flakey and error devices
Date: Thu, 7 Apr 2016 07:12:28 +0100 [thread overview]
Message-ID: <1460009548-20668-1-git-send-email-fdmanana@kernel.org> (raw)
From: Filipe Manana <fdmanana@suse.com>
When running multiple tests using dm's flakey target, often (very rarely)
I was getting an error when a test tried to setup a dm flakey target,
resulting in the following messages in the test's .out.bad file:
device-mapper: reload ioctl on flakey-test failed: Device or resource busy
Command failed
failed to create flakey device
Upon further investigation it turns out that it was because the previous
test that ran had failed to remove the flakey device because the device
was being used at the time but this has not made that previous test fail
because we simply redirect the stderr (and stdout) to /dev/null and don't
fail if the dmsetup remove command exits with a non-zero status.
The device was in use, when the test attempted to remove it, by an udev
rule (btrfs udev rule).
Fix this by passing the option --retry to dmsetup remove, which serves to
deal with such cases. From dmsetup's man page:
"If an attempt to remove a device fails, perhaps because a process run
from a quick udev rule temporarily opened the device, the --retry
option will cause the operation to be retried for a few seconds before
failing."
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
common/dmerror | 4 ++--
common/dmflakey | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/dmerror b/common/dmerror
index 5d2c1b6..c898df0 100644
--- a/common/dmerror
+++ b/common/dmerror
@@ -22,7 +22,7 @@ _dmerror_init()
{
local dm_backing_dev=$SCRATCH_DEV
- $DMSETUP_PROG remove error-test > /dev/null 2>&1
+ $DMSETUP_PROG remove --retry error-test > /dev/null 2>&1
local blk_dev_size=`blockdev --getsz $dm_backing_dev`
@@ -57,7 +57,7 @@ _dmerror_cleanup()
# 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 error-test > /dev/null 2>&1
+ $DMSETUP_PROG remove --retry error-test > /dev/null 2>&1
}
_dmerror_load_error_table()
diff --git a/common/dmflakey b/common/dmflakey
index 4434307..cc458f0 100644
--- a/common/dmflakey
+++ b/common/dmflakey
@@ -57,7 +57,7 @@ _cleanup_flakey()
# 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 flakey-test > /dev/null 2>&1
+ $DMSETUP_PROG remove --retry flakey-test > /dev/null 2>&1
$DMSETUP_PROG mknodes > /dev/null 2>&1
}
--
2.7.0.rc3
next reply other threads:[~2016-04-07 18:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 6:12 fdmanana [this message]
2016-04-07 21:28 ` [PATCH] Pass --retry to dmsetup when removing flakey and error devices 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=1460009548-20668-1-git-send-email-fdmanana@kernel.org \
--to=fdmanana@kernel.org \
--cc=fstests@vger.kernel.org \
/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