]> 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)
commit1e6d7f7e2a02157a12f6ae174217d01b6d9bbf65
tree39eecc836833ef8bdefb6fefc8ff00866f4d6390
parent30f2fd9821ec45e5f9a073d4a9a4a838d4c255e6
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: 28a5b22249c5 ("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