From 033b5a7215c7efb348bb7fd74e443cbccfd6b4f7 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 12 Sep 2014 17:37:02 -0700 Subject: [PATCH] 3.16-stable patches added patches: drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch fix-regression-in-scsi_ioctl_send_command.patch scsi-add-a-blacklist-flag-which-enables-vpd-page-inquiries.patch scsi-do-not-issue-scsi-rsoc-command-to-promise-vtrak-e610f.patch scsi-save-command-pool-address-of-scsi_host.patch scsi_scan-restrict-sequential-scan-to-256-luns.patch scsi_transport_srp-fix-fast_io_fail_tmo-dev_loss_tmo-off-behavior.patch --- ...ts-to-reflect-the-values-on-the-host.patch | 103 ++++++++++++++++++ ...ectly-handle-test_unit_ready-failure.patch | 38 +++++++ ...ased-on-the-storage-protocol-version.patch | 49 +++++++++ ...g-in-handling-vmbus-protocol-version.patch | 55 ++++++++++ ...-reflect-value-supported-by-the-host.patch | 31 ++++++ ...i-storvsc-set-srb_flags-in-all-cases.patch | 56 ++++++++++ ...egression-in-scsi_ioctl_send_command.patch | 54 +++++++++ ...lag-which-enables-vpd-page-inquiries.patch | 76 +++++++++++++ ...-rsoc-command-to-promise-vtrak-e610f.patch | 63 +++++++++++ ...ve-command-pool-address-of-scsi_host.patch | 66 +++++++++++ ...restrict-sequential-scan-to-256-luns.patch | 56 ++++++++++ ...o_fail_tmo-dev_loss_tmo-off-behavior.patch | 40 +++++++ queue-3.16/series | 12 ++ 13 files changed, 699 insertions(+) create mode 100644 queue-3.16/drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch create mode 100644 queue-3.16/drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch create mode 100644 queue-3.16/drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch create mode 100644 queue-3.16/drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch create mode 100644 queue-3.16/drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch create mode 100644 queue-3.16/drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch create mode 100644 queue-3.16/fix-regression-in-scsi_ioctl_send_command.patch create mode 100644 queue-3.16/scsi-add-a-blacklist-flag-which-enables-vpd-page-inquiries.patch create mode 100644 queue-3.16/scsi-do-not-issue-scsi-rsoc-command-to-promise-vtrak-e610f.patch create mode 100644 queue-3.16/scsi-save-command-pool-address-of-scsi_host.patch create mode 100644 queue-3.16/scsi_scan-restrict-sequential-scan-to-256-luns.patch create mode 100644 queue-3.16/scsi_transport_srp-fix-fast_io_fail_tmo-dev_loss_tmo-off-behavior.patch diff --git a/queue-3.16/drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch b/queue-3.16/drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch new file mode 100644 index 00000000000..8b2267de52d --- /dev/null +++ b/queue-3.16/drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch @@ -0,0 +1,103 @@ +From 4cd83ecdac20d30725b4f96e5d7814a1e290bc7e Mon Sep 17 00:00:00 2001 +From: "K. Y. Srinivasan" +Date: Sat, 12 Jul 2014 09:48:26 -0700 +Subject: Drivers: scsi: storvsc: Change the limits to reflect the values on the host + +From: "K. Y. Srinivasan" + +commit 4cd83ecdac20d30725b4f96e5d7814a1e290bc7e upstream. + +Hyper-V hosts can support multiple targets and multiple channels and larger number of +LUNs per target. Update the code to reflect this. With this patch we can correctly +enumerate all the paths in a multi-path storage environment. + +Signed-off-by: K. Y. Srinivasan +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/storvsc_drv.c | 51 +++++++++++++++++++++++++++++---------------- + 1 file changed, 33 insertions(+), 18 deletions(-) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -331,17 +331,17 @@ static int storvsc_timeout = 180; + + static void storvsc_on_channel_callback(void *context); + +-/* +- * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In +- * reality, the path/target is not used (ie always set to 0) so our +- * scsi host adapter essentially has 1 bus with 1 target that contains +- * up to 256 luns. +- */ +-#define STORVSC_MAX_LUNS_PER_TARGET 64 +-#define STORVSC_MAX_TARGETS 1 +-#define STORVSC_MAX_CHANNELS 1 +- +- ++#define STORVSC_MAX_LUNS_PER_TARGET 255 ++#define STORVSC_MAX_TARGETS 2 ++#define STORVSC_MAX_CHANNELS 8 ++ ++#define STORVSC_FC_MAX_LUNS_PER_TARGET 255 ++#define STORVSC_FC_MAX_TARGETS 128 ++#define STORVSC_FC_MAX_CHANNELS 8 ++ ++#define STORVSC_IDE_MAX_LUNS_PER_TARGET 64 ++#define STORVSC_IDE_MAX_TARGETS 1 ++#define STORVSC_IDE_MAX_CHANNELS 1 + + struct storvsc_cmd_request { + struct list_head entry; +@@ -1713,7 +1713,6 @@ static struct scsi_host_template scsi_dr + .slave_destroy = storvsc_device_destroy, + .slave_configure = storvsc_device_configure, + .cmd_per_lun = 1, +- /* 64 max_queue * 1 target */ + .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS, + .this_id = -1, + /* no use setting to 0 since ll_blk_rw reset it to 1 */ +@@ -1778,6 +1777,9 @@ static int storvsc_probe(struct hv_devic + } + + ++ if (dev_id->driver_data == SFC_GUID) ++ scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS * ++ STORVSC_FC_MAX_TARGETS); + host = scsi_host_alloc(&scsi_driver, + sizeof(struct hv_host_device)); + if (!host) +@@ -1811,12 +1813,25 @@ static int storvsc_probe(struct hv_devic + host_dev->path = stor_device->path_id; + host_dev->target = stor_device->target_id; + +- /* max # of devices per target */ +- host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; +- /* max # of targets per channel */ +- host->max_id = STORVSC_MAX_TARGETS; +- /* max # of channels */ +- host->max_channel = STORVSC_MAX_CHANNELS - 1; ++ switch (dev_id->driver_data) { ++ case SFC_GUID: ++ host->max_lun = STORVSC_FC_MAX_LUNS_PER_TARGET; ++ host->max_id = STORVSC_FC_MAX_TARGETS; ++ host->max_channel = STORVSC_FC_MAX_CHANNELS - 1; ++ break; ++ ++ case SCSI_GUID: ++ host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; ++ host->max_id = STORVSC_MAX_TARGETS; ++ host->max_channel = STORVSC_MAX_CHANNELS - 1; ++ break; ++ ++ default: ++ host->max_lun = STORVSC_IDE_MAX_LUNS_PER_TARGET; ++ host->max_id = STORVSC_IDE_MAX_TARGETS; ++ host->max_channel = STORVSC_IDE_MAX_CHANNELS - 1; ++ break; ++ } + /* max cmd length */ + host->max_cmd_len = STORVSC_MAX_CMD_LEN; + diff --git a/queue-3.16/drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch b/queue-3.16/drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch new file mode 100644 index 00000000000..a57450cb09e --- /dev/null +++ b/queue-3.16/drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch @@ -0,0 +1,38 @@ +From 3533f8603d28b77c62d75ec899449a99bc6b77a1 Mon Sep 17 00:00:00 2001 +From: "K. Y. Srinivasan" +Date: Sat, 12 Jul 2014 09:48:32 -0700 +Subject: drivers: scsi: storvsc: Correctly handle TEST_UNIT_READY failure + +From: "K. Y. Srinivasan" + +commit 3533f8603d28b77c62d75ec899449a99bc6b77a1 upstream. + +On some Windows hosts on FC SANs, TEST_UNIT_READY can return SRB_STATUS_ERROR. +Correctly handle this. Note that there is sufficient sense information to +support scsi error handling even in this case. + +Signed-off-by: K. Y. Srinivasan +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/storvsc_drv.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1018,6 +1018,13 @@ static void storvsc_handle_error(struct + case ATA_12: + set_host_byte(scmnd, DID_PASSTHROUGH); + break; ++ /* ++ * On Some Windows hosts TEST_UNIT_READY command can return ++ * SRB_STATUS_ERROR, let the upper level code deal with it ++ * based on the sense information. ++ */ ++ case TEST_UNIT_READY: ++ break; + default: + set_host_byte(scmnd, DID_TARGET_FAILURE); + } diff --git a/queue-3.16/drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch b/queue-3.16/drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch new file mode 100644 index 00000000000..3d68cb2c56d --- /dev/null +++ b/queue-3.16/drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch @@ -0,0 +1,49 @@ +From 8caf92d80526f3d7cc96831ec18b384ebcaccdf0 Mon Sep 17 00:00:00 2001 +From: "K. Y. Srinivasan" +Date: Sat, 12 Jul 2014 09:48:28 -0700 +Subject: Drivers: scsi: storvsc: Filter commands based on the storage protocol version + +From: "K. Y. Srinivasan" + +commit 8caf92d80526f3d7cc96831ec18b384ebcaccdf0 upstream. + +Going forward it is possible that some of the commands that are not currently +implemented will be implemented on future Windows hosts. Even if they are not +implemented, we are told the host will corrrectly handle unsupported +commands (by returning appropriate return code and sense information). +Make command filtering depend on the host version. + +Signed-off-by: K. Y. Srinivasan +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/storvsc_drv.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1564,9 +1564,19 @@ static int storvsc_queuecommand(struct S + struct vmscsi_request *vm_srb; + struct stor_mem_pools *memp = scmnd->device->hostdata; + +- if (!storvsc_scsi_cmd_ok(scmnd)) { +- scmnd->scsi_done(scmnd); +- return 0; ++ if (vmstor_current_major <= VMSTOR_WIN8_MAJOR) { ++ /* ++ * On legacy hosts filter unimplemented commands. ++ * Future hosts are expected to correctly handle ++ * unsupported commands. Furthermore, it is ++ * possible that some of the currently ++ * unsupported commands maybe supported in ++ * future versions of the host. ++ */ ++ if (!storvsc_scsi_cmd_ok(scmnd)) { ++ scmnd->scsi_done(scmnd); ++ return 0; ++ } + } + + request_size = sizeof(struct storvsc_cmd_request); diff --git a/queue-3.16/drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch b/queue-3.16/drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch new file mode 100644 index 00000000000..c787fd8fd7d --- /dev/null +++ b/queue-3.16/drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch @@ -0,0 +1,55 @@ +From adb6f9e1a8c6af1037232b59edb11277471537ea Mon Sep 17 00:00:00 2001 +From: "K. Y. Srinivasan" +Date: Sat, 12 Jul 2014 09:48:29 -0700 +Subject: Drivers: scsi: storvsc: Fix a bug in handling VMBUS protocol version + +From: "K. Y. Srinivasan" + +commit adb6f9e1a8c6af1037232b59edb11277471537ea upstream. + +Based on the negotiated VMBUS protocol version, we adjust the size of the storage +protocol messages. The two sizes we currently handle are pre-win8 and post-win8. +In WS2012 R2, we are negotiating higher VMBUS protocol version than the win8 +version. Make adjustments to correctly handle this. + +Signed-off-by: K. Y. Srinivasan +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/storvsc_drv.c | 17 ++++++++++------- + 1 file changed, 10 insertions(+), 7 deletions(-) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1764,19 +1764,22 @@ static int storvsc_probe(struct hv_devic + * set state to properly communicate with the host. + */ + +- if (vmbus_proto_version == VERSION_WIN8) { +- sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; +- vmscsi_size_delta = 0; +- vmstor_current_major = VMSTOR_WIN8_MAJOR; +- vmstor_current_minor = VMSTOR_WIN8_MINOR; +- } else { ++ switch (vmbus_proto_version) { ++ case VERSION_WS2008: ++ case VERSION_WIN7: + sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; + vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); + vmstor_current_major = VMSTOR_WIN7_MAJOR; + vmstor_current_minor = VMSTOR_WIN7_MINOR; ++ break; ++ default: ++ sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; ++ vmscsi_size_delta = 0; ++ vmstor_current_major = VMSTOR_WIN8_MAJOR; ++ vmstor_current_minor = VMSTOR_WIN8_MINOR; ++ break; + } + +- + if (dev_id->driver_data == SFC_GUID) + scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS * + STORVSC_FC_MAX_TARGETS); diff --git a/queue-3.16/drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch b/queue-3.16/drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch new file mode 100644 index 00000000000..1d31549a0dd --- /dev/null +++ b/queue-3.16/drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch @@ -0,0 +1,31 @@ +From 52f9614dd8294e95d2c0929c2d4f64b077ae486f Mon Sep 17 00:00:00 2001 +From: "K. Y. Srinivasan" +Date: Sat, 12 Jul 2014 09:48:27 -0700 +Subject: Drivers: scsi: storvsc: Set cmd_per_lun to reflect value supported by the Host + +From: "K. Y. Srinivasan" + +commit 52f9614dd8294e95d2c0929c2d4f64b077ae486f upstream. + +Set cmd_per_lun to reflect value supported by the Host. + +Signed-off-by: K. Y. Srinivasan +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/storvsc_drv.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1712,7 +1712,7 @@ static struct scsi_host_template scsi_dr + .slave_alloc = storvsc_device_alloc, + .slave_destroy = storvsc_device_destroy, + .slave_configure = storvsc_device_configure, +- .cmd_per_lun = 1, ++ .cmd_per_lun = 255, + .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS, + .this_id = -1, + /* no use setting to 0 since ll_blk_rw reset it to 1 */ diff --git a/queue-3.16/drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch b/queue-3.16/drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch new file mode 100644 index 00000000000..8f79c26e5c2 --- /dev/null +++ b/queue-3.16/drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch @@ -0,0 +1,56 @@ +From f885fb73f64154690c2158e813de56363389ffec Mon Sep 17 00:00:00 2001 +From: "K. Y. Srinivasan" +Date: Sat, 12 Jul 2014 09:48:31 -0700 +Subject: drivers: scsi: storvsc: Set srb_flags in all cases + +From: "K. Y. Srinivasan" + +commit f885fb73f64154690c2158e813de56363389ffec upstream. + +Correctly set SRB flags for all valid I/O directions. Some IHV drivers on the +Windows host require this. The host validates the command and SRB flags +prior to passing the command down to native driver stack. + +Signed-off-by: K. Y. Srinivasan +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/storvsc_drv.c | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) + +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -1601,26 +1601,24 @@ static int storvsc_queuecommand(struct S + vm_srb = &cmd_request->vstor_packet.vm_srb; + vm_srb->win8_extension.time_out_value = 60; + ++ vm_srb->win8_extension.srb_flags |= ++ (SRB_FLAGS_QUEUE_ACTION_ENABLE | ++ SRB_FLAGS_DISABLE_SYNCH_TRANSFER); + + /* Build the SRB */ + switch (scmnd->sc_data_direction) { + case DMA_TO_DEVICE: + vm_srb->data_in = WRITE_TYPE; + vm_srb->win8_extension.srb_flags |= SRB_FLAGS_DATA_OUT; +- vm_srb->win8_extension.srb_flags |= +- (SRB_FLAGS_QUEUE_ACTION_ENABLE | +- SRB_FLAGS_DISABLE_SYNCH_TRANSFER); + break; + case DMA_FROM_DEVICE: + vm_srb->data_in = READ_TYPE; + vm_srb->win8_extension.srb_flags |= SRB_FLAGS_DATA_IN; +- vm_srb->win8_extension.srb_flags |= +- (SRB_FLAGS_QUEUE_ACTION_ENABLE | +- SRB_FLAGS_DISABLE_SYNCH_TRANSFER); + break; + default: + vm_srb->data_in = UNKNOWN_TYPE; +- vm_srb->win8_extension.srb_flags = 0; ++ vm_srb->win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN | ++ SRB_FLAGS_DATA_OUT); + break; + } + diff --git a/queue-3.16/fix-regression-in-scsi_ioctl_send_command.patch b/queue-3.16/fix-regression-in-scsi_ioctl_send_command.patch new file mode 100644 index 00000000000..1750d12bf1c --- /dev/null +++ b/queue-3.16/fix-regression-in-scsi_ioctl_send_command.patch @@ -0,0 +1,54 @@ +From 2ba136daa3ae1e881c9f586f283fcaa164767dce Mon Sep 17 00:00:00 2001 +From: Tony Battersby +Date: Fri, 22 Aug 2014 15:53:35 -0400 +Subject: fix regression in SCSI_IOCTL_SEND_COMMAND + +From: Tony Battersby + +commit 2ba136daa3ae1e881c9f586f283fcaa164767dce upstream. + +blk_rq_set_block_pc() memsets rq->cmd to 0, so it should come +immediately after blk_get_request() to avoid overwriting the +user-supplied CDB. Also check for failure to allocate rq. + +Fixes: f27b087b81b7 ("block: add blk_rq_set_block_pc()") +Signed-off-by: Tony Battersby +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman + +--- + block/scsi_ioctl.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/block/scsi_ioctl.c ++++ b/block/scsi_ioctl.c +@@ -438,6 +438,11 @@ int sg_scsi_ioctl(struct request_queue * + } + + rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); ++ if (!rq) { ++ err = -ENOMEM; ++ goto error; ++ } ++ blk_rq_set_block_pc(rq); + + cmdlen = COMMAND_SIZE(opcode); + +@@ -491,7 +496,6 @@ int sg_scsi_ioctl(struct request_queue * + memset(sense, 0, sizeof(sense)); + rq->sense = sense; + rq->sense_len = 0; +- blk_rq_set_block_pc(rq); + + blk_execute_rq(q, disk, rq, 0); + +@@ -511,7 +515,8 @@ out: + + error: + kfree(buffer); +- blk_put_request(rq); ++ if (rq) ++ blk_put_request(rq); + return err; + } + EXPORT_SYMBOL_GPL(sg_scsi_ioctl); diff --git a/queue-3.16/scsi-add-a-blacklist-flag-which-enables-vpd-page-inquiries.patch b/queue-3.16/scsi-add-a-blacklist-flag-which-enables-vpd-page-inquiries.patch new file mode 100644 index 00000000000..5c83bbe3c4b --- /dev/null +++ b/queue-3.16/scsi-add-a-blacklist-flag-which-enables-vpd-page-inquiries.patch @@ -0,0 +1,76 @@ +From c1d40a527e885a40bb9ea6c46a1b1145d42b66a0 Mon Sep 17 00:00:00 2001 +From: "Martin K. Petersen" +Date: Tue, 15 Jul 2014 12:49:17 -0400 +Subject: scsi: add a blacklist flag which enables VPD page inquiries + +From: "Martin K. Petersen" + +commit c1d40a527e885a40bb9ea6c46a1b1145d42b66a0 upstream. + +Despite supporting modern SCSI features some storage devices continue to +claim conformance to an older version of the SPC spec. This is done for +compatibility with legacy operating systems. + +Linux by default will not attempt to read VPD pages on devices that +claim SPC-2 or older. Introduce a blacklist flag that can be used to +trigger VPD page inquiries on devices that are known to support them. + +Reported-by: KY Srinivasan +Tested-by: KY Srinivasan +Reviewed-by: KY Srinivasan +Signed-off-by: Martin K. Petersen +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi_scan.c | 4 +++- + drivers/scsi/sd.c | 5 +++++ + include/scsi/scsi_device.h | 1 + + include/scsi/scsi_devinfo.h | 1 + + 4 files changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/scsi_scan.c ++++ b/drivers/scsi/scsi_scan.c +@@ -950,7 +950,9 @@ static int scsi_add_lun(struct scsi_devi + + sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT; + +- if (*bflags & BLIST_SKIP_VPD_PAGES) ++ if (*bflags & BLIST_TRY_VPD_PAGES) ++ sdev->try_vpd_pages = 1; ++ else if (*bflags & BLIST_SKIP_VPD_PAGES) + sdev->skip_vpd_pages = 1; + + transport_configure_device(&sdev->sdev_gendev); +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -2681,6 +2681,11 @@ static void sd_read_write_same(struct sc + + static int sd_try_extended_inquiry(struct scsi_device *sdp) + { ++ /* Attempt VPD inquiry if the device blacklist explicitly calls ++ * for it. ++ */ ++ if (sdp->try_vpd_pages) ++ return 1; + /* + * Although VPD inquiries can go to SCSI-2 type devices, + * some USB ones crash on receiving them, and the pages +--- a/include/scsi/scsi_device.h ++++ b/include/scsi/scsi_device.h +@@ -155,6 +155,7 @@ struct scsi_device { + unsigned skip_ms_page_8:1; /* do not use MODE SENSE page 0x08 */ + unsigned skip_ms_page_3f:1; /* do not use MODE SENSE page 0x3f */ + unsigned skip_vpd_pages:1; /* do not read VPD pages */ ++ unsigned try_vpd_pages:1; /* attempt to read VPD pages */ + unsigned use_192_bytes_for_3f:1; /* ask for 192 bytes from page 0x3f */ + unsigned no_start_on_add:1; /* do not issue start on add */ + unsigned allow_restart:1; /* issue START_UNIT in error handler */ +--- a/include/scsi/scsi_devinfo.h ++++ b/include/scsi/scsi_devinfo.h +@@ -34,4 +34,5 @@ + #define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */ + #define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs + for sequential scan */ ++#define BLIST_TRY_VPD_PAGES 0x10000000 /* Attempt to read VPD pages */ + #endif diff --git a/queue-3.16/scsi-do-not-issue-scsi-rsoc-command-to-promise-vtrak-e610f.patch b/queue-3.16/scsi-do-not-issue-scsi-rsoc-command-to-promise-vtrak-e610f.patch new file mode 100644 index 00000000000..b0d994c7b3c --- /dev/null +++ b/queue-3.16/scsi-do-not-issue-scsi-rsoc-command-to-promise-vtrak-e610f.patch @@ -0,0 +1,63 @@ +From 0213436a2cc5e4a5ca2fabfaa4d3877097f3b13f Mon Sep 17 00:00:00 2001 +From: Janusz Dziemidowicz +Date: Thu, 24 Jul 2014 15:48:46 +0200 +Subject: scsi: do not issue SCSI RSOC command to Promise Vtrak E610f + +From: Janusz Dziemidowicz + +commit 0213436a2cc5e4a5ca2fabfaa4d3877097f3b13f upstream. + +Some devices don't like REPORT SUPPORTED OPERATION CODES and will +simply timeout causing sd_mod init to take a very very long time. +Introduce BLIST_NO_RSOC scsi scan flag, that stops RSOC from being +issued. Add it to Promise Vtrak E610f entry in scsi scan +blacklist. Fixes bug #79901 reported at +https://bugzilla.kernel.org/show_bug.cgi?id=79901 + +Fixes: 98dcc2946adb ("SCSI: sd: Update WRITE SAME heuristics") + +Signed-off-by: Janusz Dziemidowicz +Reviewed-by: Martin K. Petersen +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi_devinfo.c | 1 + + drivers/scsi/scsi_scan.c | 6 ++++++ + include/scsi/scsi_devinfo.h | 2 ++ + 3 files changed, 9 insertions(+) + +--- a/drivers/scsi/scsi_devinfo.c ++++ b/drivers/scsi/scsi_devinfo.c +@@ -222,6 +222,7 @@ static struct { + {"PIONEER", "CD-ROM DRM-602X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, + {"PIONEER", "CD-ROM DRM-604X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, + {"PIONEER", "CD-ROM DRM-624X", NULL, BLIST_FORCELUN | BLIST_SINGLELUN}, ++ {"Promise", "VTrak E610f", NULL, BLIST_SPARSELUN | BLIST_NO_RSOC}, + {"Promise", "", NULL, BLIST_SPARSELUN}, + {"QUANTUM", "XP34301", "1071", BLIST_NOTQ}, + {"REGAL", "CDC-4X", NULL, BLIST_MAX5LUN | BLIST_SINGLELUN}, +--- a/drivers/scsi/scsi_scan.c ++++ b/drivers/scsi/scsi_scan.c +@@ -922,6 +922,12 @@ static int scsi_add_lun(struct scsi_devi + if (*bflags & BLIST_USE_10_BYTE_MS) + sdev->use_10_for_ms = 1; + ++ /* some devices don't like REPORT SUPPORTED OPERATION CODES ++ * and will simply timeout causing sd_mod init to take a very ++ * very long time */ ++ if (*bflags & BLIST_NO_RSOC) ++ sdev->no_report_opcodes = 1; ++ + /* set the device running here so that slave configure + * may do I/O */ + ret = scsi_device_set_state(sdev, SDEV_RUNNING); +--- a/include/scsi/scsi_devinfo.h ++++ b/include/scsi/scsi_devinfo.h +@@ -35,4 +35,6 @@ + #define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs + 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 */ ++ + #endif diff --git a/queue-3.16/scsi-save-command-pool-address-of-scsi_host.patch b/queue-3.16/scsi-save-command-pool-address-of-scsi_host.patch new file mode 100644 index 00000000000..3728c3d86ee --- /dev/null +++ b/queue-3.16/scsi-save-command-pool-address-of-scsi_host.patch @@ -0,0 +1,66 @@ +From f6105c0808880c2c432b79bc81b37cc244c300c8 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Mon, 4 Aug 2014 13:30:02 +0200 +Subject: SCSI: save command pool address of Scsi_Host + +From: Juergen Gross + +commit f6105c0808880c2c432b79bc81b37cc244c300c8 upstream. + +If a scsi host driver specifies .cmd_len in it's scsi_host_template, a driver's +private command pool is needed. scsi_find_host_cmd_pool() will locate it, but +scsi_alloc_host_cmd_pool() isn't saving the pool address in the host template. + +This will result in an access error when the host is removed. + +Avoid the problem by saving the address of a new allocated command pool where +it is expected. + +Signed-off-by: Juergen Gross +Reviewed-by: Hannes Reinecke +Signed-off-by: Christoph Hellwig +Fixes: 89d9a567952baec13e26ada3e438f1b642d66b6e +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/scsi.c ++++ b/drivers/scsi/scsi.c +@@ -380,6 +380,10 @@ scsi_alloc_host_cmd_pool(struct Scsi_Hos + pool->slab_flags |= SLAB_CACHE_DMA; + pool->gfp_mask = __GFP_DMA; + } ++ ++ if (hostt->cmd_size) ++ hostt->cmd_pool = pool; ++ + return pool; + } + +@@ -424,8 +428,10 @@ out: + out_free_slab: + kmem_cache_destroy(pool->cmd_slab); + out_free_pool: +- if (hostt->cmd_size) ++ if (hostt->cmd_size) { + scsi_free_host_cmd_pool(pool); ++ hostt->cmd_pool = NULL; ++ } + goto out; + } + +@@ -447,8 +453,10 @@ static void scsi_put_host_cmd_pool(struc + if (!--pool->users) { + kmem_cache_destroy(pool->cmd_slab); + kmem_cache_destroy(pool->sense_slab); +- if (hostt->cmd_size) ++ if (hostt->cmd_size) { + scsi_free_host_cmd_pool(pool); ++ hostt->cmd_pool = NULL; ++ } + } + mutex_unlock(&host_cmd_pool_mutex); + } diff --git a/queue-3.16/scsi_scan-restrict-sequential-scan-to-256-luns.patch b/queue-3.16/scsi_scan-restrict-sequential-scan-to-256-luns.patch new file mode 100644 index 00000000000..99d782f3e2a --- /dev/null +++ b/queue-3.16/scsi_scan-restrict-sequential-scan-to-256-luns.patch @@ -0,0 +1,56 @@ +From 22ffeb48b7584d6cd50f2a595ed6065d86a87459 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Tue, 3 Jun 2014 10:58:53 +0200 +Subject: scsi_scan: Restrict sequential scan to 256 LUNs + +From: Hannes Reinecke + +commit 22ffeb48b7584d6cd50f2a595ed6065d86a87459 upstream. + +Sequential scan for more than 256 LUNs is very fragile as +LUNs might not be numbered sequentially after that point. + +SAM revisions later than SCSI-3 impose a structure on +LUNs larger than 256, making LUN numbers between 256 +and 16384 illegal. +SCSI-3, however allows for plain 64-bit numbers with +no internal structure. + +So restrict sequential LUN scan to 256 LUNs and add a +new blacklist flag 'BLIST_SCSI3LUN' to scan up to +max_lun devices. + +Signed-off-by: Hannes Reinecke +Reviewed-by: Ewan Milne +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi_scan.c | 6 ++++++ + include/scsi/scsi_devinfo.h | 2 ++ + 2 files changed, 8 insertions(+) + +--- a/drivers/scsi/scsi_scan.c ++++ b/drivers/scsi/scsi_scan.c +@@ -1239,6 +1239,12 @@ static void scsi_sequential_lun_scan(str + max_dev_lun = min(8U, max_dev_lun); + + /* ++ * Stop scanning at 255 unless BLIST_SCSI3LUN ++ */ ++ if (!(bflags & BLIST_SCSI3LUN)) ++ max_dev_lun = min(256U, max_dev_lun); ++ ++ /* + * We have already scanned LUN 0, so start at LUN 1. Keep scanning + * until we reach the max, or no LUN is found and we are not + * sparse_lun. +--- a/include/scsi/scsi_devinfo.h ++++ b/include/scsi/scsi_devinfo.h +@@ -32,4 +32,6 @@ + #define BLIST_ATTACH_PQ3 0x1000000 /* Scan: Attach to PQ3 devices */ + #define BLIST_NO_DIF 0x2000000 /* Disable T10 PI (DIF) */ + #define BLIST_SKIP_VPD_PAGES 0x4000000 /* Ignore SBC-3 VPD pages */ ++#define BLIST_SCSI3LUN 0x8000000 /* Scan more than 256 LUNs ++ for sequential scan */ + #endif diff --git a/queue-3.16/scsi_transport_srp-fix-fast_io_fail_tmo-dev_loss_tmo-off-behavior.patch b/queue-3.16/scsi_transport_srp-fix-fast_io_fail_tmo-dev_loss_tmo-off-behavior.patch new file mode 100644 index 00000000000..52f8802f5d3 --- /dev/null +++ b/queue-3.16/scsi_transport_srp-fix-fast_io_fail_tmo-dev_loss_tmo-off-behavior.patch @@ -0,0 +1,40 @@ +From cd53eb686d2418eda938aad3c9da42b7dfa9351f Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Wed, 9 Jul 2014 15:56:43 +0200 +Subject: scsi_transport_srp: Fix fast_io_fail_tmo=dev_loss_tmo=off behavior + +From: Bart Van Assche + +commit cd53eb686d2418eda938aad3c9da42b7dfa9351f upstream. + +If scsi_remove_host() is called while an rport is in the blocked state +then scsi_remove_host() will only finish if the rport is unblocked +from inside a timer function. Make sure that an rport only enters the +blocked state if a timer will be started that will unblock it. This +avoids that unloading the ib_srp kernel module after having +disconnected the initiator from the target system results in a +deadlock if both the fast_io_fail_tmo and dev_loss_tmo parameters have +been set to "off". + +Signed-off-by: Bart Van Assche +Reviewed-by: Sagi Grimberg +Reviewed-by: David Dillow +Signed-off-by: Roland Dreier +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi_transport_srp.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/scsi_transport_srp.c ++++ b/drivers/scsi/scsi_transport_srp.c +@@ -473,7 +473,8 @@ static void __srp_start_tl_fail_timers(s + if (delay > 0) + queue_delayed_work(system_long_wq, &rport->reconnect_work, + 1UL * delay * HZ); +- if (srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { ++ if ((fast_io_fail_tmo >= 0 || dev_loss_tmo >= 0) && ++ srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { + pr_debug("%s new state: %d\n", dev_name(&shost->shost_gendev), + rport->state); + scsi_target_block(&shost->shost_gendev); diff --git a/queue-3.16/series b/queue-3.16/series index 8a7ff7ded7f..014fe74473a 100644 --- a/queue-3.16/series +++ b/queue-3.16/series @@ -45,3 +45,15 @@ powerpc-thp-invalidate-with-vpn-in-loop.patch powerpc-thp-use-access_once-when-loading-pmdp.patch scsi-use-short-driver-name-for-per-driver-cmd-slab-caches.patch drivers-scsi-storvsc-implement-a-eh_timed_out-handler.patch +drivers-scsi-storvsc-filter-commands-based-on-the-storage-protocol-version.patch +drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch +drivers-scsi-storvsc-set-cmd_per_lun-to-reflect-value-supported-by-the-host.patch +drivers-scsi-storvsc-fix-a-bug-in-handling-vmbus-protocol-version.patch +drivers-scsi-storvsc-set-srb_flags-in-all-cases.patch +drivers-scsi-storvsc-correctly-handle-test_unit_ready-failure.patch +scsi_scan-restrict-sequential-scan-to-256-luns.patch +scsi-add-a-blacklist-flag-which-enables-vpd-page-inquiries.patch +scsi-do-not-issue-scsi-rsoc-command-to-promise-vtrak-e610f.patch +scsi_transport_srp-fix-fast_io_fail_tmo-dev_loss_tmo-off-behavior.patch +scsi-save-command-pool-address-of-scsi_host.patch +fix-regression-in-scsi_ioctl_send_command.patch -- 2.47.3