Patchwork glib mainloop breaks virtfs

login
register
mail settings
Submitter Aneesh Kumar K.V
Date Sept. 6, 2011, 5:41 p.m.
Message ID <87bouxd0w3.fsf@skywalker.in.ibm.com>
Download mbox | patch
Permalink /patch/113646/
State New
Headers show

Comments

Aneesh Kumar K.V - Sept. 6, 2011, 5:41 p.m.
On Tue, 06 Sep 2011 22:55:17 +0530, "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:
> On Tue, 06 Sep 2011 09:31:32 -0500, Anthony Liguori <anthony@codemonkey.ws> wrote:
> > On 09/06/2011 06:22 AM, Gerd Hoffmann wrote:
> > > Hi,
> > >
> > > virtfs stopped working for me in master, the guest (fedora 15) just
> > > hangs at boot when mounting the virtfs filesystems. Bisecting points to
> > > this commit:
> > >
> > > rincewind kraxel ~/projects/qemu ((69e5bb6...)|BISECTING)# git bisect good
> > > 4d88a2ac8643265108ef1fb47ceee5d7b28e19f2 is the first bad commit
> > > commit 4d88a2ac8643265108ef1fb47ceee5d7b28e19f2
> > > Author: Anthony Liguori <aliguori@us.ibm.com>
> > > Date: Mon Aug 22 08:12:53 2011 -0500
> > >
> > > main: switch qemu_set_fd_handler to g_io_add_watch
> > 
> > The v9fs code uses qemu_set_fd_handler to trigger coroutines.  I suspect 
> > this is not going to be a fun one to debug.
> > 
> > This changeset changes the ordering of when callbacks are fired so it 
> > may be triggering a latent bug in the coroutine usage in virtio-9p. 
> > Aneesh, can you take a look at it?
> > 
> 
> With master 344eecf6995f4a0ad1d887cec922f6806f91a3f8 I am getting SIGABRT 
> 

With the below change i can reproduce the hang. I will take a look at
virtfs co-routine use of qemu_set_fd_handler. Any reason why we check for
opaque in qemu_set_fd_handler ?

Patch

diff --git a/iohandler.c b/iohandler.c
index 5ef66fb..aaeb20d 100644
--- a/iohandler.c
+++ b/iohandler.c
@@ -121,7 +121,7 @@  int qemu_set_fd_handler(int fd,
         g_source_remove(tramp->tag);
     }
 
-    if (opaque) {
+
         GIOCondition cond = 0;
 
         tramp->fd_read = fd_read;
@@ -138,7 +138,6 @@  int qemu_set_fd_handler(int fd,
 
         tramp->chan = g_io_channel_unix_new(fd);
         tramp->tag = g_io_add_watch(tramp->chan, cond, fd_trampoline, tramp);
-    }
 
     return 0;
 }