|
|
495e37 |
From eeb4683ad8c40a03a4e91463ec1d1b651974b744 Mon Sep 17 00:00:00 2001
|
|
|
495e37 |
From: Hanna Reitz <hreitz@redhat.com>
|
|
|
495e37 |
Date: Fri, 4 Feb 2022 12:10:06 +0100
|
|
|
495e37 |
Subject: [PATCH 3/8] block/nbd: Delete reconnect delay timer when done
|
|
|
495e37 |
|
|
|
495e37 |
RH-Author: Hanna Reitz <hreitz@redhat.com>
|
|
|
495e37 |
RH-MergeRequest: 74: block/nbd: Handle AioContext changes
|
|
|
495e37 |
RH-Commit: [1/6] 34f92910b6ffd256d781109a2b39737fc6ab449c (hreitz/qemu-kvm-c-9-s)
|
|
|
495e37 |
RH-Bugzilla: 2033626
|
|
|
495e37 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
495e37 |
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
495e37 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
495e37 |
|
|
|
495e37 |
We start the reconnect delay timer to cancel the reconnection attempt
|
|
|
495e37 |
after a while. Once nbd_co_do_establish_connection() has returned, this
|
|
|
495e37 |
attempt is over, and we no longer need the timer.
|
|
|
495e37 |
|
|
|
495e37 |
Delete it before returning from nbd_reconnect_attempt(), so that it does
|
|
|
495e37 |
not persist beyond the I/O request that was paused for reconnecting; we
|
|
|
495e37 |
do not want it to fire in a drained section, because all sort of things
|
|
|
495e37 |
can happen in such a section (e.g. the AioContext might be changed, and
|
|
|
495e37 |
we do not want the timer to fire in the wrong context; or the BDS might
|
|
|
495e37 |
even be deleted, and so the timer CB would access already-freed data).
|
|
|
495e37 |
|
|
|
495e37 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
495e37 |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
495e37 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
495e37 |
(cherry picked from commit 3ce1fc16bad9c3f8b7b10b451a224d6d76e5c551)
|
|
|
495e37 |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
495e37 |
---
|
|
|
495e37 |
block/nbd.c | 7 +++++++
|
|
|
495e37 |
1 file changed, 7 insertions(+)
|
|
|
495e37 |
|
|
|
495e37 |
diff --git a/block/nbd.c b/block/nbd.c
|
|
|
495e37 |
index 5ef462db1b..b8e5a9b4cc 100644
|
|
|
495e37 |
--- a/block/nbd.c
|
|
|
495e37 |
+++ b/block/nbd.c
|
|
|
495e37 |
@@ -353,6 +353,13 @@ static coroutine_fn void nbd_reconnect_attempt(BDRVNBDState *s)
|
|
|
495e37 |
}
|
|
|
495e37 |
|
|
|
495e37 |
nbd_co_do_establish_connection(s->bs, NULL);
|
|
|
495e37 |
+
|
|
|
495e37 |
+ /*
|
|
|
495e37 |
+ * The reconnect attempt is done (maybe successfully, maybe not), so
|
|
|
495e37 |
+ * we no longer need this timer. Delete it so it will not outlive
|
|
|
495e37 |
+ * this I/O request (so draining removes all timers).
|
|
|
495e37 |
+ */
|
|
|
495e37 |
+ reconnect_delay_timer_del(s);
|
|
|
495e37 |
}
|
|
|
495e37 |
|
|
|
495e37 |
static coroutine_fn int nbd_receive_replies(BDRVNBDState *s, uint64_t handle)
|
|
|
495e37 |
--
|
|
|
495e37 |
2.27.0
|
|
|
495e37 |
|