Skip to contentSkip to conversation

Fixes bug: stale LAST_POS(f) is not being reset.

PATCH In review Juan Casse 2 participants 2 messages Sep 19, 2013 – Sep 20, 2013

lore
Share & tools
lore

Juan Casse

author
#0 lore raw

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
index 7d3a061..33b47c9 100644
@@ -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
#1 lore raw
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 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.

Quoted 5 lines

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().

Thanks, good catch and fix. Applied.

Signature · 1 line
Jens Axboe