From 45aeca74dc812f33a6617687fc7cb25a1cd2779b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 2 Apr 2014 12:25:16 -0600 Subject: [PATCH 1/1] Don't crash when using filehash lock before init We might be parsing and adding files (which locks the hash lock) before we have setup threads. For that case, don't bother locking, we're serialized at that point. Signed-off-by: Jens Axboe --- filehash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/filehash.c b/filehash.c index c6ebe761..0d61f54c 100644 --- a/filehash.c +++ b/filehash.c @@ -21,12 +21,14 @@ static unsigned short hash(const char *name) void fio_file_hash_lock(void) { - fio_mutex_down(hash_lock); + if (hash_lock) + fio_mutex_down(hash_lock); } void fio_file_hash_unlock(void) { - fio_mutex_up(hash_lock); + if (hash_lock) + fio_mutex_up(hash_lock); } void remove_file_hash(struct fio_file *f) -- 2.25.1