From 69257aa85cc5aabca2ea63ff16e9c3cbbb54ebad Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 22 Feb 2018 17:23:22 +0100 Subject: [PATCH] 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 --- lib/sandbox/sandbox.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sandbox/sandbox.go b/lib/sandbox/sandbox.go index a12a96ef..0b590586 100644 --- a/lib/sandbox/sandbox.go +++ b/lib/sandbox/sandbox.go @@ -485,6 +485,8 @@ func (s *Sandbox) NetNsRemove() error { return err } + s.netns.closed = true + if s.netns.restored { // we got namespaces in the form of // /var/run/netns/cni-0d08effa-06eb-a963-f51a-e2b0eceffc5d @@ -505,6 +507,5 @@ func (s *Sandbox) NetNsRemove() error { } } - s.netns.closed = true return nil }