Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3250575rwo; Mon, 24 Jul 2023 08:21:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlHmbJqNg0ETRn/Ku5vnJu5FZ6J5ayKarsvvq6uaAi36z2qlUZWDVTBl9C8fz27ujaC5RtsE X-Received: by 2002:a17:902:c952:b0:1b8:76ce:9dab with SMTP id i18-20020a170902c95200b001b876ce9dabmr10064085pla.41.1690212063788; Mon, 24 Jul 2023 08:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690212063; cv=none; d=google.com; s=arc-20160816; b=addj+hYTrnM3oGXMURaoAsmYna34Eb1dDZ/dt1lTTZC+a2RYz7agfPiLLeIjPtsCTB gANsXVV9MEKMnYkcVPQD+iBHMrD7w7ankR2pnWlPwm0yO76RSyIAsOq1jqSXiKWY7cAe LKzUkaf5g0z8JIE/69Hh8BxLLw9GxP9sEGxOkQCx3NY3GFIHXMQxBW643VRtFYI4Qzf9 2FbJKM+B/z8x54Ujd/Z6jD0bzWyMam1XfyGINOhwDsFfO8nw2B+KXnyfzyftgxuW+FkC zH8XjVG+kQgcymozpg6nP0NKtp5dh/vsL6QYHjiRLAoGtv9cfrBjGBNeJlf1O8k0TOYm kGZw== 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=ypOLNcWWYz98bhBvl2u/qys2akcVFXTw8mlGUAqbNFw=; fh=yNH/5ECqR+2Y5hv/QexNIE13Zg+5RBd+BrDYZtUFSyI=; b=XcSSl44Tp1qnKwdp2/CtMD/bKBI7mObFHoYG2QLbiG452L8QtoE3dLUU9GHtwU01bI g867t8NBQBvxw01slb86F+eVZBZgRNfCzK/4qXGgFH3yC2YZRdOqVUXuuMEm4trXaRqb VwJhCbB5It9Kq+jor/ktuEfrgZeQjPr3SXb2Vc9Pp5etn8zWa5KWpO/rsql4J6eF3xdp bc7n+0gYhCCcSdruiR5WTxoi3dAEkXuIAYaNv5Czr1k7VomMmbnmiDWGLaYT5b43sELQ Oifsw2fi16T3R+5sqDvXebJUafC6mjhEfCiRl8to4pyx70woZfCfgCo1qXmHqq6GOpyG iZZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PC7gE8Qb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a170902c40b00b001b8a7521b5csi9773695plk.244.2023.07.24.08.20.50; Mon, 24 Jul 2023 08:21:03 -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=@redhat.com header.s=mimecast20190719 header.b=PC7gE8Qb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbjGXOwT (ORCPT + 99 others); Mon, 24 Jul 2023 10:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbjGXOwS (ORCPT ); Mon, 24 Jul 2023 10:52:18 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C926F10C1 for ; Mon, 24 Jul 2023 07:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690210290; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ypOLNcWWYz98bhBvl2u/qys2akcVFXTw8mlGUAqbNFw=; b=PC7gE8Qb1Qya/YXbhRIeMaxZhh8MrDh5C16sQ12KRa+a7Qxd3P6NlUEz24U2qJR2ibBiw3 vKcZylLby3KsHh/QBHVe2lXOP7LOL8edp7vPFgqABuUfUQp9oITQ6zgbVxGaAPnxBeSPM0 I+/QqH7iVurLmwGcKWwb+i/j8FAFtcM= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-QdTx1NhJOIynN8_UeHK0wA-1; Mon, 24 Jul 2023 10:51:28 -0400 X-MC-Unique: QdTx1NhJOIynN8_UeHK0wA-1 Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-4436d12c318so686019137.3 for ; Mon, 24 Jul 2023 07:51:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690210288; x=1690815088; 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=ypOLNcWWYz98bhBvl2u/qys2akcVFXTw8mlGUAqbNFw=; b=KpC/G7U9Ik5a6JetGtQ7NjfYvbGq9+/io2DqywaQomJ9Ec5/bbI2/xpeksUCXiOrq+ KivASbmW9xj+r4YK5E7pYtdHZ0w9sPgaqnftwcOAU1p6myOI9/PWAYb+SgV5mvvYqeyM t9us/G7dhI5ElqHVf0JQGPBcTvAOjno0QjAf73NmBJlsxzjrfv4kNojJmGUcvQ3t0Zk0 y5YH1NBVPkYAdOzRpHCj6aMtsishS+2DJdNCO/9tKncZWtD2hlQ55zsnLK61/f/lzngu N4id56ByXvR4Fzr63hiFLvSVRoQbFqdK1cMq64JWnHTH0Ql5UrhMD0DT/TWN5KQQCxdJ 0TZA== X-Gm-Message-State: ABy/qLZaHvWsVBpYbfmbQJdq2Z7Z8husuYKhKqecPmXQvj1YCzYDSwOB HRIT4ZrIwhxxiul2hfTnbc26jboVkOP2rnpEN0Sms8sICzzMzCBC+OlyluO28AOl1sUtkZoSV1A YEslhUFBhoTy9QyMaVaMRwOKildkEK5/NBa6KLbszGv71DLi0 X-Received: by 2002:a05:6102:8c:b0:444:c49c:a95d with SMTP id t12-20020a056102008c00b00444c49ca95dmr2645845vsp.7.1690210288121; Mon, 24 Jul 2023 07:51:28 -0700 (PDT) X-Received: by 2002:a05:6102:8c:b0:444:c49c:a95d with SMTP id t12-20020a056102008c00b00444c49ca95dmr2645831vsp.7.1690210287901; Mon, 24 Jul 2023 07:51:27 -0700 (PDT) MIME-Version: 1.0 References: <7854000d2ce5ac32b75782a7c4574f25a11b573d.1689757133.git.jstancek@redhat.com> <64434.1690193532@warthog.procyon.org.uk> In-Reply-To: <64434.1690193532@warthog.procyon.org.uk> From: Jan Stancek Date: Mon, 24 Jul 2023 16:51:11 +0200 Message-ID: Subject: Re: [PATCH] splice, net: Fix splice_to_socket() for O_NONBLOCK socket To: David Howells Cc: kuba@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, brauner@kernel.org, viro@zeniv.linux.org.uk Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, Jul 24, 2023 at 12:12=E2=80=AFPM David Howells wrote: > > Jan Stancek wrote: > > > LTP sendfile07 [1], which expects sendfile() to return EAGAIN when > > transferring data from regular file to a "full" O_NONBLOCK socket, > > started failing after commit 2dc334f1a63a ("splice, net: Use > > sendmsg(MSG_SPLICE_PAGES) rather than ->sendpage()"). > > sendfile() no longer immediately returns, but now blocks. > > > > Removed sock_sendpage() handled this case by setting a MSG_DONTWAIT > > flag, fix new splice_to_socket() to do the same for O_NONBLOCK sockets. > > Does this actually work correctly in all circumstances? > > The problem might come if you have a splice from a non-rewindable source > through a temporary pipe (eg. sendfile() using splice_direct_to_actor()). I assumed this was safe, since sendfile / splice_direct_to_actor() requires input to be seekable.