diff mbox series

[PATCHv4,1/9] block: fix infiniate loop for invalid zone append

Message ID 20220526010613.4016118-2-kbusch@fb.com (mailing list archive)
State New, archived
Headers show
Series direct io dma alignment | expand

Commit Message

Keith Busch May 26, 2022, 1:06 a.m. UTC
From: Keith Busch <kbusch@kernel.org>

Returning 0 early from __bio_iov_append_get_pages() for the
max_append_sectors warning just creates an infinite loop since 0 means
success, and the bio will never fill from the unadvancing iov_iter. We
could turn the return into an error value, but it will already be turned
into an error value later on, so just remove the warning. Clearly no one
ever hit it anyway.

Fixes: 0512a75b98f84 ("block: Introduce REQ_OP_ZONE_APPEND")
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/bio.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Damien Le Moal May 26, 2022, 1:48 a.m. UTC | #1
On 2022/05/26 10:06, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 

s/infiniate/infinite in the patch title.

> Returning 0 early from __bio_iov_append_get_pages() for the
> max_append_sectors warning just creates an infinite loop since 0 means
> success, and the bio will never fill from the unadvancing iov_iter. We
> could turn the return into an error value, but it will already be turned
> into an error value later on, so just remove the warning. Clearly no one
> ever hit it anyway.
> 
> Fixes: 0512a75b98f84 ("block: Introduce REQ_OP_ZONE_APPEND")
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
>  block/bio.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index a3893d80dccc..e249f6414fd5 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1228,9 +1228,6 @@ static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
>  	size_t offset;
>  	int ret = 0;
>  
> -	if (WARN_ON_ONCE(!max_append_sectors))
> -		return 0;
> -
>  	/*
>  	 * Move page array up in the allocated memory for the bio vecs as far as
>  	 * possible so that we can start filling biovecs from the beginning

Otherwise looks good.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Christoph Hellwig May 31, 2022, 6:19 a.m. UTC | #2
On Wed, May 25, 2022 at 06:06:05PM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> Returning 0 early from __bio_iov_append_get_pages() for the
> max_append_sectors warning just creates an infinite loop since 0 means
> success, and the bio will never fill from the unadvancing iov_iter. We
> could turn the return into an error value, but it will already be turned
> into an error value later on, so just remove the warning. Clearly no one
> ever hit it anyway.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/block/bio.c b/block/bio.c
index a3893d80dccc..e249f6414fd5 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1228,9 +1228,6 @@  static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *iter)
 	size_t offset;
 	int ret = 0;
 
-	if (WARN_ON_ONCE(!max_append_sectors))
-		return 0;
-
 	/*
 	 * Move page array up in the allocated memory for the bio vecs as far as
 	 * possible so that we can start filling biovecs from the beginning