Bug 86396 - memory mapped files are not flushed to disk before munmap.
Summary: memory mapped files are not flushed to disk before munmap.
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 7.3
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Stephen Tweedie
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2003-03-21 10:11 UTC by Keith Ansell
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-03-21 10:41:54 UTC

Attachments (Terms of Use)

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.

Note You need to log in before you can comment on or make changes to this bug.