summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-05-28 17:16:27 +0300
committerKevin Wolf <kwolf@redhat.com>2021-06-02 14:23:20 +0200
commit8146b357d0cb3a3f5d500a1536f9f0e1ff3302cc (patch)
tree0d9a1964e8d492c26df1b141ad4266c9d76e3a14
parentfd6afc501a019682d1b8468b562355a2887087bd (diff)
downloadfocaccia-qemu-8146b357d0cb3a3f5d500a1536f9f0e1ff3302cc.tar.gz
focaccia-qemu-8146b357d0cb3a3f5d500a1536f9f0e1ff3302cc.zip
block-copy: fix block_copy_task_entry() progress update
Don't report successful progress on failure, when call_state->ret is
set.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210528141628.44287-2-vsementsov@virtuozzo.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/block-copy.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/block/block-copy.c b/block/block-copy.c
index c2e5090412..f9e871b64f 100644
--- a/block/block-copy.c
+++ b/block/block-copy.c
@@ -439,9 +439,11 @@ static coroutine_fn int block_copy_task_entry(AioTask *task)
 
     ret = block_copy_do_copy(t->s, t->offset, t->bytes, t->zeroes,
                              &error_is_read);
-    if (ret < 0 && !t->call_state->ret) {
-        t->call_state->ret = ret;
-        t->call_state->error_is_read = error_is_read;
+    if (ret < 0) {
+        if (!t->call_state->ret) {
+            t->call_state->ret = ret;
+            t->call_state->error_is_read = error_is_read;
+        }
     } else {
         progress_work_done(t->s->progress, t->bytes);
     }