Commit 2d82f3b
blk-mq: fix lockdep warning in __blk_mq_update_nr_hw_queues
Commit 5989bfe ("block: restore two stage elevator switch while
running nr_hw_queue update") reintroduced a lockdep warning by calling
blk_mq_freeze_queue_nomemsave() before switching the I/O scheduler.
The function blk_mq_elv_switch_none() calls elevator_change_done().
Running this while the queue is frozen causes a lockdep warning.
Fix this by reordering the operations: first, switch the I/O scheduler
to 'none', and then freeze the queue. This ensures that elevator_change_done()
is not called on an already frozen queue. And this way is safe because
elevator_set_none() does freeze queue before switching to none.
Also we still have to rely on blk_mq_elv_switch_back() for switching
back, and it has to cover unfrozen queue case.
Cc: Nilay Shroff <nilay@linux.ibm.com>
Cc: Yu Kuai <yukuai3@huawei.com>
Fixes: 5989bfe ("block: restore two stage elevator switch while running nr_hw_queue update")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Link: https://lore.kernel.org/r/20250815131737.331692-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent d0a2b52 commit 2d82f3b
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5033 | 5033 | | |
5034 | 5034 | | |
5035 | 5035 | | |
| 5036 | + | |
5036 | 5037 | | |
5037 | 5038 | | |
5038 | 5039 | | |
| |||
5056 | 5057 | | |
5057 | 5058 | | |
5058 | 5059 | | |
5059 | | - | |
5060 | | - | |
5061 | | - | |
5062 | 5060 | | |
5063 | 5061 | | |
5064 | 5062 | | |
| |||
5068 | 5066 | | |
5069 | 5067 | | |
5070 | 5068 | | |
| 5069 | + | |
| 5070 | + | |
| 5071 | + | |
5071 | 5072 | | |
5072 | 5073 | | |
5073 | 5074 | | |
| |||
5091 | 5092 | | |
5092 | 5093 | | |
5093 | 5094 | | |
5094 | | - | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
5095 | 5099 | | |
| 5100 | + | |
5096 | 5101 | | |
5097 | 5102 | | |
5098 | 5103 | | |
| |||
0 commit comments