qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: Strange virtio regression on mainline and stable-0.10
Date: Tue, 05 May 2009 14:46:33 +0300	[thread overview]
Message-ID: <4A002719.6090307@redhat.com> (raw)
In-Reply-To: <4A001563.1020604@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

(re-added qemu-devel)

Kevin Wolf wrote:
> Avi Kivity schrieb:
>   
>> Running the Fedora 10 installer on a virtio disk on current master and 
>> on v0.10.3 will cause the installer to complain when mounting the 
>> freshly formatted filesystems. 
>>     
>
> Could be related to https://bugzilla.redhat.com/show_bug.cgi?id=498405
>
>   

It appears to be the same.

> I encountered IO errors with qcow2 and virtio this morning, so I already
> wanted to start debugging it. Unfortunately, with current master extboot
> seems to be broken for me and so I can't even boot with virtio. Have not
> figured out yet what's going wrong here.
>   

I'm using the installer so I don't depend on extboot.  Of course the 
extboot issue needs to be fixed as well.

>> I don't understand it, as free_any_clusters() shouldn't be called while 
>> formatting.  Any ideas?
>>     
>
> free_any_clusters shouldn't be called at all without snapshots or
> backing files.
>
> qemu-img check notices refcount errors on my broken image though, so
> this could still be the same.

data point: if I force writes to be serialized in block-qcow2.c, then 
everything works, and there are no calls to free_any_clusters().  It's 
likely that there is some lack of serialization in the allocation code, 
some write that is in flight does not update the global state, only 
acb-local state.

-- 
error compiling committee.c: too many arguments to function


[-- Attachment #2: serialize-qcow2.patch --]
[-- Type: text/x-patch, Size: 1154 bytes --]

diff --git a/block-qcow2.c b/block-qcow2.c
index c4cd38d..151e688 100644
--- a/block-qcow2.c
+++ b/block-qcow2.c
@@ -1443,6 +1443,9 @@ static BlockDriverAIOCB *qcow_aio_readv(BlockDriverState *bs,
     return &acb->common;
 }
 
+static int nb_writes;
+static BlockDriverAIOCB *pending_writes[300];
+
 static void qcow_aio_write_cb(void *opaque, int ret)
 {
     QCowAIOCB *acb = opaque;
@@ -1518,6 +1521,18 @@ done:
         qemu_vfree(acb->orig_buf);
     acb->common.cb(acb->common.opaque, ret);
     qemu_aio_release(acb);
+
+    {
+        int i;
+
+        for (i = 1; i < nb_writes; ++i) {
+            pending_writes[i - 1] = pending_writes[i];
+        }
+        --nb_writes;
+        if (nb_writes) {
+            qcow_aio_write_cb(pending_writes[0], 0);
+        }
+    }
 }
 
 static BlockDriverAIOCB *qcow_aio_writev(BlockDriverState *bs,
@@ -1535,7 +1550,12 @@ static BlockDriverAIOCB *qcow_aio_writev(BlockDriverState *bs,
     if (!acb)
         return NULL;
 
-    qcow_aio_write_cb(acb, 0);
+    pending_writes[nb_writes++] = acb;
+
+    if (nb_writes == 1) {
+        qcow_aio_write_cb(acb, 0);
+    }
+
     return &acb->common;
 }
 

  parent reply	other threads:[~2009-05-05 11:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-05  9:52 [Qemu-devel] Strange virtio regression on mainline and stable-0.10 Avi Kivity
2009-05-05 10:03 ` [Qemu-devel] " Avi Kivity
     [not found] ` <4A001563.1020604@redhat.com>
2009-05-05 11:46   ` Avi Kivity [this message]
2009-05-05 16:18 ` [Qemu-devel] " Avi Kivity
2009-05-05 18:18   ` Avi Kivity
2009-05-06  8:14   ` Kevin Wolf
2009-05-06  8:34     ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A002719.6090307@redhat.com \
    --to=avi@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).