vhost-user: disconnect on start failure
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 6 Jun 2016 16:45:03 +0000 (18:45 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 17 Jun 2016 00:28:02 +0000 (03:28 +0300)
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>
net/vhost-user.c

index 4a7fd5fbd5e1c750b2a7258d53125b8cefaae1b6..41ddb4b9ca8a887b8960128c4d27eb4dad099b72 100644 (file)
@@ -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;