Commit f9a9098
blk-mq: fix lockdep warning in __blk_mq_update_nr_hw_queues
[ Upstream commit 2d82f3b ]
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 <[email protected]>
Cc: Yu Kuai <[email protected]>
Fixes: 5989bfe ("block: restore two stage elevator switch while running nr_hw_queue update")
Signed-off-by: Ming Lei <[email protected]>
Reviewed-by: Yu Kuai <[email protected]>
Reviewed-by: Nilay Shroff <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>1 parent e01facf commit f9a9098
1 file changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5031 | 5031 | | |
5032 | 5032 | | |
5033 | 5033 | | |
| 5034 | + | |
5034 | 5035 | | |
5035 | 5036 | | |
5036 | 5037 | | |
| |||
5054 | 5055 | | |
5055 | 5056 | | |
5056 | 5057 | | |
5057 | | - | |
5058 | | - | |
5059 | | - | |
5060 | 5058 | | |
5061 | 5059 | | |
5062 | 5060 | | |
| |||
5066 | 5064 | | |
5067 | 5065 | | |
5068 | 5066 | | |
| 5067 | + | |
| 5068 | + | |
| 5069 | + | |
5069 | 5070 | | |
5070 | 5071 | | |
5071 | 5072 | | |
| |||
5089 | 5090 | | |
5090 | 5091 | | |
5091 | 5092 | | |
5092 | | - | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
5093 | 5097 | | |
| 5098 | + | |
5094 | 5099 | | |
5095 | 5100 | | |
5096 | 5101 | | |
| |||
0 commit comments