summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau2016-06-06 18:45:03 +0200
committerMichael S. Tsirkin2016-06-17 02:28:02 +0200
commit0d572afd5266d1d67d132d06ea45d7246bcd6105 (patch)
treeaa746f7d66f74dcfd394c8fb7fec950efa488a5f
parentqemu-char: add qemu_chr_disconnect to close a fd accepted by listen fd (diff)
downloadqemu-0d572afd5266d1d67d132d06ea45d7246bcd6105.tar.gz
qemu-0d572afd5266d1d67d132d06ea45d7246bcd6105.tar.xz
qemu-0d572afd5266d1d67d132d06ea45d7246bcd6105.zip
vhost-user: disconnect on start failure
If the backend failed to start (for example feature negociation failed), do not exit, but disconnect the char device instead. Slightly more robust for reconnect case. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: Victor Kaplansky <victork@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--net/vhost-user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/vhost-user.c b/net/vhost-user.c
index 4a7fd5fbd5..41ddb4b9ca 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -202,7 +202,8 @@ static void net_vhost_user_event(void *opaque, int event)
s->watch = qemu_chr_fe_add_watch(s->chr, G_IO_HUP,
net_vhost_user_watch, s);
if (vhost_user_start(queues, ncs) < 0) {
- exit(1);
+ qemu_chr_disconnect(s->chr);
+ return;
}
qmp_set_link(name, true, &err);
break;