Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2236001pxb; Mon, 18 Jan 2021 11:55:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyo9ByfuKRd7I8yWjTPet0SONfSlAR471FIUPWwO4bqU7louTXkJQLddCUqW+/VZrYubb4J X-Received: by 2002:aa7:d919:: with SMTP id a25mr802942edr.243.1610999711439; Mon, 18 Jan 2021 11:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610999711; cv=none; d=google.com; s=arc-20160816; b=h4wmVOwxX0dbfSfU4GcOCFBBnUsh/HZEiUAb+qHoD/U+07zVCDu6QE8irCn1PLYtmy gtnC5QJf2m+xMBp1u0T5XOkvFzWnj5uXlS/sQzdVs5vOfU1Q/j2wcqnY+Oi0ARp1nUTT LwEXQqrehCFrAyl7pLDAXnXmAjLMXOhg2iTlbd1unxTc7+0FfHvAlgIEPxZJCvbK5TFc 6ishtZVvMBD6FM+cNnC6aB26q70lDFWksL/GpusZWHcMAyhSlvz1sSoJgcu/adx2xqeF Gdx/ZCTmzgWyFkQ+cjPi5W5IN1MULxAZ56ys/fOEjqkpHTiLcRtTLZ5inswADw94R1TV Csgw== 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=LXiFvEFI9kCevL4X7w4yNMEvKgK4JO1JO6fI7hoHhew=; b=B8W8J3SIGtTFTe+LA+rtur1lGnxL3xH2PMvPeqwmNaOuhm1Zp8bFQyKRQD3ooc1P2p /DxFSwLWaoknx4TMT5gn3LlvZVWirmGDtP0nIRmSt9TMDFmF9m2VxdpxuMPMck6EGrZA flmM3h4+T4RWDv3ZwfU29cDdty59oGUw5GnW7UCvwkfSJ75JJxsZJbzgHrYd5+mGsjdx tCEDaCkKP6LwM8W6TdaAk7MwhzfwTFEWJ0DW02cBNtgdp13+XHVytDCVRrjcANzP8BzN BPLfbR46ZjMkwPUzWUOGliffy992ToSdNV1jLrg3XiZK2VTq8nDOYd10Be2l+cVEQbcf 5KLQ== 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 v18si1836137ejj.105.2021.01.18.11.54.47; Mon, 18 Jan 2021 11:55:11 -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 S2437687AbhARTvX (ORCPT + 99 others); Mon, 18 Jan 2021 14:51:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394005AbhARTqd (ORCPT ); Mon, 18 Jan 2021 14:46:33 -0500 X-Greylist: delayed 644 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Jan 2021 11:45:53 PST Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 592A8C061573 for ; Mon, 18 Jan 2021 11:45:53 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1l1aTB-0036Nk-PE; Mon, 18 Jan 2021 19:45:45 +0000 Date: Mon, 18 Jan 2021 19:45:45 +0000 From: Al Viro To: Linus Torvalds Cc: Johannes Berg , Christoph Hellwig , Oliver Giles , Linux Kernel Mailing List , Greg Kroah-Hartman , Al Viro Subject: Re: Splicing to/from a tty Message-ID: <20210118194545.GB736435@zeniv-ca> References: <20210118085311.GA2735@lst.de> 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 Mon, Jan 18, 2021 at 11:26:00AM -0800, Linus Torvalds wrote: > On Mon, Jan 18, 2021 at 12:58 AM Johannes Berg > wrote: > > > > > I think just wiring up iter_file_splice_write would work. Al? > > > > Seems to work for the simple test case that I had, at least: > > Mind sending me a signed-off patch for this? > > Yeah, I know it's a trivial one-liner, but I much prefer having an > author with a patch and a sign-off to just doing it personally and > reaping all that glory for it.. IMO it's a wrong way to handle that. Look: do_sendfile() calls do_splice_direct(), which calls splice_direct_to_actor(). There we allocate an internal pipe and go through "feed from source into that pipe, then shove what's there into destination". Which is insane for the case when destination (or source, for that matter) is a pipe itself. do_splice_direct() does something that do_splice() won't - it handles non-pipe to non-pipe case. Which is how sendfile(2) is normally used, of course. I'll look into that in more details, but IMO bothering with internal pipe is just plain wrong for those cases.