]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/dmerror: add some more dmerror routines
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 12 Jan 2016 02:04:49 +0000 (18:04 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 12 Feb 2016 17:39:05 +0000 (09:39 -0800)
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 <darrick.wong@oracle.com>
common/dmerror
tests/btrfs/100
tests/btrfs/101

index 3900a4e78f1ca3aac61a7f7fb3384a16fa0b8040..004530dd3175f676b92fe26d286aa7e5dd8a7aea 100644 (file)
@@ -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"
+}
index 080d0ae9f6eda7ec0ca2f4d79693c3442994d05d..cd385e1e03ab7a9cd29aa05aa1453cd3bde1887a 100755 (executable)
@@ -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
 
index 0824de1d1428c3ee3b424babdede15cf77cce689..8d7af85b3f962f9377243edef91e86c22474ac45 100755 (executable)
@@ -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