From 67ad92428bb19008354ca20e614050241e9f17e7 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 7 Feb 2014 10:56:15 -0700 Subject: [PATCH] Fix crash with file locking and dup'ed files Ensure that we properly inherit the file locks when duplicating files. Signed-off-by: Jens Axboe --- filesetup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filesetup.c b/filesetup.c index d67f1124..d1702e29 100644 --- a/filesetup.c +++ b/filesetup.c @@ -1343,6 +1343,11 @@ void dup_files(struct thread_data *td, struct thread_data *org) __f->filetype = f->filetype; } + if (td->o.file_lock_mode == FILE_LOCK_EXCLUSIVE) + __f->lock = f->lock; + else if (td->o.file_lock_mode == FILE_LOCK_READWRITE) + __f->rwlock = f->rwlock; + td->files[i] = __f; } } -- 2.25.1