Skip to content

block: serialize elevator changes for the same queue using a writer lock#987

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1114993=>linus-master
Open

block: serialize elevator changes for the same queue using a writer lock#987
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1114993=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block: serialize elevator changes for the same queue using a writer lock
version: 2
url: https://patchwork.kernel.org/project/linux-block/list/?series=1114993

@blktests-ci

blktests-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1114993
version: 2

@blktests-ci

blktests-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1114993
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1114993=>linus-master branch from 8c294e6 to 7fad6ba Compare June 23, 2026 06:12
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
When elevator_change() is called concurrently for the same queue, the
elevator_change_done() function runs concurrently as well. This function
adds or deletes kobjects for the debugfs entry of the queue. Then the
concurrent calls cause memory corruption of the kobjects and result in a
process hang. The core part of the elevator switch is protected by queue
freeze and q->elevator_lock. However, since the commit 559dc11
("block: move elv_register[unregister]_queue out of elevator_lock"), the
elevator_change_done() is not serialized. Hence the memory corruption
and the hang.

The failures are observed when udev-worker writes to a sysfs
queue/scheduler attribute file while the blktests test case block/005
writes to the same attribute file. The failure also can be recreated by
running two processes that write to the same queue/scheduler file
concurrently. The failure is observed since another commit 370ac28
("block: avoid cpu_hotplug_lock depedency on freeze_lock"). This commit
changed the behavior of queue freeze and it unveiled the failure.

Fix the failure by changing elv_iosched_store() to acquire
update_nr_hwq_lock as the writer lock instead of the reader lock. This
serializes the whole elevator switch steps, including the
elevator_change_done() call.

Fixes: 559dc11 ("block: move elv_register[unregister]_queue out of elevator_lock")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1114993
version: 2

@blktests-ci blktests-ci Bot force-pushed the series/1114993=>linus-master branch from 7fad6ba to a308e5d Compare June 24, 2026 01:24
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.

1 participant