From nobody Sat Jul 25 00:02:26 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDD683DBD41 for ; Wed, 22 Jul 2026 03:44:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784691897; cv=none; b=QgXKfG1fydXBjcgvEval5oye5YLVtxmjFouqn4vzJKm/rO1rUypr1wLunXDo+i82RYkK+F/TB10neJ5CqU3LRbm3BcxcsmZzocAT1qDWMylAWmXjBxsSc2pGUFFIs7v+/oEQeTfd9QSL1rjqYQmPkntTbzKOvJiycLTTgJEXzR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784691897; c=relaxed/simple; bh=E7dmmcnU+LmIbXuBg4/pv0wUeDKswzuUKZorvsx2djI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=q8EdfIMlcXszmyGTc3VnzJphY7jEGaq6sno1WOZ85Xt0Vik9M0NZHr289dgNUxoj8J+3R7zY7dPOB/UzrYyo5GBI4NgFhyCARSQ1Evylt6QsrA8obItNqDraNDvuASQ6NvrBcH7xTGpKC+xY4qROsDvTJ6uH86b8YcxbvLPwkSI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rqoKNb/A; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rqoKNb/A" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-49548aebcd8so32772915e9.3 for ; Tue, 21 Jul 2026 20:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784691894; x=1785296694; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=ppOhKumLepZWu8WHOmlT34Cz/7DtUO+ziKpkk444+3M=; b=rqoKNb/AxLEzlXPKSSP8Uwni6kD3WgdoPQN5wEs+cmnJepmaqxscC85JbTDgZF5veb /2Hod0VwRNvvcZb6IXr0GbJpnB0LNSx+ZbtkvI/zoHmxyTG51Eu6ExpMaOYAPIhG7afP xn86fhDizSekXsvu5MtdQPZOMmOjwxcKqSLyAsFn1fzqxqoL52YjIuKPOG3xAhIH4huF 4JAQ7M3BR//7VTJDwFrR37KwKIK3mmAd4bzhO40ywQB55BT3o5hcLKqh15MrFqPNYONC O1tdCBDlpVhgEwSBLYAItt0WqcLy1U9nPCLt1I82YCzQMktzMufAGBfP7AZp95pZY01Q eRKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784691894; x=1785296694; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ppOhKumLepZWu8WHOmlT34Cz/7DtUO+ziKpkk444+3M=; b=ArEZIjEJHQNQe3oI22+oRkA+zvMIy0WPHT1nztd7SWuLE7qMdwZx2XumzZgtOQwz8G CuHhy+LXbLonutp7IXE+BLCIg4kmRUxx5t6kuUr885oy2Z/u0wyA4XAwc+6d87BzfXD/ hZ8WpcUcp/8chEqgPowFCjgbrj5rprrn/cIgbHy7zfyII2Ekj6muit/nEGpWUkGPcJx/ zxZYVWV2UEpVhNUWGTaMn4d6Ugj4Qtgsc2FlTdMXN6dse4T19va0a+A5gwFqO3/4x/3Y PDQUqk208INmxD0HCKnpsL6I45I7n5lNFLs0oeqndrDzpjkIj7CqHoXO7KlooD25AXjh gqJw== X-Forwarded-Encrypted: i=1; AHgh+RpWmvYrz7k0jqVgEuzMCOmHlwbLmZFNe9r1f6sUm8Df9HBNnNcHOCNbfX/Kn87P9EbDwzcq+Z1fa7Wnb4A=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3WkdtimVMOrv6X+rtHJk+YkoshETD1TZFS7PYImrMyEsfzHu2 AyjkvzVDUAZUZAEz7uf5GiA6aRGADlV5E/6ycOlHBe9L4DY6kIawvk5s X-Gm-Gg: AR+sD135FNLubKbJKPl0dS/KII7eHZobFKmPqHIBNGfsiQf2JjTuCvN2/4UArnnkwRg K4KzbU0AlQfG1IfyBceiBmtDg8Us0UBFmgndjCr/+I+So1KJqdEWT5sm7orOypNiaMBrFQFohrz KAUTxTvaGg868JttV2KENDab/SeG0Rtpu0DNkblbEmGjk7HK6Tn5wtr/sV//EI/7YHWH6xyGcAl Es87Ii9Tw+itvyAR+aNwpnL5LIwjU0hlhrtEsirxsfZVUQi4g5omcppTmF07OqK7p8n3zKumzq/ KSR9YSlVkHL0Ayere4IjUfH+pKf4j4rEEXt2gT6ysPFsxsha/J30qWNCZi03pMf/wFlQyUEs8nH 1GD6RnsunEesxm9SDnCdNu8Y8PaSgYvVbPDwjrA7QpK+7+CEJZlIlfh8hXEoZeCmmBytAIqDunT FmnG7a+GHGrUkBRzVnlvzA1XbBKKrB83hIo8BNF+I1C9luGqJswQ/jMxem64hrVzGNxIg0TPm8/ P+j4/ILv25x1Folu3P9QEJci7KkJ1yCeA5bV5ZQRM4danPZNo2EieFIzRU0WryGLmt3BuImmVjm slwbNhjM X-Received: by 2002:a05:600c:1548:b0:493:c062:a533 with SMTP id 5b1f17b1804b1-4954a3e8fe1mr243623005e9.17.1784691893766; Tue, 21 Jul 2026 20:44:53 -0700 (PDT) Received: from localhost.localdomain (dynamic-2a02-3100-ac57-0f01-2d95-8753-45c1-c833.310.pool.telefonica.de. [2a02:3100:ac57:f01:2d95:8753:45c1:c833]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47f85c6dc25sm2068993f8f.33.2026.07.21.20.44.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jul 2026 20:44:53 -0700 (PDT) From: Karl Mehltretter To: Denis Efremov , Jens Axboe Cc: Karl Mehltretter , Jiri Kosina , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] floppy: flush pending work before releasing resources on init failure Date: Wed, 22 Jul 2026 05:44:35 +0200 Message-Id: <20260722034435.13432-1-kmehltretter@gmail.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" do_floppy_init() probes each FDC with user_reset_fdc(), which queues a redo_fd_request() work item on floppy_wq that may still be pending when the probe finishes. When no controller is found, the error path calls floppy_release_irq_and_dma() to free the IRQ and DMA channel, and only later destroys the workqueue. destroy_workqueue() drains the queued work last, so it can run after the IRQ and DMA are already gone: floppy0: no floppy controllers found work still pending The flush used to be here. Commit 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") renamed the label out_flush_work to out_release_dma and dropped it. Restore it so the work drains before the IRQ and DMA are released, as floppy_module_exit() already does. Fixes: 070ad7e793dc ("floppy: convert to delayed work and single-thread wq") Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Karl Mehltretter Reviewed-by: Denis Efremov (Oracle) --- Noticed while running mainline on an emulated Acorn RiscPC, a custom personal QEMU machine. It has no floppy controller and rpc_defconfig sets CONFIG_BLK_DEV_FD=3Dy, so every boot takes the no-controller error path. No disk is registered there, so the drained work takes the empty-request fast path and just unlocks the FDC, leaving only the spurious message. Verified with 100 QEMU boots per platform on v7.2-rc4, no controller present. "work still pending" appeared on an unfixed kernel vs with this patch: Acorn RiscPC, rpc_defconfig: 100/100 -> 0/100 x86_64 defconfig, qemu -M q35: 6/100 -> 0/100 With a controller present on qemu -M pc, reading and writing a 1.44M floppy image still works. drivers/block/floppy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index f04397b8e381..6cfd114d27df 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4744,6 +4744,8 @@ static int __init do_floppy_init(void) } } out_release_dma: + /* Drain the queued redo_fd_request() before releasing IRQ and DMA. */ + flush_workqueue(floppy_wq); if (atomic_read(&usage_count)) floppy_release_irq_and_dma(); out_unreg_driver: --=20 2.53.0