| Message ID | CAJ+F1CKiJVdO5v99L2YHd9mJ3khfE4gXEQxi1y8EUjQeEBsu=w@mail.gmail.com |
|---|---|
| State | New |
| Headers | show |
Il 30/11/2013 16:49, Marc-André Lureau ha scritto: > So you suggest this block/unblock: (I haven't reviewed all callers of > unix_connect_opts(), I am not sure that's what you meant) Other option > would be to move the nonblock to unix_socket_outgoing. > > diff --git a/block/nbd-client.c b/block/nbd-client.c > index 1abfc6a..693110d 100644 > --- a/block/nbd-client.c > +++ b/block/nbd-client.c > @@ -348,6 +348,7 @@ int nbd_client_session_init(NbdClientSession *client, > int ret; > > /* NBD handshake */ > + qemu_set_block(sock); > ret = nbd_receive_negotiate(sock, client->export_name, > &client->nbdflags, &client->size, > &client->blocksize); Also qemu_set_nonblock(sock); here, and remove it from nbd_receive_negotiate. I checked again and you need not touch unix_connect_opts, nor nbd_client_thread. Paolo
----- Original Message ----- > Il 30/11/2013 16:49, Marc-André Lureau ha scritto: > > So you suggest this block/unblock: (I haven't reviewed all callers of > > unix_connect_opts(), I am not sure that's what you meant) Other option > > would be to move the nonblock to unix_socket_outgoing. > > > > diff --git a/block/nbd-client.c b/block/nbd-client.c > > index 1abfc6a..693110d 100644 > > --- a/block/nbd-client.c > > +++ b/block/nbd-client.c > > @@ -348,6 +348,7 @@ int nbd_client_session_init(NbdClientSession *client, > > int ret; > > > > /* NBD handshake */ > > + qemu_set_block(sock); > > ret = nbd_receive_negotiate(sock, client->export_name, > > &client->nbdflags, &client->size, > > &client->blocksize); > > Also > > qemu_set_nonblock(sock); > > here, It's already a few lines below. > and remove it from nbd_receive_negotiate. > I checked again and you need not touch unix_connect_opts, nor > nbd_client_thread. Ok, I'll remove those.
diff --git a/block/nbd-client.c b/block/nbd-client.c index 1abfc6a..693110d 100644 --- a/block/nbd-client.c +++ b/block/nbd-client.c @@ -348,6 +348,7 @@ int nbd_client_session_init(NbdClientSession *client, int ret; /* NBD handshake */ + qemu_set_block(sock); ret = nbd_receive_negotiate(sock, client->export_name, &client->nbdflags, &client->size, &client->blocksize); diff --git a/qemu-nbd.c b/qemu-nbd.c index c26c98e..008fbf0 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -224,6 +224,7 @@ static void *nbd_client_thread(void *arg) goto out; } + qemu_set_block(sock); ret = nbd_receive_negotiate(sock, NULL, &nbdflags, &size, &blocksize); if (ret < 0) { diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 6b97dc1..81f2660 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -747,6 +747,8 @@ int unix_connect_opts(QemuOpts *opts, Error **errp, } } while (rc == -EINTR); + qemu_set_nonblock(sock); + if (connect_state != NULL && QEMU_SOCKET_RC_INPROGRESS(rc)) { connect_state->fd = sock; qemu_set_fd_handler2(sock, NULL, NULL, wait_for_connect,