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-changelog

[Xen-changelog] Avoid a hang when probing the partition table on importe

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Avoid a hang when probing the partition table on imported block
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 02 Dec 2005 15:44:06 +0000
Delivery-date: Fri, 02 Dec 2005 15:44:18 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User sos22@xxxxxxxxxxxxxxxxxxxx
# Node ID 265f68795ebf254cc07b8cc17e8d5813b7df5c0c
# Parent  d4ab8e46136ccb64a75dbdb6e84126d6a9552ca4
Avoid a hang when probing the partition table on imported block
devices.  If you export a device so the importing domain sees it as a
whole disk rather than a partition, then add_disk will try to probe
its partition table.  However, we were calling add_disk before the
device was properly connected, and then not connecting it until
add_disk had finished.  This meant that we ended up never actually
connecting the device, and any accesses to it would then hang.

Fix this by not calling add_disk until we're connected.

Signed-off-by: Steven Smith, sos22@xxxxxxxxx

diff -r d4ab8e46136c -r 265f68795ebf 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Dec  2 
12:27:39 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Dec  2 
14:16:37 2005
@@ -311,7 +311,7 @@
        int err;
 
         if( (info->connected == BLKIF_STATE_CONNECTED) || 
-           (info->connected == BLKIF_STATE_SUSPENDED) ) 
+           (info->connected == BLKIF_STATE_SUSPENDED) )
                return;
 
        DPRINTK("blkfront.c:connect:%s.\n", info->xbdev->otherend);
@@ -327,16 +327,18 @@
                                 info->xbdev->otherend);
                return;
        }
-       
+
         xlvbd_add(sectors, info->vdevice, binfo, sector_size, info);
 
        (void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected); 
-       
+
        /* Kick pending requests. */
        spin_lock_irq(&blkif_io_lock);
        info->connected = BLKIF_STATE_CONNECTED;
        kick_pending_request_queues(info);
        spin_unlock_irq(&blkif_io_lock);
+
+       add_disk(info->gd);
 }
 
 /**
@@ -588,7 +590,6 @@
 
        while ((req = elv_next_request(rq)) != NULL) {
                info = req->rq_disk->private_data;
-
                if (!blk_fs_request(req)) {
                        end_request(req, 0);
                        continue;
diff -r d4ab8e46136c -r 265f68795ebf 
linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Fri Dec  2 12:27:39 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Fri Dec  2 14:16:37 2005
@@ -146,6 +146,9 @@
 extern void do_blkif_request (request_queue_t *rq); 
 
 /* Virtual block-device subsystem. */
+/* Note that xlvbd_add doesn't call add_disk for you: you're expected
+   to call add_disk on info->gd once the disk is properly connected
+   up. */
 int xlvbd_add(blkif_sector_t capacity, int device,
              u16 vdisk_info, u16 sector_size, struct blkfront_info *info);
 void xlvbd_del(struct blkfront_info *info);
diff -r d4ab8e46136c -r 265f68795ebf 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Fri Dec  2 12:27:39 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Fri Dec  2 14:16:37 2005
@@ -261,7 +261,6 @@
        if (vdisk_info & VDISK_CDROM)
                gd->flags |= GENHD_FL_CD;
 
-       add_disk(gd);
        info->gd = gd;
 
        return 0;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Avoid a hang when probing the partition table on imported block, Xen patchbot -unstable <=