It's only true for the pages the munmap() removes from the process' page
tables: the act of unmapping them transfers the dirty bit from the page
tables into the page cache where fsync() acts on them.
> Just to restate what you said:
> - if part of a file is mmap()ed, msync() MUST be used
> to sync it.
> - any non-mmap()ed portions are synched with fsync().
Pretty much.
> I'm assuming this is a per-process thing. i.e. The
> above is true regardless of what other processes are
> doing (e.g. even if another process has the same file
> mmap()'d, I don't care).
Right. Other processes are responsible for managing their own syncing of
dirty bits to disk at the appropriate times. The one case this breaks down
on is when the mmap()'d file is on NFS -- the reordering there can result in
writebacks from mmap()s occuring in unexpected ways. But then, nobody trusts
their data to NFS, right? ;-)
-ben
-- Junk email? <a href="mailto:aart@kvack.org">aart@kvack.org</a> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/