aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-10-01 03:57:02 +0200
committerGitHub <noreply@github.com>2022-10-01 03:57:02 +0200
commit84aff621f562fd90b8d5302ab7052d28f51ded0a (patch)
treea6da730f7b8e68bb6d7d168b334f92775f20ae45
parent63c69f3b1592a3b76940debf3e3cc9fa11511bed (diff)
parenteb7f54ef6f48745c5c0d4b17a32ce252349362a4 (diff)
downloadpodman-84aff621f562fd90b8d5302ab7052d28f51ded0a.tar.gz
podman-84aff621f562fd90b8d5302ab7052d28f51ded0a.tar.bz2
podman-84aff621f562fd90b8d5302ab7052d28f51ded0a.zip
Merge pull request #16016 from Luap99/netns-cleanup
cleanup: always delete netns mount
-rw-r--r--libpod/networking_linux.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 6ea56ade5..5376ff8ad 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -695,23 +695,31 @@ func (r *Runtime) teardownNetNS(ctr *Container) error {
// do not return an error otherwise we would prevent network cleanup
logrus.Errorf("failed to free gvproxy machine ports: %v", err)
}
- if err := r.teardownCNI(ctr); err != nil {
- return err
- }
+
+ // Do not check the error here, we want to always umount the netns
+ // This will ensure that the container interface will be deleted
+ // even when there is a CNI or netavark bug.
+ prevErr := r.teardownCNI(ctr)
// First unmount the namespace
if err := netns.UnmountNS(ctr.state.NetNS); err != nil {
+ if prevErr != nil {
+ logrus.Error(prevErr)
+ }
return fmt.Errorf("unmounting network namespace for container %s: %w", ctr.ID(), err)
}
// Now close the open file descriptor
if err := ctr.state.NetNS.Close(); err != nil {
+ if prevErr != nil {
+ logrus.Error(prevErr)
+ }
return fmt.Errorf("closing network namespace for container %s: %w", ctr.ID(), err)
}
ctr.state.NetNS = nil
- return nil
+ return prevErr
}
func getContainerNetNS(ctr *Container) (string, *Container, error) {