mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #1065 from aboch/ov
Do not allow overlay destroySandbox() to be interrupted
This commit is contained in:
commit
d0cfd9b3dd
1 changed files with 6 additions and 7 deletions
|
@ -149,9 +149,9 @@ func (n *network) joinSubnetSandbox(s *subnet) error {
|
|||
|
||||
func (n *network) leaveSandbox() {
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
n.joinCnt--
|
||||
if n.joinCnt != 0 {
|
||||
n.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -162,15 +162,14 @@ func (n *network) leaveSandbox() {
|
|||
for _, s := range n.subnets {
|
||||
s.once = &sync.Once{}
|
||||
}
|
||||
n.Unlock()
|
||||
|
||||
n.destroySandbox()
|
||||
}
|
||||
|
||||
// to be called while holding network lock
|
||||
func (n *network) destroySandbox() {
|
||||
sbox := n.sandbox()
|
||||
if sbox != nil {
|
||||
for _, iface := range sbox.Info().Interfaces() {
|
||||
if n.sbox != nil {
|
||||
for _, iface := range n.sbox.Info().Interfaces() {
|
||||
if err := iface.Remove(); err != nil {
|
||||
logrus.Debugf("Remove interface %s failed: %v", iface.SrcName(), err)
|
||||
}
|
||||
|
@ -197,8 +196,8 @@ func (n *network) destroySandbox() {
|
|||
}
|
||||
}
|
||||
|
||||
sbox.Destroy()
|
||||
n.setSandbox(nil)
|
||||
n.sbox.Destroy()
|
||||
n.sbox = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue