aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/containernetworking/plugins/pkg/ns
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2020-05-14 08:59:10 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2020-05-14 07:22:48 -0400
commit9f0845ca43c67e2282669d99fb4ea2c925ec4ff4 (patch)
tree3c331f6625f13e6f713afe7ceaca5e69f25b1f4b /vendor/github.com/containernetworking/plugins/pkg/ns
parent150679d7b10ad56b7f41d22810eb2c421edf9da5 (diff)
downloadpodman-9f0845ca43c67e2282669d99fb4ea2c925ec4ff4.tar.gz
podman-9f0845ca43c67e2282669d99fb4ea2c925ec4ff4.tar.bz2
podman-9f0845ca43c67e2282669d99fb4ea2c925ec4ff4.zip
Bump github.com/containernetworking/plugins from 0.8.5 to 0.8.6
Bumps [github.com/containernetworking/plugins](https://github.com/containernetworking/plugins) from 0.8.5 to 0.8.6. - [Release notes](https://github.com/containernetworking/plugins/releases) - [Commits](https://github.com/containernetworking/plugins/compare/v0.8.5...v0.8.6) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/containernetworking/plugins/pkg/ns')
-rw-r--r--vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go b/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go
index 31ad5f622..a34f97170 100644
--- a/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go
+++ b/vendor/github.com/containernetworking/plugins/pkg/ns/ns_linux.go
@@ -178,7 +178,16 @@ func (ns *netNS) Do(toRun func(NetNS) error) error {
if err = ns.Set(); err != nil {
return fmt.Errorf("error switching to ns %v: %v", ns.file.Name(), err)
}
- defer threadNS.Set() // switch back
+ defer func() {
+ err := threadNS.Set() // switch back
+ if err == nil {
+ // Unlock the current thread only when we successfully switched back
+ // to the original namespace; otherwise leave the thread locked which
+ // will force the runtime to scrap the current thread, that is maybe
+ // not as optimal but at least always safe to do.
+ runtime.UnlockOSThread()
+ }
+ }()
return toRun(hostNS)
}
@@ -193,6 +202,10 @@ func (ns *netNS) Do(toRun func(NetNS) error) error {
var wg sync.WaitGroup
wg.Add(1)
+ // Start the callback in a new green thread so that if we later fail
+ // to switch the namespace back to the original one, we can safely
+ // leave the thread locked to die without a risk of the current thread
+ // left lingering with incorrect namespace.
var innerError error
go func() {
defer wg.Done()