Commit 0257c0ed authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe

block: don't run get_page() on pages from non-bvec iov iter

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>
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Fixes: 7321ecbf ("block: change how we get page references in bio_iov_iter_get_pages")
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 551879a4
...@@ -992,7 +992,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) ...@@ -992,7 +992,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
if (iov_iter_bvec_no_ref(iter)) if (iov_iter_bvec_no_ref(iter))
bio_set_flag(bio, BIO_NO_PAGE_REF); bio_set_flag(bio, BIO_NO_PAGE_REF);
else else if (is_bvec)
bio_get_pages(bio); bio_get_pages(bio);
return bio->bi_vcnt ? 0 : ret; return bio->bi_vcnt ? 0 : ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment