Red Hat Bugzilla – Bug 150882
Kernel doesn't update st_mtime/st_ctime in msync
Last modified: 2007-11-30 17:07:16 EST
It seems that our kernels (and likely stock ones as well), both 2.4.x and
2.6.x based, violate POSIX for msync.
If msync() causes any write to a file, the file's st_ctime and st_mtime
fields shall be marked for update.
See the attached testcase. If test_msync is changed to false,
the tests passes, so certainly write marks the st_mtime for update.
This is distilled from a LSB 1.3 testcase, but that test is flawed
and thus usually succeeds although msync really doesn't update
st_mtime. The flaw is that the test doesn't sleep between writing
the file and calling time (or it could wait longer and increase start by 2
seconds), so usually st_mtime will be equal to start time.
With the added sleep in between writing/mmaping the file and time (&start)
it fails reliably on all arches.
I think msync.c needs to propagate up from filemap_sync_pte whether there were
any dirty pages and call inode_update_time before exiting if there were some.
Created attachment 111896 [details]
*** This bug has been marked as a duplicate of 173226 ***
bookkeeping: remove from U3 canfix list.