[pacman-dev] [PATCH 1/1] alpm: use flock() for db lock

Allan McRae allan at archlinux.org
Tue Jun 6 22:06:41 UTC 2017


On 07/06/17 07:56, Christian Hesse wrote:
> Allan McRae <allan at archlinux.org> on Wed, 2017/06/07 07:37:
>> On 07/06/17 07:26, Christian Hesse wrote:
>>> From: Christian Hesse <mail at eworm.de>
>>>
>>> We used to check for file existens, but that suffers from stale lock
>>> files caused by unexpected events like crash, shutdown, etc.
>>>
>>> Instead use flock() to lock the file. It does not matter whether or
>>> not the file exists but whether an exclusive lock can be obtained.
>>>
>>> Also remove the hint about removing the file from pacman.  
>>
>> This does not work with NFS filesystems.
> 
> Uh, did not know NFS has issues here. However, this is from NFS FAQ [0]:
> 
>> The NFS client in 2.6.12 provides support for flock()/BSD locks on NFS files
>> by emulating the BSD-style locks in terms of POSIX byte range locks. Other
>> NFS clients that use the same emulation mechanism, or that use fcntl()/POSIX
>> locks, will then see the same locks that the Linux NFS client sees.
> 
> Given the fact that linux 2.6.12 has been released nearly twelve years ago...
> We still do not want to use this?
> 
> Does any other locking mechanism has a chance to be accepted?
> 
> [0] http://nfs.sourceforge.net/#faq_d10
> 

Bringing back on list.

We has issues with NFS/OSX last time this was run (need to look up last
time this was discussed).  I think out support for OSX is dead, so we
could ignore that...

I would not mind flock being used to lock individual files, but leaving
an overall lock file during a transaction is useful.

A


More information about the pacman-dev mailing list