Fixes bug: stale LAST_POS(f) is not being reset
authorJuan Casse <jcasse@chromium.org>
Fri, 20 Sep 2013 15:20:52 +0000 (09:20 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 20 Sep 2013 15:20:52 +0000 (09:20 -0600)
commit57e54e087e051186d18cdedad20a2460463d4d30
tree9a9fa9baeda1be9393139dd2a886ea1ccef14487
parent20876c53b5d32f2da9049af5e7fb102133946981
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 <jcasse@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c