Skip to contentSkip to conversation

munmap doesn't imply msync even with O_SYNC, right?

DISCUSSION Bob Peterson 1 participant 1 message Mar 19, 2014 1 message not in the archive VFS

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi,

I've read the various man pages and past discussions, so I think I already know the answer, but I just want some clarity from the experts:

If I have a program that does open / mmap / memcpy / munmap there is no implied blocking writeback of the dirty pages at munmap, right? Even if the file was opened O_SYNC?

In other words, if these events happen...

(1) open w/O_SYNC
(2) mmap some region
(3) memcpy to dirty some pages
(4) munmap the region
(5) someone kills the power after the munmap completes successfully

...You can still see data corruption because the dirty pages may still have been dirty in page cache when the power went out. Correct?

The same thing applies even if the file is closed before the power goes out, right? (All assuming no calls to msync).

Regards,

Bob Peterson