sandbox net: set netns closed after actaully closing it

Umount/Remove below can go wrong and next calls to NetNsRemove would
trigger:

 481 Feb 22 14:37:35 ip-172-31-48-190.ec2.internal
atomic-openshift-node[88937]: E0222 14:37:35.291692   88937
remote_runtime.g     o:115] StopPodSandbox
"200a062985ebfda2bbdb1b5d724005d4a0c1be54f277a4de52f9f101d9c43db6" from
runtime service failed: rpc      error: code = Unknown desc = close
/var/run/netns/k8s_psql-1-tht5r_bingli328usyu727s_6a7b8edc-174d-11e8-9e8f-0a46c474dfe0_
0-dda1c649: file already closed

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2018-02-22 17:23:22 +01:00
parent 1c540236d1
commit 69257aa85c
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -485,6 +485,8 @@ func (s *Sandbox) NetNsRemove() error {
return err return err
} }
s.netns.closed = true
if s.netns.restored { if s.netns.restored {
// we got namespaces in the form of // we got namespaces in the form of
// /var/run/netns/cni-0d08effa-06eb-a963-f51a-e2b0eceffc5d // /var/run/netns/cni-0d08effa-06eb-a963-f51a-e2b0eceffc5d
@ -505,6 +507,5 @@ func (s *Sandbox) NetNsRemove() error {
} }
} }
s.netns.closed = true
return nil return nil
} }