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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 92180C433DB for ; Mon, 18 Jan 2021 19:52:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5799222CAD for ; Mon, 18 Jan 2021 19:52:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437698AbhARTvZ (ORCPT ); Mon, 18 Jan 2021 14:51:25 -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.