From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7681-0008Rv-QD for qemu-devel@nongnu.org; Fri, 23 Sep 2011 09:49:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R7680-0008OZ-Q6 for qemu-devel@nongnu.org; Fri, 23 Sep 2011 09:49:21 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:43741) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7680-0008OP-Ae for qemu-devel@nongnu.org; Fri, 23 Sep 2011 09:49:20 -0400 Received: by wyh22 with SMTP id 22so4258349wyh.4 for ; Fri, 23 Sep 2011 06:49:19 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E7C8E5C.90108@redhat.com> Date: Fri, 23 Sep 2011 15:49:16 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1316595388-12427-1-git-send-email-wdongxu@linux.vnet.ibm.com> <4E7C7997.2010605@redhat.com> In-Reply-To: <4E7C7997.2010605@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] support add-cow format List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: wdongxu@cn.ibm.com, Dong Xu Wang , qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com On 09/23/2011 02:20 PM, Kevin Wolf wrote: >> +static BlockDriverAIOCB *add_cow_aio_flush(BlockDriverState *bs, >> + BlockDriverCompletionFunc *cb, void *opaque) >> +{ >> + BDRVAddCowState *state = bs->opaque; >> + bdrv_aio_flush(state->image_hd, cb, opaque); >> + return bdrv_aio_flush(bs->file, cb, opaque); > > This will invoke the callback twice, and opaque will probably be invalid > after the first callback. Not good. > > This code is also lacking error handling for the ifrst bdrv_aio_flush. I'll repost the NBD series today, so that Dong Xu Wang can implement this as co_flush. Paolo