Fix problem with too many opened files
If using raw block devices, we would leak the fd from the bdev_size()
function. Also add some debug triggers to catch this in the future.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index 70d4b2b..6464b6d 100644
--- a/fio.c
+++ b/fio.c
@@ -1368,8 +1368,12 @@
* its own files. so close them, if we opened them
* for creation
*/
- 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);
+ else
+ assert(f->fd == -1);
+ }
}
init_disk_util(td);