* [PATCH] floppy: take floppy_lock when rescheduling the timeout in queue_rq
@ 2026-10-06 11:35 Denis Efremov (Oracle)
0 siblings, 0 replies; only message in thread
From: Denis Efremov (Oracle) @ 2026-10-06 11:35 UTC (permalink / raw)
To: linux-block; +Cc: linux-kernel, Denis Efremov (Oracle), stable
__reschedule_timeout() expects floppy_lock to be held. floppy_queue_rq()
still calls it without the lock, which was fine when the request function
ran under the queue lock, i.e. floppy_lock, but not since the conversion
to blk-mq. With lockdep_assert_held(&floppy_lock) added to
__reschedule_timeout(), the first read from the drive triggers:
WARNING: drivers/block/floppy.c:671 at __reschedule_timeout+0x180/0x1e0, CPU#0: dd/561
Call Trace:
<TASK>
floppy_queue_rq+0x17e/0x300
blk_mq_dispatch_rq_list+0x3e9/0x1f30
__blk_mq_sched_dispatch_requests+0xcfa/0x16e0
blk_mq_sched_dispatch_requests+0xd5/0x1c0
blk_mq_run_hw_queue+0x341/0x670
blk_mq_dispatch_list+0x50c/0x16f0
blk_mq_flush_plug_list+0x131/0x600
...
blkdev_read_iter+0x2b5/0x4e0
vfs_read+0x7fd/0xaf0
ksys_read+0x12a/0x250
do_syscall_64+0x106/0x5f0
entry_SYSCALL_64_after_hwframe+0x77/0x7f
</TASK>
Use reschedule_timeout(), which takes the lock.
Cc: stable@vger.kernel.org
Fixes: a9f38e1dec10 ("floppy: convert to blk-mq")
Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
---
There is a small ordering conflict with "floppy: select FDC before arming
timeout work" [1], which moves the same call below set_fdc(0). I will
resolve it when applying the patches, so that the timeout is armed with
reschedule_timeout() after set_fdc(0).
That is also why this patch switches to reschedule_timeout() instead of
moving __reschedule_timeout() into the floppy_lock section a couple of
lines above: there it would be armed before set_fdc(0) again.
[1] https://lore.kernel.org/linux-block/20260504032853.316099-1-zzzccc427@gmail.com/
drivers/block/floppy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index f04397b8e381..5bbd385f837c 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2872,7 +2872,7 @@ static blk_status_t floppy_queue_rq(struct blk_mq_hw_ctx *hctx,
spin_unlock_irq(&floppy_lock);
command_status = FD_COMMAND_NONE;
- __reschedule_timeout(MAXTIMEOUT, "fd_request");
+ reschedule_timeout(MAXTIMEOUT, "fd_request");
set_fdc(0);
process_fd_request();
is_alive(__func__, "");
base-commit: 22430ae5d90ab288b0ee2ad99ae941f4a666b694
--
2.55.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-06 11:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 11:35 [PATCH] floppy: take floppy_lock when rescheduling the timeout in queue_rq Denis Efremov (Oracle)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.