Commit 01b91bf
block: don't grab elevator lock during queue initialization
->elevator_lock depends on queue freeze lock, see block/blk-sysfs.c.
queue freeze lock depends on fs_reclaim.
So don't grab elevator lock during queue initialization which needs to
call kmalloc(GFP_KERNEL), and we can cut the dependency between
->elevator_lock and fs_reclaim, then the lockdep warning can be killed.
This way is safe because elevator setting isn't ready to run during
queue initialization.
There isn't such issue in __blk_mq_update_nr_hw_queues() because
memalloc_noio_save() is called before acquiring elevator lock.
Fixes the following lockdep warning:
https://lore.kernel.org/linux-block/67e6b425.050a0220.2f068f.007b.GAE@google.com/
Reported-by: syzbot+4c7e0f9b94ad65811efb@syzkaller.appspotmail.com
Cc: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250403105402.1334206-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent fb58555 commit 01b91bf
1 file changed
+17
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4464 | 4464 | | |
4465 | 4465 | | |
4466 | 4466 | | |
4467 | | - | |
4468 | | - | |
| 4467 | + | |
| 4468 | + | |
4469 | 4469 | | |
4470 | 4470 | | |
4471 | 4471 | | |
4472 | 4472 | | |
4473 | | - | |
4474 | | - | |
4475 | 4473 | | |
4476 | 4474 | | |
4477 | 4475 | | |
| |||
4504 | 4502 | | |
4505 | 4503 | | |
4506 | 4504 | | |
4507 | | - | |
| 4505 | + | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
| 4514 | + | |
| 4515 | + | |
| 4516 | + | |
| 4517 | + | |
4508 | 4518 | | |
4509 | 4519 | | |
4510 | 4520 | | |
| |||
4536 | 4546 | | |
4537 | 4547 | | |
4538 | 4548 | | |
4539 | | - | |
| 4549 | + | |
4540 | 4550 | | |
4541 | 4551 | | |
4542 | 4552 | | |
| |||
5032 | 5042 | | |
5033 | 5043 | | |
5034 | 5044 | | |
5035 | | - | |
| 5045 | + | |
5036 | 5046 | | |
5037 | 5047 | | |
5038 | 5048 | | |
| |||
0 commit comments