From patchwork Sat Dec 15 09:59:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Yuan X-Patchwork-Id: 206611 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 BA5922C007D for ; Sat, 15 Dec 2012 20:59:41 +1100 (EST) Received: from localhost ([::1]:48881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjoWx-00013i-Uh for incoming@patchwork.ozlabs.org; Sat, 15 Dec 2012 04:59:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:57136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjoWl-00013N-Ax for qemu-devel@nongnu.org; Sat, 15 Dec 2012 04:59:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjoWk-0004Ao-0k for qemu-devel@nongnu.org; Sat, 15 Dec 2012 04:59:27 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:59927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjoWj-00049T-QG for qemu-devel@nongnu.org; Sat, 15 Dec 2012 04:59:25 -0500 Received: by mail-pb0-f45.google.com with SMTP id mc8so2864429pbc.4 for ; Sat, 15 Dec 2012 01:59:25 -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=KzidFTDHGdJKz65Ak3aMKNB7wxCqGoLUZyKqMPg1fVo=; b=JIWVBS0rpbnHes3VgUCrOpuLqP2JEmQdy4hoMZHzk7xXYoroYq9mWtUD3Bdfs9ZuVW sMJzTAjlh5+9sm6TZrVwkuw562+2hEHjtBmmTGNhAlPrDUwEWkK5ZB59YbOPCXhSfynS aG2wQiYGN1qTRCt5OqdNEKH94ob4kCmn5ANg8g5m1Al9RHpKt5ghjTjauS95NY1yhbDS GWKxhqe8r557mgMGFd9G70OaAxZazjXodPALH3dn/aNGhmF0e5Bu5zxnEgXTk+CJgXyA izoxMZa9KjsXy4kDhIZ2WiAtrEOSfaoj22fsGQBSRXvoigjIOk30woVjhyQYja1pTPfN b4kw== Received: by 10.68.192.70 with SMTP id he6mr23770817pbc.142.1355565565033; Sat, 15 Dec 2012 01:59:25 -0800 (PST) Received: from localhost.localdomain ([123.122.85.169]) by mx.google.com with ESMTPS id oi3sm4504242pbb.1.2012.12.15.01.59.20 (version=SSLv3 cipher=OTHER); Sat, 15 Dec 2012 01:59:24 -0800 (PST) From: Liu Yuan To: qemu-devel@nongnu.org Date: Sat, 15 Dec 2012 17:59:12 +0800 Message-Id: <1355565552-18346-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 Update] 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 --- Update - update the coding style and passed checkpath block/sheepdog.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index a48f58c..6116316 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -697,6 +697,12 @@ static void coroutine_fn aio_read_response(void *opaque) acb = aio_req->aiocb; + if (rsp.result != SD_RES_SUCCESS) { + acb->ret = -EIO; + error_report("%s", sd_strerror(rsp.result)); + goto err; + } + switch (acb->aiocb_type) { case AIOCB_WRITE_UDATA: /* this coroutine context is no longer suitable for co_recv @@ -736,11 +742,7 @@ static void coroutine_fn aio_read_response(void *opaque) break; } - if (rsp.result != SD_RES_SUCCESS) { - acb->ret = -EIO; - error_report("%s", sd_strerror(rsp.result)); - } - +err: free_aio_req(s, aio_req); if (!acb->nr_pending) { /*