From patchwork Wed Feb 10 09:56:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lochmann X-Patchwork-Id: 1438893 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=tu-dortmund.de header.i=@tu-dortmund.de header.a=rsa-sha256 header.s=unimail header.b=C3ZWOFGs; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DbFdD3kQDz9sS8 for ; Wed, 10 Feb 2021 21:00:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbhBJKA2 (ORCPT ); Wed, 10 Feb 2021 05:00:28 -0500 Received: from mx1.hrz.uni-dortmund.de ([129.217.128.51]:64986 "EHLO unimail.uni-dortmund.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230407AbhBJJ5x (ORCPT ); Wed, 10 Feb 2021 04:57:53 -0500 Received: from ios.cs.uni-dortmund.de (ios.cs.uni-dortmund.de [129.217.43.100]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.1/8.16.1) with ESMTPSA id 11A9unNX027344 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 10 Feb 2021 10:56:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1612951017; bh=HPi4PR1X2ZJY9+JjYLzNxyQAsDi3SUIOPqfv2OzAdSQ=; h=From:To:Cc:Subject:Date; b=C3ZWOFGsjiS+o2dyE2P3lkBLkR7MJpdzsVr/KZuHAos+9Ct/sD+cwzytvxFBle8jK idmg3TfrIMT4wuCPKkl6uhFGhlg6vSj2gXD06O6blzmanPFf84nM411pfE552Yt+7T cqQaK55yo1K/GK4ZXtNYTj1J6uI1c9fzBjDhduFU= From: Alexander Lochmann Cc: Alexander Lochmann , Horst Schirmeier , "Theodore Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] Updated locking documentation for transaction_t Date: Wed, 10 Feb 2021 10:56:48 +0100 Message-Id: <20210210095649.51836-1-alexander.lochmann@tu-dortmund.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Some members of transaction_t are allowed to be read without any lock being held if consistency doesn't matter. Based on LockDoc's findings, we extended the locking documentation of those members. Each one of them is marked with a short comment: "no lock for quick racy checks". Signed-off-by: Alexander Lochmann Signed-off-by: Horst Schirmeier --- include/linux/jbd2.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 99d3cd051ac3..18f77d9b1745 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -594,18 +594,18 @@ struct transaction_s */ unsigned long t_log_start; - /* Number of buffers on the t_buffers list [j_list_lock] */ + /* Number of buffers on the t_buffers list [j_list_lock, no lock for quick racy checks] */ int t_nr_buffers; /* * Doubly-linked circular list of all buffers reserved but not yet - * modified by this transaction [j_list_lock] + * modified by this transaction [j_list_lock, no lock for quick racy checks] */ struct journal_head *t_reserved_list; /* * Doubly-linked circular list of all metadata buffers owned by this - * transaction [j_list_lock] + * transaction [j_list_lock, no lock for quick racy checks] */ struct journal_head *t_buffers; @@ -631,7 +631,7 @@ struct transaction_s /* * Doubly-linked circular list of metadata buffers being shadowed by log * IO. The IO buffers on the iobuf list and the shadow buffers on this - * list match each other one for one at all times. [j_list_lock] + * list match each other one for one at all times. [j_list_lock, no lock for quick racy checks] */ struct journal_head *t_shadow_list; From patchwork Wed Feb 10 09:57:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lochmann X-Patchwork-Id: 1438894 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=tu-dortmund.de header.i=@tu-dortmund.de header.a=rsa-sha256 header.s=unimail header.b=XWh3fNWf; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DbFdn66Blz9sCD for ; Wed, 10 Feb 2021 21:01:17 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbhBJKA4 (ORCPT ); Wed, 10 Feb 2021 05:00:56 -0500 Received: from mx1.hrz.uni-dortmund.de ([129.217.128.51]:37286 "EHLO unimail.uni-dortmund.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbhBJJ6p (ORCPT ); Wed, 10 Feb 2021 04:58:45 -0500 Received: from ios.cs.uni-dortmund.de (ios.cs.uni-dortmund.de [129.217.43.100]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.1/8.16.1) with ESMTPSA id 11A9vewj028502 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 10 Feb 2021 10:57:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1612951063; bh=qDYD80i6VVMjqchVzfARLfIkNCGcqAw2S45ciOFpyXA=; h=From:To:Cc:Subject:Date; b=XWh3fNWfg362unstw3nQqR5Wpmglb9NItw60VLqKW7h2R07r4zOyglEyV1Y3gXOhe KV3RmLAtxZEaeiaDmWwxq5VIGsq4ifa0FblvDIGVWEnfGZSzo8ll5szQtjhNA9/ueO fuU5ViQhcO3qMTJ9BXRs5NRIq6SpHDy9/u7R3GaU= From: Alexander Lochmann Cc: Alexander Lochmann , Horst Schirmeier , "Theodore Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Updated locking documentation for journal_t Date: Wed, 10 Feb 2021 10:57:38 +0100 Message-Id: <20210210095740.54881-1-alexander.lochmann@tu-dortmund.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Some members of transaction_t are allowed to be read without any lock being held if consistency doesn't matter. Based on LockDoc's findings, we extended the locking documentation of those members. Each one of them is marked with a short comment: "no lock for quick racy checks". Signed-off-by: Alexander Lochmann Signed-off-by: Horst Schirmeier Reviewed-by: Jan Kara --- include/linux/jbd2.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 18f77d9b1745..4dca33a063dd 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -768,7 +768,7 @@ enum passtype {PASS_SCAN, PASS_REVOKE, PASS_REPLAY}; struct journal_s { /** - * @j_flags: General journaling state flags [j_state_lock] + * @j_flags: General journaling state flags [j_state_lock, no lock for quick racy checks] */ unsigned long j_flags; @@ -808,7 +808,7 @@ struct journal_s /** * @j_barrier_count: * - * Number of processes waiting to create a barrier lock [j_state_lock] + * Number of processes waiting to create a barrier lock [j_state_lock, no lock for quick racy checks] */ int j_barrier_count; @@ -821,7 +821,7 @@ struct journal_s * @j_running_transaction: * * Transactions: The current running transaction... - * [j_state_lock] [caller holding open handle] + * [j_state_lock, no lock for quick racy checks] [caller holding open handle] */ transaction_t *j_running_transaction; @@ -1033,7 +1033,7 @@ struct journal_s * @j_commit_sequence: * * Sequence number of the most recently committed transaction - * [j_state_lock]. + * [j_state_lock, no lock for quick racy checks]. */ tid_t j_commit_sequence; @@ -1041,7 +1041,7 @@ struct journal_s * @j_commit_request: * * Sequence number of the most recent transaction wanting commit - * [j_state_lock] + * [j_state_lock, no lock for quick racy checks] */ tid_t j_commit_request;