OSDN Git Service

block-copy: fix block_copy_task_entry() progress update
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Fri, 28 May 2021 14:16:27 +0000 (17:16 +0300)
committerKevin Wolf <kwolf@redhat.com>
Wed, 2 Jun 2021 12:23:20 +0000 (14:23 +0200)
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>
block/block-copy.c

index c2e5090..f9e871b 100644 (file)
@@ -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);
     }