Sfoglia il codice sorgente

Merge pull request #1911 from cpuguy83/fix_missing_lockosthread_master

Lock goroutine to OS thread while changing NS
Madhu Venugopal 7 anni fa
parent
commit
07354ab656
1 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. 5 0
      libnetwork/drivers/overlay/ov_network.go

+ 5 - 0
libnetwork/drivers/overlay/ov_network.go

@@ -8,6 +8,7 @@ import (
 	"os"
 	"os/exec"
 	"path/filepath"
+	"runtime"
 	"strconv"
 	"strings"
 	"sync"
@@ -81,6 +82,10 @@ func setDefaultVlan() {
 		logrus.Error("insufficient number of arguments")
 		os.Exit(1)
 	}
+
+	runtime.LockOSThread()
+	defer runtime.UnlockOSThread()
+
 	nsPath := os.Args[1]
 	ns, err := netns.GetFromPath(nsPath)
 	if err != nil {