summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/cache_iterators.c6
-rw-r--r--src/sync-mode.c8
3 files changed, 9 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index aa93d4c..8bd6c59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,7 +15,7 @@ o use wraparound-aware functions after/before/between
o commit phase: if conntrack exists, update it
o local requests return EXIT_FAILURE if it can't connect to the daemon
o remove several debug statements
-o fork when internal/external dump cache requests are received
+o fork when internal/external dump and commit requests are received
o lots of cleanups
= conntrack =
diff --git a/src/cache_iterators.c b/src/cache_iterators.c
index 7ae25fa..446cac8 100644
--- a/src/cache_iterators.c
+++ b/src/cache_iterators.c
@@ -71,9 +71,8 @@ void cache_dump(struct cache *c, int fd, int type)
.type = type
};
- lock();
+ /* does not require locking: called inside fork() */
hashtable_iterate(c->h, (void *) &tmp, do_dump);
- unlock();
}
static int do_commit(void *data1, void *data2)
@@ -147,9 +146,8 @@ void cache_commit(struct cache *c)
unsigned int commit_exist = c->commit_exist;
unsigned int commit_fail = c->commit_fail;
- lock();
+ /* does not require locking: called inside fork() */
hashtable_iterate(c->h, c, do_commit);
- unlock();
/* calculate new entries committed */
commit_ok = c->commit_ok - commit_ok;
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 8433532..38ab016 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -244,8 +244,12 @@ static int local_handler_sync(int fd, int type, void *data)
}
break;
case COMMIT:
- dlog(STATE(log), "[REQ] commit external cache to master table");
- cache_commit(STATE_SYNC(external));
+ ret = fork();
+ if (ret == 0) {
+ dlog(STATE(log), "[REQ] committing external cache");
+ cache_commit(STATE_SYNC(external));
+ exit(EXIT_SUCCESS);
+ }
break;
case FLUSH_CACHE:
dlog(STATE(log), "[REQ] flushing caches");