1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00
Nilay Shroff 5abba4cebe block: protect hctx attributes/params using q->elevator_lock
Currently, hctx attributes (nr_tags, nr_reserved_tags, and cpu_list)
are protected using `q->sysfs_lock`. However, these attributes can be
updated in multiple scenarios:
  - During the driver's probe method.
  - When updating nr_hw_queues.
  - When writing to the sysfs attribute nr_requests,
    which can modify nr_tags.
The nr_requests attribute is already protected using q->elevator_lock,
but none of the update paths actually use q->sysfs_lock to protect hctx
attributes. So to ensure proper synchronization, replace q->sysfs_lock
with q->elevator_lock when reading hctx attributes through sysfs.

Additionally, blk_mq_update_nr_hw_queues allocates and updates hctx.
The allocation of hctx is protected using q->elevator_lock, however,
updating hctx params happens without any protection, so safeguard hctx
param update path by also using q->elevator_lock.

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Link: https://lore.kernel.org/r/20250306093956.2818808-1-nilay@linux.ibm.com
[axboe: wrap comment at 80 chars]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-03-10 07:31:06 -06:00
..
2025-01-28 12:25:12 -08:00
2025-01-24 14:56:59 -08:00
2025-01-22 09:03:41 -08:00
2025-01-29 14:38:19 -08:00
2025-01-28 14:23:46 -08:00
2025-01-23 08:04:07 -08:00
2025-01-27 08:50:19 -08:00
2025-02-08 14:12:17 -08:00
2025-02-01 15:07:56 -08:00
2025-01-25 20:22:31 -08:00
2025-01-25 08:22:26 +00:00
2025-02-04 11:27:45 -05:00
2025-01-26 16:12:44 -08:00
2025-01-21 20:09:14 -08:00
2025-01-31 10:39:07 -08:00
2025-02-03 18:39:59 -08:00
2025-01-25 20:22:42 -08:00
2025-01-25 16:03:40 -08:00
2025-01-29 09:04:28 -08:00
2025-02-08 14:12:17 -08:00
2025-01-23 17:51:16 -08:00
2025-02-11 13:04:11 -07:00