Skip to content

Commit

Permalink
block/nbd: call socket_address_parse_named_fd() in advance
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vladimir Sementsov-Ogievskiy authored and ebblake committed Jun 15, 2021
1 parent c8332c3 commit 5be11cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions block/nbd.c
Expand Up @@ -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);
Expand Down

0 comments on commit 5be11cd

Please sign in to comment.