From 3bf9188fc174e14e896b6d949a1a985b88380f8f Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 30 Sep 2019 08:22:28 -0500 Subject: [PATCH] retry: Also retry flush commands Missed in commit f0f0ec497d. Signed-off-by: Eric Blake --- filters/retry/retry.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/filters/retry/retry.c b/filters/retry/retry.c index 4d73f178..59e7d4b8 100644 --- a/filters/retry/retry.c +++ b/filters/retry/retry.c @@ -242,6 +242,23 @@ retry_trim (struct nbdkit_next_ops *next_ops, void *nxdata, return r; } +/* Flush. */ +static int +retry_flush (struct nbdkit_next_ops *next_ops, void *nxdata, + void *handle, uint32_t flags, + int *err) +{ + struct retry_handle *h = handle; + struct retry_data data = {0}; + int r; + + again: + r = next_ops->flush (nxdata, flags, err); + if (r == -1 && do_retry (h, &data, next_ops, nxdata, err)) goto again; + + return r; +} + /* Zero. */ static int retry_zero (struct nbdkit_next_ops *next_ops, void *nxdata, @@ -307,6 +324,7 @@ static struct nbdkit_filter filter = { .pread = retry_pread, .pwrite = retry_pwrite, .trim = retry_trim, + .flush = retry_flush, .zero = retry_zero, .extents = retry_extents, .cache = retry_cache, -- 2.11.4.GIT