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.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 B7BBDC35249 for ; Mon, 3 Feb 2020 17:46:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8434120CC7 for ; Mon, 3 Feb 2020 17:46:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8434120CC7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 16C546B0667; Mon, 3 Feb 2020 12:46:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 11D756B0669; Mon, 3 Feb 2020 12:46:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 033E96B066B; Mon, 3 Feb 2020 12:46:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0241.hostedemail.com [216.40.44.241]) by kanga.kvack.org (Postfix) with ESMTP id DFF166B0667 for ; Mon, 3 Feb 2020 12:46:44 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 92220629 for ; Mon, 3 Feb 2020 17:46:44 +0000 (UTC) X-FDA: 76449545928.19.robin74_9a8f20cfb42 X-HE-Tag: robin74_9a8f20cfb42 X-Filterd-Recvd-Size: 2577 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Mon, 3 Feb 2020 17:46:43 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 66CB768B20; Mon, 3 Feb 2020 18:46:41 +0100 (CET) Date: Mon, 3 Feb 2020 18:46:41 +0100 From: Christoph Hellwig To: Dave Chinner Cc: Christoph Hellwig , 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: <20200203174641.GA20035@lst.de> References: <20200114161225.309792-1-hch@lst.de> <20200118092838.GB9407@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200118092838.GB9407@dread.disaster.area> User-Agent: Mutt/1.5.17 (2007-11-01) 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 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.