Patchwork [2/2] xen_disk: detach the blkdev before bdrv_delete

login
register
mail settings
Submitter Stefano Stabellini
Date March 27, 2012, 4:15 p.m.
Message ID <1332864932-1082-2-git-send-email-stefano.stabellini@eu.citrix.com>
Download mbox | patch
Permalink /patch/148989/
State New
Headers show

Comments

Stefano Stabellini - March 27, 2012, 4:15 p.m.
We need to detach the blkdev from the BlockDriverState before calling
bdrv_delete.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 68fa36a..bf06fc1 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;