Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions drivers/overlay/ov_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,15 @@ func (d *driver) DeleteNetwork(nid string) error {
}

d.Lock()
defer d.Unlock()
// Only perform a peer flush operation (if required) AFTER unlocking
// the driver lock to avoid deadlocking w/ the peerDB.
var doPeerFlush bool
defer func() {
d.Unlock()
if doPeerFlush {
d.peerFlush(nid)
}
}()

// This is similar to d.network(), but we need to keep holding the lock
// until we are done removing this network.
Expand All @@ -270,7 +278,7 @@ func (d *driver) DeleteNetwork(nid string) error {
}
}
// flush the peerDB entries
d.peerFlush(nid)
doPeerFlush = true
delete(d.networks, nid)

vnis, err := n.releaseVxlanID()
Expand Down