patch not updating atime

Matthew Dillon dillon at
Mon Jul 11 23:09:57 PDT 2005

:I just ran into an atime update issue:
:printf "1\n\2\n\3\n" > data
:printf "1\n\4\n\3\n" > data2
:diff -u data data2 > data.diff
:sleep 60      # wait some time
:patch -o data.out -i data.diff data
:ls -lu data data2 data.diff data.out
:-rw-r--r--  1 corecode  corecode    6 Jul 12 00:08 data
:-rw-r--r--  1 corecode  corecode  119 Jul 12 00:09 data.diff
:-rw-r--r--  1 corecode  corecode    6 Jul 12 00:09 data.out
:-rw-r--r--  1 corecode  corecode    6 Jul 12 00:08 data2
:note that data, which actually was used as input source, doesn't
:have a changed atime.
:I guess this is because patch(1) does an open(2)+mmap(2), but
:never an actual read. Shouldn't we at least set the atime on
:open(2) [don't know if it's feasible for mmap/faulting in the
:  simon

    Even more to the point, its taking it directly from the VM page
    cache, the filesystem is not touched at all.

    I think the standards allow us to update the atime at munmap() time,
    but I haven't investigated how best to implement such a thing in the
    kernel.  We might have to add a new VOP API call.


More information about the Bugs mailing list