Message ID | 20230520000049.2226926-7-dhowells@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 C77C2C77B7A for <linux-mm@archiver.kernel.org>; Sat, 20 May 2023 00:01:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F5BD280004; Fri, 19 May 2023 20:01:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55871280001; Fri, 19 May 2023 20:01:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AB9B280004; Fri, 19 May 2023 20:01:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 221AF280001 for <linux-mm@kvack.org>; Fri, 19 May 2023 20:01:19 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id EA22A1A0B78 for <linux-mm@kvack.org>; Sat, 20 May 2023 00:01:18 +0000 (UTC) X-FDA: 80808678636.25.EABF8AD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 149ED18000A for <linux-mm@kvack.org>; Sat, 20 May 2023 00:01:16 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Qu2hdYVH; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1684540877; 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=3G3sKLO6NWg4Qi1Gepthcp6ipQZ6DSu/XMOeps2uwWE=; b=BqvdNCI1OXIZtgGiQ1zYFxFMhxaRt6ZGvQKNZO09zBuCVjy4ENpr/jOuyIgV9EdGENFVcT idyzUa43t+1cARXLcjgVdXB45WAIpwgLjatMIAMKYUHIubmTjyZOLK+hUfy7AuTyHwVobX xz64s8cCZqqECS3wR8/xjnykF0QenYg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684540877; a=rsa-sha256; cv=none; b=3/7UKSS16I3FLjUJmW71OFPIAFvVSM+iR87Ryd1gAtHrUduZvvX5psAUjYEq0+6I64+Jsj ZKvvqaHEUS2T2YMZ6/wrvnaMgKigCEAodxEJqQ6iumuggkyh4j96GLXCW/tQoqcDgYjCwt xIrPi4rHutW9N+TMI6szZLSt1/8FGAc= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Qu2hdYVH; spf=pass (imf24.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540876; 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=3G3sKLO6NWg4Qi1Gepthcp6ipQZ6DSu/XMOeps2uwWE=; b=Qu2hdYVHIHXuOBeqesZPLGHdGr9o4THJ1eXdrAT1Uk8mVF8oIZbMFxVcj/DYwF20clWzsP yB4O+46BqzxVJQbitJpeMpM8TWvFo5hQyWn5hxjWWaFzNuPFyBTh7MIa1+bLGVBot9JlPN Iks5h3CYsfsEXWkq79SaAlSD4p1WwT0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-CToXHsdXO_ifGZvqbzsW0w-1; Fri, 19 May 2023 20:01:12 -0400 X-MC-Unique: CToXHsdXO_ifGZvqbzsW0w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AAB3C185A78E; Sat, 20 May 2023 00:01:11 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id B202B2026D49; Sat, 20 May 2023 00:01:09 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Jens Axboe <axboe@kernel.dk>, Al Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@infradead.org> Cc: David Howells <dhowells@redhat.com>, Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>, Jeff Layton <jlayton@kernel.org>, David Hildenbrand <david@redhat.com>, Jason Gunthorpe <jgg@nvidia.com>, Logan Gunthorpe <logang@deltatee.com>, Hillf Danton <hdanton@sina.com>, Christian Brauner <brauner@kernel.org>, Linus Torvalds <torvalds@linux-foundation.org>, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig <hch@lst.de> Subject: [PATCH v21 06/30] splice: Check for zero count in vfs_splice_read() Date: Sat, 20 May 2023 01:00:25 +0100 Message-Id: <20230520000049.2226926-7-dhowells@redhat.com> In-Reply-To: <20230520000049.2226926-1-dhowells@redhat.com> References: <20230520000049.2226926-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 149ED18000A X-Rspam-User: X-Stat-Signature: tkdtf87dgihb7mps6cngwxj16qz3wt75 X-Rspamd-Server: rspam03 X-HE-Tag: 1684540876-181738 X-HE-Meta: U2FsdGVkX1+swDu+w3zb2kJuEJQ55Q69X72CN62Da4GQYYBqdNqiZdS/wj2wAOhyaMOD6x8i0UuymzaOGMbGtcKrmu9cWBKSoiPDNVfBrPDsp1vzLucBGAYRCtYzjftNlX/hmgeC/AxxVfK+mxLVFMfbcubP0RN6HDZ9jRnyn/JKM8WStDweK5rUlzkUstcP3KCymCzR+bYv8waHkSW6/DNpsE5JmiAA6ggipsrZPWgEY4Du56rTLEAZubOmcd9vxiKePoq0aEkDOoq6LPACpREy6URtdpxxR9f1Olf/GUc6+iDc/O+dVx+ZrtTZyf1dPCr+104mVNchyWJiam+QKrhXOKWepCW1kak9BtezRUrF1u/pM5W+vzgg8CbrOnR65IJ+aLPfNRdlgjpfdYFUo6Ixg5I4ZKeUxuHtTC9S9nivNQ99mHGImgMT5lFbnrL3w8AD4W+fLbiRdSZEvgfhLH74FXenBNWlNB3r+LPS0UxtLEOJ3+6qFF/G1Pywh905K80u5f+ZuPbsXogyEfKGIfKQFvZYJpkNe/82mkSWeqI0XEwMXKBK33DdeDZbRcE4Adf58siae8pZLZTXzjiSTL0FMXnDP7+edhH6pMT52an+Mjt5k026e4SAR+XIBW6IHdzeb/mGZsQaF9I0aDAhg7TZwRAlAlWXDpEuhSGpssn0Eff7brZmFEY/7oAfMo3bbQEVqH+SBlGmSjZ1O5r0m2Rxq2D9VDAVX2Dr2kHfi3BoujeKX00U4meiMCXUHGT/U60Sz8NuZOKXsV7m0pp5OkhI6nxCe92QwGq4AMinoIW7wQCF47Gk8tyYO0ynmT86wt+g4++t5XCqWKxeYre4h26mWKpDHMtk5WdNahoiwaIfhFIbi2c9IO5g95umBaiKmXz/zg4Hx2bJRR9MPIimcN+HxSHzSjl4Afw7lH+1rZikodZ3622wg+RiOQHDeQ+TGNVtbkZnefbB+0zsDbx 5KrTBB9u 9T38iOKG05WVJTn3ZXYRVUBcngdsJ+/dmRsfPPmXf9RcRzj08OlxAKuObCFjNo1bufnaI4fn4Xk42X2QVLBH/Va+41HNkIDzfbWRJ4z28ebKIK1MEOgKs+vEQ1i9N0tEjEJy7f9OhjTyAPo9UeOr7J+v3x/TmKoxxOHUKs1BhdFKMtES3KdStykMRK0m91Xk9L1sqckckgsSON78eBr0W8qk5UVnyBo8HYkAKznykzWvEwPr2p9WYin7Khwd8OXBvnb2hKU49E6ljaoiktOrUxPpwVfWm8H2I6xjqdloj87/KOTtC6FCVoxS1mcixbe9OEmtIb0IQ0O+8Kk/cStQ5nvz85qdTiKFEzJM6liU7sUkEYsfNFMirv8u2n9YHzVg01/fqP4ar66xxzY4= 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: <linux-mm.kvack.org> |
Series |
splice: Kill ITER_PIPE
|
expand
|
On Sat, May 20, 2023 at 01:00:25AM +0100, David Howells wrote: > Make vfs_splice_read() return immediately if the length is 0. > > Signed-off-by: David Howells <dhowells@redhat.com> > cc: Christoph Hellwig <hch@lst.de> > cc: Jens Axboe <axboe@kernel.dk> > cc: Al Viro <viro@zeniv.linux.org.uk> > cc: linux-block@vger.kernel.org > cc: linux-fsdevel@vger.kernel.org > cc: linux-mm@kvack.org > --- Reviewed-by: Christian Brauner <brauner@kernel.org>
diff --git a/fs/splice.c b/fs/splice.c index d815a69f6589..fe3309ffeb26 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -891,6 +891,8 @@ long vfs_splice_read(struct file *in, loff_t *ppos, if (unlikely(!(in->f_mode & FMODE_READ))) return -EBADF; + if (!len) + return 0; /* Don't try to read more the pipe has space for. */ p_space = pipe->max_usage - pipe_occupancy(pipe->head, pipe->tail);
Make vfs_splice_read() return immediately if the length is 0. Signed-off-by: David Howells <dhowells@redhat.com> cc: Christoph Hellwig <hch@lst.de> cc: Jens Axboe <axboe@kernel.dk> cc: Al Viro <viro@zeniv.linux.org.uk> cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/splice.c | 2 ++ 1 file changed, 2 insertions(+)