mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-10 05:03:06 +03:00
[BZ #7067]
2008-12-03 Petr Baudis <pasky@suse.cz> [BZ #7067] * nscd/connections.c (invalidate_cache): Use prune_run_lock instead of prune_lock. (nscd_run_prune): Before calling prune_cache, take prune_run_lock. * nscd/nscd.h (database_dyn): Add prune_run_cache.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2008-12-03 Petr Baudis <pasky@suse.cz>
|
||||||
|
|
||||||
|
[BZ #7067]
|
||||||
|
* nscd/connections.c (invalidate_cache): Use prune_run_lock
|
||||||
|
instead of prune_lock.
|
||||||
|
(nscd_run_prune): Before calling prune_cache, take prune_run_lock.
|
||||||
|
* nscd/nscd.h (database_dyn): Add prune_run_cache.
|
||||||
|
|
||||||
2008-12-07 Ulrich Drepper <drepper@redhat.com>
|
2008-12-07 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* resolv/res_send.c (send_dg): Use correct guards for SOCK_CLOEXEC
|
* resolv/res_send.c (send_dg): Use correct guards for SOCK_CLOEXEC
|
||||||
|
@@ -109,6 +109,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
[pwddb] = {
|
[pwddb] = {
|
||||||
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
||||||
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
|
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
@@ -129,6 +130,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
[grpdb] = {
|
[grpdb] = {
|
||||||
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
||||||
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
|
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
@@ -149,6 +151,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
[hstdb] = {
|
[hstdb] = {
|
||||||
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
||||||
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
|
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
@@ -169,6 +172,7 @@ struct database_dyn dbs[lastdb] =
|
|||||||
[servdb] = {
|
[servdb] = {
|
||||||
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
.lock = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
|
||||||
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
.prune_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
|
.prune_run_lock = PTHREAD_MUTEX_INITIALIZER,
|
||||||
.enabled = 0,
|
.enabled = 0,
|
||||||
.check_file = 1,
|
.check_file = 1,
|
||||||
.persistent = 0,
|
.persistent = 0,
|
||||||
@@ -976,9 +980,9 @@ invalidate_cache (char *key, int fd)
|
|||||||
|
|
||||||
if (dbs[number].enabled)
|
if (dbs[number].enabled)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock (&dbs[number].prune_lock);
|
pthread_mutex_lock (&dbs[number].prune_run_lock);
|
||||||
prune_cache (&dbs[number], LONG_MAX, fd);
|
prune_cache (&dbs[number], LONG_MAX, fd);
|
||||||
pthread_mutex_unlock (&dbs[number].prune_lock);
|
pthread_mutex_unlock (&dbs[number].prune_run_lock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1493,6 +1497,7 @@ nscd_run_prune (void *p)
|
|||||||
dbs[my_number].wakeup_time = now + CACHE_PRUNE_INTERVAL + my_number;
|
dbs[my_number].wakeup_time = now + CACHE_PRUNE_INTERVAL + my_number;
|
||||||
|
|
||||||
pthread_mutex_t *prune_lock = &dbs[my_number].prune_lock;
|
pthread_mutex_t *prune_lock = &dbs[my_number].prune_lock;
|
||||||
|
pthread_mutex_t *prune_run_lock = &dbs[my_number].prune_run_lock;
|
||||||
pthread_cond_t *prune_cond = &dbs[my_number].prune_cond;
|
pthread_cond_t *prune_cond = &dbs[my_number].prune_cond;
|
||||||
|
|
||||||
pthread_mutex_lock (prune_lock);
|
pthread_mutex_lock (prune_lock);
|
||||||
@@ -1526,7 +1531,12 @@ nscd_run_prune (void *p)
|
|||||||
|
|
||||||
pthread_mutex_unlock (prune_lock);
|
pthread_mutex_unlock (prune_lock);
|
||||||
|
|
||||||
|
/* We use a separate lock for running the prune function (instead
|
||||||
|
of keeping prune_lock locked) because this enables concurrent
|
||||||
|
invocations of cache_add which might modify the timeout value. */
|
||||||
|
pthread_mutex_lock (prune_run_lock);
|
||||||
next_wait = prune_cache (&dbs[my_number], prune_now, -1);
|
next_wait = prune_cache (&dbs[my_number], prune_now, -1);
|
||||||
|
pthread_mutex_unlock (prune_run_lock);
|
||||||
|
|
||||||
next_wait = MAX (next_wait, CACHE_PRUNE_INTERVAL);
|
next_wait = MAX (next_wait, CACHE_PRUNE_INTERVAL);
|
||||||
/* If clients cannot determine for sure whether nscd is running
|
/* If clients cannot determine for sure whether nscd is running
|
||||||
|
@@ -69,6 +69,7 @@ struct database_dyn
|
|||||||
pthread_rwlock_t lock;
|
pthread_rwlock_t lock;
|
||||||
pthread_cond_t prune_cond;
|
pthread_cond_t prune_cond;
|
||||||
pthread_mutex_t prune_lock;
|
pthread_mutex_t prune_lock;
|
||||||
|
pthread_mutex_t prune_run_lock;
|
||||||
time_t wakeup_time;
|
time_t wakeup_time;
|
||||||
|
|
||||||
int enabled;
|
int enabled;
|
||||||
|
Reference in New Issue
Block a user