]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
sheepdog: switch to writethrough mode if cluster doesn't support flush
authorMORITA Kazutaka <morita.kazutaka@gmail.com>
Wed, 2 May 2012 20:26:07 +0000 (05:26 +0900)
committerKevin Wolf <kwolf@redhat.com>
Mon, 7 May 2012 17:33:18 +0000 (19:33 +0200)
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 <morita.kazutaka@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/sheepdog.c

index 0ed6b193c9ba04c033b7ce29eb5f3b8ffa57d4df..e01d37168029fa45eb9822ab21c8a0dda97a2931 100644 (file)
@@ -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;