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

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) ===

From c7222499e4537ea633ebfd241b7c7ab5d4737331 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Tue, 5 Dec 2017 02:12:09 -0500
Subject: [PATCH 1/2] travis: Bump Go versions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <[email protected]>
---
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index da615e2d8..643ebffc7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,8 +4,8 @@ os:
   - osx
 
 go:
-  - 1.6
-  - 1.7
+  - 1.8
+  - 1.9
   - tip
 
 matrix:

From d3429336fa1a75dadf4ade1b62ed34a4e8a88506 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]>
Date: Tue, 5 Dec 2017 02:41:06 -0500
Subject: [PATCH 2/2] devlxd: Properly lock the internal struct
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <[email protected]>
---
 lxd/devlxd.go | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lxd/devlxd.go b/lxd/devlxd.go
index 90a2b29d2..6b0b543dc 100644
--- a/lxd/devlxd.go
+++ b/lxd/devlxd.go
@@ -10,6 +10,7 @@ import (
        "regexp"
        "strconv"
        "strings"
+       "sync"
        "unsafe"
 
        "github.com/gorilla/mux"
@@ -181,6 +182,7 @@ type ucred struct {
 
 type ConnPidMapper struct {
        m map[*net.UnixConn]*ucred
+       mLock sync.Mutex
 }
 
 func (m *ConnPidMapper) ConnStateHandler(conn net.Conn, state http.ConnState) {
@@ -191,7 +193,9 @@ func (m *ConnPidMapper) ConnStateHandler(conn net.Conn, 
state http.ConnState) {
                if err != nil {
                        logger.Debugf("Error getting ucred for conn %s", err)
                } else {
+                       m.mLock.Lock()
                        m.m[unixConn] = cred
+                       m.mLock.Unlock()
                }
        case http.StateActive:
                return
@@ -206,9 +210,13 @@ func (m *ConnPidMapper) ConnStateHandler(conn net.Conn, 
state http.ConnState) {
                 * more. Whatever the case, we want to forget about it since we
                 * won't see it either.
                 */
+               m.mLock.Lock()
                delete(m.m, unixConn)
+               m.mLock.Unlock()
        case http.StateClosed:
+               m.mLock.Lock()
                delete(m.m, unixConn)
+               m.mLock.Unlock()
        default:
                logger.Debugf("Unknown state for connection %s", state)
        }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to