summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
24ffd2c)
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>
-static void fio_mmapio_close(struct thread_data fio_unused *td,
- struct fio_file *f)
+static int fio_mmapio_close(struct thread_data fio_unused *td,
+ struct fio_file *f)
- munmap(f->mmap, f->io_size);
+ if (munmap(f->mmap, f->io_size) < 0)
+ ret = errno;
+
- generic_close_file(td, f);
+
+ ret2 = generic_close_file(td, f);
+ if (!ret && ret2)
+ ret = ret2;
+
+ return ret;
}
static struct ioengine_ops ioengine = {
}
static struct ioengine_ops ioengine = {
return ret;
if (sd && !sd->type_checked && fio_sgio_type_check(td, f)) {
return ret;
if (sd && !sd->type_checked && fio_sgio_type_check(td, f)) {
- generic_close_file(td, f);
+ ret = generic_close_file(td, f);
-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)
dprint(FD_FILE, "fd close %s\n", f->file_name);
dprint(FD_FILE, "fd close %s\n", f->file_name);
+ if (close(f->fd) < 0)
+ ret = errno;
+
}
int generic_open_file(struct thread_data *td, struct fio_file *f)
}
int generic_open_file(struct thread_data *td, struct fio_file *f)
-void put_file(struct thread_data *td, struct fio_file *f)
+int put_file(struct thread_data *td, struct fio_file *f)
dprint(FD_FILE, "put file %s, ref=%d\n", f->file_name, f->references);
if (!(f->flags & FIO_FILE_OPEN))
dprint(FD_FILE, "put file %s, ref=%d\n", f->file_name, f->references);
if (!(f->flags & FIO_FILE_OPEN))
assert(f->references);
if (--f->references)
assert(f->references);
if (--f->references)
if (should_fsync(td) && td->o.fsync_on_close)
fsync(f->fd);
if (td->io_ops->close_file)
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;
td->nr_open_files--;
f->flags &= ~FIO_FILE_OPEN;
}
static int recurse_dir(struct thread_data *td, const char *dirname)
}
static int recurse_dir(struct thread_data *td, const char *dirname)
extern int __must_check open_files(struct thread_data *);
extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_file *);
extern int __must_check generic_open_file(struct thread_data *, struct fio_file *);
extern int __must_check open_files(struct thread_data *);
extern int __must_check file_invalidate_cache(struct thread_data *, struct fio_file *);
extern int __must_check generic_open_file(struct thread_data *, struct fio_file *);
-extern void generic_close_file(struct thread_data *, struct fio_file *);
+extern int __must_check generic_close_file(struct thread_data *, struct fio_file *);
extern int add_file(struct thread_data *, const char *);
extern void get_file(struct fio_file *);
extern int add_file(struct thread_data *, const char *);
extern void get_file(struct fio_file *);
-extern void put_file(struct thread_data *, struct fio_file *);
+extern int __must_check put_file(struct thread_data *, struct fio_file *);
extern int add_dir_files(struct thread_data *, const char *);
extern int init_random_map(struct thread_data *);
extern void dup_files(struct thread_data *, struct thread_data *);
extern int add_dir_files(struct thread_data *, const char *);
extern int init_random_map(struct thread_data *);
extern void dup_files(struct thread_data *, struct thread_data *);
extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
extern int __must_check td_io_commit(struct thread_data *);
extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
extern int __must_check td_io_getevents(struct thread_data *, unsigned int, unsigned int, struct timespec *);
extern int __must_check td_io_commit(struct thread_data *);
extern int __must_check td_io_open_file(struct thread_data *, struct fio_file *);
-extern void td_io_close_file(struct thread_data *, struct fio_file *);
+extern int td_io_close_file(struct thread_data *, struct fio_file *);
int (*cancel)(struct thread_data *, struct io_u *);
void (*cleanup)(struct thread_data *);
int (*open_file)(struct thread_data *, struct fio_file *);
int (*cancel)(struct thread_data *, struct io_u *);
void (*cleanup)(struct thread_data *);
int (*open_file)(struct thread_data *, struct fio_file *);
- void (*close_file)(struct thread_data *, struct fio_file *);
+ int (*close_file)(struct thread_data *, struct fio_file *);
void *data;
void *dlhandle;
};
void *data;
void *dlhandle;
};
-#define FIO_IOOPS_VERSION 8
+#define FIO_IOOPS_VERSION 9
extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
extern void register_ioengine(struct ioengine_ops *);
extern struct ioengine_ops *load_ioengine(struct thread_data *, const char *);
extern void register_ioengine(struct ioengine_ops *);
assert((io_u->flags & IO_U_F_FREE) == 0);
io_u->flags |= IO_U_F_FREE;
assert((io_u->flags & IO_U_F_FREE) == 0);
io_u->flags |= IO_U_F_FREE;
- if (io_u->file)
- put_file(td, io_u->file);
+ if (io_u->file) {
+ int ret = put_file(td, io_u->file);
+
+ if (ret)
+ td_verror(td, ret, "file close");
+ }
io_u->file = NULL;
list_del(&io_u->list);
io_u->file = NULL;
list_del(&io_u->list);
-void td_io_close_file(struct thread_data *td, struct fio_file *f)
+int td_io_close_file(struct thread_data *td, struct fio_file *f)
{
if (!(f->flags & FIO_FILE_CLOSING))
log_file(td, f, FIO_LOG_CLOSE_FILE);
{
if (!(f->flags & FIO_FILE_CLOSING))
log_file(td, f, FIO_LOG_CLOSE_FILE);
*/
f->flags |= FIO_FILE_CLOSING;
*/
f->flags |= FIO_FILE_CLOSING;
+ return put_file(td, f);