On Tue, 11 Mar 2025, Damien Le Moal wrote: > Yes, for simple scalar limits, I do not think there is any issue. But there > are > some cases where changing one limit implies a change to other limits when the > limits are committed (under the limits lock). So my concern was that if the > above runs simultaneously with a queue limits commit, we may endup with the > limits struct copy grabbing part of the new limits and thus resulting in an > inconsistent limits struct. Not entirely sure that can actually happen though. > But given that queue_limits_commit_update() does: > > q->limits = *lim; > > and this code does: > > old_limits = q->limits; > > we may endup depending on how the compiler handles the struct copy ? There is no guarantee that struct copy will update the structure fields atomically. On some CPUs, a "rep movsb" instruction may be used, which may be optimized by the CPU, but it may be also interrupted at any byte boundary. I think it should be changed to the sequence of WRITE_ONCE statements, for example: WRITE_ONCE(q->limits->file, lim->field); Mikulas
- [RFC PATCH 0/7] dm: fix issues with swapping dm tables Benjamin Marzinski
- [RFC PATCH 6/7] blk-zoned: modify blk_revalidate_d... Benjamin Marzinski
- [PATCH 3/7] dm: handle failures in dm_table_set_re... Benjamin Marzinski
- Re: [PATCH 3/7] dm: handle failures in dm_tabl... Damien Le Moal
- Re: [PATCH 3/7] dm: handle failures in dm_... Benjamin Marzinski
- Re: [PATCH 3/7] dm: handle failures in... Damien Le Moal
- Re: [PATCH 3/7] dm: handle failures in... Benjamin Marzinski
- Re: [PATCH 3/7] dm: handle failur... Damien Le Moal
- Re: [PATCH 3/7] dm: handle fa... Mikulas Patocka
- Re: [PATCH 3/7] dm: handl... Mikulas Patocka
- [PATCH 2/7] dm: free table mempools if not used in... Benjamin Marzinski
- Re: [PATCH 2/7] dm: free table mempools if not... Damien Le Moal
- [PATCH 5/7] blk-zoned: clean up zone settings for ... Benjamin Marzinski
- Re: [PATCH 5/7] blk-zoned: clean up zone setti... Damien Le Moal
- [PATCH 1/7] dm: don't change md if dm_table_set_re... Benjamin Marzinski
- Re: [PATCH 1/7] dm: don't change md if dm_tabl... Damien Le Moal
- Re: [PATCH 1/7] dm: don't change md if dm_... Benjamin Marzinski
- [PATCH 4/7] dm: fix dm_blk_report_zones Benjamin Marzinski
- Re: [PATCH 4/7] dm: fix dm_blk_report_zones Damien Le Moal