about summary refs log tree commit diff
path: root/nscd/grpcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'nscd/grpcache.c')
-rw-r--r--nscd/grpcache.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index d07693f1a4..bf4a225edd 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);