Patchwork [3/3] block: mark streaming job busy at the end

login
register
mail settings
Submitter Paolo Bonzini
Date April 18, 2012, 1:12 p.m.
Message ID <1334754723-11153-4-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/153505/
State New
Headers show

Comments

Paolo Bonzini - April 18, 2012, 1:12 p.m.
Kevin noted how the part of stream_run() that is after the for loop runs with
s->common.busy = false. At least bdrv_change_backing_file() can yield,
possibly other functions, too.

The race window is really small but it's there.  Thanks to the new,
more flexible implementation of block_job_cancel_sync we can fix it
easily.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/stream.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/block/stream.c b/block/stream.c
index d38f30a..ea3566d 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -149,6 +149,7 @@  retry:
         co_sleep_ns(rt_clock, 0);
     }
 
+    s->common.busy = true;
     if (!base) {
         bdrv_disable_copy_on_read(bs);
     }