- Add missing locking when accessing sack cache (#1146734) - Improve parallel kernel installation (#1205649)
54 lines
1.8 KiB
Diff
54 lines
1.8 KiB
Diff
From 7528178aaefb5e827054c32b3a8691c29294bb46 Mon Sep 17 00:00:00 2001
|
|
From: Kalev Lember <kalevlember@gmail.com>
|
|
Date: Fri, 29 May 2015 17:56:29 +0200
|
|
Subject: [PATCH 2/4] hif: Add missing locking when accessing sack cache
|
|
|
|
Might help with the crash reported at
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1146734
|
|
---
|
|
backends/hif/pk-backend-hif.c | 26 +++++++++++++++-----------
|
|
1 file changed, 15 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/backends/hif/pk-backend-hif.c b/backends/hif/pk-backend-hif.c
|
|
index 5988ab1..48d456a 100644
|
|
--- a/backends/hif/pk-backend-hif.c
|
|
+++ b/backends/hif/pk-backend-hif.c
|
|
@@ -617,19 +617,23 @@ hif_utils_create_sack_for_filters (PkBackendJob *job,
|
|
|
|
/* do we have anything in the cache */
|
|
cache_key = hif_utils_create_cache_key (flags);
|
|
- if ((create_flags & HIF_CREATE_SACK_FLAG_USE_CACHE) > 0)
|
|
+ if ((create_flags & HIF_CREATE_SACK_FLAG_USE_CACHE) > 0) {
|
|
+ g_mutex_lock (&priv->sack_mutex);
|
|
cache_item = g_hash_table_lookup (priv->sack_cache, cache_key);
|
|
- if (cache_item != NULL && cache_item->sack != NULL) {
|
|
- if (cache_item->valid) {
|
|
- ret = TRUE;
|
|
- g_debug ("using cached sack %s", cache_key);
|
|
- sack = cache_item->sack;
|
|
- goto out;
|
|
- } else {
|
|
- /* we have to do this now rather than rely on the
|
|
- * callback of the hash table */
|
|
- g_hash_table_remove (priv->sack_cache, cache_key);
|
|
+ if (cache_item != NULL && cache_item->sack != NULL) {
|
|
+ if (cache_item->valid) {
|
|
+ ret = TRUE;
|
|
+ g_debug ("using cached sack %s", cache_key);
|
|
+ sack = cache_item->sack;
|
|
+ g_mutex_unlock (&priv->sack_mutex);
|
|
+ goto out;
|
|
+ } else {
|
|
+ /* we have to do this now rather than rely on the
|
|
+ * callback of the hash table */
|
|
+ g_hash_table_remove (priv->sack_cache, cache_key);
|
|
+ }
|
|
}
|
|
+ g_mutex_unlock (&priv->sack_mutex);
|
|
}
|
|
|
|
/* update status */
|
|
--
|
|
2.4.2
|
|
|