Skip to content

blk-cgroup: fix circular locking dependency in blkg_conf_prep - #1124

Closed
blktests-ci-kpd[bot] wants to merge 1 commit into
linus-master_basefrom
series/1144320=>linus-master
Closed

blk-cgroup: fix circular locking dependency in blkg_conf_prep#1124
blktests-ci-kpd[bot] wants to merge 1 commit into
linus-master_basefrom
series/1144320=>linus-master

Conversation

@blktests-ci-kpd

Copy link
Copy Markdown

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

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: d58772d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: f5bbbfe
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from e15a2ce to 30451ea Compare August 12, 2026 13:28
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 3d6d817
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 30451ea to 1754e5e Compare August 12, 2026 19:18
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 3aa1dca
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 1754e5e to 328ef59 Compare August 13, 2026 19:20
@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the linus-master_base branch 2 times, most recently from d89ab11 to fdba928 Compare August 16, 2026 18:34
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: fd923b3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 328ef59 to e6c934c Compare August 16, 2026 19:31
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 8d3ae59
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from e6c934c to 04a3cb0 Compare August 17, 2026 14:12
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: bd5f485
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 04a3cb0 to 5237737 Compare August 19, 2026 05:57
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 66498c7
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 5237737 to e952094 Compare August 25, 2026 03:54
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 502d457
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from e952094 to a6d060a Compare August 26, 2026 21:13
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: cf72cbb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from a6d060a to b45a5f1 Compare August 29, 2026 07:12
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: cee9395
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from b45a5f1 to 4495012 Compare August 31, 2026 10:57
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 89a3129
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 4495012 to 5946d92 Compare September 2, 2026 09:31
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: bc35965
series: https://patchwork.kernel.org/project/linux-block/list/?series=1144320
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 5946d92 to 721b883 Compare September 4, 2026 06:45
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: df29080
series: https://patchwork.kernel.org/series/1144320/
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/series/1144320/
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Patch is empty.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To record the empty patch as an empty commit, run "git am --allow-empty".
To restore the original branch and stop patching, run "git am --abort".'

conflict:


@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 28924df
series: https://patchwork.kernel.org/series/1144320/
version: 1

@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 28924df
series: https://patchwork.kernel.org/series/1144320/
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 721b883 to 170733a Compare September 8, 2026 16:33
@blktests-ci-kpd

Copy link
Copy Markdown
Author

Upstream branch: 893e117
series: https://patchwork.kernel.org/series/1144320/
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 170733a to 59948df Compare September 9, 2026 08:28
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-kpd

Copy link
Copy Markdown
Author

Upstream branch: 50d05c7
series: https://patchwork.kernel.org/series/1144320/
version: 1

@blktests-ci-kpd
blktests-ci-kpd Bot force-pushed the series/1144320=>linus-master branch from 59948df to 2eda3f1 Compare September 10, 2026 15:59
@blktests-ci-kpd

Copy link
Copy Markdown
Author

At least one diff in series https://patchwork.kernel.org/series/1144320/ irrelevant now for [{'archived': False, 'project': 241}] search patterns

@blktests-ci-kpd blktests-ci-kpd Bot closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants