From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDV57-0001aW-SP for qemu-devel@nongnu.org; Thu, 16 Jun 2016 07:03:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDV56-000137-U4 for qemu-devel@nongnu.org; Thu, 16 Jun 2016 07:03:29 -0400 From: Kevin Wolf Date: Thu, 16 Jun 2016 13:03:20 +0200 Message-Id: <1466075000-22923-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH] block: Fix snapshot=on with aio=native List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org snapshot=on creates a temporary overlay that is always opened with cache=unsafe (the cache mode specified by the user is only for the actual image file and its children). This means that we must not inherit the BDRV_O_NATIVE_AIO flag for the temporary overlay because trying to use Linux AIO with cache=unsafe results in an error. Reproducer without this patch: $ x86_64-softmmu/qemu-system-x86_64 -drive file=/tmp/test.qcow2,cache=none,aio=native,snapshot=on qemu-system-x86_64: -drive file=/tmp/test.qcow2,cache=none,aio=native,snapshot=on: aio=native was specified, but it requires cache.direct=on, which was not specified. Signed-off-by: Kevin Wolf --- block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block.c b/block.c index b350794..8104225 100644 --- a/block.c +++ b/block.c @@ -684,6 +684,10 @@ static void bdrv_temp_snapshot_options(int *child_flags, QDict *child_options, /* For temporary files, unconditional cache=unsafe is fine */ qdict_set_default_str(child_options, BDRV_OPT_CACHE_DIRECT, "off"); qdict_set_default_str(child_options, BDRV_OPT_CACHE_NO_FLUSH, "on"); + + /* aio=native doesn't work for cache.direct=off, so disable it for the + * temporary snapshot */ + *child_flags &= ~BDRV_O_NATIVE_AIO; } /* -- 1.8.3.1