Patchwork [Bug,902148] Re: qemu-img V1.0 hangs on creating Image (0.15.1 runs)

login
register
mail settings
Submitter Stefan Hajnoczi
Date Dec. 19, 2011, 1:22 p.m.
Message ID <20111219132250.GA16661@stefanha-thinkpad.localdomain>
Download mbox | patch
Permalink /patch/132227/
State New
Headers show

Comments

Stefan Hajnoczi - Dec. 19, 2011, 1:22 p.m.
On Mon, Dec 19, 2011 at 10:52:24AM -0000, Michael Niehren wrote:
> Ok, sorry, here the output:
> 
> Thread 1 (Thread 0x7f57507c2740 (LWP 27263)):
> #0  0x00007f57507da952 in qemu_aio_wait ()
> #1  0x00007f57507dcf2d in bdrv_rw_co ()
> #2  0x00007f57507dd2c2 in bdrv_pread ()
> #3  0x00007f57507ed03a in qcow2_open ()
> #4  0x00007f57507dc281 in bdrv_open_common ()
> #5  0x00007f57507ddb73 in bdrv_open ()
> #6  0x00007f57507ecafa in qcow2_create2 ()
> #7  0x00007f57507ece58 in qcow2_create ()
> #8  0x00007f57507e12c1 in bdrv_img_create ()
> #9  0x00007f575080bfeb in img_create ()
> #10 0x00007f574f340c7d in __libc_start_main () from /lib64/libc.so.6
> #11 0x00007f57507d9359 in _start ()
> 
> I compiled the rpm's myself, so i am sure the only difference of both is the enable-debug Flag, same
> source code. Here are my compile-flags on running configure:
> 
>     --disable-curses --disable-curl --audio-card-list=ac97 \
>     --enable-kvm --enable-spice --enable-linux-aio \
>     --enable-tcg-interpreter --enable-vnc-thread

I cannot reproduce it here but is it possible for you to try this patch?


Here is my sample output from a successful run of ./qemu-img create -f qcow2 test.img 10G:

Formatting 'test.img', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536
bdrv_rw_co_entry is_write 0 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 128 nb_sectors 128 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 128 nb_sectors 128 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 256 nb_sectors 128 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 128 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 128 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 256 nb_sectors 128 =waiting for rwco.ret != NOT_DONE
waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 384 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 384 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 0 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
bdrv_rw_co_entry is_write 1 sector_num 0 nb_sectors 1 =waiting for rwco.ret != NOT_DONE
0
s

Patch

diff --git a/block.c b/block.c
index d015887..aae71c2 100644
--- a/block.c
+++ b/block.c
@@ -1042,6 +1042,8 @@  static void coroutine_fn bdrv_rw_co_entry(void *opaque)
 {
     RwCo *rwco = opaque;
 
+    printf("bdrv_rw_co_entry is_write %d sector_num %" PRId64 " nb_sectors %d =",
+           rwco->is_write, rwco->sector_num, rwco->nb_sectors);
     if (!rwco->is_write) {
         rwco->ret = bdrv_co_do_readv(rwco->bs, rwco->sector_num,
                                      rwco->nb_sectors, rwco->qiov);
@@ -1049,6 +1051,8 @@  static void coroutine_fn bdrv_rw_co_entry(void *opaque)
         rwco->ret = bdrv_co_do_writev(rwco->bs, rwco->sector_num,
                                       rwco->nb_sectors, rwco->qiov);
     }
+    assert(rwco->ret != NOT_DONE);
+    printf("%d\n", rwco->ret);
 }
 
 /*
@@ -1081,6 +1085,7 @@  static int bdrv_rw_co(BlockDriverState *bs, int64_t sector_num, uint8_t *
         co = qemu_coroutine_create(bdrv_rw_co_entry);
         qemu_coroutine_enter(co, &rwco);
         while (rwco.ret == NOT_DONE) {
+            printf("waiting for rwco.ret != NOT_DONE\n");
             qemu_aio_wait();
         }
     }