From patchwork Wed May 8 09:47:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byungchul Park X-Patchwork-Id: 13658346 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36670C04FFE for ; Wed, 8 May 2024 09:48:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18C8B6B0101; Wed, 8 May 2024 05:48:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 112F96B0105; Wed, 8 May 2024 05:48:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8C756B0106; Wed, 8 May 2024 05:48:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BAFD76B0102 for ; Wed, 8 May 2024 05:48:01 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 81586C0C5A for ; Wed, 8 May 2024 09:48:01 +0000 (UTC) X-FDA: 82094752362.20.626B331 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by imf10.hostedemail.com (Postfix) with ESMTP id A0FA5C0002 for ; Wed, 8 May 2024 09:47:59 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715161680; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=4XZzKToEpZB7iW58z9X5ctRYBZOSG23vKvPRTOUCwzU=; b=Rx2FlY2Qr6I0YM1Vk34f8jtj3Kn9rBq8IqYIHcdTQrlz0Dyo1YJ+Ggm5oufpEadOYZ8jIy 70uVf8c7e2KejJW3aqRBx5LzoHovp3IH69qfaWMtgWEg2ECIzanhsfYo87ZkWEp46aNj2s kysOi5acua66qS3fk07YoKlITu6fZyo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf10.hostedemail.com: domain of byungchul@sk.com designates 166.125.252.92 as permitted sender) smtp.mailfrom=byungchul@sk.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715161680; a=rsa-sha256; cv=none; b=jAs+4jvBfXSjr67AQXT7zaVIvZYyq6nlGKgen+wdzVo7bBWh6f7qxSL2vQ5RzCbbDzvIlA VKfcZ6gOAjz9pL8lST5/++ArYUpvGsezSO75poxuAH2SQDAjMmwgAOBbMg6nwwd6Q0tKrg hzKfU0fwwTlDF1qsB19NGqKx0f9CbnU= X-AuditID: a67dfc5b-d85ff70000001748-b9-663b4a3b016a From: Byungchul Park To: linux-kernel@vger.kernel.org Cc: kernel_team@skhynix.com, torvalds@linux-foundation.org, damien.lemoal@opensource.wdc.com, linux-ide@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, joel@joelfernandes.org, sashal@kernel.org, daniel.vetter@ffwll.ch, duyuyang@gmail.com, johannes.berg@intel.com, tj@kernel.org, tytso@mit.edu, willy@infradead.org, david@fromorbit.com, amir73il@gmail.com, gregkh@linuxfoundation.org, kernel-team@lge.com, linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org, minchan@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, sj@kernel.org, jglisse@redhat.com, dennis@kernel.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, vbabka@suse.cz, ngupta@vflare.org, linux-block@vger.kernel.org, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, jack@suse.cz, jlayton@kernel.org, dan.j.williams@intel.com, hch@infradead.org, djwong@kernel.org, dri-devel@lists.freedesktop.org, rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com, hamohammed.sa@gmail.com, 42.hyeyoo@gmail.com, chris.p.wilson@intel.com, gwan-gyeong.mun@intel.com, max.byungchul.park@gmail.com, boqun.feng@gmail.com, longman@redhat.com, hdanton@sina.com, her0gyugyu@gmail.com Subject: [PATCH v14 26/28] fs/jbd2: Use a weaker annotation in journal handling Date: Wed, 8 May 2024 18:47:23 +0900 Message-Id: <20240508094726.35754-27-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240508094726.35754-1-byungchul@sk.com> References: <20240508094726.35754-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSfUxTZxSHfd97e+9tpeamknnHnJIaNcHAxMB2nEaNRn1jQjQxMUaN2sit 1EHFVlCMMyAVtXwEMYhAxYJYCCBoa/ymVkgZHwpViQMGRJgRG4E6tA0Vgms1/nPy5Dm/8/vr cJTiliSM02iPijqtKlHJyGjZWEh55Ootq9TL31aycCFnOXg/naPB1FDHgKu+FkHd7QwMbudm +Ns3imDqWRcFRYUuBOVDAxTcbhlE0Fh9moGXb+ZAt9fDQFthNgOZ1xoYeP5+GkP/pQIMtdY4 6MivwODwj9BQ5GagtCgTB8Y7DH5LDQuW9MUwXF3CwvRQNLQNvpJAY98yKC7rZ+BRYxsNLfeG Mbx8YGJgsO6LBDpaWmlwXciVwI3xCgbe+ywUWLweFl44zBhuGgJFWR9nJPBXrgNDVuUtDN29 DxHYz73GYK17xUCzdxSDzVpIwecqJ4LhvDEWzuT4WSjNyEOQfeYSDYb+WJiaNDHrVpLmUQ9F DLZjpNFnpkl7hUDulwywxGDvY4nZmkJs1RHk2iM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cOtqOglJ3UEwO51F79wq1I7aCSGp/Lxgnsoh hYZcXnhp+MoISW+6GCHHFC2UF/oIea+HsfBkwkEJpqKbtGCauMcI+p82LIw1NzPChwezpDBg y8Ch3kcl206KalWMqFm/44RE6WxaenbK/cJQCySgGTc9Ylme28g39l/SIzeW5tbwHR1OwmUP biVfnjxIuUxwoxI+v3mv63wJd4g39O5xxSS3mu9peYRdlnKbeP2zcdJlnlvBFz+v/lfjNp93 Do0hl2VcEF+lMzB3kSQHLShCHqrImAiFSh3krz2tjI1UXfAPOxNhQvOvYoyfS61Ek237ahDH IvlCqZUODpdRihhtbEQN4llC7iGtu745XCY9qYiNEzVnjmui1aK2BnmzpNxTuv+weELGnVJE iadF8ayo+b/FrJtXAtrrfn/JrkHlkQ1elQUjOt8HrcMDoRclg8oDmY5e8tW3vGm/c9KA3bIy +/LFG3807dr+Xs6/rVEb/Ffe7IwOt21ZNb7uS9CkPezURb2lJdu9I9oxk35uVhr2Ln6Zcs2m kMffJPEN7jsLiuQRa/WquMCYO/ZjT62e+t9dKS9CLweGNNfJSa1SEehDaLSKvyPMEcYmAwAA X-CFilter-Loop: Reflected X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A0FA5C0002 X-Stat-Signature: ywb4sduk5brrstftcj9bws1irf4j7r7s X-Rspam-User: X-HE-Tag: 1715161679-900834 X-HE-Meta: U2FsdGVkX1/qgOCDuje8WkktNBW7aoKVMvh4b6a0Ix4yOtOOyEMEBwPdemxTDBvfaxvIMA+ls7uBjLaWaEcqQo1OELfsjtoJnXxKl8a+Zxi8ynHm6XAXc0bo7c6n2UDXh2PgNW8FoGiC6VfOQkA80Z0pm9L1NEcgNTaETdXCSk9aZ0mX0HjaGlw0S+R1FKFrAm5WZm48aXwEsixEENVzISgsJIbs6/HTYjqPX+gPjb1Uf20mPTWLP5iVzFd/pcheIdXwY7/zceg6NkJ2TPl1SShVqvELiiVJMT/tBOnrVCMW/Goxe1ALlSj/sNmzzrLdh+sqi+5IW+ei2sWJ9mOlVfaFEDjXGqH0U8NKkyfRX+g31bdfhy+gTSDKp0yCZ8tjsdv9K76fQ1mBOVGUkGbpR/kZjqjoVvalhunD0nzP9VSe5OXrHUDfjMkJRi8L1YRDc6MLQRQZtoD6YLv/BVx5kg4zrK6NNFyEYAYTX1EX1SFvtgFRvvBa6CfXtz+hefQ230305sxKk8IbOyuPdM0vOWQjbgfVP4BJCDlLGtv//8AOjcd4vY2Leubrc7z2XHScSF8bLohoHP5M6CoGRpuqe6bA8bn7MqbLJFG+TXf76oJ4ekVrQAD1EERYAUMRpWTlSAPXoJRQHmwcdFNxDcrCX7jlj8Ku9OX82C04ky7rLfnwnZHrmCB2qYPTEI9t369mY5EqHv5Zznk2SGQ3lJmfDVLGuvF/Ztb/mJU3iQFCRl8amTRAKei/zgQ3+Du+NbuJtD/EFgai+yARMew9qPUDm4+1oEfxkfr+uU5UZU2C1z63c7QRrgztdJjSjRqtRtCkgkxbOZJaE3+iESLEm3npsfutXyl4EBRUDcZTq0zwXKVFqjLv95vISW3OS2rBbZIX9tSgquOsuHEB82NVgb5wOCNT6j9OSgfy+hym5GMsT3A5nqBhJiDjt4Crv8TU6xW1nw2TadrUc2RGwkzy8tt E/thd531 STe5X9pCKSlU81TvkYo614HpIiwMij+TlHJTws3YyAb4i6iiXjg+CjsV9r1n9aut+rVy2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: jbd2 journal handling code doesn't want jbd2_might_wait_for_commit() to be placed between start_this_handle() and stop_this_handle(). So it marks the region with rwsem_acquire_read() and rwsem_release(). However, the annotation is too strong for that purpose. We don't have to use more than try lock annotation for that. rwsem_acquire_read() implies: 1. might be a waiter on contention of the lock. 2. enter to the critical section of the lock. All we need in here is to act 2, not 1. So trylock version of annotation is sufficient for that purpose. Now that dept partially relies on lockdep annotaions, dept interpets rwsem_acquire_read() as a potential wait and might report a deadlock by the wait. So replaced it with trylock version of annotation. Signed-off-by: Byungchul Park --- fs/jbd2/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index cb0b8d6fc0c6..58261621da27 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -460,7 +460,7 @@ static int start_this_handle(journal_t *journal, handle_t *handle, read_unlock(&journal->j_state_lock); current->journal_info = handle; - rwsem_acquire_read(&journal->j_trans_commit_map, 0, 0, _THIS_IP_); + rwsem_acquire_read(&journal->j_trans_commit_map, 0, 1, _THIS_IP_); jbd2_journal_free_transaction(new_transaction); /* * Ensure that no allocations done while the transaction is open are