block: advance iov_iter on bio_add_hw_page failure
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 28 Oct 2020 07:25:36 +0000 (16:25 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 28 Oct 2020 13:51:02 +0000 (07:51 -0600)
commit4977d121bc9bc5138d4d48b85469123001859573
tree5b6040a3996fb61fa60e053e7800589cc5c3f72b
parent35bc10b2eafbb701064b94f283b77c54d3304842
block: advance iov_iter on bio_add_hw_page failure

When the bio's size reaches max_append_sectors, bio_add_hw_page returns
0 then __bio_iov_append_get_pages returns -EINVAL. This is an expected
result of building a small enough bio not to be split in the IO path.
However, iov_iter is not advanced in this case, causing the same pages
are filled for the bio again and again.

Fix the case by properly advancing the iov_iter for already processed
pages.

Fixes: 0512a75b98f8 ("block: Introduce REQ_OP_ZONE_APPEND")
Cc: stable@vger.kernel.org # 5.8+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c