[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] xen-blkfront: Fix IO race during unplug


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
  • From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
  • Date: Tue, 6 Oct 2026 14:58:06 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lX8X2R1DDq8edidJA8juOKqxFOJ2vapFzb/jiC8u58U=; b=g6FyaB3lP2g52vrnKmDj/67AqfuotkRAnD6714EETNEbUd+eGz01DCoZcufwJ6E5Je8XmoCNAHK2qZpHAlc6VtlK0tktiS/ce0EQkjTGxNHVERprT+g2MWMg/YfEGBAlAgUqJ/nTAhX4tqfy6rdUrnNAQ6cVrdDVTVPoePFtcpzrNG72uaTmyaE2MMglCIUhhGHLsl/WheAI6SywYQFTcQ4fEbXGyd0Mc2x2HM4oOfdmqmRKoMm37ulgqgWxZ2mHGqfZEzuOoCMpON4/kyXNfvgOwlGAN9h11fzS8gglkRYPK9+WCXuSEnlfZfAnrvn1Kbtrfbg9g+54XsdVzYMqEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=POMZoS6ntfaMquniUF6vy+olWi2ODdhTz779ZYjbPIRdgi8Ijh3lybfkgVJM6C9WkIA7EBKdWhDC/9r7enRluW9WsisZuiflxujBMXY+3SfBSM8VmDXbctgBvOhvPSmYKzvStPSoRDh9gCT/iSnNYdJ20bDvEIs28DrbB9AChnApHadzhJDBxuCSvzyYCnRNeAZhhwscubfnyOgOy1zEY7OMF1Sx+cJPRitErvXdf5t7FRxzSdhU7ynEsulzANf6YqJaTt9Pu7pI4Pw+ggXbIvD+ticMtDwPflj24ygSGBYDbSbXE4ILPJvc1JzDDybgRjPXWXe2ZuLELMQV9W08Xw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, stable@xxxxxxxxxxxxxxx
  • Delivery-date: Tue, 06 Oct 2026 14:00:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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 also freezes the queue which prevents new requests being added
and it synchronously runs the hw queues to clear anything pending.

Fixes: 8e141f9eb803 ("block: drain file system I/O on del_gendisk")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---

I'm not sure about the Fixes tag. It's the most likely looking candidate
to me but I didn't confirm whether it actually introduced the
regression.

 drivers/block/xen-blkfront.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 8dad7bf5f664..69a2315a1b20 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2138,10 +2138,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. */
-- 
2.55.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.