From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxUKl-0008Sz-5H for qemu-devel@nongnu.org; Fri, 03 Aug 2012 22:43:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxUKj-0000Y5-Uy for qemu-devel@nongnu.org; Fri, 03 Aug 2012 22:43:19 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:56996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxUKj-0000Xj-DA for qemu-devel@nongnu.org; Fri, 03 Aug 2012 22:43:17 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 4 Aug 2012 12:42:32 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q742h1xX21102618 for ; Sat, 4 Aug 2012 12:43:02 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q742h0rN020334 for ; Sat, 4 Aug 2012 12:43:01 +1000 Date: Sat, 4 Aug 2012 08:14:30 +0530 From: Bharata B Rao Message-ID: <20120804024430.GD26789@in.ibm.com> References: <20120801141414.GD21697@in.ibm.com> <20120801141625.GF21697@in.ibm.com> <20120802035526.GG21697@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v4 2/2] block: Support GlusterFS as a QEMU block backend Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Amar Tumballi , Vijay Bellur , Anand Avati , qemu-devel@nongnu.org, Stefan Hajnoczi On Fri, Aug 03, 2012 at 03:57:20PM +0000, Blue Swirl wrote: > >> > +static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) > >> > +{ > >> > + GlusterAIOCB *acb = (GlusterAIOCB *)arg; > >> > + BDRVGlusterState *s = acb->common.bs->opaque; > >> > + > >> > + acb->ret = ret; > >> > + if (qemu_gluster_send_pipe(s, acb) < 0) { > >> > + error_report("Could not complete read/write/flush from gluster"); > >> > + abort(); > >> > >> Aborting is a bit drastic, it would be nice to save and exit gracefully. > > > > I am not sure if there is an easy way to recover sanely and exit from this > > kind of error. > > > > Here the non-QEMU thread (gluster thread) failed to notify the QEMU thread > > on the read side of the pipe about the IO completion. So essentially > > bdrv_read or bdrv_write will never complete if this error happens. > > > > Do you have any suggestions on how to exit gracefully here ? > > Ignore but set the callback return to -EIO, see for example curl.c:249. I see the precedence for how I am handling this in posix-aio-compat.c:posix_aio_notify_event(). So instead of aborting, I could do acb->common.cb(acb->common.opaque, -EIO) as you suggest, but that would not help because, the thread at the read side of the pipe is still waiting and user will see the read/write failure as hang. [root@bharata qemu]# gdb ./x86_64-softmmu/qemu-system-x86_64 Starting program: ./x86_64-softmmu/qemu-system-x86_64 --enable-kvm --nographic -m 1024 -smp 4 -drive file=gluster://bharata/test/F16,if=virtio,cache=none [New Thread 0x7ffff4c7f700 (LWP 6537)] [New Thread 0x7ffff447e700 (LWP 6538)] [New Thread 0x7ffff3420700 (LWP 6539)] [New Thread 0x7ffff1407700 (LWP 6540)] qemu-system-x86_64: -drive file=gluster://bharata/test/F16,if=virtio,cache=none: Could not complete read/write/flush from gluster ^C Program received signal SIGINT, Interrupt. 0x00007ffff60e9403 in select () from /lib64/libc.so.6 (gdb) bt #0 0x00007ffff60e9403 in select () from /lib64/libc.so.6 #1 0x00005555555baee3 in qemu_aio_wait () at aio.c:158 #2 0x00005555555cf57b in bdrv_rw_co (bs=0x5555564cfa50, sector_num=0, buf= 0x7fffffffb640 "\353c\220", nb_sectors=4, is_write=false) at block.c:1623 #3 0x00005555555cf5e1 in bdrv_read (bs=0x5555564cfa50, sector_num=0, buf= 0x7fffffffb640 "\353c\220", nb_sectors=4) at block.c:1633 #4 0x00005555555cf9d0 in bdrv_pread (bs=0x5555564cfa50, offset=0, buf=0x7fffffffb640, count1=2048) at block.c:1720 #5 0x00005555555cc8d4 in find_image_format (filename= 0x5555564cc290 "gluster://bharata/test/F16", pdrv=0x7fffffffbe60) at block.c:529 #6 0x00005555555cd303 in bdrv_open (bs=0x5555564cef20, filename= 0x5555564cc290 "gluster://bharata/test/F16", flags=98, drv=0x0) at block.c:800 #7 0x0000555555609f69 in drive_init (opts=0x5555564cf900, default_to_scsi=0) at blockdev.c:608 #8 0x0000555555711b6c in drive_init_func (opts=0x5555564cc1e0, opaque=0x555555c357a0) at vl.c:775 #9 0x000055555574ceda in qemu_opts_foreach (list=0x555555c319e0, func= 0x555555711b31 , opaque=0x555555c357a0, abort_on_failure=1) at qemu-option.c:1094 #10 0x0000555555719d78 in main (argc=9, argv=0x7fffffffe468, envp=0x7fffffffe4b8) at vl.c:3430