aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/nbd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 3558c17..ee9ab75 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -291,8 +291,22 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
goto out;
}
+ bdrv_dec_in_flight(s->bs);
+
ret = nbd_client_handshake(s->bs, sioc, &local_err);
+ if (s->drained) {
+ s->wait_drained_end = true;
+ while (s->drained) {
+ /*
+ * We may be entered once from nbd_client_attach_aio_context_bh
+ * and then from nbd_client_co_drain_end. So here is a loop.
+ */
+ qemu_coroutine_yield();
+ }
+ }
+ bdrv_inc_in_flight(s->bs);
+
out:
s->connect_status = ret;
error_free(s->connect_err);