}
f->real_file_size = bytes;
+ td->io_ops->close_file(td, f);
return 0;
err:
td->io_ops->close_file(td, f);
char buf[FIO_VERROR_SIZE];
int __e = errno;
- if (errno == EPERM && (flags & FIO_O_NOATIME)) {
+ if (__e == EPERM && (flags & FIO_O_NOATIME)) {
flags &= ~FIO_O_NOATIME;
goto open_again;
}
unlink(f->file_name);
}
- td_io_close_file(td, f);
+ if (fio_file_open(f))
+ td_io_close_file(td, f);
+
remove_file_hash(f);
sfree(f->file_name);
dprint(FD_FILE, "put file %s, ref=%d\n", f->file_name, f->references);
- if (!fio_file_open(f))
+ if (!fio_file_open(f)) {
+ assert(f->fd == -1);
return 0;
+ }
assert(f->references);
if (--f->references)
td->nr_open_files--;
fio_file_clear_open(f);
+ assert(f->fd == -1);
return ret;
}
log_err("fio: smalloc OOM\n");
assert(0);
}
+ __f->fd = -1;
if (f->file_name) {
__f->file_name = smalloc_strdup(f->file_name);