WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Sleeping with spinlock held

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Sleeping with spinlock held
From: Glauber de Oliveira Costa <gcosta@xxxxxxxxxx>
Date: Mon, 9 Oct 2006 16:30:47 -0300
Delivery-date: Mon, 09 Oct 2006 12:31:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11
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.

-- 
Glauber de Oliveira Costa
Red Hat Inc.
"Free as in Freedom"
--- linux-2.6.18-orig/drivers/xen/blkfront//blkfront.c.orig     2006-10-07 
10:28:25.000000000 -0400
+++ linux-2.6.18-orig/drivers/xen/blkfront//blkfront.c  2006-10-07 
10:27:58.000000000 -0400
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>