util/fossilize_db: Unlock the cache file if the entry already exists.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 7 Aug 2021 21:23:56 +0000 (23:23 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 8 Aug 2021 11:34:39 +0000 (13:34 +0200)
Fixes: 4f0f8133a35 "util/fossilize_db: Do not lock the fossilize db permanently."
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12266>

src/util/fossilize_db.c

index d3c039e..013575a 100644 (file)
@@ -448,6 +448,7 @@ foz_write_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit,
       _mesa_hash_table_u64_search(foz_db->index_db, hash);
    if (entry) {
       simple_mtx_unlock(&foz_db->mtx);
+      flock(fileno(foz_db->file[0]), LOCK_UN);
       return NULL;
    }