cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-Detect-unaligned-length-in-bdrv_qiov_is_aligne.patch

0a122b
From 3015984eb6778214d381cf7de32d8ab81e277728 Mon Sep 17 00:00:00 2001
0a122b
From: Kevin Wolf <kwolf@redhat.com>
0a122b
Date: Thu, 5 Dec 2013 13:01:46 +0100
0a122b
Subject: [PATCH 07/37] block: Detect unaligned length in bdrv_qiov_is_aligned()
0a122b
0a122b
Message-id: <1392117622-28812-8-git-send-email-kwolf@redhat.com>
0a122b
Patchwork-id: 57172
0a122b
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 07/37] block: Detect unaligned length in bdrv_qiov_is_aligned()
0a122b
Bugzilla: 748906
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Max Reitz <mreitz@redhat.com>
0a122b
0a122b
For an O_DIRECT request to succeed, it's not only necessary that all
0a122b
base addresses in the qiov are aligned, but also that each length in it
0a122b
is aligned.
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
0a122b
Reviewed-by: Max Reitz <mreitz@redhat.com>
0a122b
(cherry picked from commit 1ff735bdc417945bc6df1857861b127644b3f461)
0a122b
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
---
0a122b
 block.c | 3 +++
0a122b
 1 file changed, 3 insertions(+)
0a122b
---
0a122b
 block.c |    3 +++
0a122b
 1 files changed, 3 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/block.c b/block.c
0a122b
index f62acbd..6c98ff7 100644
0a122b
--- a/block.c
0a122b
+++ b/block.c
0a122b
@@ -4743,6 +4743,9 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
0a122b
         if ((uintptr_t) qiov->iov[i].iov_base % bs->buffer_alignment) {
0a122b
             return false;
0a122b
         }
0a122b
+        if (qiov->iov[i].iov_len % bs->buffer_alignment) {
0a122b
+            return false;
0a122b
+        }
0a122b
     }
0a122b
 
0a122b
     return true;
0a122b
-- 
0a122b
1.7.1
0a122b