aboutsummaryrefslogtreecommitdiff
path: root/block/file-posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/file-posix.c')
-rw-r--r--block/file-posix.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/block/file-posix.c b/block/file-posix.c
index 71f168ee2f..87c5a4ccbd 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1588,6 +1588,13 @@ static int handle_aiocb_write_zeroes(void *opaque)
if (s->has_write_zeroes) {
int ret = do_fallocate(s->fd, FALLOC_FL_ZERO_RANGE,
aiocb->aio_offset, aiocb->aio_nbytes);
+ if (ret == -EINVAL) {
+ /*
+ * Allow falling back to pwrite for file systems that
+ * do not support fallocate() for an unaligned byte range.
+ */
+ return -ENOTSUP;
+ }
if (ret == 0 || ret != -ENOTSUP) {
return ret;
}