Received: by 10.192.165.148 with SMTP id m20csp1870611imm; Thu, 3 May 2018 06:48:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoEN9NqdajeqZJ0jH7CxgT413KFYQEOLhlGpAkLM84pOPHQKM/LnM9xKnTX0eU4jSFXKrhb X-Received: by 2002:a63:b008:: with SMTP id h8-v6mr19327499pgf.448.1525355281061; Thu, 03 May 2018 06:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525355281; cv=none; d=google.com; s=arc-20160816; b=Rinb+ZCwjvgY2P53DWG1Cc/hQSOPIEqs4u6RTIeUmI2dALd1lVFT1hRv5LjOjjwDo+ VzFN7b7KR+joMYuhrJ0zGNRug/vqRIIID5iUmQjC7YqVwdmVphifK+5hNHn3jIOgB790 cTu/hZo4GCTFvCU8DO6SstruxBM4IUQYFUI7S51H497bk9PJvVV337DywtxNbL47YFdL 48fnp9F9mMmxNZg4eC/FQo7APp/7tpVhBNVXdZTbQ1+neN26DxO9KrsXgdm1ZMPgKNzF NNVYRUbssCo/L8wVvCjLLe+Diwz37bXJYa/TXHq572ToBp659r05FTpj3JLCANo6YJxu V/oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=aIky7PZtQEn8ymmBgjA17CmSsAcJRhId6YNETTB2vHM=; b=JxP2+e7wW+EpanWqFot8bGr6sPHAmpBmmI9iR1Bp/ygmPrEXXvLyj7G2rWeIFr/bnN F4E6Ni2XZ7k4F/SsVSI7XvKdm9TN+aZiaSiPpeXtE2EYw0Pvk0nLz5J/Z79qamLdGBVH 7YU5Q32SH0jtW67EOSuGUIEejAgPwtT9/wdTk5uuO28maDimN6kWcGy+Xloogget2fBE vJ2LFu7eJTT+jCFECNG2zDfpaQ+t9Kl/NAlTjpuuTb8kaNkLuhL0L6cIQbpmuIoDreeB jWj+wjxE61UfpqMBbtPpi9pHd6ELpKqZex7TDtUn+QqsbrX+3ozmO06bcHIXtuE0ZGFf NHVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6-v6si812567plm.99.2018.05.03.06.47.17; Thu, 03 May 2018 06:48:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751287AbeECNnX (ORCPT + 99 others); Thu, 3 May 2018 09:43:23 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:49172 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750944AbeECNnU (ORCPT ); Thu, 3 May 2018 09:43:20 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fEEVx-0001on-RF; Thu, 03 May 2018 13:43:17 +0000 Date: Thu, 3 May 2018 14:43:17 +0100 From: Al Viro To: Christian Brauner Cc: Linus Torvalds , linux-fsdevel@vger.kernel.org, Linux Kernel Mailing List , hch@infradead.org, tglx@linutronix.de, kstewart@linuxfoundation.org, Greg KH , pombredanne@nexb.com, Linux API Subject: Re: [PATCH 0/6 resend] statfs: handle mount propagation Message-ID: <20180503134317.GA30522@ZenIV.linux.org.uk> References: <20180502154239.14013-1-christian.brauner@ubuntu.com> <20180502160939.GU30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 03, 2018 at 03:04:36PM +0200, Christian Brauner wrote: > >From a userspace perspective we often run into the case where we simply > want to know whether a given mountpoint is MS_SHARED or is MS_SLAVE. > If it is we remount it as MS_PRIVATE to prevent any propagation from > happening. We don't care about the peer relationship or how the > propagation is exactly setup. We only want to prevent any propagation > from happening. So what's to stop you from doing exactly that -- mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL) without bothering with statfs() in the first place? It's not like the damn thing had been costly - it's O(mounts in your namespace) with not to high constant, and in any case cheaper than allocating all of them back when you did clone(2). Confused... > The above case is what I see most often. A more specific use-case is to > differentiate between MS_SLAVE and MS_SHARED mountpoints. > Mountpoints that are MS_SLAVE are kept intact and mountpoints that are > MS_SHARED are made MS_PRIVATE. > > For both cases the only way to do this right now is by parsing > /proc//mountinfo. Yes, it is doable but still it is somewhat costly > and annoying as e.g. those mount propagation fields are optional. Umm... And how would you get the list of mountpoints to feed to statfs() if not by parsing mountinfo? IDGI...