dm: fix zoned locking imbalance due to needless check in clone_endio
authorMike Snitzer <snitzer@kernel.org>
Fri, 10 Jun 2022 19:07:48 +0000 (15:07 -0400)
committerMike Snitzer <snitzer@kernel.org>
Fri, 10 Jun 2022 19:23:54 +0000 (15:23 -0400)
commitdddf30564054796696bcd4c462b232a5beacf72c
tree28e1f26e4971e5f2df79d3f8f88928286f568ed3
parentd5a37b19983725d2045588cfa3a4699f5b39ae26
dm: fix zoned locking imbalance due to needless check in clone_endio

After the commit ca522482e3ea ("dm: pass NULL bdev to bio_alloc_clone"),
clone_endio() only calls dm_zone_endio() when DM targets remap the
clone bio's bdev to something other than the md->disk->part0 default.

However, if a DM target (e.g. dm-crypt) stacked ontop of a dm-zoned
does not remap the clone bio using bio_set_dev() then dm_zone_endio()
is not called at completion of the bios and zone locks are not
properly unlocked. This triggers a hang, in dm_zone_map_bio(), when
blktests block/004 is run for dm-crypt on zoned block devices. To
avoid the hang, simply remove the clone_endio() check that verifies
the target remapped the clone bio to a device other than the default.

Fixes: ca522482e3ea ("dm: pass NULL bdev to bio_alloc_clone")
Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm.c