From patchwork Sat May 20 00:00:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13248994 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B03C77B7A for ; Sat, 20 May 2023 00:01:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E362900006; Fri, 19 May 2023 20:01:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46BC1280001; Fri, 19 May 2023 20:01:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E5C7900007; Fri, 19 May 2023 20:01:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 1C79E900006 for ; Fri, 19 May 2023 20:01:43 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E9DEBC0ADA for ; Sat, 20 May 2023 00:01:42 +0000 (UTC) X-FDA: 80808679644.17.B4A0B2F Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf03.hostedemail.com (Postfix) with ESMTP id 3E60C2001C for ; Sat, 20 May 2023 00:01:40 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MdYStdPF; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684540900; a=rsa-sha256; cv=none; b=egLs0PUhtiKQbFhL2Wn5Glizk0E+Lj0MUjERmgsedMwzQxMUNBtbfRw5/Cdo1SrU1+Ux4+ 0yTBF3/5tc+ARoMS85FIJU19eD15FadyXtBmA3itJjmQxF06QL5fYB+cPatzeT2b9n9j// 1xfWU3CWAUgGI0X5/Is5UjvzHmp0vuM= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=MdYStdPF; spf=pass (imf03.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684540900; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gRzUovfXnw170GzVg3YWYDNx7Fcy6r2PjCbmCvJAFKQ=; b=YCh2BAao/LlFjJ3F57xhRoOarpD/sdBrPq9/rAa5zsKE0xFKRv/ydSdQgB4VtE7XXZBEkM NIZxcYUSOgnRSweji1V5TSnjiieZsb20+N3RMzvfPaB1SX6p96bvd8nSUfr6CjIUviTNS3 298iVBbL54N/0UycURofc5nWxPvHiVc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gRzUovfXnw170GzVg3YWYDNx7Fcy6r2PjCbmCvJAFKQ=; b=MdYStdPFewWlmVJPWIoViZLxFenCX184Fmmf8KG1X2ZXIfLh7eiecibre5LoQSuB9niARG Ic2ofDNX1zD9hsbYvHTWnALUyVGmHSFpCMOPo6aouZUJH7bHgFP1m3Ccrlm3+0jNMMJvhZ wQ5bj07e14e4wBjDDgskDU87ZiMnyiI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-672-1JhP-Y78PWKPthfxNC2xdQ-1; Fri, 19 May 2023 20:01:35 -0400 X-MC-Unique: 1JhP-Y78PWKPthfxNC2xdQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4596E1C041B8; Sat, 20 May 2023 00:01:34 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4E3740CFD48; Sat, 20 May 2023 00:01:31 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Christoph Hellwig , netdev@vger.kernel.org Subject: [PATCH v21 13/30] net: Make sock_splice_read() use copy_splice_read() by default Date: Sat, 20 May 2023 01:00:32 +0100 Message-Id: <20230520000049.2226926-14-dhowells@redhat.com> In-Reply-To: <20230520000049.2226926-1-dhowells@redhat.com> References: <20230520000049.2226926-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3E60C2001C X-Stat-Signature: 4uc85edps5raeznbawkz8i5ahumnz986 X-Rspam-User: X-H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e3xYYkPnh+5vitJqYdmVWySZBN/wFqa385dSyM0mNazzmcc5dCeBHNPmdjWILf5nvB3Gg+Nvs0zEl/iNTOwIKWowJJxU9U6V4/KIu08TVPZG/hRqWmpB2Rh6DsqUzKw/t6Y3AT2I6nO0o0agtBdaY4seuzj7cVlGwCA1oACCJ63f07TdlhTyToQBKGxYJKJq7aDWg59zq07+NmSv/xY82RCFu3Vm756pZHSsut1s6QSrXgI07M9ssGtr9TjzgUeIh3Hglsy8rbvtobGZ5+1rN5Rl9Lsp95JCUqKAzVnEAcC0GymFmb/Qq9JASehq2Fpty6cprjfQUKmtqPc3stE6cdmuShyr7ahp5XPvLLF6D152JUVEdXZlBXjH3Epae8+vNpOBWwXQ/3WF3ufAF/I+/XQPOdXG534D5Ahl7s1E X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Make sock_splice_read() use copy_splice_read() by default as file_splice_read() will return immediately with 0 as a socket has no pagecache and is a zero-size file. Signed-off-by: David Howells cc: "David S. Miller" cc: Eric Dumazet cc: Jakub Kicinski cc: Paolo Abeni cc: Christoph Hellwig cc: Al Viro cc: Jens Axboe cc: netdev@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org --- net/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/socket.c b/net/socket.c index b7e01d0fe082..401778380195 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1093,7 +1093,7 @@ static ssize_t sock_splice_read(struct file *file, loff_t *ppos, struct socket *sock = file->private_data; if (unlikely(!sock->ops->splice_read)) - return generic_file_splice_read(file, ppos, pipe, len, flags); + return copy_splice_read(file, ppos, pipe, len, flags); return sock->ops->splice_read(sock, ppos, pipe, len, flags); }