Update close file handler to return potential error
Filesystems like NFS do return errors on close(), up until now we
have been ignoring them. Fix that. Adjust io_ops engine version
to 9, since this is an API change.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/filesetup.c b/filesetup.c
index 3e11c4c..c0403d2 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -209,11 +209,16 @@
return ret;
}
-void generic_close_file(struct thread_data fio_unused *td, struct fio_file *f)
+int generic_close_file(struct thread_data fio_unused *td, struct fio_file *f)
{
+ int ret = 0;
+
dprint(FD_FILE, "fd close %s\n", f->file_name);
- close(f->fd);
+ if (close(f->fd) < 0)
+ ret = errno;
+
f->fd = -1;
+ return ret;
}
int generic_open_file(struct thread_data *td, struct fio_file *f)
@@ -614,25 +619,28 @@
f->references++;
}
-void put_file(struct thread_data *td, struct fio_file *f)
+int put_file(struct thread_data *td, struct fio_file *f)
{
+ int ret = 0;
+
dprint(FD_FILE, "put file %s, ref=%d\n", f->file_name, f->references);
if (!(f->flags & FIO_FILE_OPEN))
- return;
+ return 0;
assert(f->references);
if (--f->references)
- return;
+ return 0;
if (should_fsync(td) && td->o.fsync_on_close)
fsync(f->fd);
if (td->io_ops->close_file)
- td->io_ops->close_file(td, f);
+ ret = td->io_ops->close_file(td, f);
td->nr_open_files--;
f->flags &= ~FIO_FILE_OPEN;
+ return ret;
}
static int recurse_dir(struct thread_data *td, const char *dirname)