Skip to contentSkip to conversation

fix hung fio process with large I/O sizes and verify= option

PATCH In review Jeff Moyer 3 participants 4 messages Sep 29, 2018 – Sep 30, 2018 Library code

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 fix hung fio process with large I/O sizes and verify= option

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

lib/rand.c +1 -1
index 46ffe4fb..99846a8d 100644
@@ -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;
 
#1 lore raw

I'm not sure if you've overlooked this one Jens so I'm re-mentioning it...

Quoted 41 lines · Jeff Moyer

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

lib/rand.c +1 -1
index 46ffe4fb..99846a8d 100644
@@ -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;
 
Signature · 1 line
Sitsofe | http://sucs.org/~sits/
#3 lore raw
In reply to Jeff Moyer
Quoted 32 lines · Jeff Moyer

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

lib/rand.c +0 -0
index 46ffe4fb..99846a8d 100644

lib/rand.c void __fill_random_buf_percentage(unsigned long seed, void *buf, · line 161

Quoted 7 lines
lib/rand.c +1 -1
@@ -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;

Thanks Jeff, applied.

Signature · 1 line
Jens Axboe
#2 lore raw
In reply to Sitsofe Wheeler
Quoted 1 line · Sitsofe Wheeler

I'm not sure if you've overlooked this one Jens so I'm re-mentioning it...

Thanks, now applied :)

Signature · 1 line
Jens Axboe