Hi, There're two patches in this patchest. The first patch removes redundant q->sysfs_dir_lock. The second patch fixes nr_hw_queue update racing with disk addition/ removal. In the current implementation we use q->sysfs_dir_lock for protecting kobject addition/deletion while we register/unregister blk-mq with sysfs. However the sysfs/kernfs internal implementation already protects against the simultaneous addtion/deletion of kobjects. So in that sense use of q->sysfs_dir_lock appears redundant. Furthermore, there're few other callsites in the current code where we use q->sysfs_dir_lock along with q->sysfs_lock while addition/deletion of independent access ranges for a disk under sysfs. Please refer, disk_ register_independent_access_ranges() and disk_unregister_independent_ access_ranges(). Here as well we could easily remove use of q->sysfs_dir_ lock. The only thing which q->syfs_dir_lock appears to protect is the use of variable q->mq_sysfs_init_done. However this could be solved by converting q->mq_sysfs_init_done to an atomic variable. In past few days, we have seen many lockdep splat in block layer and getting rid of this one might help reduce some contention as well we need to worry less about lock ordering wrt to q->sysfs_dir_lock. The first patch helps fix this. The second patch addresses a potential race between nr_hw_queue update and disk addition/removal. The __blk_mq_update_nr_hw_queues function removes and then adds hctx sysfs files. Similarly the disk addition/ removal code also adds or remove the hctx sysfs files. So it's quite possible that disk addition/removal code could race with __blk_mq_update_ nr_hw_queues() while it adds/deletes hctx sysfs files. Apparently, __blk_mq_update_nr_hw_queues() holds q->tag_list_lock while it runs, and so to avoid race between __blk_mq_update_nr_hw_queues() and disk addition/removal code, we should hold the same q->tag_list_lock while we add/delete hctx sysfs files while registering/uregistering disk queue. So the second patch in the series helps fix this race condition which may manifests while we add/remove hctx sysfs files. Nilay Shroff (2): block: get rid of request queue ->sysfs_dir_lock block: fix nr_hw_queue update racing with disk addition/removal Changes from v1: - remove q->sysfs_init_done and replace it with registered queue flag (hch) - fix nr_hw_queue update racing with disk addition/removal (hch) - Link to v1: https://lore.kernel.org/all/20250120130413.789737-1-nilay@xxxxxxxxxxxxx/ block/blk-core.c | 1 - block/blk-ia-ranges.c | 4 ---- block/blk-mq-sysfs.c | 37 ++++++++++++++++++------------------- block/blk-sysfs.c | 5 ----- include/linux/blkdev.h | 3 --- 5 files changed, 18 insertions(+), 32 deletions(-) -- 2.47.1