From: Hou Tao <houtao1@huawei.com>
To: fstests@vger.kernel.org
Cc: guaneryu@gmail.com, linux-xfs@vger.kernel.org,
darrick.wong@oracle.com, cmaiolino@redhat.com
Subject: [PATCH v4 2/4] dmflakey: support error_writes feature for dm-flakey
Date: Thu, 11 Jan 2018 14:49:31 +0800 [thread overview]
Message-ID: <20180111064933.12088-3-houtao1@huawei.com> (raw)
In-Reply-To: <20180111064933.12088-1-houtao1@huawei.com>
Add _require_flakey_with_error_writes() to check the availability of
dm-flakey target and its error_writes feature, and support for enabling
FLAKEY_TABLE_ERROR table by passing FLAKEY_ERROR_WRITES to
_load_flakey_table().
Signed-off-by: Hou Tao <houtao1@huawei.com>
---
v4: call _cleanup_flakey() directly instead of copy & paste
---
common/dmflakey | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/common/dmflakey b/common/dmflakey
index e34fce8..06eee37 100644
--- a/common/dmflakey
+++ b/common/dmflakey
@@ -20,6 +20,7 @@
FLAKEY_ALLOW_WRITES=0
FLAKEY_DROP_WRITES=1
+FLAKEY_ERROR_WRITES=2
echo $MOUNT_OPTIONS | grep -q dax
if [ $? -eq 0 ]; then
@@ -32,6 +33,7 @@ _init_flakey()
FLAKEY_DEV=/dev/mapper/flakey-test
FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 180 0"
FLAKEY_TABLE_DROP="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 drop_writes"
+ FLAKEY_TABLE_ERROR="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 error_writes"
$DMSETUP_PROG create flakey-test --table "$FLAKEY_TABLE" || \
_fatal "failed to create flakey device"
$DMSETUP_PROG mknodes > /dev/null 2>&1
@@ -67,9 +69,9 @@ _cleanup_flakey()
# table, so it simulates power failure.
_load_flakey_table()
{
-
table="$FLAKEY_TABLE"
[ $1 -eq $FLAKEY_DROP_WRITES ] && table="$FLAKEY_TABLE_DROP"
+ [ $1 -eq $FLAKEY_ERROR_WRITES ] && table="$FLAKEY_TABLE_ERROR"
suspend_opt="--nolockfs"
[ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt=""
@@ -101,3 +103,23 @@ _flakey_drop_and_remount()
_load_flakey_table $FLAKEY_ALLOW_WRITES
_mount_flakey
}
+
+_require_flakey_with_error_writes()
+{
+ local SIZE
+ local TABLE
+ local NAME=flakey-test
+
+ _require_dm_target flakey
+
+ SIZE=`blockdev --getsz $SCRATCH_DEV`
+ TABLE="0 $SIZE flakey $SCRATCH_DEV 0 0 180 1 error_writes"
+
+ $DMSETUP_PROG create $NAME --table "$TABLE" >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ _notrun "This test requires error_writes feature in dm-flakey"
+ fi
+ $DMSETUP_PROG mknodes >/dev/null 2>&1
+
+ _cleanup_flakey
+}
--
2.9.5
next prev parent reply other threads:[~2018-01-11 6:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 6:49 [PATCH v4 0/4] test for XFS umount hang caused by the pending dquota log item in AIL Hou Tao
2018-01-11 6:49 ` [PATCH v4 1/4] dmflakey: support multiple dm targets for a dm-flakey device Hou Tao
2018-01-11 6:49 ` Hou Tao [this message]
2018-01-11 6:49 ` [PATCH v4 3/4] xfs: test for umount hang caused by the pending dquota log item in AIL Hou Tao
2018-01-11 6:49 ` [PATCH v4 4/4] common/rc: factor out _scratch_xfs_[get|set]_sb_field Hou Tao
2018-01-11 8:02 ` [PATCH v4 0/4] test for XFS umount hang caused by the pending dquota log item in AIL Eryu Guan
2018-01-11 9:23 ` Hou Tao
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=20180111064933.12088-3-houtao1@huawei.com \
--to=houtao1@huawei.com \
--cc=cmaiolino@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=fstests@vger.kernel.org \
--cc=guaneryu@gmail.com \
--cc=linux-xfs@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 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.