Re: [pacman-dev] [PATCH 1/1] alpm: use flock() for db lock
On 07/06/17 07:56, Christian Hesse wrote:
Allan McRae <allan@archlinux.org> on Wed, 2017/06/07 07:37:
On 07/06/17 07:26, Christian Hesse wrote:
From: Christian Hesse <mail@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?
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
Allan McRae <allan@archlinux.org> on Wed, 2017/06/07 08:06:
On 07/06/17 07:56, Christian Hesse wrote:
Allan McRae <allan@archlinux.org> on Wed, 2017/06/07 07:37:
On 07/06/17 07:26, Christian Hesse wrote:
From: Christian Hesse <mail@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?
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.
Andrew provided a link. ;) There are some valid arguments against flock()... So yes, let's keep things as-is. :-p -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}
participants (2)
-
Allan McRae
-
Christian Hesse