blk-cgroup: fix circular locking dependency in blkg_conf_prep - #1124
blk-cgroup: fix circular locking dependency in blkg_conf_prep#1124blktests-ci-kpd[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: d58772d |
29ac21d to
ea2c39d
Compare
|
Upstream branch: f5bbbfe |
e15a2ce to
30451ea
Compare
ea2c39d to
4082a30
Compare
|
Upstream branch: 3d6d817 |
30451ea to
1754e5e
Compare
4082a30 to
36bd7eb
Compare
|
Upstream branch: 3aa1dca |
1754e5e to
328ef59
Compare
d89ab11 to
fdba928
Compare
|
Upstream branch: fd923b3 |
328ef59 to
e6c934c
Compare
fdba928 to
60442a3
Compare
|
Upstream branch: 8d3ae59 |
e6c934c to
04a3cb0
Compare
60442a3 to
3df366e
Compare
|
Upstream branch: bd5f485 |
04a3cb0 to
5237737
Compare
3df366e to
5dd70cb
Compare
|
Upstream branch: 66498c7 |
5237737 to
e952094
Compare
5dd70cb to
055a766
Compare
|
Upstream branch: 502d457 |
e952094 to
a6d060a
Compare
055a766 to
341ae8c
Compare
|
Upstream branch: cf72cbb |
a6d060a to
b45a5f1
Compare
341ae8c to
940e422
Compare
|
Upstream branch: cee9395 |
b45a5f1 to
4495012
Compare
940e422 to
3cab524
Compare
|
Upstream branch: 89a3129 |
4495012 to
5946d92
Compare
3cab524 to
8242bf1
Compare
|
Upstream branch: bc35965 |
5946d92 to
721b883
Compare
8242bf1 to
5b28f57
Compare
|
Upstream branch: df29080 Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/series/1144320/ conflict: |
5b28f57 to
4ddd216
Compare
|
Upstream branch: 28924df |
|
Upstream branch: 28924df |
721b883 to
170733a
Compare
4ddd216 to
00cc4ca
Compare
|
Upstream branch: 893e117 |
170733a to
59948df
Compare
00cc4ca to
7efd8cd
Compare
In blkg_conf_prep, we may do IO when allocating while holding blkcg_mutex, however this presents a deadlock scenario since we may grab sysfs_lock while IO is suspended in elevator_exit, and an existing chain exists from sysfs_mutex -> blkcg_mutex. We can fix this by performing only GFP_NOIO allocations within blkg_conf_prep when blkcg_mutex is held. This patch fixes our reproducer. Full lockdep splat: [ 3795.003422] ====================================================== [ 3795.009595] WARNING: possible circular locking dependency detected [ 3795.015773] 6.18.20-dbg-DEV #1 Tainted: G N [ 3795.021432] ------------------------------------------------------ [ 3795.027604] kpython3/435194 is trying to acquire lock: [ 3795.032744] ffffffffa36959b8 (fs_reclaim){+.+.}-{0:0}, at: kmem_cache_alloc_noprof+0x49/0x5c0 [ 3795.041260] [ 3795.041260] but task is already holding lock: [ 3795.047086] ffff98c8a06477b0 (&q->blkcg_mutex){+.+.}-{4:4}, at: blkg_conf_prep+0x71/0x5e0 [ 3795.055257] [ 3795.055257] which lock already depends on the new lock. [ 3795.055257] [ 3795.063422] [ 3795.063422] the existing dependency chain (in reverse order) is: [ 3795.070893] [ 3795.070893] -> #4 (&q->blkcg_mutex){+.+.}-{4:4}: [ 3795.076986] __mutex_lock+0x92/0xb70 [ 3795.081085] blkcg_deactivate_policy+0x7f/0x230 [ 3795.086137] bfq_exit_queue+0xe1/0x110 [ 3795.090401] blk_mq_exit_sched+0xd1/0x170 [ 3795.094935] elevator_exit+0x50/0x70 (...) [ 3795.135019] [ 3795.135019] -> #3 (&eq->sysfs_lock){+.+.}-{4:4}: [ 3795.141110] __mutex_lock+0x92/0xb70 [ 3795.145211] elevator_exit+0x45/0x70 [ 3795.149308] elevator_switch+0x98/0x290 [ 3795.153660] elevator_change+0x109/0x190 [ 3795.158106] elv_iosched_store+0x198/0x240 (...) [ 3795.185276] [ 3795.185276] -> #2 (&q->elevator_lock){+.+.}-{4:4}: [ 3795.191541] __mutex_lock+0x92/0xb70 [ 3795.195642] elevator_change+0xb6/0x190 [ 3795.200001] elv_iosched_store+0x198/0x240 (...) [ 3795.227179] [ 3795.227179] -> #1 (&q->q_usage_counter(io)#19){++++}-{0:0}: [ 3795.234224] blk_alloc_queue+0x33e/0x370 (...) [ 3795.266621] [ 3795.266621] -> #0 (fs_reclaim){+.+.}-{0:0}: [ 3795.272280] __lock_acquire+0x157c/0x2980 [ 3795.276813] lock_acquire+0xd3/0x2a0 [ 3795.280904] fs_reclaim_acquire+0x55/0xc0 [ 3795.285435] kmem_cache_alloc_noprof+0x49/0x5c0 [ 3795.290481] __radix_tree_preload+0xef/0x250 [ 3795.295273] blkg_conf_prep+0x2aa/0x5e0 [ 3795.299633] tg_set_conf+0xa5/0x1a0 (...) [ 3795.330808] [ 3795.330808] other info that might help us debug this: [ 3795.330808] [ 3795.338806] Chain exists of: [ 3795.338806] fs_reclaim --> &eq->sysfs_lock --> &q->blkcg_mutex [ 3795.338806] [ 3795.349146] Possible unsafe locking scenario: [ 3795.349146] [ 3795.355057] CPU0 CPU1 [ 3795.359590] ---- ---- [ 3795.364121] lock(&q->blkcg_mutex); [ 3795.367691] lock(&eq->sysfs_lock); [ 3795.373776] lock(&q->blkcg_mutex); [ 3795.379862] lock(fs_reclaim); [ 3795.383006] [ 3795.383006] *** DEADLOCK *** Reviewed-by: Khazhy Kumykov <khazhy@google.com> Signed-off-by: Sudarsan Mahendran <sudarsanm@google.com>
|
Upstream branch: 50d05c7 |
59948df to
2eda3f1
Compare
|
At least one diff in series https://patchwork.kernel.org/series/1144320/ irrelevant now for [{'archived': False, 'project': 241}] search patterns |
Pull request for series with
subject: blk-cgroup: fix circular locking dependency in blkg_conf_prep
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1144320