block: fix pin count management when merging same-page segments
authorChristoph Hellwig <hch@lst.de>
Tue, 5 Sep 2023 12:47:31 +0000 (14:47 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 6 Sep 2023 13:32:27 +0000 (07:32 -0600)
commit5905afc2c7bb713d52c7c7585565feecbb686b44
tree52ad67da602c16bd657c2b79117aaa369822d161
parent5a26e45edb4690d58406178b5a9ea4c6dcf2c105
block: fix pin count management when merging same-page segments

There is no need to unpin the added page when adding it to the bio fails
as that is done by the loop below.  Instead we want to unpin it when adding
a single page to the bio more than once as bio_release_pages will only
unpin it once.

Fixes: d1916c86ccdc ("block: move same page handling from __bio_add_pc_page to the callers")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20230905124731.328255-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-map.c