]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
block/nbd: call socket_address_parse_named_fd() in advance
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Thu, 10 Jun 2021 10:07:36 +0000 (13:07 +0300)
committerEric Blake <eblake@redhat.com>
Fri, 18 Jun 2021 15:59:53 +0000 (10:59 -0500)
Detecting monitor by current coroutine works bad when we are not in
coroutine context. And that's exactly so in nbd reconnect code, where
qio_channel_socket_connect_sync() is called from thread.

Monitor is needed only to parse named file descriptor. So, let's just
parse it during nbd_open(), so that all further users of s->saddr don't
need to access monitor.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210610100802.5888-7-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
block/nbd.c

index f3a036354dc79c255281704710bfb91d1ee58161..1c99654ef7e542e361c6db30949299f06d5185c5 100644 (file)
@@ -2140,6 +2140,12 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
         goto done;
     }
 
+    if (socket_address_parse_named_fd(saddr, errp) < 0) {
+        qapi_free_SocketAddress(saddr);
+        saddr = NULL;
+        goto done;
+    }
+
 done:
     qobject_unref(addr);
     visit_free(iv);