]> www.infradead.org Git - nvme.git/commit
block: fix nr_hw_queue update racing with disk addition/removal
authorNilay Shroff <nilay@linux.ibm.com>
Tue, 28 Jan 2025 14:34:14 +0000 (20:04 +0530)
committerJens Axboe <axboe@kernel.dk>
Wed, 29 Jan 2025 14:16:47 +0000 (07:16 -0700)
commit14ef49657ff3b7156952b2eadcf2e5bafd735795
treeaa1ede3f316d5037e030900684af1372c398310a
parentfe6628608627424fb4a6d4c8d2235822457c5d9c
block: fix nr_hw_queue update racing with disk addition/removal

The nr_hw_queue update could potentially race with disk addtion/removal
while registering/unregistering hctx sysfs files. The __blk_mq_update_
nr_hw_queues() runs with q->tag_list_lock held and so to avoid it racing
with disk addition/removal we should acquire q->tag_list_lock while
registering/unregistering hctx sysfs files.

With this patch, blk_mq_sysfs_register() (called during disk addition)
and blk_mq_sysfs_unregister() (called during disk removal) now runs
with q->tag_list_lock held so that it avoids racing with __blk_mq_update
_nr_hw_queues().

Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20250128143436.874357-3-nilay@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-sysfs.c