The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6857

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
The following ensures that when requesting isLeader and an error is
returned, that the code correctly unlocks, otherwise you could end up
with a lockup.

I'm unsure how often this would happen, I found this just looking over
the codebase.
From bfce70ebc0199bbaa9d997184736f3f2ec0fdb88 Mon Sep 17 00:00:00 2001
From: Simon Richardson <stickup...@gmail.com>
Date: Sun, 9 Feb 2020 15:10:34 +0000
Subject: [PATCH] Unlock when isLeader failure

The following ensures that when requesting isLeader and an error is
returned, that the code correctly unlocks, otherwise you could end up
with a lockup.

I'm unsure how often this would happen, I found this just looking over
the codebase.
---
 lxd/cluster/gateway.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxd/cluster/gateway.go b/lxd/cluster/gateway.go
index 646e8f017a..7cda19b60c 100644
--- a/lxd/cluster/gateway.go
+++ b/lxd/cluster/gateway.go
@@ -700,6 +700,7 @@ func (g *Gateway) waitLeadership() error {
                g.lock.RLock()
                isLeader, err := g.isLeader()
                if err != nil {
+                       g.lock.RUnlock()
                        return err
                }
                if isLeader {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to