Skip to content

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Nov 14, 2025

Pull request for series with
subject: Fix a recently introduced deadlock
version: 6
url: https://patchwork.kernel.org/project/linux-block/list/?series=1023735

@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 14, 2025

Upstream branch: 6da43bb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 16, 2025

Upstream branch: f824272
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from be0e982 to 977c692 Compare November 16, 2025 07:46
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 00d5e5c to d782508 Compare November 17, 2025 00:45
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 17, 2025

Upstream branch: f824272
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from 977c692 to 708378f Compare November 17, 2025 00:56
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from d782508 to 6099a4d Compare November 17, 2025 23:44
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 17, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from 708378f to c005187 Compare November 17, 2025 23:57
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 6099a4d to 5121c4d Compare November 18, 2025 02:19
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 18, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from c005187 to 713b5fb Compare November 18, 2025 02:31
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 18, 2025

Upstream branch: e7c375b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from 713b5fb to 4892ea5 Compare November 18, 2025 07:01
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 5121c4d to 4458758 Compare November 19, 2025 00:24
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 19, 2025

Upstream branch: 8b69055
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from 4892ea5 to 8c20146 Compare November 19, 2025 00:34
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 4458758 to 6f43942 Compare November 21, 2025 09:45
@blktests-ci
Copy link
Author

blktests-ci bot commented Nov 21, 2025

Upstream branch: fd95357
series: https://patchwork.kernel.org/project/linux-block/list/?series=1023735
version: 6

Some but not all .ra_pages changes happen while block layer I/O is paused
with blk_mq_freeze_queue(). Filesystems may read .ra_pages even while
block layer I/O is paused, e.g. from inside their .fadvise callback.
Annotating all .ra_pages reads with READ_ONCE() would be cumbersome.
Hence, add the __data_racy annotatation to the .ra_pages member
variable.

Cc: Alexander Viro <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Nilay Shroff <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Reviewed-by: Nilay Shroff <[email protected]>
Freezing the request queue from inside sysfs store callbacks may cause a
deadlock in combination with the dm-multipath driver and the
queue_if_no_path option. Additionally, freezing the request queue slows
down system boot on systems where sysfs attributes are set synchronously.

Fix this by removing the blk_mq_freeze_queue() / blk_mq_unfreeze_queue()
calls from the store callbacks that do not strictly need these callbacks.
Add the __data_racy annotation to request_queue.rq_timeout to suppress
KCSAN data race reports about the rq_timeout reads.

This patch may cause a small delay in applying the new settings.

For all the attributes affected by this patch, I/O will complete
correctly whether the old or the new value of the attribute is used.

This patch affects the following sysfs attributes:
* io_poll_delay
* io_timeout
* nomerges
* read_ahead_kb
* rq_affinity

Here is an example of a deadlock triggered by running test srp/002
if this patch is not applied:

task:multipathd
Call Trace:
 <TASK>
 __schedule+0x8c1/0x1bf0
 schedule+0xdd/0x270
 schedule_preempt_disabled+0x1c/0x30
 __mutex_lock+0xb89/0x1650
 mutex_lock_nested+0x1f/0x30
 dm_table_set_restrictions+0x823/0xdf0
 __bind+0x166/0x590
 dm_swap_table+0x2a7/0x490
 do_resume+0x1b1/0x610
 dev_suspend+0x55/0x1a0
 ctl_ioctl+0x3a5/0x7e0
 dm_ctl_ioctl+0x12/0x20
 __x64_sys_ioctl+0x127/0x1a0
 x64_sys_call+0xe2b/0x17d0
 do_syscall_64+0x96/0x3a0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
 </TASK>
task:(udev-worker)
Call Trace:
 <TASK>
 __schedule+0x8c1/0x1bf0
 schedule+0xdd/0x270
 blk_mq_freeze_queue_wait+0xf2/0x140
 blk_mq_freeze_queue_nomemsave+0x23/0x30
 queue_ra_store+0x14e/0x290
 queue_attr_store+0x23e/0x2c0
 sysfs_kf_write+0xde/0x140
 kernfs_fop_write_iter+0x3b2/0x630
 vfs_write+0x4fd/0x1390
 ksys_write+0xfd/0x230
 __x64_sys_write+0x76/0xc0
 x64_sys_call+0x276/0x17d0
 do_syscall_64+0x96/0x3a0
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
 </TASK>

Cc: Christoph Hellwig <[email protected]>
Cc: Ming Lei <[email protected]>
Cc: Nilay Shroff <[email protected]>
Cc: Martin Wilck <[email protected]>
Cc: Benjamin Marzinski <[email protected]>
Cc: [email protected]
Fixes: af28141 ("block: freeze the queue in queue_attr_store")
Signed-off-by: Bart Van Assche <[email protected]>
Reviewed-by: Nilay Shroff <[email protected]>
@blktests-ci blktests-ci bot force-pushed the series/1023735=>linus-master branch from 8c20146 to b1e2d70 Compare November 21, 2025 09:57
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.

2 participants