]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
floppy: Fix hang in watchdog when disk is ejected
authorTasos Sahanidis <tasos@tasossah.com>
Fri, 3 Sep 2021 06:47:58 +0000 (09:47 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:35:37 +0000 (16:35 +0100)
commited3702138b494fdd07e257a0f454a600cff8ced8
treebdd5daf61328836b79e8c8f7f4a5bbee7c87d0ea
parent143217f97e3587e0fb081ee6150ef67afb7461a9
floppy: Fix hang in watchdog when disk is ejected

BugLink: https://bugs.launchpad.net/bugs/1960566
[ Upstream commit fb48febce7e30baed94dd791e19521abd2c3fd83 ]

When the watchdog detects a disk change, it calls cancel_activity(),
which in turn tries to cancel the fd_timer delayed work.

In the above scenario, fd_timer_fn is set to fd_watchdog(), meaning
it is trying to cancel its own work.
This results in a hang as cancel_delayed_work_sync() is waiting for the
watchdog (itself) to return, which never happens.

This can be reproduced relatively consistently by attempting to read a
broken floppy, and ejecting it while IO is being attempted and retried.

To resolve this, this patch calls cancel_delayed_work() instead, which
cancels the work without waiting for the watchdog to return and finish.

Before this regression was introduced, the code in this section used
del_timer(), and not del_timer_sync() to delete the watchdog timer.

Link: https://lore.kernel.org/r/399e486c-6540-db27-76aa-7a271b061f76@tasossah.com
Fixes: 070ad7e793dc ("floppy: convert to delayed work and single-thread wq")
Signed-off-by: Tasos Sahanidis <tasos@tasossah.com>
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/block/floppy.c