[lxc-devel] [lxd/master] network: Fix rare race condition with sysctl

stgraber on Github lxc-bot at linuxcontainers.org
Fri Sep 30 16:59:08 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 540 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160930/00056f74/attachment.bin>
-------------- next part --------------
From d094e2d08e255cfb7d51e0a1092b7b2e1b7d6a04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 30 Sep 2016 12:58:00 -0400
Subject: [PATCH] network: Fix rare race condition with sysctl
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On very busy systems (like our Jenkins), a network interface may
disappear between the time we list the interfaces and the time we
attempt to set the sysctl, so just ignore ENOENT.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/networks.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/networks.go b/lxd/networks.go
index a85a0dd..66e7551 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -839,12 +839,12 @@ func (n *network) Start() error {
 				}
 
 				err := networkSysctl(fmt.Sprintf("ipv6/conf/%s/accept_ra", entry.Name()), "2")
-				if err != nil {
+				if err != nil && err != os.ErrNotExist {
 					return err
 				}
 
 				err = networkSysctl(fmt.Sprintf("ipv6/conf/%s/forwarding", entry.Name()), "1")
-				if err != nil {
+				if err != nil && err != os.ErrNotExist {
 					return err
 				}
 			}


More information about the lxc-devel mailing list