From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7B3DC35247 for ; Mon, 3 Feb 2020 23:02:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9702420674 for ; Mon, 3 Feb 2020 23:02:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9702420674 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fromorbit.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2C9AB6B0003; Mon, 3 Feb 2020 18:02:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 27B9F6B0005; Mon, 3 Feb 2020 18:02:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18FC36B0006; Mon, 3 Feb 2020 18:02:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0097.hostedemail.com [216.40.44.97]) by kanga.kvack.org (Postfix) with ESMTP id F22DA6B0003 for ; Mon, 3 Feb 2020 18:02:15 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9685C180AD804 for ; Mon, 3 Feb 2020 23:02:15 +0000 (UTC) X-FDA: 76450341030.20.top05_8810a14d61232 X-HE-Tag: top05_8810a14d61232 X-Filterd-Recvd-Size: 3372 Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 3 Feb 2020 23:02:14 +0000 (UTC) Received: from dread.disaster.area (pa49-181-161-120.pa.nsw.optusnet.com.au [49.181.161.120]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 77ADE3A2A22; Tue, 4 Feb 2020 10:02:10 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1iykjJ-0006Rf-AX; Tue, 04 Feb 2020 10:02:09 +1100 Date: Tue, 4 Feb 2020 10:02:09 +1100 From: Dave Chinner To: Christoph Hellwig Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Waiman Long , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Will Deacon , Andrew Morton , linux-ext4@vger.kernel.org, cluster-devel@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: RFC: hold i_rwsem until aio completes Message-ID: <20200203230209.GC20628@dread.disaster.area> References: <20200114161225.309792-1-hch@lst.de> <20200118092838.GB9407@dread.disaster.area> <20200203174641.GA20035@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200203174641.GA20035@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=X6os11be c=1 sm=1 tr=0 a=SkgQWeG3jiSQFIjTo4+liA==:117 a=SkgQWeG3jiSQFIjTo4+liA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=l697ptgUJYAA:10 a=7-415B0cAAAA:8 a=4rX9TS273XGzNsaKJp0A:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 03, 2020 at 06:46:41PM +0100, Christoph Hellwig wrote: > On Sat, Jan 18, 2020 at 08:28:38PM +1100, Dave Chinner wrote: > > I think it's pretty gross, actually. It makes the same mistake made > > with locking in the old direct IO code - it encodes specific lock > > operations via flags into random locations in the DIO path. This is > > a very slippery slope, and IMO it is an layering violation to encode > > specific filesystem locking smeantics into a layer that is supposed > > to be generic and completely filesystem agnostic. i.e. this > > mechanism breaks if a filesystem moves to a different type of lock > > (e.g. range locks), and history teaches us that we'll end up making > > a horrible, unmaintainable mess to support different locking > > mechanisms and contexts. > > > > I think that we should be moving to a model where the filesystem > > provides an unlock method in the iomap operations structure, and if > > the method is present in iomap_dio_complete() it gets called for the > > filesystem to unlock the inode at the appropriate point. This also > > allows the filesystem to provide a different method for read or > > write unlock, depending on what type of lock it held at submission. > > This gets rid of the need for the iomap code to know what type of > > lock the caller holds, too. > > I'd rather avoid yet another method. But I think with a little > tweaking we can move the unlock into the ->end_io method. That would work, too :) Cheers, Dave. -- Dave Chinner david@fromorbit.com