[Libguestfs] [nbdkit PATCH] retry: Tweak error message

Eric Blake eblake at redhat.com
Tue Mar 31 21:00:22 UTC 2020


The retry filter defaults to 5 retries, but when run with verbose
details produces some confusing output:

$ rm -f /tmp/inject; (sleep 5s; touch /tmp/inject)& ./nbdkit -f -v -U - \
  null 1G --filter=retry --filter=noextents --filter=error error-rate=100% \
  error-file=/tmp/inject --filter=delay rdelay=1 \
  --run 'qemu-img convert $nbd out.img'
...
nbdkit: null[1]: debug: noextents: pread count=2097152 offset=14680064
nbdkit: null[1]: debug: error: pread count=2097152 offset=14680064
nbdkit: null[1]: error: injecting EIO error into pread
nbdkit: null[1]: debug: retry 6: original errno = 5
nbdkit: null[1]: debug: could not recover after 5 retries

The code is correct (there were six attempts, but that corresponds to
5 retries after the initial attempt; comments mention that retry=0
turns the filter into a no-op but even that requires an initial
attempt).  So all we need to adjust is the output.

Fixes: f0f0ec49
Signed-off-by: Eric Blake <eblake at redhat.com>
---

I'm pushing this in response to https://bugzilla.redhat.com/1819240
At the same time, I'm looking at whether qemu-img should be tweaked
to have a mode where it gives up on the first EIO error, rather than
plowing on through the rest of the image even after the first error.

 filters/retry/retry.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/filters/retry/retry.c b/filters/retry/retry.c
index 11e5313b..db91d7ca 100644
--- a/filters/retry/retry.c
+++ b/filters/retry/retry.c
@@ -173,7 +173,7 @@ do_retry (struct retry_handle *h,

  again:
   /* Log the original errno since it will be lost when we retry. */
-  nbdkit_debug ("retry %d: original errno = %d", data->retry+1, *err);
+  nbdkit_debug ("retry attempt %d: original errno = %d", data->retry, *err);

   if (data->retry >= retries) {
     nbdkit_debug ("could not recover after %d retries", retries);
-- 
2.26.0.rc2




More information about the Libguestfs mailing list