From patchwork Thu Feb 11 09:51:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lochmann X-Patchwork-Id: 1439380 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=Lkp7Qn5L; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DbsTF2gmHz9sRf for ; Thu, 11 Feb 2021 20:56:01 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230176AbhBKJzb (ORCPT ); Thu, 11 Feb 2021 04:55:31 -0500 Received: from mx1.hrz.uni-dortmund.de ([129.217.128.51]:33910 "EHLO unimail.uni-dortmund.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230192AbhBKJwy (ORCPT ); Thu, 11 Feb 2021 04:52:54 -0500 Received: from [192.168.111.113] (p4fd971d4.dip0.t-ipconnect.de [79.217.113.212]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.1/8.16.1) with ESMTPSA id 11B9ptWE008232 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT); Thu, 11 Feb 2021 10:51:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1613037116; bh=G+2UnajnP81FFlxwuwxMT+3dMca/ftJn/4u+nnK9BC4=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=Lkp7Qn5LGpxWxk8Dgs7uy6LLcxu6sqdDA45MrlMCgrpWcvtrNz8ma4C2amyf3/LkI qaniALZuvJRKVWqnOkQTMqCrirVGUWou+a1hX75sQREkeOcmd27Va6gGB14PlS+PZi QLlD0TeKX4hLfUArd7RDvTGWTpzhqLK8Vn9oK7dY= Subject: [PATCH v2] Updated locking documentation for journal_t To: Jan Kara Cc: Horst Schirmeier , "Theodore Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210210095740.54881-1-alexander.lochmann@tu-dortmund.de> <20210211093754.GJ19070@quack2.suse.cz> From: Alexander Lochmann Message-ID: Date: Thu, 11 Feb 2021 10:51:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210211093754.GJ19070@quack2.suse.cz> 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(-) @@ -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; 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;