Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp814950pxb; Wed, 11 Nov 2020 17:37:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAG/2P446bKKzZKhVbx12plfiC6WbitL35kDmQtRdY/yL1/csEf3H1UqbXasgItomVf/uZ X-Received: by 2002:a05:6402:b6e:: with SMTP id cb14mr2669099edb.308.1605145043980; Wed, 11 Nov 2020 17:37:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605145043; cv=none; d=google.com; s=arc-20160816; b=sLiLVc4RssK/Q3MeOrRtvKe8q7scjfpPn1CKwTlsQXc0V1vQN416TkteEfEg1umD36 QyOqg6qXcglcNWDoNgQS/7TGubyJLkPlNCiLZ1FFkaShB0FGwOAstCd4OlTav9p30CL9 Q0xFMTMcxOX8UtJCWj5ZiJ3nseuWX4TG0KZQ3i3sI6XmkCXg/a/FDNppDLgNtf6lzTAt I1lN6BraJQgIytBiJkb5k8gJr6ax83mSw4kiIegcRRoXC0Nw1aIMRbeX/EdkCBAbA+Vh n/xJnlIh2rPyi3pYZr4UvTt934Or0uMyErzk4qBMNCUPNHN/HE7kDlrSUd9g7VXf4uFQ h/OA== 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; bh=fGjv4X8LIjR73p5PqNARuTuUPhWSobgq3ChwwvR65dc=; b=vYSZzSNljchmFxIvUuuTvvdXekGomz7IGwtDxX75Gns8Is00VTlY3jMP4/0NuF3AJC r+GlOGKSjB/FMPWhrjGrrktPfS827iescteInbRZXmRfxSmhc+qTMIE7aKmYP93vsFvq QxZTErAO4MsuU+4H4iRk8+DKYrUTEkIFzG8BP8zEoexl9IZg9iXNumB6xZYAm6sYCD5H fQVcqhJEJwRdjQN4FDoKWPHbYgwDn1xQvCDb67Rd3Tr091KPtz+MKs1R0Pfo48o1I5GJ Az6oKhdmcgHEsdjK7lqJ6uy44oAEPMR8QXZ1tG+7nqeddWEcTkW1yEfJ477lQAJ2z85+ Mk0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 c8si2677094edr.540.2020.11.11.17.37.00; Wed, 11 Nov 2020 17:37:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728704AbgKLBeP (ORCPT + 99 others); Wed, 11 Nov 2020 20:34:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727672AbgKKXAR (ORCPT ); Wed, 11 Nov 2020 18:00:17 -0500 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05885C0613D1; Wed, 11 Nov 2020 15:00:16 -0800 (PST) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcz5y-003sj0-JF; Wed, 11 Nov 2020 23:00:06 +0000 Date: Wed, 11 Nov 2020 23:00:06 +0000 From: Al Viro To: Linus Torvalds Cc: Christoph Hellwig , Greg KH , Alexey Dobriyan , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH 1/6] seq_file: add seq_read_iter Message-ID: <20201111230006.GB3576660@ZenIV.linux.org.uk> References: <20201104082738.1054792-1-hch@lst.de> <20201104082738.1054792-2-hch@lst.de> <20201110213253.GV3576660@ZenIV.linux.org.uk> <20201110213511.GW3576660@ZenIV.linux.org.uk> <20201110232028.GX3576660@ZenIV.linux.org.uk> <20201111215220.GA3576660@ZenIV.linux.org.uk> <20201111222116.GA919131@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 02:27:02PM -0800, Linus Torvalds wrote: > On Wed, Nov 11, 2020 at 2:21 PM Al Viro wrote: > > > > Something like below (build-tested only): > > Apart from my usual "oh, Gods, the iter model really does confuse me" > this looks more like what I expected, yes. > > Considering the original bug, I'm clearly not the only one confused by > the iov_iter helper functions and the rules.. copy_to_iter() returns the amount it has actually copied, that's all; the cause of that bug is not the primitives used, it's the rules for ->read_iter(). The rules are actually fairly simple - "->read_iter() should not report less data than it has actually left there". For read(2) it's a matter of QoI - if we hit an unmapped page, POSIX pretty much says that all bets are off; read(fd, unmapped - 5, 8) might copy 5 bytes and return 4. It is allowed (and read(2) on those files used to do just that), but it's nicer not to do so. For generic_file_splice_read(), OTOH, it's a bug - we end up with stray data spewed into pipe. So converting to ->read_iter() needs some care. Probably something along those lines should go into D/f/porting...