cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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