[pve-devel] [PATCH cluster 1/3] check correct error before releasing lock in cfs_lock
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Nov 6 11:11:23 CET 2017
On 11/02/2017 02:22 PM, Dominik Csapak wrote:
> after finishing the code in cfs_lock, we want to release the lock only
> when we got it before, so we need to check the correct lock
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> note: better would be a different approach than parsing the
> error message, because this was missed for quite some time
Patch 1 and 2 look good, but I agree on your note here.
I'll send a patch proposal which mirrors more the locking mechanisms
of the HA manager, which uses a $got_lock variable to track the lock
state instead of the error checking.
Much thanks for investigating and finding this issue!
> data/PVE/Cluster.pm | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
> index 70ce250..26523f1 100644
> --- a/data/PVE/Cluster.pm
> +++ b/data/PVE/Cluster.pm
> @@ -915,8 +915,9 @@ my $cfs_lock = sub {
> $err = "$msg: no quorum!\n";
> }
>
> - if (!$err || $err !~ /^got lock timeout -/) {
> - rmdir $filename; # cfs unlock
> + if (!$err || $err ne "got lock request timeout\n") {
> + # if we did get the lock, we unlock it
> + rmdir $filename;
> }
>
> if ($err) {
>
More information about the pve-devel
mailing list