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 12C45C61DA4 for ; Wed, 15 Mar 2023 12:27:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232129AbjCOM1O (ORCPT ); Wed, 15 Mar 2023 08:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232128AbjCOM0x (ORCPT ); Wed, 15 Mar 2023 08:26:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE0097B59 for ; Wed, 15 Mar 2023 05:26:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C274E61D73 for ; Wed, 15 Mar 2023 12:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9515C4339B; Wed, 15 Mar 2023 12:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1678883127; bh=Edrase2a+V9ntO5dtbFDUhndC+P8208cBlG9RBWJynE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=koQnfU+16NdbcX3S3O0InsEctgWua9xe5UMcLREfGJRtLTgSFbfnMsrRCOD/koOon kPRQ58gQ6fijMxmPhc4Unaqa37rpGyV483Xmnh6WK9ET2bvFY+cqoAs8Cf6giEVFEp WjEC5VqDdfWk/c+5AvASSIMRXhdojfmfRJ9st/i8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.15 025/145] f2fs: avoid down_write on nat_tree_lock during checkpoint Date: Wed, 15 Mar 2023 13:11:31 +0100 Message-Id: <20230315115739.868011504@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230315115738.951067403@linuxfoundation.org> References: <20230315115738.951067403@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jaegeuk Kim [ Upstream commit 0df035c7208c5e3e2ae7685548353ae536a19015 ] Let's cache nat entry if there's no lock contention only. Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Stable-dep-of: 3aa51c61cb4a ("f2fs: retry to update the inode page given data corruption") Signed-off-by: Sasha Levin --- fs/f2fs/node.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index f810c6bbeff02..7f00f3004a665 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -430,6 +430,10 @@ static void cache_nat_entry(struct f2fs_sb_info *sbi, nid_t nid, struct f2fs_nm_info *nm_i = NM_I(sbi); struct nat_entry *new, *e; + /* Let's mitigate lock contention of nat_tree_lock during checkpoint */ + if (rwsem_is_locked(&sbi->cp_global_sem)) + return; + new = __alloc_nat_entry(sbi, nid, false); if (!new) return; -- 2.39.2