On Fri, May 24, 2024 at 04:29:11PM +0200, Christoph Hellwig wrote: > Don't stuff the values directly into the queue without any > synchronization, but instead delay applying the queue limits in > the caller and let dm_set_zones_restrictions work on the limit > structure. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > drivers/md/dm-table.c | 16 +++++++++------- > drivers/md/dm-zone.c | 11 ++++++----- > drivers/md/dm.h | 3 ++- > 3 files changed, 17 insertions(+), 13 deletions(-) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index e291b78b307b13..6e4ee829005e92 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -1981,10 +1981,6 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > if (!dm_table_supports_secure_erase(t)) > limits->max_secure_erase_sectors = 0; > > - r = queue_limits_set(q, limits); > - if (r) > - return r; > - > if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_WC))) { > wc = true; > if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_FUA))) > @@ -2036,12 +2032,18 @@ int dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > * For a zoned target, setup the zones related queue attributes > * and resources necessary for zone append emulation if necessary. > */ > - if (blk_queue_is_zoned(q)) { > - r = dm_set_zones_restrictions(t, q); > - if (r) > + if (limits->zoned) { > + r = dm_set_zones_restrictions(t, q, limits); > + if (r) { > + queue_limits_cancel_update(q); Not aware of a preceding queue_limits_start_update(). Otherwise, rest of patch looks fine.