Access times on directories.
Bruce Evans
brde at optusnet.com.au
Sun Jan 18 11:55:18 UTC 2015
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.
> The reason I'm asking is because it would allow autounmountd(8) to actually
> unmount filesystems some specified time after last use, by checking atime
> of filesystem's root, instead of just retrying unmount(2) until it succeeds.
That wouldn't be a robust test. It would be guaranteed to not work for the
r/o mount case.
I would like file systems to do this. Actually, to automatically sync
everything and mark the file system as clean if there have been no
writes to it for some time. ffs should do this per cylinder group
(not so easy) in such a way that only the unclean cg's need to be
fscked. atime updates would get in the way of this. A file system
with atime updates enabled would rarely remain unwritten to for
sufficiently long to be marked as clean unless it is not used at all.
Bruce
More information about the freebsd-arch
mailing list