|
Pablo Greco |
e6a3ae |
From 70c7a568e3c1384704228622990d6aaa2350e44e Mon Sep 17 00:00:00 2001
|
|
Pablo Greco |
e6a3ae |
From: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Date: Tue, 19 Nov 2019 15:29:58 +0000
|
|
Pablo Greco |
e6a3ae |
Subject: [PATCH 6/8] curl: Report only ready sockets
|
|
Pablo Greco |
e6a3ae |
MIME-Version: 1.0
|
|
Pablo Greco |
e6a3ae |
Content-Type: text/plain; charset=UTF-8
|
|
Pablo Greco |
e6a3ae |
Content-Transfer-Encoding: 8bit
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: <20191119153000.101646-6-mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Patchwork-id: 92519
|
|
Pablo Greco |
e6a3ae |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 5/7] curl: Report only ready sockets
|
|
Pablo Greco |
e6a3ae |
Bugzilla: 1744602
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
Pablo Greco |
e6a3ae |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Instead of reporting all sockets to cURL, only report the one that has
|
|
Pablo Greco |
e6a3ae |
caused curl_multi_do_locked() to be called. This lets us get rid of the
|
|
Pablo Greco |
e6a3ae |
QLIST_FOREACH_SAFE() list, which was actually wrong: SAFE foreaches are
|
|
Pablo Greco |
e6a3ae |
only safe when the current element is removed in each iteration. If it
|
|
Pablo Greco |
e6a3ae |
possible for the list to be concurrently modified, we cannot guarantee
|
|
Pablo Greco |
e6a3ae |
that only the current element will be removed. Therefore, we must not
|
|
Pablo Greco |
e6a3ae |
use QLIST_FOREACH_SAFE() here.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Fixes: ff5ca1664af85b24a4180d595ea6873fd3deac57
|
|
Pablo Greco |
e6a3ae |
Cc: qemu-stable@nongnu.org
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: 20190910124136.10565-6-mreitz@redhat.com
|
|
Pablo Greco |
e6a3ae |
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
(cherry picked from commit 9abaf9fc474c3dd53e8e119326abc774c977c331)
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
Pablo Greco |
e6a3ae |
---
|
|
Pablo Greco |
e6a3ae |
block/curl.c | 17 ++++++-----------
|
|
Pablo Greco |
e6a3ae |
1 file changed, 6 insertions(+), 11 deletions(-)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
diff --git a/block/curl.c b/block/curl.c
|
|
Pablo Greco |
e6a3ae |
index de00ec8..f776615 100644
|
|
Pablo Greco |
e6a3ae |
--- a/block/curl.c
|
|
Pablo Greco |
e6a3ae |
+++ b/block/curl.c
|
|
Pablo Greco |
e6a3ae |
@@ -401,24 +401,19 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
/* Called with s->mutex held. */
|
|
Pablo Greco |
e6a3ae |
-static void curl_multi_do_locked(CURLSocket *ready_socket)
|
|
Pablo Greco |
e6a3ae |
+static void curl_multi_do_locked(CURLSocket *socket)
|
|
Pablo Greco |
e6a3ae |
{
|
|
Pablo Greco |
e6a3ae |
- CURLSocket *socket, *next_socket;
|
|
Pablo Greco |
e6a3ae |
- CURLState *s = ready_socket->state;
|
|
Pablo Greco |
e6a3ae |
+ BDRVCURLState *s = socket->state->s;
|
|
Pablo Greco |
e6a3ae |
int running;
|
|
Pablo Greco |
e6a3ae |
int r;
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
- if (!s->s->multi) {
|
|
Pablo Greco |
e6a3ae |
+ if (!s->multi) {
|
|
Pablo Greco |
e6a3ae |
return;
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
- /* Need to use _SAFE because curl_multi_socket_action() may trigger
|
|
Pablo Greco |
e6a3ae |
- * curl_sock_cb() which might modify this list */
|
|
Pablo Greco |
e6a3ae |
- QLIST_FOREACH_SAFE(socket, &s->sockets, next, next_socket) {
|
|
Pablo Greco |
e6a3ae |
- do {
|
|
Pablo Greco |
e6a3ae |
- r = curl_multi_socket_action(s->s->multi, socket->fd, 0, &running);
|
|
Pablo Greco |
e6a3ae |
- } while (r == CURLM_CALL_MULTI_PERFORM);
|
|
Pablo Greco |
e6a3ae |
- }
|
|
Pablo Greco |
e6a3ae |
+ do {
|
|
Pablo Greco |
e6a3ae |
+ r = curl_multi_socket_action(s->multi, socket->fd, 0, &running);
|
|
Pablo Greco |
e6a3ae |
+ } while (r == CURLM_CALL_MULTI_PERFORM);
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
static void curl_multi_do(void *arg)
|
|
Pablo Greco |
e6a3ae |
--
|
|
Pablo Greco |
e6a3ae |
1.8.3.1
|
|
Pablo Greco |
e6a3ae |
|