240766
From 90f24ff57d4861c6143176cba17e51f3a9bd7d50 Mon Sep 17 00:00:00 2001
240766
From: Fam Zheng <famz@redhat.com>
240766
Date: Mon, 14 Apr 2014 09:59:22 +0200
240766
Subject: [PATCH 06/12] iscsi: ignore flushes on scsi-generic devices
240766
240766
RH-Author: Fam Zheng <famz@redhat.com>
240766
Message-id: <1397469562-5050-1-git-send-email-famz@redhat.com>
240766
Patchwork-id: 58458
240766
O-Subject: [RHEL-7 0day qemu-kvm PATCH v2 6/7] iscsi: ignore flushes on scsi-generic devices
240766
Bugzilla: 1090978
240766
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
240766
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
240766
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
240766
240766
From: Paolo Bonzini <pbonzini@redhat.com>
240766
240766
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1083413
240766
Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7342452
240766
240766
Non-block SCSI devices do not support flushing, but we may still send
240766
them requests via bdrv_flush_all.  Just ignore them.
240766
240766
Reviewed-by: Peter Lieven <pl@kamp.de>
240766
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
240766
(cherry picked from commit b2f9c08a4f11f16ec101e95feab8e71d7cfcfee9)
240766
Signed-off-by: Fam Zheng <famz@redhat.com>
240766
240766
Conflicts:
240766
	block/iscsi.c
240766
        Because upstream iscsi driver is converted to coroutine while
240766
        downstream is aio. So the bdrv_flush code is different.
240766
240766
---
240766
v2: Schedule BH instead of returning NULL (which is interpreted as error
240766
for AIO). (Thanks Kevin)
240766
240766
Signed-off-by: Fam Zheng <famz@redhat.com>
240766
---
240766
 block/iscsi.c | 10 ++++++++++
240766
 1 file changed, 10 insertions(+)
240766
240766
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
240766
---
240766
 block/iscsi.c |   10 ++++++++++
240766
 1 files changed, 10 insertions(+), 0 deletions(-)
240766
240766
diff --git a/block/iscsi.c b/block/iscsi.c
240766
index 268da2f..b80ebd3 100644
240766
--- a/block/iscsi.c
240766
+++ b/block/iscsi.c
240766
@@ -617,6 +617,16 @@ iscsi_aio_flush(BlockDriverState *bs,
240766
     acb->iscsilun    = iscsilun;
240766
     acb->retries     = ISCSI_CMD_RETRIES;
240766
 
240766
+    if (bs->sg) {
240766
+        acb->canceled = 0;
240766
+        acb->status = 0;
240766
+        acb->bh = NULL;
240766
+        acb->buf = NULL;
240766
+        acb->task = NULL;
240766
+        iscsi_schedule_bh(acb);
240766
+        return &acb->common;
240766
+    }
240766
+
240766
     if (iscsi_aio_flush_acb(acb) != 0) {
240766
         qemu_aio_release(acb);
240766
         return NULL;
240766
-- 
240766
1.7.1
240766