7955262
From 79abe2bd501d628b165f323098d6972d69bd13d7 Mon Sep 17 00:00:00 2001
7955262
From: Hans de Goede <hdegoede@redhat.com>
7955262
Date: Wed, 16 Mar 2016 13:20:51 +0100
7955262
Subject: [PATCH] uas: Limit qdepth at the scsi-host level
7955262
7955262
Commit 64d513ac31bd ("scsi: use host wide tags by default") causes
7955262
the scsi-core to queue more cmnds then we can handle on devices with
7955262
multiple LUNs, limit the qdepth at the scsi-host level instead of
7955262
per slave to fix this.
7955262
7955262
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1315013
7955262
Cc: stable@vger.kernel.org # 4.4.x and 4.5.x
7955262
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
7955262
---
7955262
 drivers/usb/storage/uas.c | 7 ++++++-
7955262
 1 file changed, 6 insertions(+), 1 deletion(-)
7955262
7955262
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
7955262
index c90a7e4..b5cb7ab 100644
7955262
--- a/drivers/usb/storage/uas.c
7955262
+++ b/drivers/usb/storage/uas.c
7955262
@@ -800,7 +800,6 @@ static int uas_slave_configure(struct scsi_device *sdev)
7955262
 	if (devinfo->flags & US_FL_BROKEN_FUA)
7955262
 		sdev->broken_fua = 1;
7955262
 
7955262
-	scsi_change_queue_depth(sdev, devinfo->qdepth - 2);
7955262
 	return 0;
7955262
 }
7955262
 
7955262
@@ -932,6 +931,12 @@ static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id)
7955262
 	if (result)
7955262
 		goto set_alt0;
7955262
 
7955262
+	/*
7955262
+	 * 1 tag is reserved for untagged commands +
7955262
+	 * 1 tag to avoid of by one errors in some bridge firmwares
7955262
+	 */
7955262
+	shost->can_queue = devinfo->qdepth - 2;
7955262
+
7955262
 	usb_set_intfdata(intf, shost);
7955262
 	result = scsi_add_host(shost, &intf->dev);
7955262
 	if (result)
7955262
-- 
7955262
2.7.3
7955262