FAILED: patch "[PATCH] xen-blkfront: Fix IO race during unplug" failed to apply to 5.15-stable tree
Subsystems (4)
Sasha Levin
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 61b6d1df1d6234c38a6ea7e4f58e7da035ef6ab4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 61b6d1df1d6234c38a6ea7e4f58e7da035ef6ab4 Mon Sep 17 00:00:00 2001
From: Ross Lagerwall <[email protected]>
Date: Tue, 6 Oct 2026 17:34:07 +0100
Subject: [PATCH] xen-blkfront: Fix IO race during unplug
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
During unplug, blkfront stops the hw queues and marks the disk as dead, then later during removal calls del_gendisk(). However, IO issued after the hw queues are stopped but before the call to del_gendisk() will be queued but never handled. This causes del_gendisk() to hang forever waiting for the queue refcount to drop to zero.
This can be reproduced by issuing IO during an artificial delay after stopping the hw queues.
Fix this by simply not stopping the hw queues directly. Marking the disk as dead already freezes the queue which prevents new requests being added and it synchronously runs the hw queues to clear anything pending. If the hw queues are stopped when calling blk_mark_disk_dead(), running the hw queues is a no-op and can leave queued requests unprocessed.
Message-ID: <[email protected]>
--- drivers/block/xen-blkfront.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/block/xen-blkfront.c +1 -3
@@ -2142,10 +2142,8 @@ static void blkfront_closing(struct blkfront_info *info)return ;/* No more blkif_request(). */ -if (info->rq && info->gd) { -blk_mq_stop_hw_queues (info->rq); +if (info->gd)blk_mark_disk_dead (info->gd); - }for_each_rinfo (info, rinfo, i) {/* No more gnttab callback work. */
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 xen-blkfront: Fix IO race during unplug
From: Ross Lagerwall <[email protected]>
[ Upstream commit 61b6d1df1d6234c38a6ea7e4f58e7da035ef6ab4 ]
During unplug, blkfront stops the hw queues and marks the disk as dead, then later during removal calls del_gendisk(). However, IO issued after the hw queues are stopped but before the call to del_gendisk() will be queued but never handled. This causes del_gendisk() to hang forever waiting for the queue refcount to drop to zero.
This can be reproduced by issuing IO during an artificial delay after stopping the hw queues.
Fix this by simply not stopping the hw queues directly. Marking the disk as dead already freezes the queue which prevents new requests being added and it synchronously runs the hw queues to clear anything pending. If the hw queues are stopped when calling blk_mark_disk_dead(), running the hw queues is a no-op and can leave queued requests unprocessed.
Message-ID: <[email protected]>
--- drivers/block/xen-blkfront.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/block/xen-blkfront.c +1 -2
@@ -2157,8 +2157,7 @@ static void blkfront_closing(struct blkfront_info *info)return ;/* No more blkif_request(). */ -if (info->rq && info->gd) { -blk_mq_stop_hw_queues (info->rq); +if (info->gd) {blk_mark_disk_dead (info->gd);set_capacity (info->gd,0 ); }
Signature · 1 line
2.53.0