|
|
9ae3a8 |
From 92a8426bb06ecb65af6fc6953e11870872bf52d1 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Richard Jones <rjones@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 11 Jun 2015 11:40:17 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 17/30] curl: Ensure all informationals are checked for
|
|
|
9ae3a8 |
completion
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Message-id: <1434022828-13037-11-git-send-email-rjones@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 65845
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.2 qemu-kvm v3 PATCH 10/21] curl: Ensure all informationals are checked for completion
|
|
|
9ae3a8 |
Bugzilla: 1226684
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Matthew Booth <mbooth@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
According to the documentation, the correct way to ensure all
|
|
|
9ae3a8 |
informationals have been returned by curl_multi_info_read is to loop
|
|
|
9ae3a8 |
until it returns NULL.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Matthew Booth <mbooth@redhat.com>
|
|
|
9ae3a8 |
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Upstream-status: 1f2cead324436da25c3607f4b957f0198a01fc01
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/curl.c | 53 +++++++++++++++++++++++------------------------------
|
|
|
9ae3a8 |
1 file changed, 23 insertions(+), 30 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/curl.c b/block/curl.c
|
|
|
9ae3a8 |
index b19e632..41cf015 100644
|
|
|
9ae3a8 |
--- a/block/curl.c
|
|
|
9ae3a8 |
+++ b/block/curl.c
|
|
|
9ae3a8 |
@@ -248,46 +248,39 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* Try to find done transfers, so we can free the easy
|
|
|
9ae3a8 |
* handle again. */
|
|
|
9ae3a8 |
- do {
|
|
|
9ae3a8 |
+ for (;;) {
|
|
|
9ae3a8 |
CURLMsg *msg;
|
|
|
9ae3a8 |
msg = curl_multi_info_read(s->multi, &msgs_in_queue);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ /* Quit when there are no more completions */
|
|
|
9ae3a8 |
if (!msg)
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
- if (msg->msg == CURLMSG_NONE)
|
|
|
9ae3a8 |
- break;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- switch (msg->msg) {
|
|
|
9ae3a8 |
- case CURLMSG_DONE:
|
|
|
9ae3a8 |
- {
|
|
|
9ae3a8 |
- CURLState *state = NULL;
|
|
|
9ae3a8 |
- curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE,
|
|
|
9ae3a8 |
- (char **)&state);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- /* ACBs for successful messages get completed in curl_read_cb */
|
|
|
9ae3a8 |
- if (msg->data.result != CURLE_OK) {
|
|
|
9ae3a8 |
- int i;
|
|
|
9ae3a8 |
- for (i = 0; i < CURL_NUM_ACB; i++) {
|
|
|
9ae3a8 |
- CURLAIOCB *acb = state->acb[i];
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- if (acb == NULL) {
|
|
|
9ae3a8 |
- continue;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- acb->common.cb(acb->common.opaque, -EIO);
|
|
|
9ae3a8 |
- qemu_aio_release(acb);
|
|
|
9ae3a8 |
- state->acb[i] = NULL;
|
|
|
9ae3a8 |
+ if (msg->msg == CURLMSG_DONE) {
|
|
|
9ae3a8 |
+ CURLState *state = NULL;
|
|
|
9ae3a8 |
+ curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE,
|
|
|
9ae3a8 |
+ (char **)&state);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /* ACBs for successful messages get completed in curl_read_cb */
|
|
|
9ae3a8 |
+ if (msg->data.result != CURLE_OK) {
|
|
|
9ae3a8 |
+ int i;
|
|
|
9ae3a8 |
+ for (i = 0; i < CURL_NUM_ACB; i++) {
|
|
|
9ae3a8 |
+ CURLAIOCB *acb = state->acb[i];
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (acb == NULL) {
|
|
|
9ae3a8 |
+ continue;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- curl_clean_state(state);
|
|
|
9ae3a8 |
- break;
|
|
|
9ae3a8 |
+ acb->common.cb(acb->common.opaque, -EIO);
|
|
|
9ae3a8 |
+ qemu_aio_release(acb);
|
|
|
9ae3a8 |
+ state->acb[i] = NULL;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- default:
|
|
|
9ae3a8 |
- msgs_in_queue = 0;
|
|
|
9ae3a8 |
- break;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ curl_clean_state(state);
|
|
|
9ae3a8 |
+ break;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- } while(msgs_in_queue);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void curl_multi_do(void *arg)
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|