[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180503134317.GA30522@ZenIV.linux.org.uk>
Date: Thu, 3 May 2018 14:43:17 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Christian Brauner <christian.brauner@...onical.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
hch@...radead.org, tglx@...utronix.de,
kstewart@...uxfoundation.org, Greg KH <gregkh@...uxfoundation.org>,
pombredanne@...b.com, Linux API <linux-api@...r.kernel.org>
Subject: Re: [PATCH 0/6 resend] statfs: handle mount propagation
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/<pid>/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...
Powered by blists - more mailing lists