From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <shemming@brocade.com>
Cc: "Eric W . Biederman" <ebiederm@xmission.com>, netdev@vger.kernel.org
Subject: [iproute PATCH 2/2] ipnetns: Make netns mount points private
Date: Tue, 5 Jul 2016 16:42:53 +0200 [thread overview]
Message-ID: <1467729773-16751-3-git-send-email-phil@nwl.cc> (raw)
In-Reply-To: <1467729773-16751-1-git-send-email-phil@nwl.cc>
On systems with a shared /proc mount point, the netns mounts inherit
that propagation group and therefore cause unnecessary overhead upon
netns deletion.
In order to achieve this, the MS_REC flag when making NETNS_RUN_DIR
shared has to be removed as well or otherwise it will make existing
netns mount points shared again.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
ip/ipnetns.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 1cefe73c68bfc..acaedd5894e6c 100644
--- a/ip/ipnetns.c
+++ b/ip/ipnetns.c
@@ -636,7 +636,7 @@ static int netns_add(int argc, char **argv)
* file in all namespaces allowing the network namespace to be freed
* sooner.
*/
- while (mount("", NETNS_RUN_DIR, "none", MS_SHARED | MS_REC, NULL)) {
+ while (mount("", NETNS_RUN_DIR, "none", MS_SHARED, NULL)) {
/* Fail unless we need to make the mount point */
if (errno != EINVAL || made_netns_run_dir_mount) {
fprintf(stderr, "mount --make-shared %s failed: %s\n",
@@ -678,6 +678,11 @@ static int netns_add(int argc, char **argv)
netns_path, strerror(errno));
goto out_delete;
}
+ if (mount("", netns_path, "none", MS_PRIVATE, NULL)) {
+ fprintf(stderr, "mount --make-private %s failed: %s\n",
+ netns_path, strerror(errno));
+ return -1;
+ }
return 0;
out_delete:
netns_delete(argc, argv);
--
2.8.2
next prev parent reply other threads:[~2016-07-05 14:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-05 14:42 [iproute PATCH 0/2] Netns performance improvements Phil Sutter
2016-07-05 14:42 ` [iproute PATCH 1/2] ipnetns: Move NETNS_RUN_DIR into it's own propagation group Phil Sutter
2016-07-05 14:42 ` Phil Sutter [this message]
2016-07-05 14:44 ` [iproute PATCH 0/2] Netns performance improvements Eric W. Biederman
2016-07-05 20:51 ` Phil Sutter
2016-07-07 4:58 ` Eric W. Biederman
2016-07-07 11:17 ` Phil Sutter
2016-07-07 12:59 ` Nicolas Dichtel
2016-07-07 15:48 ` Phil Sutter
2016-07-07 16:16 ` Rick Jones
2016-07-07 16:34 ` Eric W. Biederman
2016-07-07 17:28 ` Rick Jones
2016-07-08 8:12 ` Eric W. Biederman
2016-07-08 14:31 ` Brian Haley
2016-07-08 8:01 ` Nicolas Dichtel
2016-07-08 17:18 ` Rick Jones
2016-07-11 12:51 ` Nicolas Dichtel
2016-07-05 14:49 ` Phil Sutter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1467729773-16751-3-git-send-email-phil@nwl.cc \
--to=phil@nwl.cc \
--cc=ebiederm@xmission.com \
--cc=netdev@vger.kernel.org \
--cc=shemming@brocade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).