Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3473604pxf; Mon, 29 Mar 2021 03:16:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuz1FmpGvFCzen1HaTYXjP1p3THzVhA3hjhuX8kHKTxa+A9XLbmvXyxVtJvfZrA+PuraJ5 X-Received: by 2002:a17:906:5949:: with SMTP id g9mr28431500ejr.518.1617012999846; Mon, 29 Mar 2021 03:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617012999; cv=none; d=google.com; s=arc-20160816; b=LxFTuvD9Fnde7tx5wP1w9X4fDyy7pSiQNGfLCCxC1EYLIQ6N6dJL0AbYHAQ50m5f/a /HWYSiCYA+Dk8JPI5yUCadthBEjse1+s833RtGbYp9TsIG5ylbnYzpu0iLC8/BVIm5xv zlJYFMCgAExiZ/xjrub0G/X6KnaRJMTHvnmbld2FMf+KOSQJC5W7Hpo8lhmuY8+hM3rO dGF1UjeGS8HbArXxAU4Pa3E2pLp4lHD8Yx3ApFw9pse48ytv2wrPyxoeAFOoIuhhb+Kj LSAsxSztn3sOLGuYI3nZTQAc0u9BXup1/c/ZI5Nemj/y0yrc3fASf6dU1z+aB7Nk09zQ IcAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=br/DYmfx+XAzIiDWj57OhRepbgaT2NK+c5nkxLB/7Pw=; b=eN0sQoujkwEvcsJaosPPsSlEyT0dioRGIBOlCC8jaBS8O2vY/CWLOnlo1Sst6rHmgp JEBpII2wvokgp/nVjLfNVf2g0zwWidK9ekxmYbbQDDkIRSp78PRaPbLY1khFjyaEhElP yWSjY+PNbBDs6vImNkxRJCDzffK4V1PeRqtEoNCV2UpQt54drmhbn4xg3B3XNtZZz2sw WTBpHCX4Xdatd3hqBLJHe/Jjev+FAyiGR18bVwakDXMDvaTlovqdg+p3fiLfmFnLIMyy UrTkVIwPTWRo70VBqLvbFRr2i1WR5q2fDr6POrlfAznFewj6pQeN0sNNDvbsWCjfssjI eKMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 a10si12299941edv.308.2021.03.29.03.16.17; Mon, 29 Mar 2021 03:16:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232517AbhC2KO4 (ORCPT + 99 others); Mon, 29 Mar 2021 06:14:56 -0400 Received: from mx2.suse.de ([195.135.220.15]:59204 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232172AbhC2KOa (ORCPT ); Mon, 29 Mar 2021 06:14:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6B271B3DF; Mon, 29 Mar 2021 10:14:29 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 0EFC01E4353; Mon, 29 Mar 2021 12:14:29 +0200 (CEST) Date: Mon, 29 Mar 2021 12:14:29 +0200 From: Jan Kara To: Alexander Lochmann Cc: Jan Kara , Horst Schirmeier , Theodore Ts'o , Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] Updated locking documentation for transaction_t Message-ID: <20210329101429.GA4283@quack2.suse.cz> References: <20210210095740.54881-1-alexander.lochmann@tu-dortmund.de> <20210210095740.54881-2-alexander.lochmann@tu-dortmund.de> <20210211093027.GI19070@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 26-03-21 09:18:45, Alexander Lochmann wrote: > 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? Yes, that is 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. Yes, commit phase is implemented by jbd2_journal_commit_transaction() and the functions it calls. Honza -- Jan Kara SUSE Labs, CR