plugins/pkg
Ihar Hrachyshka 112288ecb2 Unlock OS thread after netns is restored
The current ns package code is very careful about not leaving the calling
thread with the overridden namespace set, for example when origns.Set() fails.
This is achieved by starting a new green thread, locking its OS thread, and
never unlocking it. Which makes golang runtime to scrap the OS thread backing
the green thread after the go routine exits.

While this works, it's probably not as optimal: stopping and starting a new OS
thread is expensive and may be avoided if we unlock the thread after resetting
network namespace to the original. On the other hand, if resetting fails, it's
better to leave the thread locked and die.

While it won't work in all cases, we can still make an attempt to reuse the OS
thread when resetting the namespace succeeds. This can be achieved by unlocking
the thread conditionally to the namespace reset success.

Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
2020-02-20 17:24:36 -05:00
..
hns [Windows] Adds optional loopbackDSR argument to cni config. 2019-07-31 15:45:54 -07:00
ip pkg/ip: use type cast instead of untrusty error message 2020-01-29 20:03:15 +08:00
ipam pkg/ipam : use delegateArgs instead of env set/unset in ipam.ExecDel 2019-06-18 21:02:01 +08:00
ns Unlock OS thread after netns is restored 2020-02-20 17:24:36 -05:00
testutils testutils: newNS() works in a rootless user namespace 2019-10-19 12:04:53 +02:00
utils pkg/utils: sysctl package should use black-box testing 2020-01-27 21:09:04 +08:00