|
Pablo Greco |
e6a3ae |
From a09766bbc8a4208fc0f62904cebec4022beba6b0 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:56 +0000
|
|
Pablo Greco |
e6a3ae |
Subject: [PATCH 4/8] curl: Check completion in curl_multi_do()
|
|
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-4-mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Patchwork-id: 92516
|
|
Pablo Greco |
e6a3ae |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 3/7] curl: Check completion in curl_multi_do()
|
|
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 |
While it is more likely that transfers complete after some file
|
|
Pablo Greco |
e6a3ae |
descriptor has data ready to read, we probably should not rely on it.
|
|
Pablo Greco |
e6a3ae |
Better be safe than sorry and call curl_multi_check_completion() in
|
|
Pablo Greco |
e6a3ae |
curl_multi_do(), too, just like it is done in curl_multi_read().
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
With this change, curl_multi_do() and curl_multi_read() are actually the
|
|
Pablo Greco |
e6a3ae |
same, so drop curl_multi_read() and use curl_multi_do() as the sole FD
|
|
Pablo Greco |
e6a3ae |
handler.
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
Pablo Greco |
e6a3ae |
Message-id: 20190910124136.10565-4-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 948403bcb1c7e71dcbe8ab8479cf3934a0efcbb5)
|
|
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 | 14 ++------------
|
|
Pablo Greco |
e6a3ae |
1 file changed, 2 insertions(+), 12 deletions(-)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
diff --git a/block/curl.c b/block/curl.c
|
|
Pablo Greco |
e6a3ae |
index b3fe09f..8f31594 100644
|
|
Pablo Greco |
e6a3ae |
--- a/block/curl.c
|
|
Pablo Greco |
e6a3ae |
+++ b/block/curl.c
|
|
Pablo Greco |
e6a3ae |
@@ -148,7 +148,6 @@ typedef struct BDRVCURLState {
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
static void curl_clean_state(CURLState *s);
|
|
Pablo Greco |
e6a3ae |
static void curl_multi_do(void *arg);
|
|
Pablo Greco |
e6a3ae |
-static void curl_multi_read(void *arg);
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
#ifdef NEED_CURL_TIMER_CALLBACK
|
|
Pablo Greco |
e6a3ae |
/* Called from curl_multi_do_locked, with s->mutex held. */
|
|
Pablo Greco |
e6a3ae |
@@ -195,7 +194,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
|
Pablo Greco |
e6a3ae |
switch (action) {
|
|
Pablo Greco |
e6a3ae |
case CURL_POLL_IN:
|
|
Pablo Greco |
e6a3ae |
aio_set_fd_handler(s->aio_context, fd, false,
|
|
Pablo Greco |
e6a3ae |
- curl_multi_read, NULL, NULL, state);
|
|
Pablo Greco |
e6a3ae |
+ curl_multi_do, NULL, NULL, state);
|
|
Pablo Greco |
e6a3ae |
break;
|
|
Pablo Greco |
e6a3ae |
case CURL_POLL_OUT:
|
|
Pablo Greco |
e6a3ae |
aio_set_fd_handler(s->aio_context, fd, false,
|
|
Pablo Greco |
e6a3ae |
@@ -203,7 +202,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
|
Pablo Greco |
e6a3ae |
break;
|
|
Pablo Greco |
e6a3ae |
case CURL_POLL_INOUT:
|
|
Pablo Greco |
e6a3ae |
aio_set_fd_handler(s->aio_context, fd, false,
|
|
Pablo Greco |
e6a3ae |
- curl_multi_read, curl_multi_do, NULL, state);
|
|
Pablo Greco |
e6a3ae |
+ curl_multi_do, curl_multi_do, NULL, state);
|
|
Pablo Greco |
e6a3ae |
break;
|
|
Pablo Greco |
e6a3ae |
case CURL_POLL_REMOVE:
|
|
Pablo Greco |
e6a3ae |
aio_set_fd_handler(s->aio_context, fd, false,
|
|
Pablo Greco |
e6a3ae |
@@ -427,15 +426,6 @@ static void curl_multi_do(void *arg)
|
|
Pablo Greco |
e6a3ae |
|
|
Pablo Greco |
e6a3ae |
qemu_mutex_lock(&s->s->mutex);
|
|
Pablo Greco |
e6a3ae |
curl_multi_do_locked(s);
|
|
Pablo Greco |
e6a3ae |
- qemu_mutex_unlock(&s->s->mutex);
|
|
Pablo Greco |
e6a3ae |
-}
|
|
Pablo Greco |
e6a3ae |
-
|
|
Pablo Greco |
e6a3ae |
-static void curl_multi_read(void *arg)
|
|
Pablo Greco |
e6a3ae |
-{
|
|
Pablo Greco |
e6a3ae |
- CURLState *s = (CURLState *)arg;
|
|
Pablo Greco |
e6a3ae |
-
|
|
Pablo Greco |
e6a3ae |
- qemu_mutex_lock(&s->s->mutex);
|
|
Pablo Greco |
e6a3ae |
- curl_multi_do_locked(s);
|
|
Pablo Greco |
e6a3ae |
curl_multi_check_completion(s->s);
|
|
Pablo Greco |
e6a3ae |
qemu_mutex_unlock(&s->s->mutex);
|
|
Pablo Greco |
e6a3ae |
}
|
|
Pablo Greco |
e6a3ae |
--
|
|
Pablo Greco |
e6a3ae |
1.8.3.1
|
|
Pablo Greco |
e6a3ae |
|