From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRSAF-0007uE-5z for qemu-devel@nongnu.org; Mon, 07 May 2012 13:56:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRSAD-00030P-GI for qemu-devel@nongnu.org; Mon, 07 May 2012 13:56:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRSAD-0002zm-94 for qemu-devel@nongnu.org; Mon, 07 May 2012 13:56:01 -0400 From: Kevin Wolf Date: Mon, 7 May 2012 19:55:50 +0200 Message-Id: <1336413354-5244-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1336413354-5244-1-git-send-email-kwolf@redhat.com> References: <1336413354-5244-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 1/5] sheepdog: switch to writethrough mode if cluster doesn't support flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: MORITA Kazutaka 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 Signed-off-by: Kevin Wolf --- 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; -- 1.7.6.5