Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D2F2C636D7 for ; Fri, 10 Feb 2023 22:26:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233821AbjBJW0F (ORCPT ); Fri, 10 Feb 2023 17:26:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233379AbjBJW0A (ORCPT ); Fri, 10 Feb 2023 17:26:00 -0500 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E6C27534E for ; Fri, 10 Feb 2023 14:25:59 -0800 (PST) Received: by mail-pj1-x1035.google.com with SMTP id m2-20020a17090a414200b00231173c006fso10743828pjg.5 for ; Fri, 10 Feb 2023 14:25:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; t=1676067959; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=VXBM3BZPJurQG+9S0/yF7Jxgoc2wkik3nPAHNKQyPdo=; b=2dnOYsDrWpY6Q9SO7Yz27hs41FZUdKTa840dThiS0JCvA81scgVYZGfZ588HEWjYJx h50yZMB+2DNsfYenYGLA1BoQrIq3iKsZFh31wBsZ5F2/3MME40Gcts0oruqC2rGXzkrp rjIESvq4+M6VD3SUkw4Kcm6JnGB/UAL1beCa+y3qZwfPER8cMI9xkiCda3pgOrnpp6AT GjxH6mrdBt4uQwqLmfBOLLXUPmednsBvlBZ5vVeai/L8z37NFSypqnq5UuxeGBUIVUeO vqvR7J4CvAIjb7n0WoVWir2d7Ykj3YMne8ASZm70XCVCRz2i4AtmhU3qoGpYDdp68KgI PC/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676067959; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VXBM3BZPJurQG+9S0/yF7Jxgoc2wkik3nPAHNKQyPdo=; b=IttHylVNGIYD1Db8lobjon1Dr2pNGO6VoDHf4EijVLSmXq5R/HBz/SFOELqoi6ZUeR TkLXRa/FPJXKE6jUM2jOXROHSgzhR1+rI468shrepFpBjnxxpdD6RmUiRR/jvohBBJS/ IbR45vuqxaMN6biNCmC+kuyzJfgHHtF55wcJmijy9LX16v6hXU4XBsmJI954eRyZUAk/ HAg2Sdtk/J4ksewkOfd6jQ2dS1D+Eud92pVKwzb/M6WY4WUjrALRB4nWGdQMiRf79Sse UrwM9XDJJTLvd1AOeuM9bcQvddKyZW+uBZoU3kG8xeDtl7kJztzBzhYSrZx5YyBLy3E5 s/xA== X-Gm-Message-State: AO0yUKVTdrXlk3D702rcsus2rlsXv4ei4JiI/RoBEwRjJbff4n1wApag 6OcYIvsMZaF8httV518q3Jzlyw== X-Google-Smtp-Source: AK7set+GrkUIVowp8cBbgQHdtPTA9kJYbebkONcykH0FZvMiCq2V47NSvr+b8gJtPFWlvvKx7UygHQ== X-Received: by 2002:a17:903:182:b0:199:1292:53cd with SMTP id z2-20020a170903018200b00199129253cdmr17899305plg.1.1676067958914; Fri, 10 Feb 2023 14:25:58 -0800 (PST) Received: from [192.168.1.136] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id jb1-20020a170903258100b001990c6c16ebsm3856968plb.37.2023.02.10.14.25.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Feb 2023 14:25:58 -0800 (PST) Message-ID: <824fa356-7d6e-6733-8848-ab84d850c27a@kernel.dk> Date: Fri, 10 Feb 2023 15:25:56 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: copy on write for splice() from file to pipe? Content-Language: en-US To: Linus Torvalds , Ming Lei Cc: Andy Lutomirski , Dave Chinner , Matthew Wilcox , Stefan Metzmacher , linux-fsdevel , Linux API Mailing List , io-uring , "linux-kernel@vger.kernel.org" , Al Viro , Samba Technical References: <0cfd9f02-dea7-90e2-e932-c8129b6013c7@samba.org> <1dd85095-c18c-ed3e-38b7-02f4d13d9bd6@kernel.dk> <7a2e5b7f-c213-09ff-ef35-d6c2967b31a7@kernel.dk> <2bb12591-9d24-6b26-178f-05e939bf3251@kernel.dk> From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/10/23 3:17?PM, Linus Torvalds wrote: > On Fri, Feb 10, 2023 at 2:08 PM Linus Torvalds > wrote: >> >> (a) the first one is to protect from endless loops > > Just to clarify: they're not "endless loops" per se, but we have > splice sources and destinations that always succeed, like /dev/zero > and /dev/null. > > So things like "sendfile()" that are happy to just repeat until done > do need to have some kind of signal handling even for the case when > we're not actually waiting for data. That's what that whole > > /* > * Check for signal early to make process killable when there are > * always buffers available > */ > > this is all about. See commit c725bfce7968 ("vfs: Make sendfile(2) > killable even better") for a less obvious example than that > "zero->null" kind of thing. > > (I actually suspect that /dev/zero no longer works as a splice source, > since we disabled the whole "fall back to regular IO" that Christoph > did in 36e2c7421f02 "fs: don't allow splice read/write without > explicit ops"). Yet another one... Since it has a read_iter, should be fixable with just adding the generic splice_read. -- Jens Axboe