glibc/nscd-gc-cycle.patch
Andreas Schwab 129004b05a Accepting request 816574 from home:Andreas_Schwab:Factory
- long-double-alias.patch: Fix build with GCC 10 when long double = double
- nscd-gc-cycle.patch: nscd: bump GC cycle during cache pruning
  (bsc#1171878, BZ #26130)

OBS-URL: https://build.opensuse.org/request/show/816574
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=565
2020-06-23 11:59:46 +00:00

43 lines
1.3 KiB
Diff

From 4350db8d5e45dc4ec63e5fabc6bdc3a9425769dc Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 17 Jun 2020 16:05:13 +0200
Subject: [PATCH] nscd: bump GC cycle during cache pruning (bug 26130)
While nscd prunes a cache it becomes inconsistent temporarily, which is
visible to clients if that cache is shared. Bump the GC cycle counter so
that the clients notice the modification window.
---
nscd/cache.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/nscd/cache.c b/nscd/cache.c
index 94163d9ce3..2ceac94c23 100644
--- a/nscd/cache.c
+++ b/nscd/cache.c
@@ -453,6 +453,11 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
pthread_rwlock_wrlock (&table->lock);
}
+ /* Now we start modifying the data. Make sure all readers of the
+ data are aware of this and temporarily don't use the data. */
+ ++table->head->gc_cycle;
+ assert ((table->head->gc_cycle & 1) == 1);
+
while (first <= last)
{
if (mark[first])
@@ -493,6 +498,10 @@ prune_cache (struct database_dyn *table, time_t now, int fd)
++first;
}
+ /* Now we are done modifying the data. */
+ ++table->head->gc_cycle;
+ assert ((table->head->gc_cycle & 1) == 0);
+
/* It's all done. */
pthread_rwlock_unlock (&table->lock);
--
2.26.2