dm integrity: use dm_bio_record and dm_bio_restore
authorMike Snitzer <snitzer@redhat.com>
Fri, 28 Feb 2020 23:11:53 +0000 (18:11 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Mar 2020 07:06:07 +0000 (08:06 +0100)
commit1ea3bdf9e9bffe29e396c25a8b7f40778b99c1ac
treeddd50a15cdd623139f96e794db25f2e4604920d5
parentda23154ff03b76df14838440872f5a69dac9e61e
dm integrity: use dm_bio_record and dm_bio_restore

[ Upstream commit 248aa2645aa7fc9175d1107c2593cc90d4af5a4e ]

In cases where dec_in_flight() has to requeue the integrity_bio_wait
work to transfer the rest of the data, the bio's __bi_remaining might
already have been decremented to 0, e.g.: if bio passed to underlying
data device was split via blk_queue_split().

Use dm_bio_{record,restore} rather than effectively open-coding them in
dm-integrity -- these methods now manage __bi_remaining too.

Depends-on: f7f0b057a9c1 ("dm bio record: save/restore bi_end_io and bi_integrity")
Reported-by: Daniel Glöckner <dg@emlix.com>
Suggested-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/dm-integrity.c