Patchwork [18/24] mirror: do nothing on zero-sized disk

login
register
mail settings
Submitter Kevin Wolf
Date Jan. 25, 2013, 6:45 p.m.
Message ID <1359139560-15387-19-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/215851/
State New
Headers show

Comments

Kevin Wolf - Jan. 25, 2013, 6:45 p.m.
From: Paolo Bonzini <pbonzini@redhat.com>

On a zero-sized disk we need to break out of the job successfully
before bdrv_dirty_iter_init is called, otherwise you will get an
assertion failure with the next patch.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/mirror.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/block/mirror.c b/block/mirror.c
index 9347533..a62ad86 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -305,7 +305,7 @@  static void coroutine_fn mirror_run(void *opaque)
     }
 
     s->common.len = bdrv_getlength(bs);
-    if (s->common.len < 0) {
+    if (s->common.len <= 0) {
         block_job_completed(&s->common, s->common.len);
         return;
     }