]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib/namespace: avoid double-mounting a /sys
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 24 Jul 2018 17:26:38 +0000 (19:26 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 27 Jul 2018 20:40:12 +0000 (13:40 -0700)
commit3655f788d3c1b3a081173cbada83726cdbdfe8dd
tree4ea3f5af70a66422d846d6886f328238f9113ba3
parentc8f7a754ed1e846270a895d9dc2a993d53700ade
lib/namespace: avoid double-mounting a /sys

This partly reverts 8f0807023d067e2bb585a2ae8da93e59689d10f1, bringing
back the umount(/sys) attempt.

In a LXC container we're unable to umount the sysfs instance, nor mount
a read-write one. We still are able to create a new read-only instance.

Nevertheless, it still makes sense to attempt the umount() even though
the sysfs is mounted read-only. Otherwise we may end up attempting to
mount a sysfs with the same flags as is already mounted, resulting in
an EBUSY error (meaning "Already mounted").

Perhaps this is not a very likely scenario in real world, but we hit
it in NetworkManager test suite and makes netns_switch() somewhat more
robust. It also fixes the case, when /sys wasn't mounted at all.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/namespace.c