]> git.baikalelectronics.ru Git - kernel.git/commit
dm: fix report zone remapping to account for partition offset
authorDamien Le Moal <damien.lemoal@wdc.com>
Tue, 9 Oct 2018 05:24:31 +0000 (14:24 +0900)
committerMike Snitzer <snitzer@redhat.com>
Tue, 9 Oct 2018 18:20:13 +0000 (14:20 -0400)
commit61f735e21c119a1c997b44091e5454a7c4e3a2b6
tree39eecc836833ef8bdefb6fefc8ff00866f4d6390
parent6ce18c1471b7e79ad41588a53c4961e124b24f52
dm: fix report zone remapping to account for partition offset

If dm-linear or dm-flakey are layered on top of a partition of a zoned
block device, remapping of the start sector and write pointer position
of the zones reported by a report zones BIO must be modified to account
for the target table entry mapping (start offset within the device and
entry mapping with the dm device).  If the target's backing device is a
partition of a whole disk, the start sector on the physical device of
the partition must also be accounted for when modifying the zone
information.  However, dm_remap_zone_report() was not considering this
last case, resulting in incorrect zone information remapping with
targets using disk partitions.

Fix this by calculating the target backing device start sector using
the position of the completed report zones BIO and the unchanged
position and size of the original report zone BIO. With this value
calculated, the start sector and write pointer position of the target
zones can be correctly remapped.

Fixes: 45d2c250c1ba ("dm: introduce dm_remap_zone_report()")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c