Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp891512rwb; Thu, 22 Sep 2022 07:38:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4W6Q0tooASzPTb7URcNGR4/J/pRGsMiKczvUeTzJFAN6OqGeguwW3i1fbyjr7HI2JZjMta X-Received: by 2002:a17:906:6a24:b0:782:5c86:3589 with SMTP id qw36-20020a1709066a2400b007825c863589mr2307720ejc.747.1663857519259; Thu, 22 Sep 2022 07:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663857519; cv=none; d=google.com; s=arc-20160816; b=TYQN2sJMoDkB+ZU98VYNKN2qzsu5/ikli3X8WQQrn67E9KK8DddW+TaCGu6HCiXU92 sTZm79B30kTP53fWsfAZPWGYxT1B17KJkjYVuxtnBiUMflL0ucpjOo04wtedgos93nTJ jmdMfWFRnH51Ya+IjjjjrKzYPt1nQS1x6z44asCGFHrHCGoBssvvx12GSA7uHwmAkY9l R12tDh5VLg3l5U4/hwMpWZsJgbigiHeQTu/uH1rTeE6RJ2z8PMV+MrIPomM4f/d9++TR F/HknL+u4I++IwhvgsmmA2n/vCXihiWOhbnu5gM2ezrj6J+2cQd7zlwJBgDKatDfC2Vj EN1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=PnZrxUy9P5w7rj/UPAer5HPpUVVqgQM8T4IHUrrMARE=; b=o92oDzX5fij0xDMsTeA2ErQZqvvudb5PQYHv6GGXP7MPCC+IOtEti0nSB25tOwlzhh op5P9xMVgu8KJpPkRPx6tvTJqndrseGPGEBDBE4eQAbQnqP4/Wo1vJTN5D5OQByS06aT Efr4PAqabVMbRZMM2mgsCakP6LObJqgLJ+FkR/T1L1QyHjy+cn9ICHSB5pl2juMKQ8u1 ZklziiDEpUCPGJ2tmS/9UnNX/1mVZFKg/AGsiiBEwGu+2oZOJRyeOr2jA0YYQ/WgxLyb VcZZwi0KVHZwYnRS9kqp6ZWAdLdhMorGFfRZSWzyjF+hsEEg+YjxdXXV9Cbr8CuvJ1QH 5w8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=O7Uf24eP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a17090603c900b0070fc7c9d71dsi4288705eja.989.2022.09.22.07.38.12; Thu, 22 Sep 2022 07:38:39 -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=@linux.org.uk header.s=zeniv-20220401 header.b=O7Uf24eP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231956AbiIVOhk (ORCPT + 99 others); Thu, 22 Sep 2022 10:37:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbiIVOhb (ORCPT ); Thu, 22 Sep 2022 10:37:31 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3301FF8592; Thu, 22 Sep 2022 07:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PnZrxUy9P5w7rj/UPAer5HPpUVVqgQM8T4IHUrrMARE=; b=O7Uf24ePDbCW3jV0DTEkbSSKYV bNiC//IcuLghSDMf1uFDPey4RLVLwwCExs21sumSsTXYpYORgU/MicluPYCOVTW1mvwXGxbHoUoyb hvFqRT9d5TfP8fIU6zKHuYi6PXuDzliIxGLb2IQfA3s0ynJtZBb8Jv9VIne13C04DE5XVQb9h/52c ya9BAq7upUONaIemf1jZZnpjTXDvLIIgYS48eqPW7VgIiGjewfoZPXY6TLKJwcighU/a5igF7Im+I Ike3xVTI4+UN4EM7aNEe7DRcPuEO+kmLbq/9t/mfrlniEimUkLt7/v7drU6tlGY0lvzfihrTSJZtA UNsO2dog==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1obNJs-002RKQ-1W; Thu, 22 Sep 2022 14:36:52 +0000 Date: Thu, 22 Sep 2022 15:36:52 +0100 From: Al Viro To: Christoph Hellwig Cc: 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: <20220831041843.973026-1-jhubbard@nvidia.com> <20220831041843.973026-5-jhubbard@nvidia.com> <103fe662-3dc8-35cb-1a68-dda8af95c518@nvidia.com> <20220906102106.q23ovgyjyrsnbhkp@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,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 Thu, Sep 22, 2022 at 07:31:36AM -0700, Christoph Hellwig wrote: > On Wed, Sep 14, 2022 at 04:51:17AM +0100, Al Viro wrote: > > Unless I'm misreading Jan, the question is whether they should get or > > pin. > > And I think the answer is: inside ->read_iter or ->write_iter they > should neither get or pin. The callers of it need to pin the pages > if they are pagecache pages that can potentially be written to through > shared mappings, else a get would be enough. But the method instance > should not have to care and just be able to rely on the caller making > sure they do not go away. The interesting part, AFAICS, is where do we _unpin_ them and how do we keep track which pages (obtained from iov_iter_get_pages et.al.) need to be unpinned. > > I'm really tempted to slap > > if (WARN_ON(i->data_source)) > > return 0; > > into copy_to_iter() et.al., along with its opposite for copy_from_iter(). > > Ys, I think that would be useful. And we could use something more > descriptive than READ/WRITE to start with. See #work.iov_iter; done, but it took a bit of fixing the places that create iov_iter instances.