From: Casey Callendrello Date: Tue, 1 Aug 2017 15:46:09 +0000 (+0200) Subject: netns: make /var/run/netns bind-mount recursive X-Git-Tag: v4.13.0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6a4076b6ba6547d7e52c377a7c58c56eb5ea16e;p=thirdparty%2Fiproute2.git netns: make /var/run/netns bind-mount recursive When ip netns {add|delete} is first run, it bind-mounts /var/run/netns on top of itself, then marks it as shared. However, if there are already bind-mounts in the directory from other tools, these would not be propagated. Fix this by recursively bind-mounting. Signed-off-by: Casey Callendrello Acked-by: "Eric W. Biederman" --- diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 198e9de8c..9ee1fe6a5 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -636,7 +636,7 @@ static int netns_add(int argc, char **argv) } /* Upgrade NETNS_RUN_DIR to a mount point */ - if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND, NULL)) { + if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND | MS_REC, NULL)) { fprintf(stderr, "mount --bind %s %s failed: %s\n", NETNS_RUN_DIR, NETNS_RUN_DIR, strerror(errno)); return -1;