Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp114169rwb; Mon, 26 Sep 2022 09:59:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qQoQ0awTwrO1iAw9Df3AxPHceDUNbQ8wcUhsV3jhZolbnLGQJEEQzAfVgEJqcacVv1NQQ X-Received: by 2002:a05:6a00:17a2:b0:540:f501:ab76 with SMTP id s34-20020a056a0017a200b00540f501ab76mr24964675pfg.42.1664211574490; Mon, 26 Sep 2022 09:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664211574; cv=none; d=google.com; s=arc-20160816; b=AI4bqhdpm4m0PBZruL3BV5jRbvT36hrlGYO4l7zafZ4n+GrB3suYTj0SPMpbsCASAS LasvAwwQ7xAGpCAgznEKv5x+7rA8xTKEANbrhJxJ9rMZ2Y+K6DdSh70CNnGizDfCsgu4 QxZsA80wXJsI4+gjMlF3I3+2QSQI9Ewap/AttDBU2DiMgCMHEN/CHNt1WvEZc8a6tjl6 dDojkS/v1E3Uv7YDUQJnnuvy2stispweJWdH55boS4/NqPRsd1mc+hYiri+6FtU0xSNF nWeQu92M4LaxXV/8+/FSLonN3WRxfSrT8yTI0Z5Lm7VsDRUUu4jPnusF9Q0w2e/flhRZ BLXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GLjOCldwMSYbtIvOp9MNc738nkI+qSWqG0cQCtDGyYs=; b=XAOOByh52ragrsCgIAogBTmGB4LfavmN/zo6olCxDE3E7rDdhxKyKsrLdcpVZp/nHT OYFxPCB2k+v0TMx5mA98xvrEhUlXYT8ldT8UKgO6KMX+GfJCxS/7H9IMvzZrgdXBWsR8 cZIhvakBq2bInVRd/4ugHqv1D7zOxsI49kDngws4qPnpr5pT/MI/rwbRnyvBnTQr3yL3 145sHfMOd8WzAOgjep+6HAa0nhUUXN8pAElo5BAPRJ0FWVTKVxMLR4qcU4jdPnfSkErn WoOYemtF2tjT6v35qQ1Dx481W/23PInCBePyFNepMSP0rW1rmGfPI/qSbrHXr0KMdjNM zKVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=iKgsgckx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a056a001a9100b0053b36138dc5si20146990pfv.222.2022.09.26.09.59.04; Mon, 26 Sep 2022 09:59:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=iKgsgckx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229509AbiIZQ6I (ORCPT + 99 others); Mon, 26 Sep 2022 12:58:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbiIZQ5w (ORCPT ); Mon, 26 Sep 2022 12:57:52 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB07293; Mon, 26 Sep 2022 08:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GLjOCldwMSYbtIvOp9MNc738nkI+qSWqG0cQCtDGyYs=; b=iKgsgckx1BpnYBt1Ml1luRzlNo UEaD93VJ/NaxUNW6l6hN4BiK/C+lXg9TvmRBVZsr6VTRgniAUARhROkGwU1gb/+ga6hgyHbqIk4/Z MZ2vk2dp+YZ4n0PysUqI70IA94ZPELr3jKfzqB+j9wqcDa40U1/yUR6ed5i6U/Ooq6akJwUIH9LCc 4FE9DI2L7LRdgnfG+csHbDb8jVG/m3HrQoeTsrshIrc6b/uSVjKzkoMcldkhksDV/gf35W549vzaw QW3k1gYHecYAhnbGFnhN3AfKto9jFnIhYWcwx925qCXeqVUi440PLfDtd4qG2idoghktcU6o/gEhs CpXOoeeQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocqQR-005okf-Pg; Mon, 26 Sep 2022 15:53:43 +0000 Date: Mon, 26 Sep 2022 08:53:43 -0700 From: Christoph Hellwig To: Al Viro Cc: Christoph Hellwig , Jan Kara , John Hubbard , Andrew Morton , Jens Axboe , Miklos Szeredi , "Darrick J . Wong" , Trond Myklebust , Anna Schumaker , David Hildenbrand , Logan Gunthorpe , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, LKML Subject: Re: [PATCH v2 4/7] iov_iter: new iov_iter_pin_pages*() routines Message-ID: References: <20220914145233.cyeljaku4egeu4x2@quack3> <20220915081625.6a72nza6yq4l5etp@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, Sep 23, 2022 at 05:13:42PM +0100, Al Viro wrote: > You are mixing two issues here - holding references to pages while using > iov_iter instance is obvious; holding them until async IO is complete, even > though struct iov_iter might be long gone by that point is a different > story. But someone needs to hold a refernce until the I/O is completed, because the I/O obviously needs the pages. Yes, we could say the callers holds them and can drop the references right after I/O submission, while the method needs to grab another reference. But that is more complicated and is more costly than just holding the damn reference. > And originating iov_iter instance really can be long-gone by the time > of IO completion - requirement to keep it around would be very hard to > satisfy. I've no objections to requiring the pages in ITER_BVEC to be > preserved at least until the IO completion by means independent of > whatever ->read_iter/->write_iter does to them, but > * that needs to be spelled out very clearly and > * we need to verify that it is, indeed, the case for all existing > iov_iter_bvec callers, preferably with comments next to non-obvious ones > (something that is followed only by the sync IO is obvious) Agreed. > That goes not just for bio - if we make get_pages *NOT* grab references > on ITER_BVEC (and I'm all for it), we need to make sure that those > pages won't be retained after the original protection runs out. Yes.