Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1838309pxb; Mon, 18 Jan 2021 00:56:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxo2x8Ty8oG1pklcw5aSNyWMs1sdDQCeMhsWXwM6YO7s1110IfbQbFR+ThgIf8RQFxAy5oY X-Received: by 2002:a05:6402:1ad1:: with SMTP id ba17mr18082977edb.51.1610960180630; Mon, 18 Jan 2021 00:56:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610960180; cv=none; d=google.com; s=arc-20160816; b=aa2yVsDW7oBhxPauH37HshVNtCh1kyEg8bO7RY+ZK0qOfSYSSikNddHbJLZnixB29m ifILqnMEhaFrmrGMpkRjTsPsBRcnv4WaSIxu6tmsHCmK2rvVNImG9qHyN+mIRR5J5T13 Ypkwl+QoW2fFf4d/CtTYZcxeT5QUjff/BvFzU10LVt2/nhvvTA7C03KyQMGCMR2eU9cc QVP6KkT6ibGoDuR/2w1Y+y2A8grBlVcRpuOGw88Per0m3gzTavufMK6iGkEFICoVXnu9 gW+413INcTYcE6HBjsZW+NysGUT2encoc4Yj1ktW3a4y1vbU2NFGK0wB4eRz99q9y+MU xw7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qIA04X1VybxV1Og3vdusbcRPaFXubBQWtv++Uu20cUM=; b=wxEVC2aGzwcAPrN+sJIwikhzR/nRnbJ7k3OVHEN8rW15gXoMrmoYN270aIU3JlJ906 VKn79+uaPhRz/UABhqzHwKf93D66VxdR7BtBAnfv6XNwGeNkTeBidR6SUBbNcG3T7vOi M08sqwTRZ2wTuMQljf7XgFeHboocZOxxdIYL0BKPwGr/3SVoKkmOJVGWoCX4ap/lkAXB 4+VnZgku9ocf/Trd0FouxfuBwZFVWAfNANJLN+Yq3FYZBbOB0k20+43ECIdnzz/w0Quc dM7KpphkOmMkhNObY43/+ZFiO8VrQfhl4DvQXfc9IQNyCW+Iu4bZmDXDjBeBpRxt9LtD pgRA== 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 dk7si7732829ejb.687.2021.01.18.00.55.57; Mon, 18 Jan 2021 00:56:20 -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 S2387973AbhARIxy (ORCPT + 99 others); Mon, 18 Jan 2021 03:53:54 -0500 Received: from verein.lst.de ([213.95.11.211]:47062 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387937AbhARIxx (ORCPT ); Mon, 18 Jan 2021 03:53:53 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 66CE968AFE; Mon, 18 Jan 2021 09:53:11 +0100 (CET) Date: Mon, 18 Jan 2021 09:53:11 +0100 From: Christoph Hellwig To: Johannes Berg Cc: Oliver Giles , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Christoph Hellwig , Linus Torvalds , Al Viro Subject: Re: Splicing to/from a tty Message-ID: <20210118085311.GA2735@lst.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 16, 2021 at 05:46:33PM +0100, Johannes Berg wrote: > > For my case, I attempted to instead implement splice_write and > > splice_read in tty_fops; I managed to get splice_write working calling > > ld->ops->write, but splice_read is not so simple because the > > tty_ldisc_ops read method expects a userspace buffer. So I cannot see > > how to implement this without either (a) using set_fs, or (b) > > implementing iter ops on all line disciplines. > > > > Is splice()ing between a tty and a pipe worth supporting at all? Not a > > big deal for my use case at least, but it used to work. > > Is it even strictly related to the tty? > > I was just now looking into why my cgit/fcgi/nginx setup no longer > works, and the reason is getting -EINVAL from sendfile() when the input > is a file and the output is a pipe(). Yes, pipes do not support ->splice_write currenly. I think just wiring up iter_file_splice_write would work. Al? > So I wrote a simple test program (below) and that errors out on kernel > 5.10.4, while it works fine on the 5.9.16 I currently have. Haven't > tried reverting anything yet, but now that I haev a test program it > should be simple to even bisect. > > johannes > > > #include > #include > #include > #include > #include > #include > #include > > int main(int argc, char **argv) > { > int in = open(argv[0], O_RDONLY); > int p[2], out; > off_t off = 0; > int err; > > assert(in >= 0); > assert(pipe(p) >= 0); > out = p[1]; > err = sendfile(out, in, &off, 1024); > if (err < 0) > perror("sendfile"); > assert(err == 1024); > > return 0; > } > ---end quoted text---