Explorar o código

Check for isAgent() outside the network lock to avoid deadlocks

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Madhu Venugopal %!s(int64=9) %!d(string=hai) anos
pai
achega
83b0be7f1a
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      libnetwork/network.go

+ 2 - 1
libnetwork/network.go

@@ -702,12 +702,13 @@ func (n *network) driver(load bool) (driverapi.Driver, error) {
 	}
 
 	c := n.getController()
+	isAgent := c.isAgent()
 	n.Lock()
 	// If load is not required, driver, cap and err may all be nil
 	if cap != nil {
 		n.scope = cap.DataScope
 	}
-	if c.isAgent() || n.dynamic {
+	if isAgent || n.dynamic {
 		// If we are running in agent mode then all networks
 		// in libnetwork are local scope regardless of the
 		// backing driver.