958e1b
From 4c3960c0fdeb57a5cb74a9de3883b6e6109bf946 Mon Sep 17 00:00:00 2001
91048c
From: Paolo Bonzini <pbonzini@redhat.com>
91048c
Date: Fri, 12 Sep 2014 11:56:30 +0200
91048c
Subject: [PATCH] scsi-disk: fix bug in scsi_block_new_request() introduced by commit 137745c
91048c
91048c
Message-id: <1410522991-11612-1-git-send-email-pbonzini@redhat.com>
91048c
Patchwork-id: 61021
91048c
O-Subject: [RHEL 7.1/7.0.z qemu-kvm PATCH] scsi-disk: fix bug in scsi_block_new_request() introduced by commit 137745c
958e1b
Bugzilla: 1105880
91048c
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
91048c
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
91048c
RH-Acked-by: Fam Zheng <famz@redhat.com>
91048c
91048c
From: Ulrich Obergfell <uobergfe@redhat.com>
91048c
91048c
This patch fixes a bug in scsi_block_new_request() that was introduced
91048c
by commit 137745c5c60f083ec982fe9e861e8c16ebca1ba8. If the host cache
91048c
is used - i.e. if BDRV_O_NOCACHE is _not_ set - the 'break' statement
91048c
needs to be executed to 'fall back' to SG_IO.
91048c
91048c
Cc: qemu-stable@nongnu.org
91048c
Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
91048c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
91048c
(cherry picked from commit 2fe5a9f73b3446690db2cae8a58473b0b4beaa32)
91048c
91048c
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
91048c
---
91048c
 hw/scsi/scsi-disk.c |    2 +-
91048c
 1 files changed, 1 insertions(+), 1 deletions(-)
91048c
91048c
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
958e1b
index 1d41db2..50b7910 100644
91048c
--- a/hw/scsi/scsi-disk.c
91048c
+++ b/hw/scsi/scsi-disk.c
958e1b
@@ -2502,7 +2502,7 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag,
91048c
 	 * ones (such as WRITE SAME or EXTENDED COPY, etc.).  So, without
91048c
 	 * O_DIRECT everything must go through SG_IO.
91048c
          */
91048c
-        if (bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE) {
91048c
+        if (!(bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE)) {
91048c
             break;
91048c
         }
91048c
 
91048c
-- 
91048c
1.7.1
91048c