Message ID | 20230520000049.2226926-7-dhowells@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp41305vqo; Fri, 19 May 2023 17:03:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7QfmpC3jVCa9rWd4DXyGDFA5JscfIixf+7lD94huJYG0WPxHjaTExrt9qe0F5L8NtgRrZe X-Received: by 2002:a17:902:7287:b0:1a9:8ba4:d0d3 with SMTP id d7-20020a170902728700b001a98ba4d0d3mr3857551pll.8.1684541037959; Fri, 19 May 2023 17:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684541037; cv=none; d=google.com; s=arc-20160816; b=FlZU7VvqRNfIla3Ql3fOMhK7l8bzx7Gok8AXRCyTT0IpXx2imBBLIe3PDeSgK7ynty OwRSyVh04ipkBFswfgWP1V7Ty08ki1iUvtgVfa+eCcg4DrBRVroFQJpDlt6NpPs/9HuY ptQaaMFWH5P9WnMI6WT8lgozG4/ur7A2Gpq3b0I6bq7prVoniywq+1mVyd+ZQTscIcdo GtoRgyy7z1OQdDCb4oSxcf+2Ma7tyw9yAO7eMLt5jHSr9sAWSlAPbpA0thBXiTHKpOwH ym34mJDAGbZDyNUtbRk/BWdEthacaVIofr6JYJuJWwXgWDXqgve8dOZltp+1I04mse/k h/nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3G3sKLO6NWg4Qi1Gepthcp6ipQZ6DSu/XMOeps2uwWE=; b=eQsA6ZpZwucoTEAPmxSvGDZJJz8zhWzuVd9uLRf4fsQOyJjHWbVJ40zBAV5H77SqXn G8syjqZH5RXZ46g5KNonNK/53sIF2RlIDNH0X8i9JoSqZPvM6ZvgdP5WGR13xrudLJXp BXChLRo42G1FCI3OlGn+z2V7Wm5m3FsmfdkKNyuoGyGYBo5mSNGerMInKcbpHVpoFhD3 gk/+wlK9R3ama9pekHRykSKHQyhrXkFMzkPUTONFp87alMATovcVJaEMeiy7rhFvd8Yw 5yZcTDxsDrpJ+MLOF4O47h34A9nrewNjmo2I3T4M1+xg0gdRrmDFrWmw4gw2EZXPyIQu FFqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="IU7b3/vS"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz12-20020a170902ef8c00b001adcdac8969si304404plb.463.2023.05.19.17.03.44; Fri, 19 May 2023 17:03:57 -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="IU7b3/vS"; 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 S230086AbjETACq (ORCPT <rfc822;wlfightup@gmail.com> + 99 others); Fri, 19 May 2023 20:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbjETACk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 19 May 2023 20:02:40 -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 2D2D910C6 for <linux-kernel@vger.kernel.org>; Fri, 19 May 2023 17:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684540874; 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=IU7b3/vS7XeJv3sWUvDfc1zcwWroULfKtqyKqoEej6zgyjbclQJb8Gdgl5y/qnUI4DFqYO PFy6yB8O61PIPGyn1urxErzMrwgSFeMB+k6BDpJfakUaPyPXUPRjT4iJX1ft7+o+Jm685Q ainJW8OHhm3PAAbIvlPzmAPwBiqFjw8= 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-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, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766369303430641542?= X-GMAIL-MSGID: =?utf-8?q?1766369303430641542?= |
Series |
splice: Kill ITER_PIPE
|
|
Commit Message
David Howells
May 20, 2023, midnight UTC
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(+)
Comments
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);