浏览代码

Merge pull request #1911 from cpuguy83/fix_missing_lockosthread_master

Lock goroutine to OS thread while changing NS
Madhu Venugopal 7 年之前
父节点
当前提交
07354ab656
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      libnetwork/drivers/overlay/ov_network.go

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

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