From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlLjz-0005pR-M6 for qemu-devel@nongnu.org; Wed, 19 Dec 2012 10:39:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlLjr-0002Po-RM for qemu-devel@nongnu.org; Wed, 19 Dec 2012 10:39:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlLjr-0002Pb-Is for qemu-devel@nongnu.org; Wed, 19 Dec 2012 10:39:19 -0500 From: Stefan Hajnoczi Date: Wed, 19 Dec 2012 16:38:18 +0100 Message-Id: <1355931499-7912-18-git-send-email-stefanha@redhat.com> In-Reply-To: <1355931499-7912-1-git-send-email-stefanha@redhat.com> References: <1355931499-7912-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 17/18] sheepdog: don't update inode when create_and_write fails List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori From: Liu Yuan 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 --- block/sheepdog.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index a48f58c..ef7bc81 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 -- 1.8.0.2