mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-16 09:23:04 +00:00
fix bug #273: retry flock if it fails with EINTR
This commit is contained in:
parent
e0cabd2caa
commit
b5d12b0845
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
|||||||
RELEASE=2.2
|
RELEASE=2.2
|
||||||
|
|
||||||
VERSION=1.0
|
VERSION=1.0
|
||||||
PKGREL=37
|
PKGREL=38
|
||||||
|
|
||||||
PACKAGE=libpve-common-perl
|
PACKAGE=libpve-common-perl
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package PVE::Tools;
|
package PVE::Tools;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use POSIX;
|
use POSIX qw(EINTR);
|
||||||
use IO::Socket::INET;
|
use IO::Socket::INET;
|
||||||
use IO::Select;
|
use IO::Select;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
@ -92,7 +92,15 @@ sub lock_file {
|
|||||||
|
|
||||||
if (!flock ($lock_handles->{$$}->{$filename}, LOCK_EX|LOCK_NB)) {
|
if (!flock ($lock_handles->{$$}->{$filename}, LOCK_EX|LOCK_NB)) {
|
||||||
print STDERR "trying to aquire lock...";
|
print STDERR "trying to aquire lock...";
|
||||||
if (!flock ($lock_handles->{$$}->{$filename}, LOCK_EX)) {
|
my $success;
|
||||||
|
while(1) {
|
||||||
|
$success = flock($lock_handles->{$$}->{$filename}, LOCK_EX);
|
||||||
|
# try again on EINTR (see bug #273)
|
||||||
|
if ($success || ($! != EINTR)) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$success) {
|
||||||
print STDERR " failed\n";
|
print STDERR " failed\n";
|
||||||
die "can't aquire lock - $!\n";
|
die "can't aquire lock - $!\n";
|
||||||
}
|
}
|
||||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
|||||||
|
libpve-common-perl (1.0-38) unstable; urgency=low
|
||||||
|
|
||||||
|
* fix bug #273: retry flock if it fails with EINTR
|
||||||
|
|
||||||
|
-- Proxmox Support Team <support@proxmox.com> Wed, 31 Oct 2012 08:21:43 +0100
|
||||||
|
|
||||||
libpve-common-perl (1.0-37) unstable; urgency=low
|
libpve-common-perl (1.0-37) unstable; urgency=low
|
||||||
|
|
||||||
* fix bug #264: use option pipefail for shell commands
|
* fix bug #264: use option pipefail for shell commands
|
||||||
|
Loading…
Reference in New Issue
Block a user