util/fossilize_db: don't destroy foz on RO load fail

When loading multiple RO foz dbs, if a db fails to load, continue trying
to load other RO foz dbs instead of destroying the foz cache.

Preserve destroying the foz cache and not preceding to load RO caches
if the RW cache fails to load.

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19328>
This commit is contained in:
Juston Li
2022-10-21 20:01:31 +00:00
committed by Marge Bot
parent 4c19426fd6
commit 483ee5d6ba

View File

@@ -259,7 +259,6 @@ load_foz_dbs(struct foz_db *foz_db, FILE *db_idx, uint8_t file_idx,
fail:
flock(fileno(foz_db->file[file_idx]), LOCK_UN);
foz_destroy(foz_db);
return false;
}
@@ -333,7 +332,10 @@ foz_prepare(struct foz_db *foz_db, char *cache_path)
if (!load_foz_dbs(foz_db, db_idx, file_idx, true)) {
fclose(db_idx);
goto fail;
fclose(foz_db->file[file_idx]);
foz_db->file[file_idx] = NULL;
continue; /* Ignore invalid user provided foz db */
}
fclose(db_idx);