From: Liu Yuan Date: Mon, 17 Dec 2012 06:17:26 +0000 (+0800) Subject: sheepdog: don't update inode when create_and_write fails X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~2872^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd751f2204a03d6fcd47a4b4b12ac534d2ecbea7;p=sdk%2Femulator%2Fqemu.git sheepdog: don't update inode when create_and_write fails For the error case such as SD_RES_NO_SPACE, we shouldn't update the inode bitmap to avoid the scenario that the object is allocated but wasn't created at the server side. This will result in VM's IO error on the failed object. Cc: MORITA Kazutaka Cc: Kevin Wolf Signed-off-by: Liu Yuan Reviewed-by: MORITA Kazutaka Signed-off-by: Stefan Hajnoczi --- diff --git a/block/sheepdog.c b/block/sheepdog.c index 13dc023..b9186fb 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -714,10 +714,11 @@ static void coroutine_fn aio_read_response(void *opaque) * and max_dirty_data_idx are changed to include updated * index between them. */ - s->inode.data_vdi_id[idx] = s->inode.vdi_id; - s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); - s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); - + if (rsp.result == SD_RES_SUCCESS) { + s->inode.data_vdi_id[idx] = s->inode.vdi_id; + s->max_dirty_data_idx = MAX(idx, s->max_dirty_data_idx); + s->min_dirty_data_idx = MIN(idx, s->min_dirty_data_idx); + } /* * Some requests may be blocked because simultaneous * create requests are not allowed, so we search the