From f6f1cd4e2dfa45705dd8179dd332869d0e7e99b8 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Mon, 23 May 2011 14:30:01 +0300 Subject: fs-tests: integck: EIO can also be return in power-cut testing Currently when we are doing UBIFS power cut emulation testing we assume that EROFS is returned in case of an emulated power cut event. However, this is not true and sometimes Linux returns EIO to user-space instead. Namely, this happens when we are waiting for write-back to finish. Here is a call trace form kernel 2.6.39-rc7: Call Trace: [] filemap_write_and_wait_range+0x78/0xb1 [] vfs_fsync_range+0x38/0xd3 [] generic_write_sync+0x43/0x65 [] generic_file_aio_write+0xaa/0xf2 [] ubifs_aio_write+0x13a/0x1a1 [ubifs] [] do_sync_write+0xcb/0x141 [] vfs_write+0xb0/0x150 [] sys_write+0x48/0x72 [] system_call_fastpath+0x16/0x1b 'filemap_fdatawait_range()' returns hard-coded -EIO if a page write-back happens with whatever error code. Thus, this patch teaches integck to handle EIO when doing power cut emulation testing. Signed-off-by: Artem Bityutskiy --- tests/fs-tests/integrity/integck.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c index 7fd662b..b9f4666 100644 --- a/tests/fs-tests/integrity/integck.c +++ b/tests/fs-tests/integrity/integck.c @@ -72,7 +72,13 @@ #define CHECK_ERRNO() do { \ if (args.power_cut_mode) \ - CHECK(errno == EROFS); \ + /* \ + * In case of emulated power cut failures the FS has to \ + * return EROFS. But unfortunately, the Linux kernel \ + * sometimes returns EIO to user-space anyway (when write- \ + * back fails the return code is awayse EIO). \ + */ \ + CHECK(errno == EROFS || errno == EIO); \ else \ CHECK(0); \ } while(0) @@ -3248,7 +3254,7 @@ int main(int argc, char *argv[]) } CHECK(ret); - CHECK(errno == EROFS); + CHECK(errno == EROFS || errno == EIO); free_test_data(); -- cgit v1.2.3