jwboyer pushed to kernel (f20). "Fix iscsi with QNAP devices (rhbz 1208999)"

notifications at fedoraproject.org notifications at fedoraproject.org
Fri Apr 24 14:00:11 UTC 2015


>From 85d983710e69b443d1a96de686440fbf5c65b858 Mon Sep 17 00:00:00 2001
From: Josh Boyer <jwboyer at fedoraproject.org>
Date: Fri, 24 Apr 2015 09:47:26 -0400
Subject: Fix iscsi with QNAP devices (rhbz 1208999)


diff --git a/SCSI-add-1024-max-sectors-black-list-flag.patch b/SCSI-add-1024-max-sectors-black-list-flag.patch
new file mode 100644
index 0000000..ae942b4
--- /dev/null
+++ b/SCSI-add-1024-max-sectors-black-list-flag.patch
@@ -0,0 +1,95 @@
+From: Mike Christie <michaelc at cs.wisc.edu>
+Date: Tue, 21 Apr 2015 03:42:24 -0400
+Subject: [PATCH] SCSI: add 1024 max sectors black list flag
+
+This works around a issue with qnap iscsi targets not handling large IOs
+very well.
+
+The target returns:
+
+VPD INQUIRY: Block limits page (SBC)
+  Maximum compare and write length: 1 blocks
+  Optimal transfer length granularity: 1 blocks
+  Maximum transfer length: 4294967295 blocks
+  Optimal transfer length: 4294967295 blocks
+  Maximum prefetch, xdread, xdwrite transfer length: 0 blocks
+  Maximum unmap LBA count: 8388607
+  Maximum unmap block descriptor count: 1
+  Optimal unmap granularity: 16383
+  Unmap granularity alignment valid: 0
+  Unmap granularity alignment: 0
+  Maximum write same length: 0xffffffff blocks
+  Maximum atomic transfer length: 0
+  Atomic alignment: 0
+  Atomic transfer length granularity: 0
+
+and it is *sometimes* able to handle at least one IO of size up to 8 MB. We
+have seen in traces where it will sometimes work, but other times it
+looks like it fails and it looks like it returns failures if we send
+multiple large IOs sometimes. Also it looks like it can return 2 different
+errors. It will sometimes send iscsi reject errors indicating out of
+resources or it will send invalid cdb illegal requests check conditions.
+And then when it sends iscsi rejects it does not seem to handle retries
+when there are command sequence holes, so I could not just add code to
+try and gracefully handle that error code.
+
+The problem is that we do not have a good contact for the company,
+so we are not able to determine under what conditions it returns
+which error and why it sometimes works.
+
+So, this patch just adds a new black list flag to set targets like this to
+the old max safe sectors of 1024. The max_hw_sectors changes added in 3.19
+caused this regression, so I also ccing stable.
+
+Reported-by: Christian Hesse <list at eworm.de>
+Signed-off-by: Mike Christie <michaelc at cs.wisc.edu>
+Cc: stable at vger.kernel.org
+---
+ drivers/scsi/scsi_devinfo.c | 1 +
+ drivers/scsi/scsi_scan.c    | 6 ++++++
+ include/scsi/scsi_devinfo.h | 1 +
+ 3 files changed, 8 insertions(+)
+
+diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
+index 262ab837a704..9f77d23239a2 100644
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -226,6 +226,7 @@ static struct {
+ 	{"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
+ 	{"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC},
+ 	{"Promise", "", NULL, BLIST_SPARSELUN},
++	{"QNAP", "iSCSI Storage", NULL, BLIST_MAX_1024},
+ 	{"QUANTUM", "XP34301", "1071", BLIST_NOTQ},
+ 	{"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN},
+ 	{"SanDisk", "ImageMate CF-SD1", NULL, BLIST_FORCELUN},
+diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
+index 983aed10ff2f..cc662c98d2b6 100644
+--- a/drivers/scsi/scsi_scan.c
++++ b/drivers/scsi/scsi_scan.c
+@@ -909,6 +909,12 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
+ 	 */
+ 	if (*bflags & BLIST_MAX_512)
+ 		blk_queue_max_hw_sectors(sdev->request_queue, 512);
++	/*
++	 * Max 1024 sector transfer length for targets that report incorrect
++	 * max/optimal lengths and relied on the old block layer safe default
++	 */
++	else if (*bflags & BLIST_MAX_1024)
++		blk_queue_max_hw_sectors(sdev->request_queue, 1024);
+ 
+ 	/*
+ 	 * Some devices may not want to have a start command automatically
+diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
+index 183eaab7c380..96e3f56519e7 100644
+--- a/include/scsi/scsi_devinfo.h
++++ b/include/scsi/scsi_devinfo.h
+@@ -36,5 +36,6 @@
+ 					     for sequential scan */
+ #define BLIST_TRY_VPD_PAGES	0x10000000 /* Attempt to read VPD pages */
+ #define BLIST_NO_RSOC		0x20000000 /* don't try to issue RSOC */
++#define BLIST_MAX_1024		0x40000000 /* maximum 1024 sector cdb length */
+ 
+ #endif
+-- 
+2.1.0
+
diff --git a/kernel.spec b/kernel.spec
index 8d194aa..bed0187 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -778,6 +778,9 @@ Patch26180: HID-logitech-hidpp-add-a-module-parameter-to-keep-fi.patch
 #rhbz 1205083
 Patch26181: 0001-iwlwifi-mvm-remove-WARN_ON-for-invalid-BA-notificati.patch
 
+#rhbz 1208999
+Patch26182: SCSI-add-1024-max-sectors-black-list-flag.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1525,6 +1528,9 @@ ApplyPatch HID-logitech-hidpp-add-a-module-parameter-to-keep-fi.patch
 #rhbz 1205083
 ApplyPatch 0001-iwlwifi-mvm-remove-WARN_ON-for-invalid-BA-notificati.patch
 
+#rhbz 1208999
+ApplyPatch SCSI-add-1024-max-sectors-black-list-flag.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2336,6 +2342,9 @@ fi
 #                 ||----w |
 #                 ||     ||
 %changelog
+* Fri Apr 24 2015 Josh Boyer <jwboyer at fedoraproject.org>
+- Fix iscsi with QNAP devices (rhbz 1208999)
+
 * Thu Apr 23 2015 Laura Abbott <labbott at fedoraproject.com>
 - Fix noisy iwlwifi warning (rhbz 1205083)
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/kernel.git/commit/?h=f20&id=85d983710e69b443d1a96de686440fbf5c65b858


More information about the scm-commits mailing list