From 1852736ee364cbbabf9b777bed07dc8a9f8dcd54 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 11 Feb 2021 14:27:39 +0100 Subject: [PATCH] disk_cache: Fail creation when cannot inizialize queue. Signed-off-by: Giovanni Mascellani Reviewed-by: Timothy Arceri Fixes: e2c4435b078a ("util/disk_cache: add thread queue to disk cache") Part-of: (cherry picked from commit c6731daa5e70a28f5577a7aa572cad59e49caba2) --- .pick_status.json | 2 +- src/util/disk_cache.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8f5586afc07..7a322a91911 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6205,7 +6205,7 @@ "description": "disk_cache: Fail creation when cannot inizialize queue.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "e2c4435b078a1471b044219552873a54b1817bac" }, diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index e1eee29839f..c9104856166 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -155,10 +155,11 @@ disk_cache_create(const char *gpu_name, const char *driver_id, * The queue will resize automatically when it's full, so adding new jobs * doesn't stall. */ - util_queue_init(&cache->cache_queue, "disk$", 32, 4, - UTIL_QUEUE_INIT_RESIZE_IF_FULL | - UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY | - UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY); + if (!util_queue_init(&cache->cache_queue, "disk$", 32, 4, + UTIL_QUEUE_INIT_RESIZE_IF_FULL | + UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY | + UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY)) + goto fail; cache->path_init_failed = false;