Ver código fonte

Merge pull request #1253 from mrjana/overlay

Purge vniTbl after cleaning up network sandbox
Alessandro Boch 9 anos atrás
pai
commit
7933b04775
1 arquivos alterados com 13 adições e 0 exclusões
  1. 13 0
      libnetwork/drivers/overlay/ov_network.go

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

@@ -475,6 +475,19 @@ func (n *network) cleanupStaleSandboxes() {
 				deleteVxlanByVNI(path, 0)
 				syscall.Unmount(path, syscall.MNT_DETACH)
 				os.Remove(path)
+
+				// Now that we have destroyed this
+				// sandbox, remove all references to
+				// it in vniTbl so that we don't
+				// inadvertently destroy the sandbox
+				// created in this life.
+				networkMu.Lock()
+				for vni, tblPath := range vniTbl {
+					if tblPath == path {
+						delete(vniTbl, vni)
+					}
+				}
+				networkMu.Unlock()
 			}
 
 			return nil