Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2480838rwd; Fri, 2 Jun 2023 09:59:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Y7MD+dn91/UGPOgS8tbOzLm9HHjj3GQ1YCM/8U+CoMscf176Ua1aHbQf9YJ65Gk45M1ZT X-Received: by 2002:a05:6a00:124a:b0:64f:bf12:a7f7 with SMTP id u10-20020a056a00124a00b0064fbf12a7f7mr11665783pfi.5.1685725192099; Fri, 02 Jun 2023 09:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685725192; cv=none; d=google.com; s=arc-20160816; b=h0o0djowKAGlhUQ8K2A1eofNp1UDF0lKYqMdzNRsdW6rTjP50h93cdsd+OftgTeIOA /b5d7MryTNSKyd9RUpeDN8LNk00UfcIa3lDdXM1YXZs1ODn2/VfOa32XWMI+5+DjtJZY WXGjkK31/4jEi5CPGGFSCsy/yRUkeivn1LWZ1qUIGta8+ipVFeQgDgfREq4NVQpE3Bpp iBY26mg98YbalNdjQKnMz7IlQbrycxnRPqg+2lFFC3Xur1mAsn3o/bP8/rDrIrQZtU4z q3BeTygSwp0Wh6yBct5HyBZtPjwHB/Zr++uCFqSe4BHG5Ty+33Yr17yq8kP0HUQiSjFv R5zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vzJT3HyKG2J4xiGoewlppsTGaruPJowM8pRCfo3JmUA=; b=bl1r2Sd/RrsPEuY+ya+k1tGitX9fXKtNaFXTSE0jK2PGbh0aYXK4+LE0pKYKKP7q7i Euk9kB1ke915T+vp9pvZtyS3+lGFU/aOGB1nCEaqvMjI6sx/SMhGtsX3LjoqcRYuq7jC jHHNO1LZzjdfJw5D1SeWStZe1TgZEhAMLgzALjSGGscCg1H8mn6m095CWwNbRUEHjHYB ipqux4U3d30DRB2ONMSKp1fTXN7hGJUs5QAeiM2BwEeMYFgcKGGGe+kWUDzgKT2pMCAt d3FNJMVqVsso6jKuI+Nohq/Q+PkZtc/UhPCJotFeJw3xR6W84WgrleRb/SH9/ohsHnXM S0Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ex3hBZuf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x3-20020aa79563000000b006462cc07d9esi968995pfq.300.2023.06.02.09.59.39; Fri, 02 Jun 2023 09:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=ex3hBZuf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234942AbjFBQg4 (ORCPT + 99 others); Fri, 2 Jun 2023 12:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234584AbjFBQgz (ORCPT ); Fri, 2 Jun 2023 12:36:55 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44747B4 for ; Fri, 2 Jun 2023 09:36:54 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f3ba703b67so3036015e87.1 for ; Fri, 02 Jun 2023 09:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1685723812; x=1688315812; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vzJT3HyKG2J4xiGoewlppsTGaruPJowM8pRCfo3JmUA=; b=ex3hBZuf687wTeLAQT1ZHHSKrPZ4p/Co3Hyth76X0c1fUP+5vgyQMVzI7qKNtWfwhg 6445h4vRh9wUMGGbVwmbzHjKEmCVV329+8YPReHmBrIwsT4xncD9jR6mYSEsn7WKvhxB WEToExzPMBMClXU0lQOnnf+rxRLpv/r/dLHHQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685723812; x=1688315812; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vzJT3HyKG2J4xiGoewlppsTGaruPJowM8pRCfo3JmUA=; b=NTR+ywalsldSLFd1OgFaBBi6p+XBESCNwYxmVkwdAKxNmEnTZF128w7r6GMMO5R9cx 8tOXEHUiKH6CH4AmPFSX5NtSbQVZ2WJLa5SK5NA3MvKDeupBB3eX47jwSqvQ5wiDfXWU vJdoYSO0/9tmPNzJrPWaSS4WIVwSR3aZE/cQruVNSD80rUv+FnEGrmw33o26nl4Sf7QH k86IZvXFdUU+D6vD3fqNC7S6NyVDgPMWQVYXPVRvplmgry9khq+hzHJEIbnviTx7yrpV GsbVSuO0NR2m3yfjMM8LU6z2mfeMUVWSrj5+6z3kjgyrn/BdkSZF/a5ba+WAs2VJVQHr mIdQ== X-Gm-Message-State: AC+VfDzV2PU8wJBLP6gNBrpYYYO+vx340CsWPdEE2dBfibGf9x5p7dq0 u1LM0f2qBMIOjrqU0tOWUHM5xoMKN+f9vhhyCDEoI3Vr X-Received: by 2002:ac2:54a9:0:b0:4ef:eb50:4d3d with SMTP id w9-20020ac254a9000000b004efeb504d3dmr2194191lfk.18.1685723812538; Fri, 02 Jun 2023 09:36:52 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id c24-20020ac25318000000b004eefdd8b37fsm210753lfh.194.2023.06.02.09.36.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Jun 2023 09:36:52 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-4effb818c37so3029984e87.3 for ; Fri, 02 Jun 2023 09:36:52 -0700 (PDT) X-Received: by 2002:a2e:7302:0:b0:2af:1681:2993 with SMTP id o2-20020a2e7302000000b002af16812993mr311009ljc.49.1685723811492; Fri, 02 Jun 2023 09:36:51 -0700 (PDT) MIME-Version: 1.0 References: <20230602150752.1306532-1-dhowells@redhat.com> <20230602150752.1306532-6-dhowells@redhat.com> In-Reply-To: <20230602150752.1306532-6-dhowells@redhat.com> From: Linus Torvalds Date: Fri, 2 Jun 2023 12:36:34 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net-next v3 05/11] splice, net: Fix SPLICE_F_MORE signalling in splice_direct_to_actor() To: David Howells Cc: netdev@vger.kernel.org, Chuck Lever , Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Al Viro , Jan Kara , Jeff Layton , David Hildenbrand , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 2, 2023 at 11:08=E2=80=AFAM David Howells = wrote: > > Fix this by making splice_direct_to_actor() always signal SPLICE_F_MORE i= f > we haven't yet hit the requested operation size. Well, I certainly like this patch better than the previous versions, just because it doesn't add random fd-specific code. That said, I think it might be worth really documenting the behavior, particularly for files where the kernel *could* know "the file is at EOF, no more data". I hope that if user space wants to splice() a file to a socket, said user space would have done an 'fstat()' and actually pass in the file size as the length to splice(). Because if they do, I think this simplified patch does the right thing automatically. But if user space instead passes in a "maximally big len", and just depends on the kernel then doing tha ret =3D do_splice_to(in, &pos, pipe, len, flags); if (unlikely(ret <=3D 0)) goto out_release; to stop splicing at EOF, then the last splice_write() will have had SPLICE_F_MORE set, even though no more data is coming from the file, of course. And I think that's fine. But wasn't that effectively what the old code was already doing because 'read_len' was smaller than 'len'? I thought that was what you wanted to fix? IOW, I thought you wanted to clear SPLICE_F_MORE when we hit EOF. This still doesn't do that. So now I'm confused about what your "fix" is. Your patch doesn't actually seem to change existing behavior in splice_direct_to_actor(). I was expecting you to actually pass the 'sd' down to do_splice_to() and then to ->splice_read(), so that the splice_read() function could say "I have no more", and clear it. But you didn't do that. Am I misreading something, or did I miss another patch? Linus