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