From 1ff735bdc417945bc6df1857861b127644b3f461 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 5 Dec 2013 13:01:46 +0100 Subject: block: Detect unaligned length in bdrv_qiov_is_aligned() For an O_DIRECT request to succeed, it's not only necessary that all base addresses in the qiov are aligned, but also that each length in it is aligned. Signed-off-by: Kevin Wolf Reviewed-by: Wenchao Xia Reviewed-by: Max Reitz --- block.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block.c') diff --git a/block.c b/block.c index 9d0cfc46da..275d387354 100644 --- a/block.c +++ b/block.c @@ -4811,6 +4811,9 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov) if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) { return false; } + if (qiov->iov[i].iov_len % bs->buffer_alignment) { + return false; + } } return true; -- cgit v1.2.1