From: Jens Axboe Date: Wed, 4 Jun 2008 13:13:02 +0000 (+0200) Subject: We need to grab and mark the file open before jumping to an error path X-Git-Tag: fio-1.21-rc8~10 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d5707a3565e958af566247e2c0acf09e031d8921 We need to grab and mark the file open before jumping to an error path The error path will close the file. Signed-off-by: Jens Axboe --- diff --git a/ioengines.c b/ioengines.c index 3e178976..1a7a6301 100644 --- a/ioengines.c +++ b/ioengines.c @@ -329,6 +329,13 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) return 1; } + fio_file_reset(f); + f->flags |= FIO_FILE_OPEN; + f->flags &= ~FIO_FILE_CLOSING; + + td->nr_open_files++; + get_file(f); + if (f->filetype == FIO_TYPE_PIPE) { if (td_random(td)) { log_err("fio: can't seek on pipes (no random io)\n"); @@ -336,10 +343,6 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) } } - fio_file_reset(f); - f->flags |= FIO_FILE_OPEN; - f->flags &= ~FIO_FILE_CLOSING; - if (td->io_ops->flags & FIO_DISKLESSIO) goto done; @@ -366,8 +369,6 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f) done: log_file(td, f, FIO_LOG_OPEN_FILE); - td->nr_open_files++; - get_file(f); return 0; err: if (td->io_ops->close_file)