From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH review 11/11] mnt: Honor MNT_LOCKED when detaching mounts Date: Wed, 07 Jan 2015 13:30:22 -0600 Message-ID: <87h9w2gzht.fsf@x220.int.ebiederm.org> References: <87mw5xq7lt.fsf@x220.int.ebiederm.org> <1420490787-14387-11-git-send-email-ebiederm@xmission.com> <20150107184334.GZ22149@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain Cc: Linux Containers , linux-fsdevel@vger.kernel.org, "Serge E. Hallyn" , Andy Lutomirski , Chen Hanxiao , Richard Weinberger , Andrey Vagin To: Al Viro Return-path: Received: from out02.mta.xmission.com ([166.70.13.232]:57803 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753600AbbAGTdI (ORCPT ); Wed, 7 Jan 2015 14:33:08 -0500 In-Reply-To: <20150107184334.GZ22149@ZenIV.linux.org.uk> (Al Viro's message of "Wed, 7 Jan 2015 18:43:34 +0000") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Al Viro writes: > On Mon, Jan 05, 2015 at 02:46:27PM -0600, Eric W. Biederman wrote: >> Modify umount(MNT_DETACH) to keep mounts in the hash table that are >> locked to their parent mounts, when the parent is lazily unmounted. >> In doing this invert the reference count so that the parent holds a >> reference to the children instead of the children holding a reference >> to the parent. >> >> Then in mntput_no_expire detach the children and in cleanup_mnt mntput >> the children and dput the dentry they were mounted on. >> >> In __detach_mounts if there are any mounts that have been unmounted >> but still are on the list of mounts of a mountpoint, detach those >> mounts and schedule them to be mntput and their reference to the dentry >> to be put when it becomes safe to sleep. > > Explicit description of your new refcounting rules, please. What's more, > how do those non-pinning children interact with e.g. copy_tree()? The parents hold a reference on the children, and the parent keeps track of it's children through the mnt_mounts list. The parents reference to a child is held until the final mntput of the parent. As for how those mounts interact with copy_tree, they aren't designed to. I had overlooked that collect_mounts is weird and if the proper race exists can be called on an unmounted tree. So I expect the interaction with copy_tree is buggy. I will look at that and see what I can do to fix that (it shouldn't be hard). I expect I can just return an error if the mount has been unmounted. Eric