[systemd-devel] systemd-tmpfiles-clean could remove recently created files

Lennart Poettering lennart at poettering.net
Wed Nov 16 14:16:10 UTC 2016


On Wed, 16.11.16 16:08, Alexander Kochetkov (al.kochet at gmail.com) wrote:

> Hello,
> 
> I’d like to discuss the issue I faced. I don’t know should I fill issue report or make something else.
> I made a decision to disable systemd-tmpfiles-clean entirely.
> 
> systemd-tmpfiles-clean by default configured to delete all files from /tmp with atime older than 10 days
> after 15 min of system startup. That is regulated using tmpfiles.d rule and systemd-tmpfiles-clean.timer.
> 
> If machine has incorrect time set during boot (RTC not configured and no /var/lib/systemd/clock) and
> later that time will be corrected using ntp, than systemd-tmpfiles-clean could delete all files and folder
> (created withing 15 min, even opened and used at time systemd-tmpfiles-clean run) from /tmp directory.
> 
> I’d think about patching linux kernel to bind tmpfs atime to CLOCK_MONOTONIC. So atime wouldn’d be
> affected by system time changes.
> 
> May be there is another solution for the issue.

I figure systemd could also record the realtime and monotonic clock
when it first passed control to userspace and tmpfiles could then use
that information and only delete files that are older than the age
value on the wallclock AND older than the age value on the monotonic
clock when taking the initial clock pairing into account.

Consider filing an RFE for this, or even better an PR...

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list