Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3555970pxb; Mon, 24 Jan 2022 12:08:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTdccIHpXvdIZgyj5v4Gne9JfPXwrw0GgpH5KtjHKAKkGdOz+o+MqpLalauvCSJENimX4C X-Received: by 2002:a62:e210:0:b0:4c9:1cff:15cc with SMTP id a16-20020a62e210000000b004c91cff15ccmr2974677pfi.55.1643054888652; Mon, 24 Jan 2022 12:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054888; cv=none; d=google.com; s=arc-20160816; b=PXU9AYZwGWVBgvPdwLn5OX5ru/V2/iAiSKeuQmHNCOMmi0a+2+Gq9TjbrJ9RkqAuuh QbLONc98/cYBhLZGmgOaPgJsLvJInPfigL1uza+JpuUUJWLNob9kB++0FDD1xx64yubK 0epIrT/ANH8Leywhw08EUoX0gvDcG4t5Ql7wjh+thwDULKYIgk9deI0u6GAVnGoTPkce mJaEtoinyiY528hjdLKkmjUf8+uQ1Xrna8CTm9U4wMbTdJYsr4LPOfWMoh2Y3WCa319h +nsDlPTkUc6sJ8/qjkk0nix1pZ+iWNamOKdclkIwRaai1M1O3bc/iD8xRHA0Ocv8WF5w 93sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rNSgFY/bbj5lXlmwlPNSR1ZcmS/PlWhQIYGqq4ampgw=; b=qS3EVqOtHI4uwxDU9qvDH/gN+RkY01L5w0DL8lTpV+9VBIICUh8gxrNcY8tDuHyWNf 2hot6nc+BIdeSSDtquUqg3sToYdIhkVJU47hmZnLt53R+MXhEHPvyLETcTwJFI1b4LTS NjoAQm0SfrU0ivTpt+qnaIBOJauToycyBCMY07L5gxr4s3wZheG5RHmF4sgp2f6/ISx2 0qjk6j/y7s5yD4m16oMeOZvU1IFJZO/6npd9sYawhEj/5JVdMG0mcrRKa9Yfz8LnvI/Z w041I7Zavebkb1wA9H3luknD1rA4IKyuEW9tA3EgnnmId4u0C99BT7M1mZp7ZskGOMYn JiVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ccBx9IZT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 9si13113783pll.118.2022.01.24.12.07.56; Mon, 24 Jan 2022 12:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ccBx9IZT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346539AbiAXTGv (ORCPT + 99 others); Mon, 24 Jan 2022 14:06:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345668AbiAXTAw (ORCPT ); Mon, 24 Jan 2022 14:00:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 351AEC061365; Mon, 24 Jan 2022 10:58:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CDD59B81235; Mon, 24 Jan 2022 18:58:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7471C340E5; Mon, 24 Jan 2022 18:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050695; bh=l31NYPDy27HsQINdourGHA5+CrTxr1+qXptsDsZ7qy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ccBx9IZTM1ODMIgWTYkCquGhUf0RnSOZYpCkfgknrDFVtlhj8uuROS0XGA8qoZZGy Mr2ENuGlUgEwpfhU6GDRsNkVeQ14PeComNjPgyZBnAAxkdTFcnYDjsQWJhJl/l0ykj mFz3EIPLe71sqr/7lhZs5KagFCiITggITPPP2S/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tasos Sahanidis , Denis Efremov , Jens Axboe , Sasha Levin Subject: [PATCH 4.9 041/157] floppy: Fix hang in watchdog when disk is ejected Date: Mon, 24 Jan 2022 19:42:11 +0100 Message-Id: <20220124183934.101171195@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tasos Sahanidis [ 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 Signed-off-by: Denis Efremov Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- 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 4496e7a492352..d508dda49dee4 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -994,7 +994,7 @@ static DECLARE_DELAYED_WORK(fd_timer, fd_timer_workfn); static void cancel_activity(void) { do_floppy = NULL; - cancel_delayed_work_sync(&fd_timer); + cancel_delayed_work(&fd_timer); cancel_work_sync(&floppy_work); } -- 2.34.1