From patchwork Tue Aug 1 15:46:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Casey Callendrello X-Patchwork-Id: 796300 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=coreos.com header.i=@coreos.com header.b="NVLWcgN8"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xMLJl2sJRz9sR9 for ; Wed, 2 Aug 2017 01:46:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751817AbdHAPqN (ORCPT ); Tue, 1 Aug 2017 11:46:13 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:38746 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599AbdHAPqM (ORCPT ); Tue, 1 Aug 2017 11:46:12 -0400 Received: by mail-wm0-f48.google.com with SMTP id m85so18634351wma.1 for ; Tue, 01 Aug 2017 08:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coreos.com; s=google; h=from:to:subject:date:message-id; bh=TN0uQkFqbWgf3F4d93Iekyd/9GJsKS48sHQWmzpXuf0=; b=NVLWcgN8fBVmCsvqf20uJxj6qHQtJWF89GZOmRiUEdurxngSXmJ8RFvEjOAiHGTDT8 NCx+nLdi9luVxUz1fTvXYJt2ulDRS/J7WimJ8LzLpcnEYqnCbJCapJWZRKDWmuzkhEB2 ullLkVJEcuL0cK1YAsCqE+1ZJeawO9F8WDvws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=TN0uQkFqbWgf3F4d93Iekyd/9GJsKS48sHQWmzpXuf0=; b=HhwUzGhOODLllsRxaBK/Emehod1mhMfPRAOJ0vIdzt3jFQk92KAzWiLEM+CQQDynFX r2nmGO+ISHEgM0pfkCWEi2rlBa/l+dT/jM3Zcl9oYey2BLzQNfOx6o0Oz0jwF+AhIyTg E48j67CpwECL4nlJZK/9TtSlEnEc42D85DroYhEnppaRhRdZKw931MWd4zH81/mh5GYz Qe0+VtfJmcYcKOQSC/KzcO1kGTh35+1n6a3J1LfPCSYK3MT+gTBIBEq5trFeStvYTcum uclCqWh/RLFgQH/aW6JKFDiKLyW3uGxLi8x6uQROa4wDeXy8HPR+yVHno6FeeJ8U/jtc Rv2A== X-Gm-Message-State: AIVw110HYuPQ/48AV4RusgSecVxtZ9gA25uCEFhbHFgZP+/HmRtPdKOO jGQ+IyEqExlpFGeSOLtITg== X-Received: by 10.80.194.193 with SMTP id u1mr16126061edf.103.1501602370875; Tue, 01 Aug 2017 08:46:10 -0700 (PDT) Received: from localhost.ber.coreos.systems ([2001:470:6d:7bf:6a6d:bf70:e819:f5ed]) by smtp.gmail.com with ESMTPSA id f29sm99369edd.23.2017.08.01.08.46.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Aug 2017 08:46:10 -0700 (PDT) From: Casey Callendrello To: netdev@vger.kernel.org, stephen@networkplumber.org Subject: [PATCH iproute2] netns: make /var/run/netns bind-mount recursive Date: Tue, 1 Aug 2017 17:46:09 +0200 Message-Id: <20170801154609.29895-1-casey.callendrello@coreos.com> X-Mailer: git-send-email 2.13.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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" --- ip/ipnetns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 198e9de8..9ee1fe6a 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;