[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 33/55] dataplane: fail notifier setting gracefully
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 33/55] dataplane: fail notifier setting gracefully |
Date: |
Fri, 15 Aug 2014 18:06:40 +0100 |
From: Cornelia Huck <address@hidden>
The dataplane code is currently doing a hard exit if it fails to set
up either guest or host notifiers. In practice, this may mean that a
guest suddenly dies after a dataplane device failed to come up (e.g.,
when a file descriptor limit is hit for tne nth device).
Let's just try to unwind the setup instead and return.
Acked-by: Christian Borntraeger <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/block/dataplane/virtio-blk.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index 527a53c..94e1a29 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -232,8 +232,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
vq = virtio_get_queue(s->vdev, 0);
if (!vring_setup(&s->vring, s->vdev, 0)) {
- s->starting = false;
- return;
+ goto fail_vring;
}
/* Set up guest notifier (irq) */
@@ -241,7 +240,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
if (r != 0) {
fprintf(stderr, "virtio-blk failed to set guest notifier (%d), "
"ensure -enable-kvm is set\n", r);
- exit(1);
+ goto fail_guest_notifiers;
}
s->guest_notifier = virtio_queue_get_guest_notifier(vq);
@@ -249,7 +248,7 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
r = k->set_host_notifier(qbus->parent, 0, true);
if (r != 0) {
fprintf(stderr, "virtio-blk failed to set host notifier (%d)\n", r);
- exit(1);
+ goto fail_host_notifier;
}
s->host_notifier = *virtio_queue_get_host_notifier(vq);
@@ -269,6 +268,14 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s)
aio_context_acquire(s->ctx);
aio_set_event_notifier(s->ctx, &s->host_notifier, handle_notify);
aio_context_release(s->ctx);
+ return;
+
+ fail_host_notifier:
+ k->set_guest_notifiers(qbus->parent, 1, false);
+ fail_guest_notifiers:
+ vring_teardown(&s->vring, s->vdev, 0);
+ fail_vring:
+ s->starting = false;
}
/* Context: QEMU global mutex held */
--
1.9.3
- [Qemu-devel] [PULL 24/55] qtest/ide: Fix small memory leak, (continued)
- [Qemu-devel] [PULL 24/55] qtest/ide: Fix small memory leak, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 26/55] cmd646: synchronise DMA interrupt status with UDMA interrupt status, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 25/55] cmd646: add constants for CNTRL register access, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 28/55] cmd646: allow MRDMODE interrupt status bits clearing from PCI config space, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 31/55] channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK), Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 32/55] dataplane: print why starting failed, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 35/55] parallels: extend parallels format header with actual data values, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 27/55] cmd646: switch cmd646_update_irq() to accept PCIDevice instead of PCIIDEState, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 36/55] parallels: replace tabs with spaces in block/parallels.c, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 29/55] cmd646: synchronise UDMA interrupt status with DMA interrupt status, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 33/55] dataplane: fail notifier setting gracefully,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 37/55] parallels: split check for parallels format in parallels_open, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 34/55] dataplane: stop trying on notifier error, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 38/55] parallels: 2TB+ parallels images support, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 40/55] ide: Fix segfault when flushing a device that doesn't exist, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 39/55] qemu-options: add missing -drive discard option to cmdline help, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 30/55] qemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK), Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 41/55] libqtest: add QTEST_LOG for debugging qtest testcases, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 42/55] libqos: Correct mask to align size to PAGE_SIZE in malloc-pc, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 45/55] ide: only constrain read/write requests to drive size, not other types, Stefan Hajnoczi, 2014/08/15
- [Qemu-devel] [PULL 43/55] libqos: Change free function called in malloc, Stefan Hajnoczi, 2014/08/15