[Bug 270810] munmap does not always sync the underlying file

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 13 Apr 2023 00:23:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270810

            Bug ID: 270810
           Summary: munmap does not always sync the underlying file
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: geoffrey@dommett.com

the man page explicitly states that The msync() system call is usually not
needed

however when doing the following sequence
open() 
mmap()
close() 
do something that writes to the memory mapped region
munmap()

program exits immediately, the underlying file is not reliably updated when on
an nfs mount. Random pages are not written. Calling msync before unmapping
solves this, but the man pages do not indicate that this is necessary. The
problem does not seem to occur if the program performs more IO after the munmap
before exiting. The problem never occurs when the mapped file is on a local
file system.

nfs server of this test was running FreeBSD 12.1-RELEASE-p3
nfs clients tested FreeBSD 12.1-RELEASE-p3 and FreeBSD 13.1-RELEASE-p2

-- 
You are receiving this mail because:
You are the assignee for the bug.