sg engine: IO should be done sync of O_SYNC and O_DIRECT
[fio.git] / filesetup.c
index 17bdd2639f6ce3cc75e192063c1c5276ba6076e0..a0a4b80d33483d70c00db8fe56882ce073136286 100644 (file)
@@ -710,8 +710,10 @@ void close_files(struct thread_data *td)
        struct fio_file *f;
        unsigned int i;
 
-       for_each_file(td, f, i)
-               td_io_close_file(td, f);
+       for_each_file(td, f, i) {
+               if (fio_file_open(f))
+                       td_io_close_file(td, f);
+       }
 }
 
 void close_and_free_files(struct thread_data *td)