qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 4/5] block/nbd: drop connection_co


From: Vladimir Sementsov-Ogievskiy
Subject: Re: [PATCH v5 4/5] block/nbd: drop connection_co
Date: Wed, 14 Jul 2021 20:07:38 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

[add Roman}

14.07.2021 19:59, Vladimir Sementsov-Ogievskiy wrote:
OK, that's a big rewrite of the logic.

Pre-patch we have an always running coroutine - connection_co. It does
reply receiving and reconnecting. And it leads to a lot of difficult
and unobvious code around drained sections and context switch. We also
abuse bs->in_flight counter which is increased for connection_co and
temporary decreased in points where we want to allow drained section to
begin. One of these place is in another file: in nbd_read_eof() in
nbd/client.c.

We also cancel reconnect and requests waiting for reconnect on drained
begin which is not correct.

And this patch fixes that.


Let's finally drop this always running coroutine and go another way:

Hmm here is missed something like:

  go another way: do both reconnect and receiving in request coroutines.
  The detailed list of changes below (in the sequence of diff hunks).


1. receiving coroutines are woken directly from nbd_channel_error, when
    we change s->state

2. nbd_co_establish_connection_cancel(): we don't have drain_begin now,
    and in nbd_teardown_connection() all requests should already be
    finished (and reconnect is done from request). So
    nbd_co_establish_connection_cancel() is called from
    nbd_cancel_in_flight() (to cancel the request that is doing


--
Best regards,
Vladimir



reply via email to

[Prev in Thread] Current Thread [Next in Thread]