Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2847674pxb; Tue, 13 Apr 2021 11:36:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrbU+ILYQmagawrn69V1DlHng2eZLctG0DFq5MUZ96mosJVg1rZsKDCQ78RvCAeLFR/AkW X-Received: by 2002:a05:6402:2209:: with SMTP id cq9mr20607503edb.216.1618339013338; Tue, 13 Apr 2021 11:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618339013; cv=none; d=google.com; s=arc-20160816; b=AYJmR0AVpz+3ZQ0ZhtAIC9HmSXlHPwScLsOEHJ/oYYxFQ89UmdyLz+9vEV4FAgB8ds J+lSPkyXySG3UaJ67hyv5LYvCQ28tOMyfoMzKaBk/ICQGR4asgmgeB5/bAyvxXz3BYbq znnuW79H/m9E/OZ+TCeC88g7PlIUw/6GLudfTMS2o/aA4XPUuBauoZGvCy+G3tdXQUd1 k21UG85/tuPAWN2lSZXTFbjEDamtAfTYrVisPW77cOOSnTokeLa4XxiRu116NUV6sco4 bov9Ymz4/DwOdmZyEGtZ9WB9128HExLfG6lpmIr2MjXz/Ew4zkX2L+l6PJxr0YShV3h4 n3EA== 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=FtwD9qgucaDfyHMOvfN4AOVHCWLXRIz++2e4L28m/o8=; b=MqGct67gWCXmYcVCG9hFXU9m4m43rUS1mMllJuptpUW+HhVH6tCAkELvdtn46uUPYB P6/Rz/BpzOpLRHC63tVI2F1lxy5TIC+3GThpDyF1oRAfHn0Gzv8SuThNxomymVxqn7eF +XlutVfHhDBNlTNvdmZupQKZWnNEeocGJLm27F5MB5MyWtBfaL/Qv4cEbIrolDbEyfb4 d/j6MkfnQTlYektDZuXZZQP6d4knxtl0N580fEDdc1ioljSOdvkrCpE61kyYXTt2Sg8v A/k3J7KbT4vDLtIK2SXUy5RMgBXx9R+JDgSLexpku3SLxor4waWjJyCdO88t7w23Zx+l Zlog== ARC-Authentication-Results: i=1; mx.google.com; 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 c12si10803718eja.302.2021.04.13.11.36.25; Tue, 13 Apr 2021 11:36:53 -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; 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 S229690AbhDMORc (ORCPT + 99 others); Tue, 13 Apr 2021 10:17:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:35586 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbhDMORc (ORCPT ); Tue, 13 Apr 2021 10:17:32 -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 73746B178; Tue, 13 Apr 2021 14:17:11 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 06D941E37A2; Tue, 13 Apr 2021 16:17:11 +0200 (CEST) Date: Tue, 13 Apr 2021 16:17:11 +0200 From: Jan Kara To: Christoph Hellwig Cc: Jan Kara , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, Ted Tso , Amir Goldstein , Dave Chinner Subject: Re: [PATCH 0/7 RFC v3] fs: Hole punch vs page cache filling races Message-ID: <20210413141710.GE15752@quack2.suse.cz> References: <20210413105205.3093-1-jack@suse.cz> <20210413130950.GD1366579@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210413130950.GD1366579@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 13-04-21 14:09:50, Christoph Hellwig wrote: > > Also when writing the documentation I came across one question: Do we mandate > > i_mapping_sem for truncate + hole punch for all filesystems or just for > > filesystems that support hole punching (or other complex fallocate operations)? > > I wrote the documentation so that we require every filesystem to use > > i_mapping_sem. This makes locking rules simpler, we can also add asserts when > > all filesystems are converted. The downside is that simple filesystems now pay > > the overhead of the locking unnecessary for them. The overhead is small > > (uncontended rwsem acquisition for truncate) so I don't think we care and the > > simplicity is worth it but I wanted to spell this out. > > I think all makes for much better to understand and document rules, > so I'd shoot for that eventually. OK. > Btw, what about locking for DAX faults? XFS seems to take > the mmap sem for those as well currently. Yes, I've mechanically converted all those uses to i_mapping_sem for XFS, ext4, and ext2 as well. Longer term we may be able to move some locking into generic DAX code now that the lock is in struct inode. But I want to leave that for later since DAX locking is different enough that it needs some careful thinking and justification... Honza -- Jan Kara SUSE Labs, CR