From: Tomohiro Kusumi Date: Tue, 28 Mar 2017 20:02:56 +0000 (+0300) Subject: Don't proceed with error set when failed to pre-read files/devices X-Git-Tag: fio-2.19~9 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=afe0d59a6e3cfd146ffba3c060bc423cabb3c624 Don't proceed with error set when failed to pre-read files/devices 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 Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index bd971e8e..cd486eaa 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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)