From: Kevin Wolf Date: Fri, 16 Aug 2019 09:48:17 +0000 (+0200) Subject: file-posix: Fix has_write_zeroes after NO_FALLBACK X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=effecce6bcb830a661c882d7299b53382b56a131;p=people%2Fpauldu%2Fqemu.git file-posix: Fix has_write_zeroes after NO_FALLBACK If QEMU_AIO_NO_FALLBACK is given, we always return failure and don't even try to use the BLKZEROOUT ioctl. In this failure case, we shouldn't disable has_write_zeroes because we didn't learn anything about the ioctl. The next request might not set QEMU_AIO_NO_FALLBACK and we can still use the ioctl then. Fixes: 738301e1175 Reported-by: Eric Blake Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake --- diff --git a/block/file-posix.c b/block/file-posix.c index f683a36c8a..f12c06de2d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1502,12 +1502,12 @@ static ssize_t handle_aiocb_write_zeroes_block(RawPosixAIOData *aiocb) } while (errno == EINTR); ret = translate_err(-errno); + if (ret == -ENOTSUP) { + s->has_write_zeroes = false; + } } #endif - if (ret == -ENOTSUP) { - s->has_write_zeroes = false; - } return ret; }