From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH review 11/11] mnt: Honor MNT_LOCKED when detaching mounts Date: Thu, 8 Jan 2015 03:02:29 +0000 Message-ID: <20150108030229.GD22149@ZenIV.linux.org.uk> References: <87mw5xq7lt.fsf@x220.int.ebiederm.org> <1420490787-14387-11-git-send-email-ebiederm@xmission.com> <20150107184334.GZ22149@ZenIV.linux.org.uk> <87h9w2gzht.fsf@x220.int.ebiederm.org> <20150107205239.GB22149@ZenIV.linux.org.uk> <87iogi8dka.fsf@x220.int.ebiederm.org> <20150108002227.GC22149@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linux Containers , linux-fsdevel@vger.kernel.org, "Serge E. Hallyn" , Andy Lutomirski , Chen Hanxiao , Richard Weinberger , Andrey Vagin , Linus Torvalds To: "Eric W. Biederman" Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:50411 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752151AbbAHDCf (ORCPT ); Wed, 7 Jan 2015 22:02:35 -0500 Content-Disposition: inline In-Reply-To: <20150108002227.GC22149@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Thu, Jan 08, 2015 at 12:22:27AM +0000, Al Viro wrote: > Not sure if I like the use of mnt_child between mntput_no_expire() and > cleanup_mnt() - it's probably safe, but the fewer lists we modify outside of > mount hash lock, the better; hell knows, I'll need to stare at that code > a bit more. FWIW, AFAICS the refcount rules with your variant are > * external references countribute > * mnt_parent contributes unless it points to ourselves *or* mnt_ns is > NULL > * reachable from mount hash => add 1 > * in addition to the wart around namespace_unlock(), we have a similar > wart between mntput_no_expire() and cleanup_mnt(), only there we thread the > suckers on mnt_child instead of mnt_list and use slightly different logics to > prevent shutdown of parent fs before the dput(mountpoint). BTW, why do you use detach_mnt() in __detach_mounts()? Unless I'm missing something really subtle, __detach_mnt() is the right thing there... And while we are at it, all other callers of detach_mnt() are followed by attach_mnt() within the same namespace *and* all attach_mnt() follow detach_mnt(). So why bother with mnt_list in either? Or, put it another way, why have __detach_mnt() separate from detach_mnt()?