Blame SOURCES/kvm-pr-helper-fix-assertion-failure-on-failed-multipath-.patch

357786
From ffe4cdcc9b82668410476d565961821515dde5b1 Mon Sep 17 00:00:00 2001
357786
From: Paolo Bonzini <pbonzini@redhat.com>
357786
Date: Fri, 6 Jul 2018 17:56:52 +0200
357786
Subject: [PATCH 18/89] pr-helper: fix assertion failure on failed multipath
357786
 PERSISTENT RESERVE IN
357786
MIME-Version: 1.0
357786
Content-Type: text/plain; charset=UTF-8
357786
Content-Transfer-Encoding: 8bit
357786
357786
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
357786
Message-id: <20180706175659.30615-3-pbonzini@redhat.com>
357786
Patchwork-id: 81246
357786
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 2/9] pr-helper: fix assertion failure on failed multipath PERSISTENT RESERVE IN
357786
Bugzilla: 1533158
357786
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
357786
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
357786
RH-Acked-by: Michal Privoznik <mprivozn@redhat.com>
357786
357786
The response size is expected to be zero if the SCSI status is not
357786
"GOOD", but nothing was resetting it.
357786
357786
This can be reproduced simply by "sg_persist -s /dev/sdb" where /dev/sdb
357786
in the guest is a scsi-block device corresponding to a multipath device
357786
on the host.
357786
357786
Before:
357786
357786
  PR in (Read full status): Aborted command
357786
357786
and on the host:
357786
357786
  prh_write_response: Assertion `resp->sz == 0' failed.
357786
357786
After:
357786
357786
  PR in (Read full status): bad field in cdb or parameter list
357786
  (perhaps unsupported service action)
357786
357786
Reported-by: Jiri Belka <jbelka@redhat.com>
357786
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
357786
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
357786
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
357786
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
357786
(cherry picked from commit 86933b4e7879e427e03365bf352c0964640cb37b)
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 scsi/qemu-pr-helper.c | 6 +++++-
357786
 1 file changed, 5 insertions(+), 1 deletion(-)
357786
357786
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
357786
index 19887f5..3961023 100644
357786
--- a/scsi/qemu-pr-helper.c
357786
+++ b/scsi/qemu-pr-helper.c
357786
@@ -547,7 +547,11 @@ static int do_pr_in(int fd, const uint8_t *cdb, uint8_t *sense,
357786
 #ifdef CONFIG_MPATH
357786
     if (is_mpath(fd)) {
357786
         /* multipath_pr_in fills the whole input buffer.  */
357786
-        return multipath_pr_in(fd, cdb, sense, data, *resp_sz);
357786
+        int r = multipath_pr_in(fd, cdb, sense, data, *resp_sz);
357786
+        if (r != GOOD) {
357786
+            *resp_sz = 0;
357786
+        }
357786
+        return r;
357786
     }
357786
 #endif
357786
 
357786
-- 
357786
1.8.3.1
357786