summaryrefslogtreecommitdiff
path: root/klm/util/mmap.cc
diff options
context:
space:
mode:
Diffstat (limited to 'klm/util/mmap.cc')
-rw-r--r--klm/util/mmap.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/klm/util/mmap.cc b/klm/util/mmap.cc
index 456ce953..e7c0643b 100644
--- a/klm/util/mmap.cc
+++ b/klm/util/mmap.cc
@@ -15,8 +15,9 @@ namespace util {
scoped_mmap::~scoped_mmap() {
if (data_ != (void*)-1) {
- if (munmap(data_, size_)) {
- std::cerr << "munmap failed for " << size_ << " bytes." << std::endl;
+ // Thanks Denis Filimonov for pointing on NFS likes msync first.
+ if (msync(data_, size_, MS_SYNC) || munmap(data_, size_)) {
+ std::cerr << "msync or mmap failed for " << size_ << " bytes." << std::endl;
abort();
}
}