From: Juan Casse Date: Fri, 20 Sep 2013 15:20:52 +0000 (-0600) Subject: Fixes bug: stale LAST_POS(f) is not being reset X-Git-Tag: fio-2.1.3~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=57e54e087e051186d18cdedad20a2460463d4d30;p=fio.git 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(). Signed-off-by: Juan Casse Reviewed-by: Grant Grundler Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 7d3a0613..33b47c92 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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; }