blk-cgroup: fix circular locking dependency in blkg_conf_prep - #1124
Open
blktests-ci[bot] wants to merge 1 commit into
Open
blk-cgroup: fix circular locking dependency in blkg_conf_prep#1124blktests-ci[bot] wants to merge 1 commit into
blktests-ci[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: d58772d |
blktests-ci
Bot
force-pushed
the
linus-master_base
branch
from
August 12, 2026 13:27
29ac21d to
ea2c39d
Compare
Author
|
Upstream branch: f5bbbfe |
blktests-ci
Bot
force-pushed
the
series/1144320=>linus-master
branch
from
August 12, 2026 13:28
e15a2ce to
30451ea
Compare
blktests-ci
Bot
force-pushed
the
linus-master_base
branch
from
August 12, 2026 18:56
ea2c39d to
4082a30
Compare
Author
|
Upstream branch: 3d6d817 |
blktests-ci
Bot
force-pushed
the
series/1144320=>linus-master
branch
from
August 12, 2026 19:18
30451ea to
1754e5e
Compare
blktests-ci
Bot
force-pushed
the
linus-master_base
branch
from
August 13, 2026 19:18
4082a30 to
36bd7eb
Compare
Author
|
Upstream branch: 3aa1dca |
blktests-ci
Bot
force-pushed
the
series/1144320=>linus-master
branch
from
August 13, 2026 19:20
1754e5e to
328ef59
Compare
blktests-ci
Bot
force-pushed
the
linus-master_base
branch
2 times, most recently
from
August 16, 2026 18:34
d89ab11 to
fdba928
Compare
Author
|
Upstream branch: fd923b3 |
blktests-ci
Bot
force-pushed
the
series/1144320=>linus-master
branch
from
August 16, 2026 19:31
328ef59 to
e6c934c
Compare
blktests-ci
Bot
force-pushed
the
linus-master_base
branch
from
August 17, 2026 14:10
fdba928 to
60442a3
Compare
Author
|
Upstream branch: 8d3ae59 |
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>
blktests-ci
Bot
force-pushed
the
series/1144320=>linus-master
branch
from
August 17, 2026 14:12
e6c934c to
04a3cb0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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