diff -r abbe3df33774 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Tue Nov 8 17:39:58 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Tue Nov 8 22:49:53 2005 @@ -641,6 +641,7 @@ info->vdevice = vdevice; info->connected = BLKIF_STATE_DISCONNECTED; info->mi = NULL; + info->gd = NULL; INIT_WORK(&info->work, blkif_restart_queue, (void *)info); info->shadow_free = 0; diff -r abbe3df33774 linux-2.6-xen-sparse/drivers/xen/blkfront/block.h --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Tue Nov 8 17:39:58 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Tue Nov 8 22:49:53 2005 @@ -116,6 +116,7 @@ /* We watch the backend */ struct xenbus_watch watch; dev_t dev; + struct gendisk *gd; int vdevice; blkif_vdev_t handle; int connected; diff -r abbe3df33774 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c Tue Nov 8 17:39:58 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c Tue Nov 8 22:49:53 2005 @@ -259,6 +259,7 @@ gd->flags |= GENHD_FL_CD; add_disk(gd); + info->gd = gd; return 0; @@ -292,22 +293,19 @@ xlvbd_del(struct blkfront_info *info) { struct block_device *bd; - struct gendisk *gd; - int unused; - request_queue_t *rq; bd = bdget(info->dev); if (bd == NULL) return; - gd = get_gendisk(info->dev, &unused); - rq = gd->queue; - - del_gendisk(gd); - put_disk(gd); + if (info->gd == NULL) + return; + + del_gendisk(info->gd); + put_disk(info->gd); xlbd_put_major_info(info->mi); info->mi = NULL; - blk_cleanup_queue(rq); + blk_cleanup_queue(info->rq); bdput(bd); }