[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Transitioning from existence-based lockfiles and /var/lock to flock



On Mon, Oct 13, 2025 at 11:26:39AM -0700, Russ Allbery wrote:
> Josh Triplett <josh@joshtriplett.org> writes:
> 
> > - Software should not use existence-based lockfiles (where the existence
> >   of the lockfile constitutes holding the lock); software should use
> >   file-based locking (`flock`) on an appropriate file instead.
> > - Where possible, software should apply `flock` to an appropriate target
> >   file rather than a dedicated lockfile. For instance, if locking a
> >   device or a data file, software should `flock` the device file or data
> >   file, rather than creating a separate file to lock.
> 
> Way back in the day, it used to matter whether you used flock or fcntl and
> one type of lock was potentially invisible to the other type of lock. Has
> this been fixed, or is that still a concern?

There are also issues with NFS to consider.

Cheers,
-- 
Bill. <ballombe@debian.org>

Imagine a large red swirl here. 


Reply to: