mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Denis Efremov (Oracle)" <efremov@linux.com>
To: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"Denis Efremov (Oracle)" <efremov@linux.com>,
	stable@vger.kernel.org
Subject: [PATCH] floppy: take floppy_lock when rescheduling the timeout in queue_rq
Date: Tue,  6 Oct 2026 15:35:47 +0400	[thread overview]
Message-ID: <20261006113547.2099599-1-efremov@linux.com> (raw)

__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


                 reply	other threads:[~2026-10-06 11:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261006113547.2099599-1-efremov@linux.com \
    --to=efremov@linux.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®