• Damien Le Moal's avatar
    dm: fix report zone remapping to account for partition offset · 9864cd5d
    Damien Le Moal authored
    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: 10999307 ("dm: introduce dm_remap_zone_report()")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    9864cd5d
dm.c 73.8 KB