Commit e46cb38f13dda9b2b7754de521836c0c97bb09cd
1 parent
7a9f6e4a
virtio-net migration fix (Mark McLoughlin)
We are failing to save whether the guest will supply us rx buffers using the new mergeable format; this can cause a migrated guest to crash with: virtio-net header not in first element Bump the savevm version number and refuse to load v1 saves just to be on the safe side. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6221 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
4 additions
and
2 deletions
hw/virtio-net.c
| @@ -275,19 +275,21 @@ static void virtio_net_save(QEMUFile *f, void *opaque) | @@ -275,19 +275,21 @@ static void virtio_net_save(QEMUFile *f, void *opaque) | ||
| 275 | 275 | ||
| 276 | qemu_put_buffer(f, n->mac, 6); | 276 | qemu_put_buffer(f, n->mac, 6); |
| 277 | qemu_put_be32(f, n->tx_timer_active); | 277 | qemu_put_be32(f, n->tx_timer_active); |
| 278 | + qemu_put_be32(f, n->mergeable_rx_bufs); | ||
| 278 | } | 279 | } |
| 279 | 280 | ||
| 280 | static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) | 281 | static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) |
| 281 | { | 282 | { |
| 282 | VirtIONet *n = opaque; | 283 | VirtIONet *n = opaque; |
| 283 | 284 | ||
| 284 | - if (version_id != 1) | 285 | + if (version_id != 2) |
| 285 | return -EINVAL; | 286 | return -EINVAL; |
| 286 | 287 | ||
| 287 | virtio_load(&n->vdev, f); | 288 | virtio_load(&n->vdev, f); |
| 288 | 289 | ||
| 289 | qemu_get_buffer(f, n->mac, 6); | 290 | qemu_get_buffer(f, n->mac, 6); |
| 290 | n->tx_timer_active = qemu_get_be32(f); | 291 | n->tx_timer_active = qemu_get_be32(f); |
| 292 | + n->mergeable_rx_bufs = qemu_get_be32(f); | ||
| 291 | 293 | ||
| 292 | if (n->tx_timer_active) { | 294 | if (n->tx_timer_active) { |
| 293 | qemu_mod_timer(n->tx_timer, | 295 | qemu_mod_timer(n->tx_timer, |
| @@ -324,7 +326,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) | @@ -324,7 +326,7 @@ PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) | ||
| 324 | n->tx_timer_active = 0; | 326 | n->tx_timer_active = 0; |
| 325 | n->mergeable_rx_bufs = 0; | 327 | n->mergeable_rx_bufs = 0; |
| 326 | 328 | ||
| 327 | - register_savevm("virtio-net", virtio_net_id++, 1, | 329 | + register_savevm("virtio-net", virtio_net_id++, 2, |
| 328 | virtio_net_save, virtio_net_load, n); | 330 | virtio_net_save, virtio_net_load, n); |
| 329 | 331 | ||
| 330 | return (PCIDevice *)n; | 332 | return (PCIDevice *)n; |