Patchwork tools: initialize main loop before block layer

login
register
mail settings
Submitter Paolo Bonzini
Date Nov. 3, 2012, 5:10 p.m.
Message ID <1351962617-13680-1-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/196891/
State New
Headers show

Comments

Paolo Bonzini - Nov. 3, 2012, 5:10 p.m.
Tools were broken because they initialized the block layer while
qemu_aio_context was still NULL.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-img.c | 3 +--
 qemu-io.c  | 3 +--
 2 file modificati, 2 inserzioni(+), 4 rimozioni(-)
malc - Nov. 6, 2012, 12:39 a.m.
On Sat, 3 Nov 2012, Paolo Bonzini wrote:

> Tools were broken because they initialized the block layer while
> qemu_aio_context was still NULL.
> 
> Reported-by: malc <av1474@comtv.ru>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

[..snip..]

Applied, thanks.

Patch

diff --git a/qemu-img.c b/qemu-img.c
index b17bddd..e29e01b 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2001,14 +2001,13 @@  int main(int argc, char **argv)
 
     error_set_progname(argv[0]);
 
+    qemu_init_main_loop();
     bdrv_init();
     if (argc < 2)
         help();
     cmdname = argv[1];
     argc--; argv++;
 
-    qemu_init_main_loop();
-
     /* find the command */
     for(cmd = img_cmds; cmd->name != NULL; cmd++) {
         if (!strcmp(cmdname, cmd->name)) {
diff --git a/qemu-io.c b/qemu-io.c
index d0f4fb7..1ad7d3a 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1892,9 +1892,8 @@  int main(int argc, char **argv)
         exit(1);
     }
 
-    bdrv_init();
-
     qemu_init_main_loop();
+    bdrv_init();
 
     /* initialize commands */
     quit_init();