From 27ddbfa09b22911d5cefb42a44f894e6eb48216e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 22 Jan 2014 16:27:32 -0800 Subject: [PATCH] Fix potential oops in file unlocking at free time Signed-off-by: Jens Axboe --- filesetup.c | 3 +++ 1 file changed, 3 insertions(+) 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); } -- 2.25.1