Check for open files on io operations
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 4d628b9..85eb22b 100644
--- a/fio.c
+++ b/fio.c
@@ -263,6 +263,8 @@
* read from disk.
*/
for_each_file(td, f, i) {
+ if (!(f->flags & FIO_FILE_OPEN))
+ continue;
if (fio_io_sync(td, f))
break;
if (file_invalidate_cache(td, f))
@@ -520,8 +522,12 @@
if (should_fsync(td) && td->end_fsync) {
td_set_runstate(td, TD_FSYNCING);
- for_each_file(td, f, i)
+
+ for_each_file(td, f, i) {
+ if (!(f->flags & FIO_FILE_OPEN))
+ continue;
fio_io_sync(td, f);
+ }
}
} else
cleanup_pending_aio(td);