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