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, it has
the the kernel report them once on every file description that was
open at the time of the error.

This patch adds a test for this 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 from the script. It's also suitable for
setting up, frobbing and tearing down a dmerror device for by-hand testing.

For now, only ext2/3/4 and xfs are whitelisted on this test, since those
filesystems are included in the initial patchset. We can add to that as
we convert filesystems, and eventually make it a more general test.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Jeff Layton
2017-06-16 15:36:17 -04:00
committed by Eryu Guan
parent 39c3f812de
commit 702421f528
9 changed files with 382 additions and 7 deletions
+16
View File
@@ -16,6 +16,8 @@ note the dependency with:
Contents:
- af_unix -- Create an AF_UNIX socket
- dmerror -- fault injection block device control
- fsync-err -- tests fsync error reporting after failed writeback
- open_by_handle -- open_by_handle_at syscall exercise
- stat_test -- statx syscall exercise
- t_dir_type -- print directory entries and their file type
@@ -30,6 +32,20 @@ af_unix
The af_unix program creates an AF_UNIX socket at the given location.
dmerror
dmerror is a program for creating, destroying and controlling a
fault injection device. The device can be set up as initially
working and then flip to throwing errors for testing purposes.
fsync-err
Specialized program for testing how the kernel reports errors that
occur during writeback. Works in conjunction with the dmerror script
in tools/ to write data to a device, and then force it to fail
writeback and test that errors are reported during fsync and cleared
afterward.
open_by_handle
The open_by_handle program exercises the open_by_handle_at() system