Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1123860pxf; Fri, 26 Mar 2021 01:20:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6q3A9b4tCylQxit0eCnhjCCS2HOImrDMNnr3k+0jTqBCvBHA25/LuT0qOze8LAOfUgO5m X-Received: by 2002:a05:6402:614:: with SMTP id n20mr13396424edv.58.1616746841709; Fri, 26 Mar 2021 01:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616746841; cv=none; d=google.com; s=arc-20160816; b=OxFtCDf+J687bfO/RJ3QBJgrrBkxA0oBzeOfcfMrToNEZ7Oz7EXOu+hhO4/xakESD7 f+4XzyaRwKpEk14qL3uJ4XQGNiz31uKEQGhNGcir+sCixN3oQXwx8Jv6U9gFXlmbHnRB VbtZifgONHXdJ3DciREkSLIaHXRdXT92Up/PlYGpWHGYycJnQysBe1wT5jVfUEWdej+e g5V5eLSxLbjJ8IRWqKHJwx3KayCuSq12LuabjiWMkHciyMHUZe5KuQIJyt5BuVb3v2t8 G1wgBStlYWVbhRu0BmexjioeQQ6wPmyMrTQ2xvRYZxdi4rWws16FP7UC84pgBqCxjsq4 O4mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=pxQjH/FZr8c7Aos+pCUlRGiG6K/IJQBTFnnB3DLwEpo=; b=ozIe+rh+rwdzBgK1wtVbf5wj4jUfCU9o9eWvmpLzwXxJiaIqKIQAw3VO1CjJhnhSrn aIaSivi6a6iqhSe3NAaZudXlngKoQwtiaSydoQ0mehKgXkJFYKGn1HPfolIhHYn893AW 8ivaP0N8O4aCcw10Gn/jfgs3r2nG9C1h0pEkARW+BLOYgCetrHAHcA0G4moqvN/mmJfr 6BbgXXsdLQ61TrzWvgiGO5p+YcW/XLVUrOcBLcISRrmUH34WZf2+moClmKfRaAPV6UdL QykAEPvhPcSKT2ZcsJ44ys7imGo3Agu8HZRrGn9KTRGLXrFaP/0qRsFLvs9j40WQXe0k DrXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@tu-dortmund.de header.s=unimail header.b=cVOdF1Sx; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gz5si6276107ejb.19.2021.03.26.01.20.13; Fri, 26 Mar 2021 01:20:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@tu-dortmund.de header.s=unimail header.b=cVOdF1Sx; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbhCZITZ (ORCPT + 99 others); Fri, 26 Mar 2021 04:19:25 -0400 Received: from mx1.hrz.uni-dortmund.de ([129.217.128.51]:37351 "EHLO unimail.uni-dortmund.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbhCZIS7 (ORCPT ); Fri, 26 Mar 2021 04:18:59 -0400 Received: from [192.168.111.103] (p4fd97b97.dip0.t-ipconnect.de [79.217.123.151]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.1/8.16.1) with ESMTPSA id 12Q8IknN008587 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT); Fri, 26 Mar 2021 09:18:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1616746726; bh=ben2mc9PqCco6wmBW93BX/pWuiCf7vcnCghf41yvMuE=; h=To:Cc:References:From:Subject:Date:In-Reply-To; b=cVOdF1SxmarPMH195YKtL8CsuGpvsEG+imVHH9HlrEDGP6YRyfebyZYUvGVNIPgfE 6TEEbrE4wv27+TXz4qChBpB6gFsjOfjN4TDMGUpfTKNw3zy72ngHYfgCHkNCEkgFZI 24TkH3eE0P7pxvnCJUnGwPdm9GMOfuhKEgFKkggg= 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> <20210210095740.54881-2-alexander.lochmann@tu-dortmund.de> <20210211093027.GI19070@quack2.suse.cz> From: Alexander Lochmann Subject: Re: [PATCH 1/2] Updated locking documentation for transaction_t Message-ID: Date: Fri, 26 Mar 2021 09:18:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210211093027.GI19070@quack2.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 11.02.21 10:30, Jan Kara wrote: >> 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; > > So this case is actually somewhat different now that I audited the uses. > There are two types of users - commit code (fs/jbd2/commit.c) and others. > Other users properly use j_list_lock to access t_nr_buffers. Commit code > does not use any locks because committing transaction is fully in > ownership of the jbd2 thread and all other users need to check & wait for > commit to be finished before doing anything with the transaction's buffers. I'm still trying understand how thinks work: Accesses to transaction_t might occur from different contexts. Thus, locks are necessary. If it comes to the commit phase, every other context has to wait until jbd2 thread has done its work. Therefore, jbd2 thread does not need any locks to access a transaction_t (or just parts of it?) during commit phase. Is that correct? If so: I was thinking whether it make sense to ignore all memory accesses to a transaction_t (or parts of it) that happen in the commit phase. They deliberately ignore the locking policy, and would confuse our approach. Is the commit phase performed by jbd2_journal_commit_transaction()? We would add this function to our blacklist for transaction_t. - Alex -- Technische Universität Dortmund Alexander Lochmann PGP key: 0xBC3EF6FD Otto-Hahn-Str. 16 phone: +49.231.7556141 D-44227 Dortmund fax: +49.231.7556116 http://ess.cs.tu-dortmund.de/Staff/al