• Damien Le Moal's avatar
    block: Improve checks on zone resource limits · e21d12c7
    Damien Le Moal authored
    Make sure that the zone resource limits of a zoned block device are
    correct by checking that:
    (a) If the device has a max active zones limit, make sure that the max
        open zones limit is lower than the max active zones limit.
    (b) If the device has zone resource limits, check that the limits
        values are lower than the number of sequential zones of the device.
        If it is not, assume that the zoned device has no limits by setting
        the limits to 0.
    
    For (a), a check is added to blk_validate_zoned_limits() and an error
    returned if the max open zones limit exceeds the value of the max active
    zone limit (if there is one).
    
    For (b), given that we need the number of sequential zones of the zoned
    device, this check is added to disk_update_zone_resources(). This is
    safe to do as that function is executed with the disk queue frozen and
    the check executed after queue_limits_start_update() which takes the
    queue limits lock. Of note is that the early return in this function
    for zoned devices that do not use zone write plugging (e.g. DM devices
    using native zone append) is moved to after the new check and adjustment
    of the zone resource limits so that the check applies to any zoned
    device.
    Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Reviewed-by: default avatarNiklas Cassel <cassel@kernel.org>
    Reviewed-by: default avatarBenjamin Marzinski <bmarzins@redhat.com>
    Link: https://lore.kernel.org/r/20240611023639.89277-2-dlemoal@kernel.orgSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    e21d12c7
blk-settings.c 23.3 KB