]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
file-posix: Fix has_write_zeroes after NO_FALLBACK
authorKevin Wolf <kwolf@redhat.com>
Fri, 16 Aug 2019 09:48:17 +0000 (11:48 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 10 Sep 2019 06:58:43 +0000 (08:58 +0200)
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 <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block/file-posix.c

index f683a36c8a1cbbd970a24d4cf2081c12efc25009..f12c06de2df5726ff361c28e44da2d688572c82c 100644 (file)
@@ -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;
 }