Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 86396

Summary: memory mapped files are not flushed to disk before munmap.
Product: [Retired] Red Hat Linux Reporter: Keith Ansell <keitha>
Component: kernelAssignee: Stephen Tweedie <sct>
Status: CLOSED NOTABUG QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: high    
Version: 7.3   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-03-21 10:41:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Keith Ansell 2003-03-21 10:11:44 UTC
Description of problem:
Can you help, we have a database product that uses memory mapping to access and 
update the database file. 

On Linux the flushing deamon can not flush the modified memory until a munmap 
or msync is called.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. A program that opens a file and map's the first 4k block.
2. Modify that memory block.
3. Crash the box after 30 seconds.
Actual results:

The disk file is not modified.

Expected results:

This disk file is modified.

Additional info:
Can I get bdflush deamon to detect and flush the dirty pages to disk?
Is this a linux bug? The flushing deamon on the Unix operating system, flushes 
all write required pages to disk and that includes all those modified memory 
mapped pages, but linux doesn't.

Comment 1 Stephen Tweedie 2003-03-21 10:41:54 UTC
From my reading of the SingleUnix spec, we are not required to sync mmaps to
disk unless there is an explicit msync or if the region is unmapped.  This is
not a bug.  Please reopen if you can find an assertion to the contrary in the
standard, but I think this is simply a portability issue --- any code that
assumes it does not need to msync is just non-portable, as it is relying on
implementation-specific behaviour.