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 <kwolf@redhat.com> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
e5354657a6
commit
1ff735bdc4
3
block.c
3
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) {
|
if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (qiov->iov[i].iov_len % bs->buffer_alignment) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user