Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2015-06-11 11:27:07 +0200
committerHannes Reinecke <hare@suse.de>2015-06-11 11:27:07 +0200
commitcb4c719ef4909982d3c3a734d3aacd6c591ce317 (patch)
tree3c31d0ebb95f8fd8d399fe2aa8e99bee7d4616ca
parentf64b71ddde1b981d44edb6b5e40b5768e90d4b3f (diff)
scsi: Debug sg tablesize mismatch (bsc#933782).
-rw-r--r--patches.suse/scsi-Debug-sg-tablesize-mismatch.patch47
-rw-r--r--series.conf1
2 files changed, 48 insertions, 0 deletions
diff --git a/patches.suse/scsi-Debug-sg-tablesize-mismatch.patch b/patches.suse/scsi-Debug-sg-tablesize-mismatch.patch
new file mode 100644
index 0000000000..cfed3da376
--- /dev/null
+++ b/patches.suse/scsi-Debug-sg-tablesize-mismatch.patch
@@ -0,0 +1,47 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Thu, 11 Jun 2015 11:18:23 +0200
+Subject: [PATCH] scsi: Debug sg tablesize mismatch
+References: bsc#933782
+Patch-Mainline: n/a
+
+After a multipath failover we're seeing mysterious BUG_ON()
+triggers in scsi_init_sgtable(), which can only be explained
+by a request segment count mismatch.
+For debugging recount the rq segments and issue a warning
+if a mismatch occurs. The mismatch is fixed up afterwards,
+so the BUG_ON() statement later on is avoided.
+
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_lib.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
+index c61dbe4..db7180f 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -992,7 +992,20 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
+ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb,
+ gfp_t gfp_mask)
+ {
+- int count;
++ int count = 0;
++ struct bio_vec *bvec;
++ struct req_iterator iter;
++
++ rq_for_each_segment(bvec, req, iter)
++ count++;
++
++ if (count > req->nr_phys_segments) {
++ printk(KERN_WARNING "%s: sg tablesize mismatch, "
++ "%d should be %d\n", __func__,
++ count, req->nr_phys_segments);
++ blk_dump_rq_flags(req, __func__);
++ req->nr_phys_segments = count;
++ }
+
+ /*
+ * If sg table allocation fails, requeue request later.
+--
+1.8.5.2
+
diff --git a/series.conf b/series.conf
index 355231b04c..e1c47810ab 100644
--- a/series.conf
+++ b/series.conf
@@ -7640,6 +7640,7 @@
# SCSI update for SP4
patches.fixes/scsi-enclosure-fix-WARN_ON-in-dual-path-device-remov.patch
patches.fixes/scsi-enclosure-handle-non-unique-element-descriptors.patch
+ patches.suse/scsi-Debug-sg-tablesize-mismatch.patch
# NVMe backport (FATE#313627)
patches.drivers/nvme-0001-New-driver.patch