* [PATCH] block: don't run get_page() on pages from non-bvec iov iter
@ 2019-04-24 11:01 Ming Lei
2019-04-24 12:39 ` Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ming Lei @ 2019-04-24 11:01 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-block, Ming Lei, Christoph Hellwig
The refcount has been increased for pages retrieved from non-bvec iov iter
via __bio_iov_iter_get_pages(), so don't need to do that again.
Otherwise, IO pages are leaked easily.
Cc: Christoph Hellwig <hch@lst.de>
Fixes: 7321ecbfc7cf ("block: change how we get page references in bio_iov_iter_get_pages")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
block/bio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/bio.c b/block/bio.c
index c81ed2dfee53..662d45752ec5 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -992,7 +992,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
if (iov_iter_bvec_no_ref(iter))
bio_set_flag(bio, BIO_NO_PAGE_REF);
- else
+ else if (is_bvec)
bio_get_pages(bio);
return bio->bi_vcnt ? 0 : ret;
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block: don't run get_page() on pages from non-bvec iov iter
2019-04-24 11:01 [PATCH] block: don't run get_page() on pages from non-bvec iov iter Ming Lei
@ 2019-04-24 12:39 ` Chaitanya Kulkarni
2019-04-24 14:06 ` Jens Axboe
2019-04-24 14:33 ` Christoph Hellwig
2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-04-24 12:39 UTC (permalink / raw)
To: Ming Lei, Jens Axboe; +Cc: linux-block, Christoph Hellwig
Looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
On 4/24/19 4:02 AM, Ming Lei wrote:
> The refcount has been increased for pages retrieved from non-bvec iov iter
> via __bio_iov_iter_get_pages(), so don't need to do that again.
>
> Otherwise, IO pages are leaked easily.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Fixes: 7321ecbfc7cf ("block: change how we get page references in bio_iov_iter_get_pages")
> Signed-off-by: Ming Lei <ming.lei@redhat.com>
> ---
> block/bio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index c81ed2dfee53..662d45752ec5 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -992,7 +992,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>
> if (iov_iter_bvec_no_ref(iter))
> bio_set_flag(bio, BIO_NO_PAGE_REF);
> - else
> + else if (is_bvec)
> bio_get_pages(bio);
>
> return bio->bi_vcnt ? 0 : ret;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: don't run get_page() on pages from non-bvec iov iter
2019-04-24 11:01 [PATCH] block: don't run get_page() on pages from non-bvec iov iter Ming Lei
2019-04-24 12:39 ` Chaitanya Kulkarni
@ 2019-04-24 14:06 ` Jens Axboe
2019-04-24 14:33 ` Christoph Hellwig
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2019-04-24 14:06 UTC (permalink / raw)
To: Ming Lei; +Cc: linux-block, Christoph Hellwig
On 4/24/19 5:01 AM, Ming Lei wrote:
> The refcount has been increased for pages retrieved from non-bvec iov iter
> via __bio_iov_iter_get_pages(), so don't need to do that again.
>
> Otherwise, IO pages are leaked easily.
Thanks Ming, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: don't run get_page() on pages from non-bvec iov iter
2019-04-24 11:01 [PATCH] block: don't run get_page() on pages from non-bvec iov iter Ming Lei
2019-04-24 12:39 ` Chaitanya Kulkarni
2019-04-24 14:06 ` Jens Axboe
@ 2019-04-24 14:33 ` Christoph Hellwig
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2019-04-24 14:33 UTC (permalink / raw)
To: Ming Lei; +Cc: Jens Axboe, linux-block, Christoph Hellwig
On Wed, Apr 24, 2019 at 07:01:46PM +0800, Ming Lei wrote:
> The refcount has been increased for pages retrieved from non-bvec iov iter
> via __bio_iov_iter_get_pages(), so don't need to do that again.
>
> Otherwise, IO pages are leaked easily.
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-24 14:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 11:01 [PATCH] block: don't run get_page() on pages from non-bvec iov iter Ming Lei
2019-04-24 12:39 ` Chaitanya Kulkarni
2019-04-24 14:06 ` Jens Axboe
2019-04-24 14:33 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.