[systemd-devel] tmpfiles versus tmpwatch

Roger Qiu roger.qiu at polycademy.com
Wed Apr 29 03:08:35 PDT 2015

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.

On servers that don't shutdown, processes may access the file for long 
periods of time, and the atime may not be updated.


On 29/04/2015 9:33 PM, Lennart Poettering wrote:
> On Wed, 29.04.15 15:10, Roger Qiu (roger.qiu at polycademy.com) wrote:
>> Hello all,
>> I'm planning to use tmpwatch's `fuser` feature.
>> But I'd prefer to run this simple service using systemd's tmpfiles.
>> Does systemd tmpfiles support running `fuser` so that way it won't delete
>> any files that have an open file descriptor?
> Nope, we do not support this, and it's unlikely we ever will. fuser is
> relatively expensive, since it iterates manually through all
> subdirectories of /proc to find open files. If the kernel had a better
> interface for this, that makes this less expensive, we might consider
> supporting that, but the iterating through /proc is simply too bad.
> In almost all cases the atime checks we do should be fully sufficient
> though. Do you have a case where they aren't?
> (Note that we do compare all unix sockets we find with /proc/net/unix
> though, which is relatively efficient still. Also, as unix sockets
> which are actively used do not get their atime bumped this is kinda a
> necessity to cover them nicely.)
> Lennart

Founder of Matrix AI

More information about the systemd-devel mailing list