From: Jens Axboe Date: Thu, 23 Jan 2014 00:27:32 +0000 (-0800) Subject: Fix potential oops in file unlocking at free time X-Git-Tag: fio-2.1.5~37 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=27ddbfa09b22911d5cefb42a44f894e6eb48216e;p=fio.git Fix potential oops in file unlocking at free time Signed-off-by: Jens Axboe --- diff --git a/filesetup.c b/filesetup.c index 601df8f1..d67f1124 100644 --- a/filesetup.c +++ b/filesetup.c @@ -1050,6 +1050,7 @@ void close_and_free_files(struct thread_data *td) td->files_index = 0; td->files = NULL; td->file_locks = NULL; + td->o.file_lock_mode = FILE_LOCK_NONE; td->o.nr_files = 0; } @@ -1242,6 +1243,8 @@ void unlock_file(struct thread_data *td, struct fio_file *f) void unlock_file_all(struct thread_data *td, struct fio_file *f) { + if (td->o.file_lock_mode == FILE_LOCK_NONE) + return; if (td->file_locks[f->fileno] != FILE_LOCK_NONE) unlock_file(td, f); }