提交 1ff735bd 编写于 作者: K Kevin Wolf

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: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NWenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: NMax Reitz <mreitz@redhat.com>
上级 e5354657
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册