Subject: Re: kern/25279: NFS read doesn't update atime
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 06/27/2005 16:21:02
On Mon, Jun 27, 2005 at 09:29:26PM +0900, YAMAMOTO Takashi wrote:
> > > > > doesn't it make write(2) and mmap'ed accesses update atime
> > > > > in somewhat unpredictable manner?
> > > >
> > > > For mmap'ed accesses, probably. But I don't think this is a problem,
> > > > because if we're faulting in a page via mmap(), we're reading the file,
> > > > isn't it ?
> > >
> > > i agree that it shouldn't be a problem, because it's
> > > the pre-ubc behaviour, iirc.
> >
> > Ha yes, so this should be restored too.
>
> i'm not sure if it should.
> i have not heard about any actual problem due to it.
Because peoples don't look at the access time that often. But it's usefull
for diagnostics and statistics.
> besides, netbsd is not only os which doesn't update atime for mmap.
But it was doing it before, and it didn't cause any problems either.
>
> > > > Hum, I just tested. Yes the atime is updated on a write, and testing
> > > > PGO_OVERWRITE doesn't fix the problem :(
> > >
> > > i think testing access_type works for -current.
> > > it doesn't work for netbsd-2, though.
> >
> > Hum, I tried this (see attached patch), and atime is still updated when writing
> > to an existing file (my test is: echo >> some_file).
>
> due to VOP_GETPAGES called by ufs_balloc_range?
Yes, that's it. Testing !(ap->a_flags & PGO_PASTEOF) in addition to
!(ap->a_access_type & VM_PROT_WRITE) makes the atime behaves as expected,
from my tests.
But we probably want a PGO_NOATIME (or maybe PGO_RMW, for read-modify-write)
flag for this kind of access instead.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--