aboutsummaryrefslogtreecommitdiff
path: root/block/nbd.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-06-10 13:07:56 +0300
committerEric Blake <eblake@redhat.com>2021-06-18 12:20:53 -0500
commit43cb34dede464c2e9a51ea33bc246b40db5d68d4 (patch)
treeb7615e2527419f62b44a5b705644143a01def90a /block/nbd.c
parent95a078ea3e4863c0d516cf19ebcb5130bc760f49 (diff)
downloadqemu-43cb34dede464c2e9a51ea33bc246b40db5d68d4.zip
qemu-43cb34dede464c2e9a51ea33bc246b40db5d68d4.tar.gz
qemu-43cb34dede464c2e9a51ea33bc246b40db5d68d4.tar.bz2
nbd/client-connection: return only one io channel
block/nbd doesn't need underlying sioc channel anymore. So, we can update nbd/client-connection interface to return only one top-most io channel, which is more straight forward. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210610100802.5888-27-vsementsov@virtuozzo.com> [eblake: squash in Vladimir's fixes for uninit usage caught by clang] Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'block/nbd.c')
-rw-r--r--block/nbd.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 9f193d1..411435c 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -360,7 +360,6 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
{
int ret;
AioContext *aio_context = bdrv_get_aio_context(s->bs);
- QIOChannelSocket *sioc;
if (!nbd_client_connecting(s)) {
return;
@@ -399,20 +398,12 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
s->ioc = NULL;
}
- sioc = nbd_co_establish_connection(s->conn, &s->info, &s->ioc, NULL);
- if (!sioc) {
+ s->ioc = nbd_co_establish_connection(s->conn, &s->info, NULL);
+ if (!s->ioc) {
ret = -ECONNREFUSED;
goto out;
}
- if (s->ioc) {
- /* sioc is referenced by s->ioc */
- object_unref(OBJECT(sioc));
- } else {
- s->ioc = QIO_CHANNEL(sioc);
- }
- sioc = NULL;
-
qio_channel_set_blocking(QIO_CHANNEL(s->ioc), false, NULL);
qio_channel_attach_aio_context(QIO_CHANNEL(s->ioc), aio_context);