[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zjd7pn0o.fsf@x220.int.ebiederm.org>
Date: Tue, 07 Oct 2014 14:50:47 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Andy Lutomirski <luto@...capital.net>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Andrey Vagin <avagin@...nvz.org>,
Linux FS Devel <linux-fsdevel@...r.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Andrey Vagin <avagin@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
Pavel Emelyanov <xemul@...allels.com>,
Serge Hallyn <serge.hallyn@...onical.com>,
Rob Landley <rob@...dley.net>
Subject: Re: [PATCH] [RFC] mnt: add ability to clone mntns starting with the current root
Andy Lutomirski <luto@...capital.net> writes:
> On Tue, Oct 7, 2014 at 2:26 PM, Eric W. Biederman <ebiederm@...ssion.com> wrote:
>> Andy Lutomirski <luto@...capital.net> writes:
>>
>>> Why should MNT_LOCKED on submounts be enforced?
>>>
>>> Is it because, if you retain a reference to the detached tree, then
>>> you can see under the submounts?
>>
>> Yes. MNT_DETACH is a recursive operation that detaches all of the mount
>> and all of it's submounts. Which means you can see under the submounts
>> if you have a reference to a detached mount.
>>
>>> If so, let's fix *that*. Because
>>> otherwise the whole model of pivot_root + detach will break.
>>
>> I am not certain what you are referring to. pivot_root doesn't
>> manipulate the mount tree so you can see under anything.
>>
>> What I believe is the appropriate fix is to fail umount2(...,MNT_DETACH)
>> if there are any referenced mount points being detached that have a
>> locked submount.
>
> Most of the container-using things do, roughly:
>
> Unshare userns and mountns
> Mount some new stuff
> pivot_root to the new stuff
> MNT_DETACH the old.
>
> That last step will almost always fail if you make this change.
I don't think so.
I expect I could add full busy detection of normal umounts and those
applications would not fail.
What I am proposing is a more targeted version of busy detection that
looks at each mount in the set that detach will unmount. For each mount
if it is busy with non-submount references and it has at least one
locked submount fail the detach with -EBUSY.
Do you really think we have userspace references to the one or more of the
mounts under old?
Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists