summaryrefslogtreecommitdiff
path: root/filehash.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-04-02 12:25:16 -0600
committerJens Axboe <axboe@fb.com>2014-04-02 12:25:16 -0600
commit45aeca74dc812f33a6617687fc7cb25a1cd2779b (patch)
treecca80e1abe8e8d7633ed3975004a393b0110dd13 /filehash.c
parent632f415c8d67a1ade18834a0f56d95c508aaa8af (diff)
downloadfio-45aeca74dc812f33a6617687fc7cb25a1cd2779b.tar.gz
fio-45aeca74dc812f33a6617687fc7cb25a1cd2779b.tar.bz2
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 <axboe@fb.com>
Diffstat (limited to 'filehash.c')
-rw-r--r--filehash.c6
1 files 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)