Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1840552pxb; Mon, 18 Jan 2021 01:01:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyhljC6RTFKz1UXLN1Qk2QoL04eIGpINwD5r2r78vaWGi4Tp/6sZFRosGBg3Csi9RadnqmB X-Received: by 2002:a17:906:d1cb:: with SMTP id bs11mr15889732ejb.535.1610960471368; Mon, 18 Jan 2021 01:01:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610960471; cv=none; d=google.com; s=arc-20160816; b=yhifAaK4a+UXGZZvR5jjdARr8g4ukBv419vnj3Zv7vD06QdGAqYqBBSY5hOSO6pG1j 4ojqNenBeB9OkWzauvtTJdXZQs05INgmRwKO8ihRQqJ72hmpixCKIF4AKIhgP9tnjeRt O0tTVenZGS3neDsbRRqLoAvtGCnch56gPqI8RRQFS4u5eV+lYjo9BEKF6SWaYkVu34F1 k0LMmRM6SZPzoFwSWghgCPB+d1GAK2ndfHOh5d9e36j8BtUpCwGnAIfNEYlU3vOgsp7v 7n94oFyDHbIWYn33T1BlQ3WKHLch/hYmFQO3ttRxDNlFPIOS0buN8pB+9OqpA1ivkRjH OxZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=Sw14dJgJbjxmSXpGirTTxxua5frtqbn5l0pbpt8QHCQ=; b=wB52cwbs589wieDuVV0FMRzk8EbiFRwRD47e3w8udPVdWDd87uel8RKxbnYeUpMbd6 Fe8nCQQs9wIkXU+HZtmrGu7cYWxHaDKPOa3l+UZX3w/Suga9I5Wp0ABg1sxiMcIVh+DC evsDs+JnfZHESfBDPpLZ5qVXXvdWjzg/l8OLGwuEXdhKhSrXUxR6ydv3ncQn88WUeCqY K+EiQa1I9JuhEkmA/4gLtY3cYLPVGT76LPYNUwfmoCi7L3PUmSeBDBRaxDJEhegV+qLG IHfnf0VWm7ODfGb4KmfGmKDtHmPsEGHtNZQBJktufkkYVyYA74lBM+AqTITSWEzkK/EJ Kzcw== 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 o18si7313047edq.530.2021.01.18.01.00.47; Mon, 18 Jan 2021 01:01: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 S2388022AbhARI7j (ORCPT + 99 others); Mon, 18 Jan 2021 03:59:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387918AbhARI7g (ORCPT ); Mon, 18 Jan 2021 03:59:36 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B78BC061574 for ; Mon, 18 Jan 2021 00:58:56 -0800 (PST) Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94) (envelope-from ) id 1l1QN8-008Aiv-Fy; Mon, 18 Jan 2021 09:58:50 +0100 Message-ID: Subject: Re: Splicing to/from a tty From: Johannes Berg To: Christoph Hellwig Cc: Oliver Giles , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Linus Torvalds , Al Viro Date: Mon, 18 Jan 2021 09:58:49 +0100 In-Reply-To: <20210118085311.GA2735@lst.de> References: <20210118085311.GA2735@lst.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-01-18 at 09:53 +0100, Christoph Hellwig wrote: > 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. Well, it clearly used to work :-) > 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: diff --git a/fs/pipe.c b/fs/pipe.c index c5989cfd564d..39c96845a72f 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -1206,6 +1206,7 @@ const struct file_operations pipefifo_fops = { .unlocked_ioctl = pipe_ioctl, .release = pipe_release, .fasync = pipe_fasync, + .splice_write = iter_file_splice_write, }; /* johannes