[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 33/33] block/nbd: drop connection_co
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [PATCH v3 33/33] block/nbd: drop connection_co |
Date: |
Fri, 16 Apr 2021 11:14:32 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 |
16.04.2021 11:09, 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.
Let's finally drop this always running coroutine and go another way:
1. reconnect_attempt() goes to nbd_co_send_request and called under
send_mutex
2. We do receive headers in request coroutine. But we also should
dispatch replies for another pending requests. So,
nbd_connection_entry() is turned into nbd_receive_replies(), which
does reply dispatching until it receive another request headers, and
returns when it receive the requested header.
3. All old staff around drained sections and context switch is dropped.
Signed-off-by: Vladimir Sementsov-Ogievskiy<vsementsov@virtuozzo.com>
Please consider this last patch as RFC for now:
1. It is complicated, and doesn't have good documentation. Please look through
and ask everything that is not obvious, I'll explain. Don't waste your time
trying to understand what is not clean.
2. I also failed to image, how to split the patch into smaller simple patches..
Ideas are welcome.
3. It actually reverts what was done in
commit 8c517de24a8a1dcbeb54e7e12b5b0fda42a90ace
Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Date: Thu Sep 3 22:02:58 2020 +0300
block/nbd: fix drain dead-lock because of nbd reconnect-delay
and I didn't check yet, does this dead-lock still here or not. Even if it still
here I believe that nbd driver is a wrong place to workaround this bug, but I
should check it first at least.
--
Best regards,
Vladimir
- [PATCH v3 28/33] nbd/client-connection: do qio_channel_set_delay(false), (continued)
- [PATCH v3 28/33] nbd/client-connection: do qio_channel_set_delay(false), Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 25/33] nbd/client-connection: return only one io channel, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 22/33] block/nbd: pass monitor directly to connection thread, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 20/33] block/nbd: use negotiation of NBDClientConnection, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 29/33] nbd/client-connection: add option for non-blocking connection attempt, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 19/33] block/nbd: split nbd_handle_updated_info out of nbd_client_handshake(), Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 26/33] block-coroutine-wrapper: allow non bdrv_ prefix, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 30/33] block/nbd: reuse nbd_co_do_establish_connection() in nbd_open(), Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 31/33] block/nbd: add nbd_clinent_connected() helper, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 33/33] block/nbd: drop connection_co, Vladimir Sementsov-Ogievskiy, 2021/04/16
- Re: [PATCH v3 33/33] block/nbd: drop connection_co,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v3 21/33] qemu-socket: pass monitor link to socket_get_fd directly, Vladimir Sementsov-Ogievskiy, 2021/04/16
- [PATCH v3 32/33] block/nbd: safer transition to receiving request, Vladimir Sementsov-Ogievskiy, 2021/04/16