From patchwork Mon Dec 17 06:17:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yuan X-Patchwork-Id: 206783 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 D33542C0092 for ; Mon, 17 Dec 2012 17:35:11 +1100 (EST) Received: from localhost ([::1]:49637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkUI9-0006Hc-L1 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2012 01:35:09 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkUEQ-0000A6-Er for qemu-devel@nongnu.org; Mon, 17 Dec 2012 01:34:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkU1E-00050Z-4s for qemu-devel@nongnu.org; Mon, 17 Dec 2012 01:21:14 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:58637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkU1D-00050S-T1 for qemu-devel@nongnu.org; Mon, 17 Dec 2012 01:17:40 -0500 Received: by mail-pb0-f45.google.com with SMTP id mc8so3595477pbc.4 for ; Sun, 16 Dec 2012 22:17:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=k7r+9CX/jfI7gEj1zH7IHS7Yc713ZbJ0X4TSXt71TmE=; b=AcmzzpNpJ868rclDKLd/bHbGYr43ZU3O1mFz6LrrlbfcgMxp+rUjObvGxdpvor7WCJ D30Z/sgkq2nmNglBR/zaIZN28arzwcJ/F+yvBpRrrN8WLd3NWPp9po1Q6jwk3Dgcl+43 J1M/IuFllPwZPWGrBuQi8sTFePHsaSYKfCl87n0rVb0MN4SP90A/A88D3b6EA4/snChw bHD7JX5H0aHwyOnhF5rdFu88WnEMYL8ZlZ2EXenseE3jgK4MDG5ZnSgQGlUKOiJpuERm d59qhAtsI/dBpa4+ZQ7seWVZ7nAaFmB4GYZyrlZgudhm8QbjgEMWrCo+VZwHGX4TWNwq s+kw== Received: by 10.66.83.136 with SMTP id q8mr39437187pay.83.1355725059117; Sun, 16 Dec 2012 22:17:39 -0800 (PST) Received: from K55VM-ubuntu.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id zv10sm7603218pbc.76.2012.12.16.22.17.35 (version=SSLv3 cipher=OTHER); Sun, 16 Dec 2012 22:17:38 -0800 (PST) From: Liu Yuan To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2012 14:17:26 +0800 Message-Id: <1355725047-5096-1-git-send-email-namei.unix@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355565174-5121-1-git-send-email-namei.unix@gmail.com> References: <1355565174-5121-1-git-send-email-namei.unix@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.45 Cc: Kevin Wolf , MORITA Kazutaka Subject: [Qemu-devel] [PATCH v2 1/2] 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 --- 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