From: Greg Kroah-Hartman Date: Mon, 7 Jul 2014 03:04:54 +0000 (-0700) Subject: 3.15-stable patches X-Git-Tag: v3.4.98~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=662a4f327e301253c6f6c7b2ee26f949c847303a;p=thirdparty%2Fkernel%2Fstable-queue.git 3.15-stable patches added patches: scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch usb-storage-scsi-add-broken_fua-blacklist-flag.patch --- diff --git a/queue-3.10/series b/queue-3.10/series new file mode 100644 index 00000000000..e69de29bb2d diff --git a/queue-3.14/series b/queue-3.14/series new file mode 100644 index 00000000000..e69de29bb2d diff --git a/queue-3.15/scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch b/queue-3.15/scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch new file mode 100644 index 00000000000..11f82a5eaa5 --- /dev/null +++ b/queue-3.15/scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch @@ -0,0 +1,48 @@ +From 5616b0a46ed82eb9a093f752fc4d7bd3cc688583 Mon Sep 17 00:00:00 2001 +From: "Martin K. Petersen" +Date: Tue, 24 Jun 2014 16:59:35 +0200 +Subject: SCSI: use the scsi data buffer length to extract transfer size + +From: "Martin K. Petersen" + +commit 5616b0a46ed82eb9a093f752fc4d7bd3cc688583 upstream. + +Commit 8846bab180fa introduced a helper that can be used to query the +wire transfer size for a SCSI command taking protection information into +account. + +However, some commands do not have a 1:1 mapping between the block range +they work on and the payload size (discard, write same). After the +scatterlist has been set up these requests use __data_len to store the +number of bytes to report completion on. This means that callers of +scsi_transfer_length() would get the wrong byte count for these types of +requests. + +To overcome this we make scsi_transfer_length() use the scatterlist +length in the scsi_data_buffer as basis for the wire transfer +calculation instead of __data_len. + +Reported-by: Christoph Hellwig +Debugged-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Christoph Hellwig +Reviewed-by: Sagi Grimberg +Fixes: d77e65350f2d82dfa0557707d505711f5a43c8fd +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + include/scsi/scsi_cmnd.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/scsi/scsi_cmnd.h ++++ b/include/scsi/scsi_cmnd.h +@@ -309,7 +309,7 @@ static inline void set_driver_byte(struc + + static inline unsigned scsi_transfer_length(struct scsi_cmnd *scmd) + { +- unsigned int xfer_len = blk_rq_bytes(scmd->request); ++ unsigned int xfer_len = scsi_out(scmd)->length; + unsigned int prot_op = scsi_get_prot_op(scmd); + unsigned int sector_size = scmd->device->sector_size; + diff --git a/queue-3.15/series b/queue-3.15/series new file mode 100644 index 00000000000..6ed8d4c48ba --- /dev/null +++ b/queue-3.15/series @@ -0,0 +1,2 @@ +scsi-use-the-scsi-data-buffer-length-to-extract-transfer-size.patch +usb-storage-scsi-add-broken_fua-blacklist-flag.patch diff --git a/queue-3.15/usb-storage-scsi-add-broken_fua-blacklist-flag.patch b/queue-3.15/usb-storage-scsi-add-broken_fua-blacklist-flag.patch new file mode 100644 index 00000000000..e105069f108 --- /dev/null +++ b/queue-3.15/usb-storage-scsi-add-broken_fua-blacklist-flag.patch @@ -0,0 +1,97 @@ +From b14bf2d0c0358140041d1c1805a674376964d0e0 Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Mon, 30 Jun 2014 11:04:21 -0400 +Subject: usb-storage/SCSI: Add broken_fua blacklist flag +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alan Stern + +commit b14bf2d0c0358140041d1c1805a674376964d0e0 upstream. + +Some buggy JMicron USB-ATA bridges don't know how to translate the FUA +bit in READs or WRITEs. This patch adds an entry in unusual_devs.h +and a blacklist flag to tell the sd driver not to use FUA. + +Signed-off-by: Alan Stern +Reported-by: Michael Büsch +Tested-by: Michael Büsch +Acked-by: James Bottomley +CC: Matthew Dharm +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/sd.c | 5 ++++- + drivers/usb/storage/scsiglue.c | 4 ++++ + drivers/usb/storage/unusual_devs.h | 7 +++++++ + include/linux/usb_usual.h | 4 +++- + include/scsi/scsi_device.h | 1 + + 5 files changed, 19 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -2455,7 +2455,10 @@ sd_read_cache_type(struct scsi_disk *sdk + } + + sdkp->DPOFUA = (data.device_specific & 0x10) != 0; +- if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { ++ if (sdp->broken_fua) { ++ sd_first_printk(KERN_NOTICE, sdkp, "Disabling FUA\n"); ++ sdkp->DPOFUA = 0; ++ } else if (sdkp->DPOFUA && !sdkp->device->use_10_for_rw) { + sd_first_printk(KERN_NOTICE, sdkp, + "Uses READ/WRITE(6), disabling FUA\n"); + sdkp->DPOFUA = 0; +--- a/drivers/usb/storage/scsiglue.c ++++ b/drivers/usb/storage/scsiglue.c +@@ -256,6 +256,10 @@ static int slave_configure(struct scsi_d + if (us->fflags & US_FL_WRITE_CACHE) + sdev->wce_default_on = 1; + ++ /* A few buggy USB-ATA bridges don't understand FUA */ ++ if (us->fflags & US_FL_BROKEN_FUA) ++ sdev->broken_fua = 1; ++ + } else { + + /* Non-disk-type devices don't need to blacklist any pages +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1936,6 +1936,13 @@ UNUSUAL_DEV( 0x14cd, 0x6600, 0x0201, 0x + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE ), + ++/* Reported by Michael Büsch */ ++UNUSUAL_DEV( 0x152d, 0x0567, 0x0114, 0x0114, ++ "JMicron", ++ "USB to ATA/ATAPI Bridge", ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, ++ US_FL_BROKEN_FUA ), ++ + /* Reported by Alexandre Oliva + * JMicron responds to USN and several other SCSI ioctls with a + * residue that causes subsequent I/O requests to fail. */ +--- a/include/linux/usb_usual.h ++++ b/include/linux/usb_usual.h +@@ -70,7 +70,9 @@ + US_FLAG(NEEDS_CAP16, 0x00400000) \ + /* cannot handle READ_CAPACITY_10 */ \ + US_FLAG(IGNORE_UAS, 0x00800000) \ +- /* Device advertises UAS but it is broken */ ++ /* Device advertises UAS but it is broken */ \ ++ US_FLAG(BROKEN_FUA, 0x01000000) \ ++ /* Cannot handle FUA in WRITE or READ CDBs */ \ + + #define US_FLAG(name, value) US_FL_##name = value , + enum { US_DO_ALL_FLAGS }; +--- a/include/scsi/scsi_device.h ++++ b/include/scsi/scsi_device.h +@@ -173,6 +173,7 @@ struct scsi_device { + unsigned is_visible:1; /* is the device visible in sysfs */ + unsigned wce_default_on:1; /* Cache is ON by default */ + unsigned no_dif:1; /* T10 PI (DIF) should be disabled */ ++ unsigned broken_fua:1; /* Don't set FUA bit */ + + atomic_t disk_events_disable_depth; /* disable depth for disk events */ + diff --git a/queue-3.4/series b/queue-3.4/series new file mode 100644 index 00000000000..e69de29bb2d