Don't proceed with error set when failed to pre-read files/devices
authorTomohiro Kusumi <tkusumi@tuxera.com>
Tue, 28 Mar 2017 20:02:56 +0000 (23:02 +0300)
committerJens Axboe <axboe@fb.com>
Tue, 28 Mar 2017 21:14:20 +0000 (15:14 -0600)
pre_read_files() never fails (never returns negative), and because
of this behavior, fio threads can continue regardless of td_verror()
call while prereading, and results in statistics with error in it,
which is quite confusing as to how it should be interpreted for regular
users.

This commit makes pre_read_files() return -1 if preread fails, and
eventually aborts fio, which is also the case with some other options.
It also changes non error return from 1 to 0, since all it matters
is if it's <0 or not, and fio normally uses 0 for success.

Not sure what the proper way of fixing this is if it legitimately
failed for some error on prereading though. Some options just print
a message to indicate it's unsupported and continue normally withtout
any error set.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
filesetup.c

index bd971e8e1f032731ed3f72582c07beb486f34261..cd486eaa41186ec3668e22b687ec868962b2a571 100644 (file)
@@ -1119,10 +1119,11 @@ int pre_read_files(struct thread_data *td)
        dprint(FD_FILE, "pre_read files\n");
 
        for_each_file(td, f, i) {
-               pre_read_file(td, f);
+               if (pre_read_file(td, f))
+                       return -1;
        }
 
-       return 1;
+       return 0;
 }
 
 static int __init_rand_distribution(struct thread_data *td, struct fio_file *f)