fix hung fio process with large I/O sizes and verify= option
authorJeff Moyer <jmoyer@redhat.com>
Fri, 28 Sep 2018 21:27:58 +0000 (17:27 -0400)
committerJens Axboe <axboe@kernel.dk>
Sun, 30 Sep 2018 14:15:50 +0000 (08:15 -0600)
Hi,

If you use a very large I/O size (1G in this instance), and also specify
the verify option, fio will hang, using up 100% cpu, for ever and ever.
The problem is that __fill_random_buf_percentage does math that
overflows the size of an unsigned int.  Fixing that gets fio to
terminate as expected.

Here is the job file which showed the problem:

[global]
ioengine=dev-dax
direct=0
filename=/dev/dax0.0
verify=crc32c
bs=1G
[write]
rw=write
runtime=5
[read]
stonewall
rw=read
runtime=5

Reported-by: sujith_pandel@dell.com
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/rand.c

index 46ffe4fb0c6b9108685254cbe7f110983eb27088..99846a8d0fdd553e9fa3faea39f73c6971da13ac 100644 (file)
@@ -156,7 +156,7 @@ void __fill_random_buf_percentage(unsigned long seed, void *buf,
                /*
                 * Fill random chunk
                 */
-               this_len = (segment * (100 - percentage)) / 100;
+               this_len = ((unsigned long long)segment * (100 - percentage)) / 100;
                if (this_len > len)
                        this_len = len;