Message ID | 20230913111013.77623-9-hch@lst.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:a8d:b0:3f2:4152:657d with SMTP id gr13csp10708vqb; Wed, 13 Sep 2023 11:42:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5zvjmuECJvomJqewXEjHcB0iSnBstOCjCpYejQzgIB4NrbULgGqJkaulQinyANmC3hJEJ X-Received: by 2002:a05:6a20:734f:b0:14e:2208:d62f with SMTP id v15-20020a056a20734f00b0014e2208d62fmr5235495pzc.22.1694630537403; Wed, 13 Sep 2023 11:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694630537; cv=none; d=google.com; s=arc-20160816; b=0ja3EG6lZlyT+QmpXFSUl0RpGQn3XAFyE/Gds0/9BFXK1bVWCFyrQ3LCkrK7fu+Q7Y 7DBH2AMzbeVZylWs2R2Dbf/qr5HGPCpWtdkT3hm8qJKWshbQlXzjIhuHNy25jdGKQ9Dw POiF36fdt+tr8/QBi9YXMROmRAhgIoA+taH0IFMkke9h3qb8g3Ph2DtCCPQ+D9lJ42Oa wfdf2FUH/Hn4ObXvVsWPeo0VMjVtIhLpTOd9zmapltT5x6tgxn7PVXbKTpYrKpQl3DkT tfFNswGcY/E1F80uX8h8knh8okFlxfX7CM2UrrlhDtK3YfcwQFgI+0r972ahRnXlydcK TSiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Xklao4KHcROHR/8WDTUTeOE5QrsYvb1TOynYxxAM1IY=; fh=BKhaubn3NgfOFdJuURkVVw5laQp2qzBZJf/ffKnJtu8=; b=oe2Vwj9WKjUnYK5Zys1E0FBqi9TE9HIn9aQx5cX8NLq1sbZYEiSqQHhasFL8RVGkk9 7puE0XvCbB6yE1C7ABROX4zRGOZbY5/byxRYqSUV6ofJcd8LLHDp5pBQpVcFAIb89wDQ E3LiBVD3nSBeNHZTCqJ8IMKY7ncB6qI/2TdcyXwPGyS2eHgtl76hUTK4SKlxan5dD2hm vmEMY+YhY7dXEfbUGRMGrzcB/XyB9VFfL9GIzZxpYFZOtp7jTBWSMLKUTwj676q3EN95 WoZE33bkiZxNPiUkbXWaCvjtlB383VJ0wk9XNLs2vY/1iUvO/bXIkOLsmhKeQq/6EnKF 9Qwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="0av/5m71"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id k14-20020aa788ce000000b0068e35157c11si10684232pff.112.2023.09.13.11.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 11:42:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="0av/5m71"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D64DD819D21C; Wed, 13 Sep 2023 04:11:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240052AbjIMLLU (ORCPT <rfc822;pwkd43@gmail.com> + 36 others); Wed, 13 Sep 2023 07:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239924AbjIMLLJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Sep 2023 07:11:09 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F5491BC3; Wed, 13 Sep 2023 04:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Xklao4KHcROHR/8WDTUTeOE5QrsYvb1TOynYxxAM1IY=; b=0av/5m717cplc+QOcwl88ZZhkv YQM9yzvQDx1wwNM1F4FN/+TZdcZakCPUB9tpX7qIKXviEYJGNiKL7nM6wzdoFpXYUwE8dRlxYP85n AheRdG3C68ZFMu0glT+SSrQiXRTWdZz1OA6HzM3aCxLykdLie2/UAUNYXAUOU8LULnl7dF85H1y3I bfHoOdc64/KYRLDOL+/ElcKMIOyRVN8LF7dTQpsazJCGbzefGXOUpSfMlN8KQMxT5w6XrbKzELime Ut1U2f7WzU7RHmh/n7g+ZCkfXpAq547wD8l7r+0tUECJw5acUGSocQEMGdzdnjGO/bAAnIc7s4T9b hrVh7h5Q==; Received: from [190.210.221.22] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qgNli-005hzf-03; Wed, 13 Sep 2023 11:10:50 +0000 From: Christoph Hellwig <hch@lst.de> To: Christian Brauner <brauner@kernel.org>, Al Viro <viro@zeniv.linux.org.uk> Cc: Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, Fenghua Yu <fenghua.yu@intel.com>, Reinette Chatre <reinette.chatre@intel.com>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com>, Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>, Tejun Heo <tj@kernel.org>, Trond Myklebust <trond.myklebust@hammerspace.com>, Anna Schumaker <anna@kernel.org>, Kees Cook <keescook@chromium.org>, Damien Le Moal <dlemoal@kernel.org>, Naohiro Aota <naohiro.aota@wdc.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org, linux-hardening@vger.kernel.org, cgroups@vger.kernel.org Subject: [PATCH 08/19] pstore: shrink the pstore_sb_lock critical section in pstore_kill_sb Date: Wed, 13 Sep 2023 08:10:02 -0300 Message-Id: <20230913111013.77623-9-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913111013.77623-1-hch@lst.de> References: <20230913111013.77623-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from <hch@infradead.org> by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 04:11:39 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776948910396030984 X-GMAIL-MSGID: 1776948910396030984 |
Series |
[01/19] fs: reflow deactivate_locked_super
|
|
Commit Message
Christoph Hellwig
Sept. 13, 2023, 11:10 a.m. UTC
->kill_sb can't race with creating ->fill_super because pstore is a
_single file system that only ever has a single sb instance, and we wait
for the previous one to go away before creating a new one. Reduce
the critical section so that is is not held over generic_shutdown_super.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/pstore/inode.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Wed, Sep 13, 2023 at 08:10:02AM -0300, Christoph Hellwig wrote: > ->kill_sb can't race with creating ->fill_super because pstore is a > _single file system that only ever has a single sb instance, and we wait > for the previous one to go away before creating a new one. Reduce > the critical section so that is is not held over generic_shutdown_super. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Thanks for the refactoring! Reviewed-by: Kees Cook <keescook@chromium.org>
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 585360706b335f..fd1d24b47160d0 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -467,10 +467,9 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type, static void pstore_kill_sb(struct super_block *sb) { - mutex_lock(&pstore_sb_lock); - WARN_ON(pstore_sb && pstore_sb != sb); - kill_litter_super(sb); + + mutex_lock(&pstore_sb_lock); pstore_sb = NULL; mutex_lock(&records_list_lock);