From patchwork Tue Oct 18 00:58:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 3856 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1715821wrs; Mon, 17 Oct 2022 18:01:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6+dpApwdKTSFnbWdYeJpOgPXl6aNKBO15GChX4KNxhMt+ROQVDesJEszTeRd2cIGlErbbA X-Received: by 2002:a05:6402:518d:b0:45d:d319:2a88 with SMTP id q13-20020a056402518d00b0045dd3192a88mr330687edd.35.1666054888478; Mon, 17 Oct 2022 18:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666054888; cv=none; d=google.com; s=arc-20160816; b=bggwy14oV1ZDJfXmmRu6yTg9aE95VCSAl9TH1guL0wpqlXWMn1G+SsWOOaTSwNUYY0 HhWQsiRP60Thvh3BF89s/uPIwvL4NCxd/NFnmt85rwdNoRiZxrbnNVdtRoxX6pnYHOd1 Cqz2aafdUvKvZGDujccbM4HfN02jl9/5dH4R5mC6Xsn5kJf5WfLlmkd+BqKF1Excgu5k Hkf6eYscqRkv9N3+CyC/VDZVsFmRFTSQ8u4hcMp2Ygrq/Rj2U8/ZOz3yzljIOb7lGfjm LNNMukGPN0KgyhJih7bea+kLgWITysbZQcCs9E6t0NQTTH0TD8QoWKU2E1uzcUxWVTF/ 7h/Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=UHqNkRk4bPYgLLFvmZmG1eW5DjX+Z2iPUVmnW0Nqwb4=; b=Q8XNRMd4htoFjBEJHcPS70CT8UHCFN9k/OoERc9mpropZyoP2vnTiPsthW/0IBd2h3 OxIqpk+lNe0fTkh7EGQXvccsizTtq9zvRrj/ELw5bZ1Wg3cbbeg91sdgRXz0ODbBNo7S Vf7NX1wKtlExkOXroZhePZUHolx0kJKSDBNijXt5iDGdL180PKCml6IqcAVY4e58DjtL ogfkLydaXtaoTo0BCF6IO8bUUhiZUFT+bI+kfDWty1rPokHG2/VLSFLhHi4f//kJuC/c mqXgD3/mPbl/lt8pEsYhwwFQAhJzMfASLGav7FLbJuRM9uc4ZCvqywDbsDI5yEonzzIu 5d3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U4vZwFiU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t16-20020a056402021000b00458c5c47070si9110673edv.234.2022.10.17.18.01.02; Mon, 17 Oct 2022 18:01:28 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U4vZwFiU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230426AbiJRA6Q (ORCPT + 99 others); Mon, 17 Oct 2022 20:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230248AbiJRA6O (ORCPT ); Mon, 17 Oct 2022 20:58:14 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D04B0193EC for ; Mon, 17 Oct 2022 17:58:13 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0D21ACE180B for ; Tue, 18 Oct 2022 00:58:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40829C433C1; Tue, 18 Oct 2022 00:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666054690; bh=EQfYE38gG+3EcKKsQRkrz/TOt3/lj4TBQRUYoSHM1ZA=; h=From:To:Cc:Subject:Date:From; b=U4vZwFiUKpge2D1EXLJqUATIuJMvFM/JYBRI43lZBV2OCmEfZo1ZFd9L5rR/pdwGK oIhgrg4ykO93RQQoM09JiC6oMCo3r/uQY5RvYamimihg88BCNKegNfGEQ4RN3OfljW DQgnf0/Qy0kJdgSaZcljHtM312itonP2yMosfsdRHZR1hput9pIUW3LwKQif99cz9u 3R2UsdYg9Q1No7ymlZuSNYzBDFiCCE0fYHNTkB6trKZxUzFwiZYpzI09fyC2FJvHoP s4bKSEiL1WDk48Hkqa4TXjK9IGxHQctCuYSiSMfzuAxV5amG9cNafkF+Vc0H3Qy0BQ E6TsKKljkBYHQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH] f2fs: let's avoid to get cp_rwsem twice by f2fs_evict_inode by d_invalidate Date: Mon, 17 Oct 2022 17:58:06 -0700 Message-Id: <20221018005806.892778-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746985171230017059?= X-GMAIL-MSGID: =?utf-8?q?1746985171230017059?= f2fs_unlink -> f2fs_lock_op -> d_invalidate -> shrink_dentry_list -> iput_final -> f2fs_evict_inode -> f2fs_lock_op Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Tested-by: Yangtao Li --- fs/f2fs/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index a389772fd212..e104409c3a0e 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -632,6 +632,8 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) goto fail; } f2fs_delete_entry(de, page, dir, inode); + f2fs_unlock_op(sbi); + #if IS_ENABLED(CONFIG_UNICODE) /* VFS negative dentries are incompatible with Encoding and * Case-insensitiveness. Eventually we'll want avoid @@ -642,8 +644,6 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) if (IS_CASEFOLDED(dir)) d_invalidate(dentry); #endif - f2fs_unlock_op(sbi); - if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); fail: