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

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