]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
block: break pcpu_alloc_mutex dependency on freeze_lock
authorNilay Shroff <nilay@linux.ibm.com>
Sun, 1 Mar 2026 12:59:43 +0000 (18:29 +0530)
committerJens Axboe <axboe@kernel.dk>
Mon, 2 Mar 2026 16:23:04 +0000 (09:23 -0700)
commit539d1b47e935e8384977dd7e5cec370c08b7a644
tree35c26d9015b8269dcb6cd91192d8ea43acdba55f
parentda46b5dfef48658d03347cda21532bcdbb521e67
block: break pcpu_alloc_mutex dependency on freeze_lock

While nr_hw_update allocates tagset tags it acquires ->pcpu_alloc_mutex
after ->freeze_lock is acquired or queue is frozen. This potentially
creates a circular dependency involving ->fs_reclaim if reclaim is
triggered simultaneously in a code path which first acquires ->pcpu_
alloc_mutex. As the queue is already frozen while nr_hw_queue update
allocates tagsets, the reclaim can't forward progress and thus it could
cause a potential deadlock as reported in lockdep splat[1].

Fix this by pre-allocating tagset tags before we freeze queue during
nr_hw_queue update. Later the allocated tagset tags could be safely
installed and used after queue is frozen.

Reported-by: Yi Zhang <yi.zhang@redhat.com>
Closes: https://lore.kernel.org/all/CAHj4cs8F=OV9s3La2kEQ34YndgfZP-B5PHS4Z8_b9euKG6J4mw@mail.gmail.com/ [1]
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Reviewed-by: Yu Kuai <yukuai@fnnas.com>
[axboe: fix brace style issue]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c