[systemd-devel] tmpfiles versus tmpwatch

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Apr 30 12:40:27 PDT 2015


On Wed, Apr 29, 2015 at 10:28:26PM +1200, Roger Qiu wrote:
> Doesn't relatime still update the time if the file is 1 day old
> (regardless of modication time), and the current tmpfiles wipes
> files that are older by 10 days?
Yes, everything should work with relatime, unless you set tmpfiles cleanup
time to less than 1 day. On modern kernels, with the "lazytime" option,
it will work even if you set it to less than 1 day.

commit 0ae45f63d4ef8d8eeec49c7d8b44a1775fff13e8
Author: Theodore Ts'o <tytso at mit.edu>
Date:   Mon Feb 2 00:37:00 2015 -0500

    vfs: add support for a lazytime mount option
    
    Add a new mount option which enables a new "lazytime" mode.  This mode
    causes atime, mtime, and ctime updates to only be made to the
    in-memory version of the inode.  The on-disk times will only get
    updated when (a) if the inode needs to be updated for some non-time
    related change, (b) if userspace calls fsync(), syncfs() or sync(), or
    (c) just before an undeleted inode is evicted from memory.

> > Since Linux 2.6.30, the kernel defaults to the behavior provided
> by this option (unless |noatime| was specified), and the
> |strictatime| option is required to obtain traditional semantics. In
> addition, since Linux 2.6.30, the file's last access time is always
> updated if it is more than 1 day old.
> >
> > http://manpages.courier-mta.org/htmlman8/*mount*.8.html
> 
> On 29/04/2015 10:22 PM, Lennart Poettering wrote:
> >On Wed, 29.04.15 22:08, Roger Qiu (roger.qiu at polycademy.com) wrote:
> >
> >>Hi Lennart,
> >>
> >>So there really isn't a fast of way just checking if a file has an open file
> >>descriptor on it?
> >>
> >>Sometimes atime is on relatime, so it only gets updated if modification is
> >>earlier.
> >Using relatime is fine, except for /tmp and /var/tmp really. Setting
> >the flag for those file systems is really a poor choice, since it
> >breaks "aging" things there...

I think that relatime is still the default, but lazytime seems to better
in all respects.

Zbyszek


More information about the systemd-devel mailing list