[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 28/37] virtio-blk: fix unplug + virsh reboot
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 28/37] virtio-blk: fix unplug + virsh reboot |
Date: |
Tue, 2 Apr 2013 16:45:33 -0500 |
From: Christian Borntraeger <address@hidden>
virtio-blk registers a vmstate change handler. Unfortunately this
handler is not unregistered on unplug, leading to some random
crashes if the system is restarted, e.g. via virsh reboot.
Lets unregister the vmstate change handler if the device is removed.
Signed-off-by: Christian Borntraeger <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
(cherry picked from commit 69b302b2044a9a0f6d157d25b39a91ff7124c61f)
Signed-off-by: Michael Roth <address@hidden>
---
hw/virtio-blk.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 34913ee..f5e6ee9 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -36,6 +36,7 @@ typedef struct VirtIOBlock
VirtIOBlkConf *blk;
unsigned short sector_mask;
DeviceState *qdev;
+ VMChangeStateEntry *change;
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
VirtIOBlockDataPlane *dataplane;
#endif
@@ -681,7 +682,7 @@ VirtIODevice *virtio_blk_init(DeviceState *dev,
VirtIOBlkConf *blk)
}
#endif
- qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
+ s->change = qemu_add_vm_change_state_handler(virtio_blk_dma_restart_cb, s);
s->qdev = dev;
register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
virtio_blk_save, virtio_blk_load, s);
@@ -702,6 +703,7 @@ void virtio_blk_exit(VirtIODevice *vdev)
virtio_blk_data_plane_destroy(s->dataplane);
s->dataplane = NULL;
#endif
+ qemu_del_vm_change_state_handler(s->change);
unregister_savevm(s->qdev, "virtio-blk", s);
blockdev_mark_auto_del(s->bs);
virtio_cleanup(vdev);
--
1.7.9.5
- [Qemu-devel] [PATCH 18/37] qcow2: make is_allocated return true for zero clusters, (continued)
- [Qemu-devel] [PATCH 18/37] qcow2: make is_allocated return true for zero clusters, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 19/37] qemu-ga: use key-value store to avoid recycling fd handles after restart, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 21/37] tcg: Fix occasional TCG broken problem when ldst optimization enabled, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 22/37] virtio-ccw: Queue sanity check for notify hypercall., Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 20/37] qga/main.c: Don't use g_key_file_get/set_int64, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 23/37] qemu-bridge-helper: force usage of a very high MAC address for the bridge, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 24/37] configure: Require at least spice-protocol-0.12.3, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 25/37] pseries: Add cleanup hook for PAPR virtual LAN device, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 26/37] target-ppc: Fix CPU_POWERPC_MPC8547E, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 27/37] ide/macio: Fix macio DMA initialisation., Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 28/37] virtio-blk: fix unplug + virsh reboot,
Michael Roth <=
- [Qemu-devel] [PATCH 35/37] linux-user: make bogus negative iovec lengths fail EINVAL, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 34/37] linux-user: fix futex strace of FUTEX_CLOCK_REALTIME, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 36/37] linux-user/syscall.c: Don't warn about unimplemented get_robust_list, Michael Roth, 2013/04/02
- [Qemu-devel] [PATCH 37/37] update seabios to 1.7.2.1, Michael Roth, 2013/04/02
- Re: [Qemu-devel] Patch Round-up for stable 1.4.1, freeze next Tuesday, Eric Blake, 2013/04/02
- [Qemu-devel] [PATCH 31/37] qcow2: flush refcount cache correctly in alloc_refcount_block(), Michael Roth, 2013/04/02