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

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