diff options
author | Piotr Balcer <piotr.balcer@intel.com> | 2019-09-19 12:18:58 +0200 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2019-09-19 14:40:47 -0700 |
commit | c0a868b5b56433c0a01ea2ce9f0b30c111ab6e5c (patch) | |
tree | 1518a5c051f81902eac8020e0e04665842ec21a9 /restart.c | |
parent | 9485db55edf2dc6b75b2024770ae41ad6b68de18 (diff) | |
download | memcached-c0a868b5b56433c0a01ea2ce9f0b30c111ab6e5c.tar.gz |
restart: add missing msync at close time
To make sure that the backing pages actually make it to the backing
device prior to shutdown, munmap must be preceded by an msync call.
Additionally, since the metadata file is used as a flag to check if
the shutdown was graceful, the data needs to be sync'd prior to that
file being written.
Diffstat (limited to 'restart.c')
-rw-r--r-- | restart.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -303,6 +303,8 @@ bool restart_mmap_open(const size_t limit, const char *file, void **mem_base) { /* Gracefully stop/close the shared memory segment */ void restart_mmap_close(void) { + msync(mmap_base, slabmem_limit, MS_SYNC); + if (restart_save(memory_file) != 0) { fprintf(stderr, "[restart] failed to save metadata"); } |