From 8522cbe6563f679d912afd9d963b8646b87f63c7 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 11 Jan 2016 18:04:49 -0800 Subject: [PATCH] common/dmerror: add some more dmerror routines Add functions to the dmerror routine so that we can load both the error table and the linear table. This will help us with EIO testing of copy-on-write. Signed-off-by: Darrick J. Wong --- common/dmerror | 27 +++++++++++++++++++++++++-- tests/btrfs/100 | 2 +- tests/btrfs/101 | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/common/dmerror b/common/dmerror index 3900a4e7..004530dd 100644 --- a/common/dmerror +++ b/common/dmerror @@ -46,15 +46,23 @@ _dmerror_mount() _mount -t $FSTYP `_dmerror_mount_options $*` } +_dmerror_unmount() +{ + umount $SCRATCH_MNT +} + _dmerror_cleanup() { $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 $DMSETUP_PROG remove error-test > /dev/null 2>&1 } -_dmerror_load_table() +_dmerror_load_error_table() { - $DMSETUP_PROG suspend error-test + suspend_opt="--nolockfs" + [ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt="" + + $DMSETUP_PROG suspend $suspend_opt error-test [ $? -ne 0 ] && _fail "dmsetup suspend failed" $DMSETUP_PROG load error-test --table "$DMERROR_TABLE" @@ -63,3 +71,18 @@ _dmerror_load_table() $DMSETUP_PROG resume error-test [ $? -ne 0 ] && _fail "dmsetup resume failed" } + +_dmerror_load_working_table() +{ + suspend_opt="--nolockfs" + [ $# -gt 1 ] && [ $2 -eq 1 ] && suspend_opt="" + + $DMSETUP_PROG suspend $suspend_opt error-test + [ $? -ne 0 ] && _fail "dmsetup suspend failed" + + $DMSETUP_PROG load error-test --table "$DMLINEAR_TABLE" + [ $? -ne 0 ] && _fail "dmsetup failed to load error table" + + $DMSETUP_PROG resume error-test + [ $? -ne 0 ] && _fail "dmsetup resume failed" +} diff --git a/tests/btrfs/100 b/tests/btrfs/100 index 080d0ae9..cd385e1e 100755 --- a/tests/btrfs/100 +++ b/tests/btrfs/100 @@ -69,7 +69,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \ "$snapshot_cmd" -X 50 # now load the error into the DMERROR_DEV -_dmerror_load_table +_dmerror_load_error_table _run_btrfs_util_prog replace start -B $error_devid $dev2 $SCRATCH_MNT diff --git a/tests/btrfs/101 b/tests/btrfs/101 index 0824de1d..8d7af85b 100755 --- a/tests/btrfs/101 +++ b/tests/btrfs/101 @@ -70,7 +70,7 @@ run_check $FSSTRESS_PROG -d $SCRATCH_MNT -n 200 -p 8 $FSSTRESS_AVOID -x \ "$snapshot_cmd" -X 50 # now load the error into the DMERROR_DEV -_dmerror_load_table +_dmerror_load_error_table _run_btrfs_util_prog device delete $error_devid $SCRATCH_MNT -- 2.39.5