naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame SOURCES/0147-netns-make-var-run-netns-bind-mount-recursive.patch

e138d9
From 1e13fc4c604f91c5d38b889824e2dfee1bd17c34 Mon Sep 17 00:00:00 2001
e138d9
From: Andrea Claudi <aclaudi@redhat.com>
e138d9
Date: Fri, 15 Nov 2019 12:02:31 +0100
e138d9
Subject: [PATCH] netns: make /var/run/netns bind-mount recursive
e138d9
e138d9
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1772827
e138d9
Upstream Status: iproute2.git commit d6a4076b6ba65
e138d9
e138d9
commit d6a4076b6ba6547d7e52c377a7c58c56eb5ea16e
e138d9
Author: Casey Callendrello <casey.callendrello@coreos.com>
e138d9
Date:   Tue Aug 1 17:46:09 2017 +0200
e138d9
e138d9
    netns: make /var/run/netns bind-mount recursive
e138d9
e138d9
    When ip netns {add|delete} is first run, it bind-mounts /var/run/netns
e138d9
    on top of itself, then marks it as shared. However, if there are already
e138d9
    bind-mounts in the directory from other tools, these would not be
e138d9
    propagated. Fix this by recursively bind-mounting.
e138d9
e138d9
    Signed-off-by: Casey Callendrello <casey.callendrello@coreos.com>
e138d9
    Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
e138d9
---
e138d9
 ip/ipnetns.c | 2 +-
e138d9
 1 file changed, 1 insertion(+), 1 deletion(-)
e138d9
e138d9
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
e138d9
index 427b59c57381d..c8e22e9b6e952 100644
e138d9
--- a/ip/ipnetns.c
e138d9
+++ b/ip/ipnetns.c
e138d9
@@ -640,7 +640,7 @@ static int netns_add(int argc, char **argv)
e138d9
 		}
e138d9
 
e138d9
 		/* Upgrade NETNS_RUN_DIR to a mount point */
e138d9
-		if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND, NULL)) {
e138d9
+		if (mount(NETNS_RUN_DIR, NETNS_RUN_DIR, "none", MS_BIND | MS_REC, NULL)) {
e138d9
 			fprintf(stderr, "mount --bind %s %s failed: %s\n",
e138d9
 				NETNS_RUN_DIR, NETNS_RUN_DIR, strerror(errno));
e138d9
 			return -1;
e138d9
-- 
e138d9
2.21.0
e138d9