diff options
-rw-r--r-- | nbd/server.c | 8 | ||||
-rw-r--r-- | qemu-nbd.c | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/nbd/server.c b/nbd/server.c index ee59e5d234..49b55f6ede 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1358,16 +1358,14 @@ static coroutine_fn void nbd_co_client_start(void *opaque) if (exp) { nbd_export_get(exp); + QTAILQ_INSERT_TAIL(&exp->clients, client, next); } + qemu_co_mutex_init(&client->send_lock); + if (nbd_negotiate(data)) { client_close(client); goto out; } - qemu_co_mutex_init(&client->send_lock); - - if (exp) { - QTAILQ_INSERT_TAIL(&exp->clients, client, next); - } nbd_client_receive_next_request(client); diff --git a/qemu-nbd.c b/qemu-nbd.c index f60842fd86..651f85ecc1 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -325,7 +325,7 @@ out: static int nbd_can_accept(void) { - return nb_fds < shared; + return state == RUNNING && nb_fds < shared; } static void nbd_export_closed(NBDExport *exp) |