]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
dm table: Fix zoned model check and zone sectors check
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tue, 16 Mar 2021 04:36:02 +0000 (13:36 +0900)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 8 Apr 2021 20:42:40 +0000 (15:42 -0500)
commit07d5fa89336fa1a817c3b7e893b7aadd7219f709
tree804e914fe03082a7ec2aa8c46064b29fdce6fa1f
parent47c705b99beed7061656344c4f19754199900eec
dm table: Fix zoned model check and zone sectors check

BugLink: https://bugs.launchpad.net/bugs/1922601
[ Upstream commit 2d669ceb69c276f7637cf760287ca4187add082e ]

Commit 24f6b6036c9e ("dm table: fix zoned iterate_devices based device
capability checks") triggered dm table load failure when dm-zoned device
is set up for zoned block devices and a regular device for cache.

The commit inverted logic of two callback functions for iterate_devices:
device_is_zoned_model() and device_matches_zone_sectors(). The logic of
device_is_zoned_model() was inverted then all destination devices of all
targets in dm table are required to have the expected zoned model. This
is fine for dm-linear, dm-flakey and dm-crypt on zoned block devices
since each target has only one destination device. However, this results
in failure for dm-zoned with regular cache device since that target has
both regular block device and zoned block devices.

As for device_matches_zone_sectors(), the commit inverted the logic to
require all zoned block devices in each target have the specified
zone_sectors. This check also fails for regular block device which does
not have zones.

To avoid the check failures, fix the zone model check and the zone
sectors check. For zone model check, introduce the new feature flag
DM_TARGET_MIXED_ZONED_MODEL, and set it to dm-zoned target. When the
target has this flag, allow it to have destination devices with any
zoned model. For zone sectors check, skip the check if the destination
device is not a zoned block device. Also add comments and improve an
error message to clarify expectations to the two checks.

Fixes: 24f6b6036c9e ("dm table: fix zoned iterate_devices based device capability checks")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/md/dm-table.c
drivers/md/dm-zoned-target.c
include/linux/device-mapper.h