From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5CC0C4332F for ; Sat, 19 Feb 2022 05:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238349AbiBSFu7 (ORCPT ); Sat, 19 Feb 2022 00:50:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236043AbiBSFuz (ORCPT ); Sat, 19 Feb 2022 00:50:55 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF713BDE44; Fri, 18 Feb 2022 21:50:36 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLIdf-002uw8-6x; Sat, 19 Feb 2022 05:50:35 +0000 Date: Sat, 19 Feb 2022 05:50:35 +0000 From: Al Viro To: Rik van Riel Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, linux-fsdevel@vger.kernel.org, paulmck@kernel.org, gscrivan@redhat.com, Eric Biederman , Chris Mason Subject: Re: [PATCH 1/2] vfs: free vfsmount through rcu work from kern_unmount Message-ID: References: <20220218183114.2867528-1-riel@surriel.com> <20220218183114.2867528-2-riel@surriel.com> <5f442a7770fe4ac06b2837e4f937d559f5d17b8b.camel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 18, 2022 at 09:06:31PM +0000, Al Viro wrote: > FWIW, that won't work correctly wrt failure exits. I'm digging > through the lifetime rules in there right now, will post when > I'm done. OK, now that I'd reconstructed the picture... The problems with delayed shutdown are prevented by mq_clear_sbinfo() call in there - mqueue is capable of more or less gracefully dealing with having ->s_fs_info ripped from under it, which is what that thing does. Before the kern_unmount(). And since that code is non-modular, we don't need to protect that either. IOW, having void put_ipc_ns(struct ipc_namespace *ns) { if (refcount_dec_and_lock(&ns->ns.count, &mq_lock)) { mq_clear_sbinfo(ns); spin_unlock(&mq_lock); free_ipc_ns(ns); } } and void mq_put_mnt(struct ipc_namespace *ns) { /* * The only reason it's safe to have the mntput async * is that we'd already ripped the ipc_namespace away * from the mqueue superblock, by having called * mq_clear_sbinfo(). * * NOTE: kern_unmount_rcu() IS NOT SAFE TO USE * WITHOUT SERIOUS PRECAUTIONS. * * Anything that is used by filesystem must either * be already taken away (and fs must survive that) * or have its destruction delayed until the superblock * shutdown. * */ kern_unmount_rcu(ns->mq_mnt); } would suffice. free_ipc_work/free_ipc/mnt_llist can be killed off.