Skip to contentSkip to conversation

Sleeping with spinlock held

PATCH New Glauber de Oliveira Costa 1 participant 1 message Oct 9, 2006 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Sleeping with spinlock held

Hi,

In drivers/xen/blkfront/blkfront.c, flush_scheduled_work(), that might sleep, is being called with a spinlock held, thus triggering a BUG. I think it's safe to just poke it out from the locked region, as it seems to me we won't be receiving any more work at this time.

In case you agree, I'm attaching a simple patch that fix this.

Signature · 3 lines
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
drivers/xen/blkfront//blkfront.c renamed from drivers/xen/blkfront//blkfront.c.orig +2 -2
@@ -355,8 +355,8 @@ static void blkfront_closing(struct xenb
 	blk_stop_queue(info->rq);
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	flush_scheduled_work();
 	spin_unlock_irqrestore(&blkif_io_lock, flags);
+	flush_scheduled_work();
 
 	xlvbd_del(info);
 
@@ -714,8 +714,8 @@ static void blkif_free(struct blkfront_i
 		blk_stop_queue(info->rq);
 	/* No more gnttab callback work. */
 	gnttab_cancel_free_callback(&info->callback);
-	flush_scheduled_work();
 	spin_unlock_irq(&blkif_io_lock);
+	flush_scheduled_work();
 
 	/* Free resources associated with old device channel. */
 	if (info->ring_ref != GRANT_INVALID_REF) {

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel