Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp2011915pxb; Fri, 18 Feb 2022 23:09:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJysCsIL+As75OMBCPqr6jKh/HCxF88B0Z7kCABUnW2+zN7UsF1i5UqChfHwAo7IeFn9Sssq X-Received: by 2002:a63:8449:0:b0:372:b85f:debb with SMTP id k70-20020a638449000000b00372b85fdebbmr9096338pgd.103.1645254562782; Fri, 18 Feb 2022 23:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645254562; cv=none; d=google.com; s=arc-20160816; b=IKyVTQTnCiGI/L3zrigRCchcLmKX3o0sl/VTNoPWd/wWZhWzW+Qh4lAcEwDDZA84u+ dc1SJFirC7TrefrEmRB5Fb4f4/9LCar7gftVMZhJ+dv+BCES0coCvQvy6QFlbAZdczgZ MP5J4wpjc1UVzY0uZKbDUQlig8188/oLUXWaA46CQ8R0chX9XCpACIg9BmbjnHzFgcLU qxSq4TzJY3I5WqneO9fejN8YGvalhMShlCRQlDlxrAmjCSI5La/sRfQ4dYUNSc8hJm8r Pv5RPIuyWF2m8o7iwZnEg+TEdaRMvufu7Fvc8dwqi6vdiANeDuAs+KMqFoE+al1enpz4 lRcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=US8eMNkdkLeDvIsfCt3EJx4yaImTugG6cTxKEGx49o4=; b=HlFSLS42zkB+rG44rB9Z7prg4068XYbLqxypPhPn5GYh7qYDzAmz8ZZBQJ6+yW2ZxY O1G0bsbjLIAiyeA7GBu+FUrrGA75P3Ai4b74q/4JeKixPNbTxok0jXxs4xWJemCZpN/m of6Jh9q4jeZCA7hDtl5OEkQK6nvsqnVz6rIoYfrp3kKBENorX82w1fNiepSPKIxhGVmU nbcTDVvAllpHO0T1aGF5jW2gsoJV4NotxkrtbdMLMzC+Sra77gEN0O0jwADde/5NSTfa ddxXAkAiccE58pLQksc9Pj70DpTBSnoJjRygtDIpbK9VlPzoTIErThQBsJACrHq1s76y F/XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p17si3038490pgm.846.2022.02.18.23.09.07; Fri, 18 Feb 2022 23:09:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237695AbiBSFu6 (ORCPT + 99 others); Sat, 19 Feb 2022 00:50:58 -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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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.