Access times on directories.

John Baldwin jhb at freebsd.org
Tue Jan 20 19:02:44 UTC 2015


On Sunday, January 18, 2015 6:55:07 am Bruce Evans wrote:
> On Sun, 18 Jan 2015, Edward Tomasz [utf-8] NapieraÅ~Ba wrote:
> 
> > What is FreeBSD semantics for atime updates on directories?  It does not
> > seem to be working.  Is that by design?
> 
> read(2) marks the atime for update in the usual way for directories
> on most or all file systems that support read(2) on directories.  That
> is about the only time atimes are marked on directories.  However,
> read(2) is rarely used for reading directories.  Most directory reads
> are probably done by readdir(2), and it uses getdirentries(2).  POSIX
> requires readdir() to mark the atime for update if an (uncached)
> directory entry is actually read.  This seems to be quite broken.
> There is no code in either readdir() or getdirentries to waste time
> marking the atime.  I think directory searches for the purpose of
> creating a new entry also don't update the atime, but this is not
> required by POSIX.

Also, I suspect that lookups would not trigger an atime update even if you fix 
getdirentries (and of course that ignores the read-only mount case that Bruce 
already mentioned).

-- 
John Baldwin


More information about the freebsd-arch mailing list