Skip to content
Snippets Groups Projects
  1. Jul 14, 2023
  2. Jul 13, 2023
  3. Jul 12, 2023
  4. Jul 06, 2023
    • Damien Le Moal's avatar
      scsi: block: Improve checks in blk_revalidate_disk_zones() · 03e51c4a
      Damien Le Moal authored
      
      blk_revalidate_disk_zones() implements checks of the zones of a zoned
      block device, verifying that the zone size is a power of 2 number of
      sectors, that all zones (except possibly the last one) have the same
      size and that zones cover the entire addressing space of the device.
      
      While these checks are appropriate to verify that well tested hardware
      devices have an adequate zone configurations, they lack in certain areas
      which may result in issues with emulated devices implemented with user
      drivers such as ublk or tcmu. Specifically, this function does not
      check if the device driver indicated support for the mandatory zone
      append writes, that is, if the device max_zone_append_sectors queue
      limit is set to a non-zero value. Additionally, invalid zones such as
      a zero length zone with a start sector equal to the device capacity will
      not be detected and result in out of bounds use of the zone bitmaps
      prepared with the callback function blk_revalidate_zone_cb().
      
      Improve blk_revalidate_disk_zones() to address these inadequate checks,
      relying on the fact that all device drivers supporting zoned block
      devices must set the device zone size (chunk_sectors queue limit) and
      the max_zone_append_sectors queue limit before executing this function.
      
      The check for a non-zero max_zone_append_sectors value is done in
      blk_revalidate_disk_zones() before executing the zone report. The zone
      report callback function blk_revalidate_zone_cb() is also modified to
      add a check that a zone start is below the device capacity.
      
      The check that the zone size is a power of 2 number of sectors is moved
      to blk_revalidate_disk_zones() as the zone size is already known.
      Similarly, the number of zones of the device can be calculated in
      blk_revalidate_disk_zones() before executing the zone report.
      
      The kdoc comment for blk_revalidate_disk_zones() is also updated to
      mention that device drivers must set the device zone size and the
      max_zone_append_sectors queue limit before calling this function.
      
      Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
      Link: https://lore.kernel.org/r/20230703024812.76778-6-dlemoal@kernel.org
      
      
      Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      03e51c4a
  5. Jul 05, 2023
  6. Jun 28, 2023
  7. Jun 26, 2023
  8. Jun 25, 2023
  9. Jun 22, 2023
  10. Jun 21, 2023
  11. Jun 20, 2023
  12. Jun 16, 2023
  13. Jun 15, 2023
  14. Jun 14, 2023
  15. Jun 12, 2023
Loading