Fixes bug: stale LAST_POS(f) is not being reset.
PATCH 1/1 Fixes bug: stale LAST_POS(f) is not being reset.
Problem:
When running fio with ioengine=sync, LAST_POS(f) state is not reset after the file is closed. This causes workloads with readwrite=randread and loops > 1 to fail verification if the state of LAST_POS(f) at the beginning of the next loop is the same as the io_u->offset. If that is the case, lseek in not invoked, but the file position is at 0 and not at io_u->offset.
Proposed Solution:
Other ioengines, such as binject and fusion-aw, set f->engine_data to 0 when closing the file. The sync ioengin uses f->engine_data to store the LAST_POS(f) state. The proposed solution is to set f->engine_data = 0 when closing a file in generic_close_file().
--- filesetup.c | 1 + 1 file changed, 1 insertion(+)
filesetup.c +1 -0
@@ -444,6 +444,7 @@ int generic_close_file(struct thread_data fio_unused *td, struct fio_file *f) f->shadow_fd =-1 ; } + f->engine_data =0 ;return ret; }
Signature · 1 line
1.7.12.4
Quoted 8 lines · Juan Casse
Problem:
When running fio with ioengine=sync,LAST_POS(f)state is not reset after the file is closed. This causes workloads with readwrite=randread and loops > 1 to fail verification if the state ofLAST_POS(f)at the beginning of the next loop is the same as theio_u->offset. If that is the case, lseek in not invoked, but the file position is at 0 and not atio_u->offset.
Quoted 5 lines
Proposed Solution:
Other ioengines, such as binject and fusion-aw, setf->engine_datato 0 when closing the file. The sync ioengin usesf->engine_datato store theLAST_POS(f)state. The proposed solution is to setf->engine_data= 0 when closing a file ingeneric_close_file().
Thanks, good catch and fix. Applied.
Signature · 1 line
Jens Axboe