From 028c85f0fffe5d4fdd435e06af4188397acf1cb6 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 27 Mar 2012 16:02:21 +0000 Subject: [PATCH 1/2] xen_console: ignore console disconnect events from console/0 The first console has a different location compared to other PV devices (console, rather than device/console/0) and doesn't obey the xenstore state protocol. We already special case the first console in con_init and con_initialise, we should also do it in con_disconnect. Signed-off-by: Stefano Stabellini --- hw/xen_console.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/xen_console.c b/hw/xen_console.c index edcb31ce66..3794b1972d 100644 --- a/hw/xen_console.c +++ b/hw/xen_console.c @@ -248,6 +248,9 @@ static void con_disconnect(struct XenDevice *xendev) { struct XenConsole *con = container_of(xendev, struct XenConsole, xendev); + if (!xendev->dev) { + return; + } if (con->chr) qemu_chr_add_handlers(con->chr, NULL, NULL, NULL, NULL); xen_be_unbind_evtchn(&con->xendev); From 7429f2e1981c6cc77a853e2e88654001bdddd461 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Tue, 27 Mar 2012 16:03:07 +0000 Subject: [PATCH 2/2] xen_disk: detach the blkdev before bdrv_delete We need to detach the blkdev from the BlockDriverState before calling bdrv_delete. Signed-off-by: Stefano Stabellini --- hw/xen_disk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 68fa36a1cf..bf06fc1978 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -726,6 +726,7 @@ static void blk_disconnect(struct XenDevice *xendev) if (!blkdev->dinfo) { /* close/delete only if we created it ourself */ bdrv_close(blkdev->bs); + bdrv_detach_dev(blkdev->bs, blkdev); bdrv_delete(blkdev->bs); } blkdev->bs = NULL;