Re: [PATCH v3 0/6] [PATCH v3 0/6] dm: fix issues with swapping dm tables

2025-04-08 Thread Damien Le Moal
On 4/9/25 8:51 AM, Benjamin Marzinski wrote: Thanks for all the fixes. Of note is that I am looking into the dm-delay pre-suspend problem for zoned case (potential reordering of writes). It turns out to not be an easy fix given how dm-delay works. Still scratching my head :) > There were multiple

Re: [PATCH v3 6/6] dm: fix native zone append devices on top of emulated ones

2025-04-08 Thread Damien Le Moal
On 4/9/25 8:51 AM, Benjamin Marzinski wrote: > If a DM device that can pass down zone append commands is stacked on top > of a device that emulates zone append commands, it will allocate zone > append emulation resources, even though it doesn't use them. This is > because the underlying device will

Re: [PATCH v3 5/6] dm: limit swapping tables for devices with zone write plugs

2025-04-08 Thread Damien Le Moal
On 4/9/25 8:51 AM, Benjamin Marzinski wrote: > dm_revalidate_zones() only allowed new or previously unzoned devices to > call blk_revalidate_disk_zones(). If the device was already zoned, > disk->nr_zones would always equal md->nr_zones, so dm_revalidate_zones() > returned without doing any work. T

Re: [PATCH v3 4/6] dm: fix dm_blk_report_zones

2025-04-08 Thread Damien Le Moal
On 4/9/25 8:51 AM, Benjamin Marzinski wrote: > If dm_get_live_table() returned NULL, dm_put_live_table() was never > called. Also, it is possible that md->zone_revalidate_map will change > while calling this function. Only read it once, so that we are always > using the same value. Otherwise we mig

Re: [PATCH v3 3/6] dm: handle failures in dm_table_set_restrictions

2025-04-08 Thread Damien Le Moal
On 4/9/25 8:51 AM, Benjamin Marzinski wrote: > If dm_table_set_restrictions() fails while swapping tables, > device-mapper will continue using the previous table. It must be sure to > leave the mapped_device in it's previous state on failure. Otherwise > device-mapper could end up using the old ta

[PATCH v3 1/6] dm: don't change md if dm_table_set_restrictions() fails

2025-04-08 Thread Benjamin Marzinski
__bind was changing the disk capacity, geometry and mempools of the mapped device before calling dm_table_set_restrictions() which could fail, forcing dm to drop the new table. Failing here would leave the device using the old table but with the wrong capacity and mempools. Move dm_table_set_restr

[PATCH v3 0/6] [PATCH v3 0/6] dm: fix issues with swapping dm tables

2025-04-08 Thread Benjamin Marzinski
There were multiple places in dm's __bind() function where it could fail and not completely roll back, leaving the device using the the old table, but with device limits and resources from the new table. Additionally, unused mempools for request-based devices were not always freed immediately. Als

[PATCH v3 6/6] dm: fix native zone append devices on top of emulated ones

2025-04-08 Thread Benjamin Marzinski
If a DM device that can pass down zone append commands is stacked on top of a device that emulates zone append commands, it will allocate zone append emulation resources, even though it doesn't use them. This is because the underlying device will have max_hw_zone_append_sectors set to 0 to request

[PATCH v3 4/6] dm: fix dm_blk_report_zones

2025-04-08 Thread Benjamin Marzinski
If dm_get_live_table() returned NULL, dm_put_live_table() was never called. Also, it is possible that md->zone_revalidate_map will change while calling this function. Only read it once, so that we are always using the same value. Otherwise we might miss a call to dm_put_live_table(). Finally, whil

[PATCH v3 5/6] dm: limit swapping tables for devices with zone write plugs

2025-04-08 Thread Benjamin Marzinski
dm_revalidate_zones() only allowed new or previously unzoned devices to call blk_revalidate_disk_zones(). If the device was already zoned, disk->nr_zones would always equal md->nr_zones, so dm_revalidate_zones() returned without doing any work. This would make the zoned settings for the device not

[PATCH v3 3/6] dm: handle failures in dm_table_set_restrictions

2025-04-08 Thread Benjamin Marzinski
If dm_table_set_restrictions() fails while swapping tables, device-mapper will continue using the previous table. It must be sure to leave the mapped_device in it's previous state on failure. Otherwise device-mapper could end up using the old table with settings from the unused table. Do not upda