From patchwork Wed May 2 20:26:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MORITA Kazutaka X-Patchwork-Id: 156546 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 C1864B6FE8 for ; Thu, 3 May 2012 06:26:51 +1000 (EST) Received: from localhost ([::1]:51966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPg8P-0003yN-G9 for incoming@patchwork.ozlabs.org; Wed, 02 May 2012 16:26:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPg8J-0003yD-I5 for qemu-devel@nongnu.org; Wed, 02 May 2012 16:26:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPg8H-00049m-Dl for qemu-devel@nongnu.org; Wed, 02 May 2012 16:26:43 -0400 Received: from sh.osrg.net ([192.16.179.4]:36490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPg8G-00048l-US for qemu-devel@nongnu.org; Wed, 02 May 2012 16:26:41 -0400 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id q42KQN89013438; Thu, 3 May 2012 05:26:23 +0900 Received: from localhost (dfs1401.osrg.net [10.68.14.1]) by fs.osrg.net (Postfix) with ESMTP id 27A9C3E003F; Thu, 3 May 2012 05:26:23 +0900 (JST) From: MORITA Kazutaka To: kwolf@redhat.com Date: Thu, 3 May 2012 05:26:07 +0900 Message-Id: <1335990367-18749-1-git-send-email-morita.kazutaka@gmail.com> X-Mailer: git-send-email 1.7.2.5 X-Dispatcher: imput version 20100215(IM150) Lines: 30 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.7 (sh.osrg.net [192.16.179.4]); Thu, 03 May 2012 05:26:25 +0900 (JST) X-Virus-Scanned: clamav-milter 0.97.3 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 192.16.179.4 Cc: morita.kazutaka@gmail.com, namei.unix@gmail.com, hch@lst.de, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] sheepdog: switch to writethrough mode if cluster doesn't support flush 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 This is necessary for qemu to work with the older version of Sheepdog which doesn't support SD_OP_FLUSH_VDI. Signed-off-by: MORITA Kazutaka --- block/sheepdog.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/block/sheepdog.c b/block/sheepdog.c index 0ed6b19..e01d371 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -1678,6 +1678,14 @@ static int coroutine_fn sd_co_flush_to_disk(BlockDriverState *bs) return ret; } + if (rsp->result == SD_RES_INVALID_PARMS) { + dprintf("disable write cache since the server doesn't support it\n"); + + s->cache_enabled = 0; + closesocket(s->flush_fd); + return 0; + } + if (rsp->result != SD_RES_SUCCESS) { error_report("%s", sd_strerror(rsp->result)); return -EIO;