Browse code

Merge pull request #37252 from thaJeztah/bump-libnetwork

bump libnetwork to 19279f0492417475b6bfbd0aa529f73e8f178fb5

Vincent Demeester authored on 2018/06/11 15:23:05
Showing 4 changed files
... ...
@@ -3,7 +3,7 @@
3 3
 # LIBNETWORK_COMMIT is used to build the docker-userland-proxy binary. When
4 4
 # updating the binary version, consider updating github.com/docker/libnetwork
5 5
 # in vendor.conf accordingly
6
-LIBNETWORK_COMMIT=3931ba4d815e385ab97093c64477b82f14dadefb
6
+LIBNETWORK_COMMIT=19279f0492417475b6bfbd0aa529f73e8f178fb5
7 7
 
8 8
 install_proxy() {
9 9
 	case "$1" in
... ...
@@ -35,7 +35,7 @@ github.com/opentracing/opentracing-go 1361b9cd60be79c4c3a7fa9841b3c132e40066a7
35 35
 #get libnetwork packages
36 36
 
37 37
 # When updating, also update LIBNETWORK_COMMIT in hack/dockerfile/install/proxy accordingly
38
-github.com/docker/libnetwork 3931ba4d815e385ab97093c64477b82f14dadefb
38
+github.com/docker/libnetwork 19279f0492417475b6bfbd0aa529f73e8f178fb5
39 39
 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
40 40
 github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
41 41
 github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
... ...
@@ -244,7 +244,15 @@ func (d *driver) DeleteNetwork(nid string) error {
244 244
 	}
245 245
 
246 246
 	d.Lock()
247
-	defer d.Unlock()
247
+	// Only perform a peer flush operation (if required) AFTER unlocking
248
+	// the driver lock to avoid deadlocking w/ the peerDB.
249
+	var doPeerFlush bool
250
+	defer func() {
251
+		d.Unlock()
252
+		if doPeerFlush {
253
+			d.peerFlush(nid)
254
+		}
255
+	}()
248 256
 
249 257
 	// This is similar to d.network(), but we need to keep holding the lock
250 258
 	// until we are done removing this network.
... ...
@@ -270,7 +278,7 @@ func (d *driver) DeleteNetwork(nid string) error {
270 270
 		}
271 271
 	}
272 272
 	// flush the peerDB entries
273
-	d.peerFlush(nid)
273
+	doPeerFlush = true
274 274
 	delete(d.networks, nid)
275 275
 
276 276
 	vnis, err := n.releaseVxlanID()
... ...
@@ -279,7 +279,7 @@ const ingressChain = "DOCKER-INGRESS"
279 279
 
280 280
 var (
281 281
 	ingressOnce     sync.Once
282
-	ingressProxyMu  sync.Mutex
282
+	ingressMu       sync.Mutex // lock for operations on ingress
283 283
 	ingressProxyTbl = make(map[string]io.Closer)
284 284
 	portConfigMu    sync.Mutex
285 285
 	portConfigTbl   = make(map[PortConfig]int)
... ...
@@ -328,6 +328,9 @@ func programIngress(gwIP net.IP, ingressPorts []*PortConfig, isDelete bool) erro
328 328
 		addDelOpt = "-D"
329 329
 	}
330 330
 
331
+	ingressMu.Lock()
332
+	defer ingressMu.Unlock()
333
+
331 334
 	chainExists := iptables.ExistChain(ingressChain, iptables.Nat)
332 335
 	filterChainExists := iptables.ExistChain(ingressChain, iptables.Filter)
333 336
 
... ...
@@ -497,13 +500,11 @@ func plumbProxy(iPort *PortConfig, isDelete bool) error {
497 497
 
498 498
 	portSpec := fmt.Sprintf("%d/%s", iPort.PublishedPort, strings.ToLower(PortConfig_Protocol_name[int32(iPort.Protocol)]))
499 499
 	if isDelete {
500
-		ingressProxyMu.Lock()
501 500
 		if listener, ok := ingressProxyTbl[portSpec]; ok {
502 501
 			if listener != nil {
503 502
 				listener.Close()
504 503
 			}
505 504
 		}
506
-		ingressProxyMu.Unlock()
507 505
 
508 506
 		return nil
509 507
 	}
... ...
@@ -523,9 +524,7 @@ func plumbProxy(iPort *PortConfig, isDelete bool) error {
523 523
 		return err
524 524
 	}
525 525
 
526
-	ingressProxyMu.Lock()
527 526
 	ingressProxyTbl[portSpec] = l
528
-	ingressProxyMu.Unlock()
529 527
 
530 528
 	return nil
531 529
 }