]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0007-block-nbd-Delete-reconnect-delay-timer-when-done.patch
update submodule and patches to 6.2.0
[pve-qemu.git] / debian / patches / extra / 0007-block-nbd-Delete-reconnect-delay-timer-when-done.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Hanna Reitz <hreitz@redhat.com>
3 Date: Wed, 9 Feb 2022 15:02:52 +0100
4 Subject: [PATCH] block/nbd: Delete reconnect delay timer when done
5
6 We start the reconnect delay timer to cancel the reconnection attempt
7 after a while. Once nbd_co_do_establish_connection() has returned, this
8 attempt is over, and we no longer need the timer.
9
10 Delete it before returning from nbd_reconnect_attempt(), so that it does
11 not persist beyond the I/O request that was paused for reconnecting; we
12 do not want it to fire in a drained section, because all sort of things
13 can happen in such a section (e.g. the AioContext might be changed, and
14 we do not want the timer to fire in the wrong context; or the BDS might
15 even be deleted, and so the timer CB would access already-freed data).
16
17 Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
18 Signed-off-by: Hanna Reitz <hreitz@redhat.com>
19 ---
20 block/nbd.c | 7 +++++++
21 1 file changed, 7 insertions(+)
22
23 diff --git a/block/nbd.c b/block/nbd.c
24 index 5ef462db1b..b8e5a9b4cc 100644
25 --- a/block/nbd.c
26 +++ b/block/nbd.c
27 @@ -353,6 +353,13 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
28 }
29
30 nbd_co_do_establish_connection(s->bs, NULL);
31 +
32 + /*
33 + * The reconnect attempt is done (maybe successfully, maybe not), so
34 + * we no longer need this timer. Delete it so it will not outlive
35 + * this I/O request (so draining removes all timers).
36 + */
37 + reconnect_delay_timer_del(s);
38 }
39
40 static coroutine_fn int nbd_receive_replies(BDRVNBDState *s, uint64_t handle)