yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-ide-only-constrain-read-write-requests-to-drive-size.patch

9ae3a8
From 466d66e193341115f2a48e27997d61d8fddc811e Mon Sep 17 00:00:00 2001
9ae3a8
From: Markus Armbruster <armbru@redhat.com>
9ae3a8
Date: Fri, 31 Oct 2014 16:29:56 +0100
9ae3a8
Subject: [PATCH 19/19] ide: only constrain read/write requests to drive size,
9ae3a8
 not other types
9ae3a8
9ae3a8
Message-id: <1414772996-17272-6-git-send-email-armbru@redhat.com>
9ae3a8
Patchwork-id: 62017
9ae3a8
O-Subject: [PATCH RHEL-7.1 qemu-kvm 5/5] ide: only constrain read/write requests to drive size, not other types
9ae3a8
Bugzilla: 1085232
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
From: Michael Tokarev <mjt@tls.msk.ru>
9ae3a8
9ae3a8
Commit 58ac321135a introduced a check to ide dma processing which
9ae3a8
constrains all requests to drive size.  However, apparently, some
9ae3a8
valid requests (like TRIM) does not fit in this constraint, and
9ae3a8
fails in 2.1.  So check the range only for reads and writes.
9ae3a8
9ae3a8
Cc: qemu-stable@nongnu.org
9ae3a8
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9ae3a8
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit d66168ed687325aa6d338ce3a3cff18ce3098ed6)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/ide/core.c | 3 ++-
9ae3a8
 1 file changed, 2 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/hw/ide/core.c b/hw/ide/core.c
9ae3a8
index 4c36f52..24a1708 100644
9ae3a8
--- a/hw/ide/core.c
9ae3a8
+++ b/hw/ide/core.c
9ae3a8
@@ -702,7 +702,8 @@ void ide_dma_cb(void *opaque, int ret)
9ae3a8
            sector_num, n, s->dma_cmd);
9ae3a8
 #endif
9ae3a8
 
9ae3a8
-    if (!ide_sect_range_ok(s, sector_num, n)) {
9ae3a8
+    if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) &&
9ae3a8
+        !ide_sect_range_ok(s, sector_num, n)) {
9ae3a8
         dma_buf_commit(s);
9ae3a8
         ide_dma_error(s);
9ae3a8
         return;
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8