util/fossilize_db: Pull seek into lock.

Otherwise the seek can overlap with other reads/writes.

Fixes: eca6bb9540 ("util/fossilize_db: add basic fossilize db util to read/write shader caches")
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11485>
This commit is contained in:
Bas Nieuwenhuizen 2021-06-19 18:40:49 +02:00 committed by Marge Bot
parent a99474fae5
commit bd41c51c8f

View file

@ -362,14 +362,14 @@ foz_read_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit,
goto fail;
}
/* Reset file offset to the end of the file ready for writing */
fseek(foz_db->file[file_idx], offset, SEEK_SET);
simple_mtx_unlock(&foz_db->mtx);
if (size)
*size = data_sz;
/* Reset file offset to the end of the file ready for writing */
fseek(foz_db->file[file_idx], offset, SEEK_SET);
return data;
fail: