Skip to contentSkip to conversation

Xen: Fix warning when hot-unplugging virtual block devices

PATCH In review Alex Nixon 2 participants 2 messages Aug 21, 2008

Subsystems (3)
lore
Share & tools
lore

Alex Nixon

author
#0 lore raw

PATCH 1/1 Xen: Fix warning when hot-unplugging virtual block devices

From: Alex Nixon <[email protected]>
Date: Thu, 21 Aug 2008 12:30:54 +0100
Subject: [PATCH] Xen: Fix warning when hot-unplugging virtual block devices

WARNING: at kernel/softirq.c:136 local_bh_enable+0x3f/0x8a()

del_gendisk needs IRQs enabled, as the code path eventually reaches local_bh_enable. blk_stop_queue needs them disabled - so do so temporarily.

It shouldn't matter if an interrupt comes in whilst blkif_io_lock is held, as it will block on the lock. Upon acquisition, it'll realise the device is down and exit cleanly.

---
 drivers/block/xen-blkfront.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/block/xen-blkfront.c +4 -2
index d5e7532..95cee2c 100644
@@ -899,16 +899,18 @@ static void blkfront_closing(struct xenbus_device *dev)
 	if (info->rq == NULL)
 		goto out;
 
-	spin_lock_irqsave(&blkif_io_lock, flags);
+	spin_lock(&blkif_io_lock);
 
 	del_gendisk(info->gd);
 
+	local_irq_save(flags);
 	/* No more blkif_request(). */
 	blk_stop_queue(info->rq);
+	local_irq_restore(flags);
 
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	spin_unlock(&blkif_io_lock);
 
 	/* Flush gnttab callback work. Must be done with no locks held. */
 	flush_scheduled_work();
Signature · 1 line
1.5.4.3
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Alex Nixon

From: Alex Nixon <[email protected]>
Date: Thu, 21 Aug 2008 12:30:54 +0100
Subject: [PATCH] Xen: Fix warning when hot-unplugging virtual block devices

Quoted 9 lines
WARNING: at kernel/softirq.c:136 local_bh_enable+0x3f/0x8a()

del_gendisk needs IRQs enabled, as the code path eventually reaches local_bh_enable. blk_stop_queue needs them disabled - so do so temporarily.

It shouldn't matter if an interrupt comes in whilst blkif_io_lock is held, as it will block on the lock. Upon acquisition, it'll realise the device is down and exit cleanly.

Send a clean copy to Jens with my ack.

J

Quoted 30 lines
---
 drivers/block/xen-blkfront.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/block/xen-blkfront.c +4 -2
index d5e7532..95cee2c 100644
@@ -899,16 +899,18 @@ static void blkfront_closing(struct xenbus_device *dev)
 	if (info->rq == NULL)
 		goto out;
 
-	spin_lock_irqsave(&blkif_io_lock, flags);
+	spin_lock(&blkif_io_lock);
 
 	del_gendisk(info->gd);
 
+	local_irq_save(flags);
 	/* No more blkif_request(). */
 	blk_stop_queue(info->rq);
+	local_irq_restore(flags);
 
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	spin_unlock(&blkif_io_lock);
 
 	/* Flush gnttab callback work. Must be done with no locks held. */
 	flush_scheduled_work();