block/nbd: nbd_co_reconnect_loop(): don't sleep if drained
commit12c75e20a269ac917f4a76936d7142264e522233
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Mon, 27 Jul 2020 18:47:50 +0000 (27 21:47 +0300)
committerEric Blake <eblake@redhat.com>
Tue, 28 Jul 2020 14:54:43 +0000 (28 09:54 -0500)
tree3517fc68a10c75bb527a2e9295cef764c00f5fce
parentfbeb3e63b34a1af4a968031de1c82e5edf20bf6c
block/nbd: nbd_co_reconnect_loop(): don't sleep if drained

We try to go to wakeable sleep, so that, if drain begins it will break
the sleep. But what if nbd_client_co_drain_begin() already called and
s->drained is already true? We'll go to sleep, and drain will have to
wait for the whole timeout. Let's improve it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200727184751.15704-5-vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
block/nbd.c