From patchwork Wed Jan 2 15:15:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 209096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 742162C0086 for ; Thu, 3 Jan 2013 03:52:59 +1100 (EST) Received: from localhost ([::1]:46904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqRYn-0004dw-NQ for incoming@patchwork.ozlabs.org; Wed, 02 Jan 2013 11:52:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqQ45-0001wX-WD for qemu-devel@nongnu.org; Wed, 02 Jan 2013 10:17:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqQ3y-0005jQ-KS for qemu-devel@nongnu.org; Wed, 02 Jan 2013 10:17:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqQ3y-0005jC-C5 for qemu-devel@nongnu.org; Wed, 02 Jan 2013 10:17:02 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r02FGlfC018788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 2 Jan 2013 10:16:47 -0500 Received: from localhost (ovpn-112-16.ams2.redhat.com [10.36.112.16]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r02FGjJJ032406; Wed, 2 Jan 2013 10:16:45 -0500 From: Stefan Hajnoczi To: Date: Wed, 2 Jan 2013 16:15:55 +0100 Message-Id: <1357139756-11951-18-git-send-email-stefanha@redhat.com> In-Reply-To: <1357139756-11951-1-git-send-email-stefanha@redhat.com> References: <1357139756-11951-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , Liu Yuan , MORITA Kazutaka Subject: [Qemu-devel] [PATCH 17/18] sheepdog: don't update inode when create_and_write fails X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 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