aboutsummaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-12 10:10:48 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-12 10:10:48 +0000
commitcf244b74a04435b6954d5499a09fa97a628bc3ab (patch)
tree897579a8737715c5850e0d96b59024bf9556e68f /nscd
parent8c89236fd36aac2a048c9a400572ef0ee642fb83 (diff)
downloadglibc-cf244b74a04435b6954d5499a09fa97a628bc3ab.zip
glibc-cf244b74a04435b6954d5499a09fa97a628bc3ab.tar.gz
glibc-cf244b74a04435b6954d5499a09fa97a628bc3ab.tar.bz2
Update.
2004-09-12 Ulrich Drepper <drepper@redhat.com> * nscd/pwdcache.c (cache_addpw): Sync also negative results to disk. * nscd/grpcache.c (cache_addgr): Likewise. * nscd/hstcache.c (cache_addhst): Likewise.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/grpcache.c10
-rw-r--r--nscd/pwdcache.c12
2 files changed, 21 insertions, 1 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index d07693f..bf4a225 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -128,6 +128,16 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
/* Copy the key data. */
memcpy (dataset->strdata, key, req->key_len);
+ /* If necessary, we also propagate the data to disk. */
+ if (db->persistent)
+ {
+ // XXX async OK?
+ uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1;
+ msync ((void *) pval,
+ ((uintptr_t) dataset & pagesize_m1)
+ + sizeof (struct dataset) + req->key_len, MS_ASYNC);
+ }
+
/* Now get the lock to safely insert the records. */
pthread_rwlock_rdlock (&db->lock);
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 2354b6d..93049ba 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -135,6 +135,16 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
/* Copy the key data. */
char *key_copy = memcpy (dataset->strdata, key, req->key_len);
+ /* If necessary, we also propagate the data to disk. */
+ if (db->persistent)
+ {
+ // XXX async OK?
+ uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1;
+ msync ((void *) pval,
+ ((uintptr_t) dataset & pagesize_m1)
+ + sizeof (struct dataset) + req->key_len, MS_ASYNC);
+ }
+
/* Now get the lock to safely insert the records. */
pthread_rwlock_rdlock (&db->lock);
@@ -245,7 +255,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
&& memcmp (&dataset->resp, dh->data,
dh->allocsize - offsetof (struct dataset, resp)) == 0)
{
- /* The sata has not changed. We will just bump the
+ /* The data has not changed. We will just bump the
timeout value. Note that the new record has been
allocated on the stack and need not be freed. */
dh->timeout = dataset->head.timeout;