Fix potential oops in file unlocking at free time
authorJens Axboe <axboe@kernel.dk>
Thu, 23 Jan 2014 00:27:32 +0000 (16:27 -0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 Jan 2014 00:27:32 +0000 (16:27 -0800)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
filesetup.c

index 601df8f1ddec655b09ec8eb7b2d03947307a8e65..d67f1124618744db85595c2f037ffe07f9788794 100644 (file)
@@ -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);
 }