xfstest for updated writeback error handling
Subsystems (9)
v2 cover xfstest for updated writeback error handling
I've numbered the new test as 999 for the moment so as not to collide with tests being added while I've been working on this. I can change that and resend if this should go in.
I'm working on a set of kernel patches to change how writeback errors are handled and reported in the kernel. Instead of reporting a writeback error to only the first fsync caller on the file, I aim to make the kernel report them once on every file description:
http://www.spinics.net/lists/kernel/msg2504453.html
This patch adds a test for the new behavior, on local filesystems that can handle journalling to a separate device. Basically, open many fds to the same file, turn on dm_error, write to each of the fds, and then fsync them all to ensure that they all get an error back. Then, flip the device back to working, reopen the files and ensure that no error is reported.
With the kernel patch series in place, ext4 and xfs now pass. btrfs still clears the error after the first fsync, so it seems like it still needs a bit of work.
Jeff Layton (3):
generic: add a writeback error handling test
ext4: allow ext4 to use $SCRATCH_LOGDEV
btrfs: allow it to use $SCRATCH_LOGDEV
common/dmerror | 13 +++-- common/rc | 5 ++ src/Makefile | 2 +- src/fsync-err.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/999 | 75 +++++++++++++++++++++++++++ tests/generic/999.out | 3 ++ tests/generic/group | 1 + tools/dmerror | 47 +++++++++++++++++ 8 files changed, 278 insertions(+), 6 deletions(-) create mode 100644 src/fsync-err.c create mode 100755 tests/generic/999 create mode 100644 tests/generic/999.out create mode 100755 tools/dmerror
Signature · 1 line
2.9.3
PATCH v2 1/3 generic: add a writeback error handling test
I'm working on a set of kernel patches to change how writeback errors are handled and reported in the kernel. Instead of reporting a writeback error to only the first fsync caller on the file, I aim to make the kernel report them once on every file description.
This patch adds a test for the new behavior. Basically, open many fds to the same file, turn on dm_error, write to each of the fds, and then fsync them all to ensure that they all get an error back.
To do that, I'm adding a new tools/dmerror script that the C program can use to load the error table. For now, that's all it can do, but we can fill it out with other commands as necessary.
--- common/dmerror | 13 +++-- src/Makefile | 2 +- src/fsync-err.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/999 | 75 +++++++++++++++++++++++++++ tests/generic/999.out | 3 ++ tests/generic/group | 1 + tools/dmerror | 47 +++++++++++++++++ 7 files changed, 273 insertions(+), 6 deletions(-) create mode 100644 src/fsync-err.c create mode 100755 tests/generic/999 create mode 100644 tests/generic/999.out create mode 100755 tools/dmerror
common/dmerror +8 -5
@@ -23,22 +23,25 @@ if [ $? -eq 0 ]; then _notrun "Cannot run tests with DAX on dmerror devices" fi -_dmerror_init() +_dmerror_setup() { local dm_backing_dev=$SCRATCH_DEV - $DMSETUP_PROG remove error-test > /dev/null 2>&1 - local blk_dev_size=`blockdev --getsz $dm_backing_dev` DMERROR_DEV='/dev/mapper/error-test' DMLINEAR_TABLE="0 $blk_dev_size linear $dm_backing_dev 0" + DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" +} + +_dmerror_init() +{ + _dmerror_setup + $DMSETUP_PROG remove error-test > /dev/null 2>&1 $DMSETUP_PROG create error-test --table "$DMLINEAR_TABLE" || \ _fatal "failed to create dm linear device" - - DMERROR_TABLE="0 $blk_dev_size error $dm_backing_dev 0" } _dmerror_mount()
src/Makefile +1 -1
@@ -12,7 +12,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ godown resvtest writemod makeextents itrash rename \ multi_open_unlink dmiperf unwritten_sync genhashnames t_holes \ t_mmap_writev t_truncate_cmtime dirhash_collide t_rename_overwrite \ - holetest t_truncate_self t_mmap_dio af_unix t_mmap_stale_pmd + holetest t_truncate_self t_mmap_dio af_unix t_mmap_stale_pmd fsync-err LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \ preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/fsync-err.c new file +138 -0
138 lines not on this page · raw message
tests/generic/999 new file +75 -0
75 lines not on this page · raw message
tests/generic/999.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 999 +Format and mount +Test passed!
tests/generic/group +1 -0
@@ -432,3 +432,4 @@ 427 auto quick aio rw 428 auto quick 429 auto encrypt +999 auto quick
tools/dmerror new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.9.3
PATCH v2 2/3 ext4: allow ext4 to use $SCRATCH_LOGDEV
In reply to Jeff LaytonThe writeback error handling test requires that you put the journal on a separate device. This allows us to use dmerror to simulate data writeback failure, without affecting the journal.
xfs already has infrastructure for this (a'la $SCRATCH_LOGDEV), so wire up the ext4 code so that it can do the same thing when _scratch_mkfs is called.
--- common/rc | 3 +++ 1 file changed, 3 insertions(+)
common/rc +3 -0
@@ -675,6 +675,9 @@ _scratch_mkfs_ext4() local tmp=`mktemp` local mkfs_status + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + $mkfs_cmd -O journal_dev $SCRATCH_LOGDEV && \ + mkfs_cmd="$mkfs_cmd -J device=$SCRATCH_LOGDEV" _scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $* 2>$tmp.mkfserr 1>$tmp.mkfsstd mkfs_status=$?
Signature · 1 line
2.9.3
PATCH v2 3/3 btrfs: allow it to use $SCRATCH_LOGDEV
In reply to Jeff LaytonWith btrfs, we can't really put the log on a separate device. What we can do however is mirror the metadata across two devices and put the data on a single device. When we turn on dmerror then the metadata can fall back to using the other mirror while the data errors out.
--- common/rc | 2 ++ 1 file changed, 2 insertions(+)
common/rc +2 -0
@@ -829,6 +829,8 @@ _scratch_mkfs() ;; btrfs) mkfs_cmd="$MKFS_BTRFS_PROG" + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + mkfs_cmd="$mkfs_cmd -d single -m raid1 $SCRATCH_LOGDEV" mkfs_filter="cat" ;; ext2|ext3)
Signature · 1 line
2.9.3
Re: [xfstests PATCH v2 2/3] ext4: allow ext4 to use $SCRATCH_LOGDEV
In reply to Jeff LaytonQuoted 9 lines · Jeff Layton
The writeback error handling test requires that you put the journal on a separate device. This allows us to use dmerror to simulate data writeback failure, without affecting the journal.
xfs already has infrastructure for this (a'la $SCRATCH_LOGDEV), so wire up the ext4 code so that it can do the same thing when
_scratch_mkfsis called.Signed-off-by Jeff Layton <[email protected]>
Looks ok,
--D
Quoted 25 lines
--- common/rc | 3 +++ 1 file changed, 3 insertions(+)common/rc +3
-0@@ -675,6 +675,9 @@ _scratch_mkfs_ext4() local tmp=`mktemp` local mkfs_status + [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \ + $mkfs_cmd -O journal_dev $SCRATCH_LOGDEV && \ + mkfs_cmd="$mkfs_cmd -J device=$SCRATCH_LOGDEV" _scratch_do_mkfs "$mkfs_cmd" "$mkfs_filter" $* 2>$tmp.mkfserr 1>$tmp.mkfsstd mkfs_status=$?Signature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html