Re: NFS: msync required for data writes to server?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Linda Dunaphant <[email protected]> wrote:
>
> Hi Trond,
> 
> On our 2.6.9 based systems, data written using mmap(MAP_SHARED) on a NFS
> client is *never* being pushed out to the server if an explicit msync call
> is not issued before the munmap.
> 
> On 11/12/04, there was a message thread concerning NFS corruption when
> using mmap/munmap:
> 
> http://marc.theaimsgroup.com/?l=linux-nfs&m=110028817508318&w=2
> 
> In this thread you stated:
> 
>      mmap() offers absolutely NO guarantees that the file will be synced to
>      disk on close. Use msync(MS_SYNC) if you want such a guarantee.
> 
> Are you saying that the data will *never* be written to the server?  Could
> you please clarify your position on this further? 

The dirty pages will float about in memory until something causes them to
be written back.  That "something" could be
msync/fsync/sync/pdflush/journal commit or, eventually, the VM system
deciding that it wants to reuse that physical page for something else.

So yes, the page will eventually be written to the server, but not for
quite some time.

In the case where the page was dirtied by mmap and was then unmapped (via
munmap or via program exit), the page will be marked dirty in pagecache
when its pagetable entry is unmapped.  That makes the page's dirtiness
visible to the VFS and the page will be written out approximately 30
seconds later by pdflush.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux