From: "Richard W.M. Jones" <rjones@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: agraf@suse.de, jcody@redhat.com,
Markus Armbruster <armbru@redhat.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] block/curl: Don't lose original error when a connection fails.
Date: Wed, 8 Jul 2015 13:27:26 +0100 [thread overview]
Message-ID: <20150708122726.GX29283@redhat.com> (raw)
In-Reply-To: <20150708120130.GI4117@noname.redhat.com>
On Wed, Jul 08, 2015 at 02:01:30PM +0200, Kevin Wolf wrote:
> The guest can't cause it, but once the connection is down, I expect
> every request to fail. You don't have to have a malicious guest for
> filling up the log file, it just needs to be careless enough to continue
> trying new requests instead of offlining the device.
How about something along these lines?
[I'm not clear if atomic is necessary here, nor if there is already
some mechanism for suppressing log messages - a cursory grep of the
qemu source didn't find anything.]
diff --git a/block/curl.c b/block/curl.c
index 2fd7c06..33c14d8 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -299,11 +299,20 @@ static void curl_multi_check_completion(BDRVCURLState *s)
/* ACBs for successful messages get completed in curl_read_cb */
if (msg->data.result != CURLE_OK) {
int i;
+ static int errcount = 100;
+ int current_errcount;
/* Don't lose the original error message from curl, since
* it contains extra data.
*/
- error_report("curl: %s", state->errmsg);
+ current_errcount = atomic_fetch_add(&errcount, 0);
+ if (current_errcount > 0) {
+ error_report("curl: %s", state->errmsg);
+ if (current_errcount == 1) {
+ error_report("curl: further errors suppressed");
+ }
+ atomic_dec(&errcount);
+ }
for (i = 0; i < CURL_NUM_ACB; i++) {
CURLAIOCB *acb = state->acb[i];
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
prev parent reply other threads:[~2015-07-08 12:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 11:48 [Qemu-devel] [PATCH v2] block/curl: Don't lose original error when a connection Richard W.M. Jones
2015-06-30 11:48 ` [Qemu-devel] [PATCH v2] block/curl: Don't lose original error when a connection fails Richard W.M. Jones
2015-07-03 12:35 ` Markus Armbruster
2015-07-08 10:23 ` Kevin Wolf
2015-07-08 11:36 ` Richard W.M. Jones
2015-07-08 12:01 ` Kevin Wolf
2015-07-08 12:27 ` Richard W.M. Jones [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150708122726.GX29283@redhat.com \
--to=rjones@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).