Skip to contentSkip to conversation

nbd: fix NBD over TLS

PATCH In review Paolo Bonzini 2 participants 2 messages Jun 15, 2017 – Jun 27, 2017 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nbd: fix NBD over TLS

When attaching the NBD QIOChannel to an AioContext, the TLS channel should be used, not the underlying socket channel. This is because, trivially, the TLS channel will be the one that we read/write to and thus the one that will get the qio_channel_yield() call.

Fixes ff82911cd3f69f028f2537825c9720ff78bc3f19
Cc Daniel P. Berrange <[email protected]>
---
 block/nbd-client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/nbd-client.c +2 -2
index 1e2952fdae..56eb0e2e16 100644
@@ -352,14 +352,14 @@ int nbd_client_co_pdiscard(BlockDriverState *bs, int64_t offset, int count)
 void nbd_client_detach_aio_context(BlockDriverState *bs)
 {
     NBDClientSession *client = nbd_get_client_session(bs);
-    qio_channel_detach_aio_context(QIO_CHANNEL(client->sioc));
+    qio_channel_detach_aio_context(QIO_CHANNEL(client->ioc));
 }
 
 void nbd_client_attach_aio_context(BlockDriverState *bs,
                                    AioContext *new_context)
 {
     NBDClientSession *client = nbd_get_client_session(bs);
-    qio_channel_attach_aio_context(QIO_CHANNEL(client->sioc), new_context);
+    qio_channel_attach_aio_context(QIO_CHANNEL(client->ioc), new_context);
     aio_co_schedule(new_context, client->read_reply_co);
 }
 
Signature · 1 line
2.13.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Paolo Bonzini

When attaching the NBD QIOChannel to an AioContext, the TLS channel should be used, not the underlying socket channel. This is because, trivially, the TLS channel will be the one that we read/write to and thus the one that will get the qio_channel_yield() call.

Quoted 7 lines
Fixes ff82911cd3f69f028f2537825c9720ff78bc3f19
Cc Daniel P. Berrange <[email protected]>
---
 block/nbd-client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org