From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Sutter Subject: [iproute PATCHv2 1/2] ipnetns: Move NETNS_RUN_DIR into it's own propagation group Date: Tue, 5 Jul 2016 16:51:19 +0200 Message-ID: <1467730280-17493-2-git-send-email-phil@nwl.cc> References: <1467730280-17493-1-git-send-email-phil@nwl.cc> Cc: "Eric W . Biederman" , netdev@vger.kernel.org To: Stephen Hemminger Return-path: Received: from orbyte.nwl.cc ([151.80.46.58]:42772 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933141AbcGEOvj (ORCPT ); Tue, 5 Jul 2016 10:51:39 -0400 In-Reply-To: <1467730280-17493-1-git-send-email-phil@nwl.cc> Sender: netdev-owner@vger.kernel.org List-ID: On systems where the parent mount point is shared, NETNS_RUN_DIR inherits the parent's propagation group. This leads to netns mount points being propagated to the parent and thus showing up twice in the output of 'mount'. By making the newly mounted NETNS_RUN_DIR private first, then shared again, it will move to it's own propagation group which will still allow for netns mounts to propagate between mount namespaces but gets rid of the double netns entry at the same time. Suggested-by: Miklos Szeredi Signed-off-by: Phil Sutter --- ip/ipnetns.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index b3ee23c23aaa2..1cefe73c68bfc 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -650,6 +650,11 @@ static int netns_add(int argc, char **argv) NETNS_RUN_DIR, NETNS_RUN_DIR, strerror(errno)); return -1; } + if (mount("", NETNS_RUN_DIR, "none", MS_PRIVATE, NULL)) { + fprintf(stderr, "mount --make-private %s failed: %s\n", + NETNS_RUN_DIR, strerror(errno)); + return -1; + } made_netns_run_dir_mount = 1; } -- 2.8.2