Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-02-23 12:40:00 +0100
committerJiri Kosina <jkosina@suse.cz>2018-02-23 12:47:03 +0100
commit2f3fa64f32f8ac2d9fd8f36aae6a31c50a2d41bb (patch)
tree319e74278944e459030e60e5b15bfae5bc787c74
parente6920e9ad29d56fccb83c785af6a565b2ea55e11 (diff)
parenta7c32d796e728769bef2b0528378506746dfc6c0 (diff)
Merge remote-tracking branch 'origin/users/hare/SLE15/for-next' into SLE15
Conflicts: series.conf
-rw-r--r--patches.drivers/dm-mpath-remove-annoying-message-of-blk_get_request-.patch43
-rw-r--r--patches.drivers/qla2xxx-0040-Add-module-parameter-for-interrupt-mode.patch79
-rw-r--r--patches.drivers/scsi-bnx2fc-Simplify-CPU-hotplug-code.patch173
-rw-r--r--patches.drivers/scsi-bnx2i-simplify-cpu-hotplug-code21
-rw-r--r--patches.drivers/scsi-fc-check-for-rport-presence-in-fc_block_scsi_eh.patch41
-rw-r--r--patches.drivers/scsi-scsi_dh-Return-SCSI_DH_XX-error-code-from-attac.patch198
-rw-r--r--patches.drivers/scsi-scsi_dh-suppress-errors-from-unsupported-device.patch109
-rw-r--r--patches.drivers/scsi-scsi_transport_fc-Also-check-for-NOTPRESENT-in-.patch39
-rw-r--r--patches.drivers/scsi-scsi_transport_fc-set-scsi_target_id-upon-resca.patch53
-rw-r--r--patches.fixes/block-Make-q_usage_counter-also-track-legacy-request.patch115
-rw-r--r--patches.fixes/block-fix-blk_rq_append_bio.patch165
-rw-r--r--patches.fixes/cxlflash-get-rid-of-pointless-access_ok.patch33
-rw-r--r--patches.fixes/ibmvscsis-Enable-Logical-Partition-Migration-Support.patch312
-rw-r--r--patches.fixes/ibmvscsis-Use-tpgt-passed-in-by-user.patch46
-rw-r--r--patches.fixes/scsi-Add-AIX-VDASD-to-blacklist.patch31
-rw-r--r--patches.fixes/scsi-Convert-a-strncmp-call-into-a-strcmp-call.patch37
-rw-r--r--patches.fixes/scsi-Document-which-queue-type-a-function-is-intende.patch127
-rw-r--r--patches.fixes/scsi-Fix-the-kerneldoc-for-scsi_initialize_rq.patch38
-rw-r--r--patches.fixes/scsi-ILLEGAL-REQUEST-ASC-27-target-failure.patch38
-rw-r--r--patches.fixes/scsi-Modify-HITACHI-OPEN-V-blacklist.patch30
-rw-r--r--patches.fixes/scsi-Suppress-gcc-7-fall-through-warnings-reported-w.patch114
-rw-r--r--patches.fixes/scsi-Use-blk_mq_rq_to_pdu-to-convert-a-request-to-a-.patch136
-rw-r--r--patches.fixes/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch (renamed from patches.drivers/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch)21
-rw-r--r--patches.fixes/scsi-aacraid-Fix-2T-drives-on-SmartIOC-2000.patch66
-rw-r--r--patches.fixes/scsi-aacraid-Fix-I-O-drop-during-reset.patch53
-rw-r--r--patches.fixes/scsi-aacraid-Perform-initialization-reset-only-once.patch126
-rw-r--r--patches.fixes/scsi-aacraid-Prevent-crash-in-case-of-free-interrupt.patch67
-rw-r--r--patches.fixes/scsi-bnx2fc-Fix-hung-task-messages-when-a-cleanup-re.patch157
-rw-r--r--patches.fixes/scsi-bnx2fc-Plug-CPU-hotplug-race.patch91
-rw-r--r--patches.fixes/scsi-bnx2fc-Prevent-recursive-cpuhotplug-locking.patch63
-rw-r--r--patches.fixes/scsi-bnx2i-Clean-up-unused-pointers-in-bnx2i_hwi.patch87
-rw-r--r--patches.fixes/scsi-csiostor-enable-PCIe-relaxed-ordering-if-suppor.patch71
-rw-r--r--patches.fixes/scsi-cxgb4i-call-neigh_event_send-to-update-MAC-addr.patch34
-rw-r--r--patches.fixes/scsi-cxlflash-Allow-cards-without-WWPN-VPD-to-config.patch101
-rw-r--r--patches.fixes/scsi-cxlflash-Derive-pid-through-accessors.patch59
-rw-r--r--patches.fixes/scsi-cxlflash-Use-derived-maximum-write-same-length.patch66
-rw-r--r--patches.fixes/scsi-devinfo-Apply-to-HP-rebranded-the-same-flags-as.patch51
-rw-r--r--patches.fixes/scsi-devinfo-apply-to-HP-XP-the-same-flags-as-Hitach.patch46
-rw-r--r--patches.fixes/scsi-devinfo-replace-Dell-PV-650F-with-EMC-CLARiiON.patch38
-rw-r--r--patches.fixes/scsi-dh-add-new-rdac-devices.patch52
-rw-r--r--patches.fixes/scsi-do-not-retry-invalid-function-error.patch26
-rw-r--r--patches.fixes/scsi-esas2r-Replace-semaphore-fm_api_semaphore-with-.patch71
-rw-r--r--patches.fixes/scsi-esas2r-Replace-semaphore-fs_api_semaphore-with-.patch80
-rw-r--r--patches.fixes/scsi-esp_scsi-Always-clear-msg_out_len-after-MESSAGE.patch36
-rw-r--r--patches.fixes/scsi-esp_scsi-Avoid-sending-ABORT-TASK-SET-messages.patch136
-rw-r--r--patches.fixes/scsi-esp_scsi-Clean-up-control-flow-and-dead-code.patch150
-rw-r--r--patches.fixes/scsi-fcoe-move-fcoe_interface_remove-out-of-fcoe_int.patch60
-rw-r--r--patches.fixes/scsi-fcoe-open-code-fcoe_destroy_work-for-NETDEV_UNR.patch96
-rw-r--r--patches.fixes/scsi-fcoe-separate-out-fcoe_vport_remove.patch105
-rw-r--r--patches.fixes/scsi-fnic-add-a-space-after-p-in-printf-format.patch40
-rw-r--r--patches.fixes/scsi-hpsa-Fix-configured_logical_drive_count-check.patch38
-rw-r--r--patches.fixes/scsi-hpsa-add-controller-checkpoint.patch51
-rw-r--r--patches.fixes/scsi-hpsa-add-enclosure-logical-identifier.patch130
-rw-r--r--patches.fixes/scsi-hpsa-bump-driver-version.patch32
-rw-r--r--patches.fixes/scsi-hpsa-change-timeout-for-internal-cmds.patch125
-rw-r--r--patches.fixes/scsi-hpsa-cleanup-sas_phy-structures-in-sysfs-when-u.patch58
-rw-r--r--patches.fixes/scsi-hpsa-clear-tmpdevice-in-scan-thread.patch35
-rw-r--r--patches.fixes/scsi-hpsa-correct-logical-volume-removal.patch48
-rw-r--r--patches.fixes/scsi-hpsa-correct-smart-path-enabled.patch370
-rw-r--r--patches.fixes/scsi-hpsa-destroy-sas-transport-properties-before-sc.patch87
-rw-r--r--patches.fixes/scsi-hpsa-fix-spelling-mistake-encrypytion-encryptio.patch33
-rw-r--r--patches.fixes/scsi-hpsa-reduce-warning-messages-on-device-removal.patch40
-rw-r--r--patches.fixes/scsi-hpsa-update-discovery-polling.patch113
-rw-r--r--patches.fixes/scsi-hpsa-update-queue-depth-for-externals.patch41
-rw-r--r--patches.fixes/scsi-hptiop-make-function-hptiop_iop_request_callbac.patch38
-rw-r--r--patches.fixes/scsi-ibmvscsi_tgt-remove-use-of-class_attrs.patch48
-rw-r--r--patches.fixes/scsi-ibmvscsis-Fix-write_pending-failure-path.patch36
-rw-r--r--patches.fixes/scsi-ibmvscsis-add-DRC-indices-to-debug-statements.patch938
-rw-r--r--patches.fixes/scsi-libcxgbi-in-case-of-vlan-pass-0-as-ifindex-to-f.patch39
-rw-r--r--patches.fixes/scsi-libcxgbi-remove-redundant-check-and-close-on-cs.patch36
-rw-r--r--patches.fixes/scsi-libcxgbi-use-ndev-ifindex-to-find-route.patch119
-rw-r--r--patches.fixes/scsi-libiscsi-Fix-use-after-free-race-during-iscsi_s.patch56
-rw-r--r--patches.fixes/scsi-libiscsi-Remove-iscsi_destroy_session.patch61
-rw-r--r--patches.fixes/scsi-libiscsi-use-kvzalloc-for-iscsi_pool_init.patch97
-rw-r--r--patches.fixes/scsi-mpt3sas-Fix-memory-allocation-failure-test-in-m.patch42
-rw-r--r--patches.fixes/scsi-mpt3sas-Proper-handling-of-set-clear-of-ATA-com.patch101
-rw-r--r--patches.fixes/scsi-mpt3sas-fix-format-overflow-warning.patch47
-rw-r--r--patches.fixes/scsi-mvsas-replace-kfree-with-scsi_host_put.patch44
-rw-r--r--patches.fixes/scsi-pmcraid-fix-duplicated-code-for-different-branc.patch39
-rw-r--r--patches.fixes/scsi-pmcraid-use-correct-size-unit-when-calling-find.patch34
-rw-r--r--patches.fixes/scsi-qedf-Fix-error-return-code-in-__qedf_probe.patch49
-rw-r--r--patches.fixes/scsi-scsi-Export-blacklist-flags-to-sysfs.patch120
-rw-r--r--patches.fixes/scsi-scsi_devinfo-Add-scsi_devinfo_tbl.c.patch28
-rw-r--r--patches.fixes/scsi-scsi_error-DID_SOFT_ERROR-comment-clean-up.patch45
-rw-r--r--patches.fixes/scsi-scsi_error-Do-not-retry-illegal-function-error.patch34
-rw-r--r--patches.fixes/scsi-scsi_error-Handle-power-on-reset-unit-attention.patch (renamed from patches.fixes/scsi-Handle-power-on-reset-unit-attention.patch)40
-rw-r--r--patches.fixes/scsi-sd-Align-maximum-write-same-blocks-to-physical-.patch63
-rw-r--r--patches.fixes/scsi-sd-Implement-blacklist-option-for-WRITE-SAME-w-.patch107
-rw-r--r--patches.fixes/scsi-sd-change-allow_restart-to-bool-in-sysfs-interf.patch46
-rw-r--r--patches.fixes/scsi-sd-change-manage_start_stop-to-bool-in-sysfs-in.patch41
-rw-r--r--patches.fixes/scsi-sd_zbc-Fix-comments-and-indentation.patch273
-rw-r--r--patches.fixes/scsi-sd_zbc-Fix-sd_zbc_read_zoned_characteristics.patch50
-rw-r--r--patches.fixes/scsi-sd_zbc-Move-ZBC-declarations-to-scsi_proto.h.patch124
-rw-r--r--patches.fixes/scsi-sd_zbc-Rearrange-code.patch64
-rw-r--r--patches.fixes/scsi-sd_zbc-Use-well-defined-macros.patch63
-rw-r--r--patches.fixes/scsi-sg-off-by-one-in-sg_ioctl.patch35
-rw-r--r--patches.fixes/scsi-sym53c8xx-Avoid-undefined-behaviour.patch40
-rw-r--r--patches.fixes/scsi-ufs-reqs-and-tasks-were-put-in-the-wrong-order.patch30
-rw-r--r--patches.fixes/scsi-virtio-virtio_scsi-Set-can_queue-to-the-length-.patch60
-rw-r--r--patches.suse/dm-mpath-accept-failed-paths4
-rw-r--r--series.conf100
101 files changed, 8210 insertions, 209 deletions
diff --git a/patches.drivers/dm-mpath-remove-annoying-message-of-blk_get_request-.patch b/patches.drivers/dm-mpath-remove-annoying-message-of-blk_get_request-.patch
new file mode 100644
index 0000000000..e7085fdf27
--- /dev/null
+++ b/patches.drivers/dm-mpath-remove-annoying-message-of-blk_get_request-.patch
@@ -0,0 +1,43 @@
+From: Ming Lei <ming.lei@redhat.com>
+Date: Sat, 30 Sep 2017 19:46:48 +0800
+Subject: [PATCH] dm mpath: remove annoying message of 'blk_get_request()
+ returned -11'
+Git-commit: 9dc112e2daf87b40607fd8d357e2d7de32290d45
+Patch-Mainline: v4.15-rc1
+References: bsc#1077989
+
+It is very normal to see allocation failure, especially with blk-mq
+request_queues, so it's unnecessary to report this error and annoy
+people.
+
+In practice this 'blk_get_request() returned -11' error gets logged
+quite frequently when a blk-mq DM multipath device sees heavy IO.
+
+This change is marked for stable@ because the annoying message in
+question was included in stable@ commit 7083abbbf.
+
+Fixes: 7083abbbf ("dm mpath: avoid that path removal can trigger an infinite loop")
+Cc: stable@vger.kernel.org
+Signed-off-by: Ming Lei <ming.lei@redhat.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Acked-by: Hannes Reinecke <hare@suse.com>
+---
+ drivers/md/dm-mpath.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
+index 11f273d2f018..e8094d8fbe0d 100644
+--- a/drivers/md/dm-mpath.c
++++ b/drivers/md/dm-mpath.c
+@@ -499,8 +499,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,
+ if (IS_ERR(clone)) {
+ /* EBUSY, ENODEV or EWOULDBLOCK: requeue */
+ bool queue_dying = blk_queue_dying(q);
+- DMERR_LIMIT("blk_get_request() returned %ld%s - requeuing",
+- PTR_ERR(clone), queue_dying ? " (path offline)" : "");
+ if (queue_dying) {
+ atomic_inc(&m->pg_init_in_progress);
+ activate_or_offline_path(pgpath);
+--
+2.12.3
+
diff --git a/patches.drivers/qla2xxx-0040-Add-module-parameter-for-interrupt-mode.patch b/patches.drivers/qla2xxx-0040-Add-module-parameter-for-interrupt-mode.patch
deleted file mode 100644
index 01b25603bd..0000000000
--- a/patches.drivers/qla2xxx-0040-Add-module-parameter-for-interrupt-mode.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From: Joe Carnuccio <joe.carnuccio@qlogic.com>
-Date: Tue, 9 Apr 2013 14:37:30 -0700
-Subject: qla2xxx: Add module parameter for interrupt mode.
-References: bnc#853689,FATE#315933
-Patch-Mainline: queued in scsi-misc for v3.14
-
-[hare: patch needs validation; not present in 4.4]
-
-Signed-off-by: Joe Carnuccio <joe.carnuccio@qlogic.com>
-Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
-Acked-by: Hannes Reinecke <hare@suse.de>
----
- drivers/scsi/qla2xxx/qla_gbl.h | 1 +
- drivers/scsi/qla2xxx/qla_isr.c | 10 +++++++---
- drivers/scsi/qla2xxx/qla_os.c | 8 ++++++++
- 3 files changed, 16 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
-index 7686bfe..3e5254d 100644
---- a/drivers/scsi/qla2xxx/qla_gbl.h
-+++ b/drivers/scsi/qla2xxx/qla_gbl.h
-@@ -104,6 +104,7 @@ extern int ql2xextended_error_logging;
- extern int ql2xiidmaenable;
- extern int ql2xmaxqueues;
- extern int ql2xmultique_tag;
-+extern int ql2xenablemsix;
- extern int ql2xfwloadbin;
- extern int ql2xetsenable;
- extern int ql2xshiftctondsd;
-diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
-index ccf6a7f..ce8de73 100644
---- a/drivers/scsi/qla2xxx/qla_isr.c
-+++ b/drivers/scsi/qla2xxx/qla_isr.c
-@@ -3110,9 +3110,10 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
- scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
-
- /* If possible, enable MSI-X. */
-- if (!IS_QLA2432(ha) && !IS_QLA2532(ha) && !IS_QLA8432(ha) &&
-- !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha) && !IS_QLAFX00(ha) &&
-- !IS_QLA27XX(ha))
-+ if (ql2xenablemsix == 0 || (!IS_QLA2432(ha) && !IS_QLA2532(ha) &&
-+ !IS_QLA8432(ha) && !IS_CNA_CAPABLE(ha) &&
-+ !IS_QLA2031(ha) && !IS_QLAFX00(ha) &&
-+ !IS_QLA27XX(ha)))
- goto skip_msi;
-
- if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
-@@ -3126,6 +3127,9 @@ qla2x00_request_irqs(struct qla_hw_data *ha, struct rsp_que *rsp)
- goto skip_msi;
- }
-
-+ if (ql2xenablemsix == 2)
-+ goto skip_msix;
-+
- if (IS_QLA2432(ha) && (ha->pdev->revision < QLA_MSIX_CHIP_REV_24XX)) {
- ql_log(ql_log_warn, vha, 0x0035,
- "MSI-X; Unsupported ISP2432 (0x%X, 0x%X).\n",
-diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
-index bfa9a64..4e06bc1 100644
---- a/drivers/scsi/qla2xxx/qla_os.c
-+++ b/drivers/scsi/qla2xxx/qla_os.c
-@@ -155,6 +155,14 @@ MODULE_PARM_DESC(ql2xmultique_tag,
- "Default is 0 for no affinity of request and response IO. "
- "Set it to 1 to turn on the cpu affinity.");
-
-+int ql2xenablemsix = 1;
-+module_param(ql2xenablemsix, int, S_IRUGO);
-+MODULE_PARM_DESC(ql2xenablemsix,
-+ "Set to enable MSI or MSI-X interrupt mechanism."
-+ " Default is 1, enable MSI-X interrupt mechanism."
-+ " 0 -- enable traditional pin-based mechanism."
-+ " 1 -- enable MSI-X interrupt mechanism."
-+ " 2 -- enable MSI interrupt mechanism.");
- int ql2xfwloadbin;
- module_param(ql2xfwloadbin, int, S_IRUGO|S_IWUSR);
- MODULE_PARM_DESC(ql2xfwloadbin,
---
-1.8.5.6
-
diff --git a/patches.drivers/scsi-bnx2fc-Simplify-CPU-hotplug-code.patch b/patches.drivers/scsi-bnx2fc-Simplify-CPU-hotplug-code.patch
new file mode 100644
index 0000000000..1a1e50fc2b
--- /dev/null
+++ b/patches.drivers/scsi-bnx2fc-Simplify-CPU-hotplug-code.patch
@@ -0,0 +1,173 @@
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 24 Jul 2017 12:52:59 +0200
+Subject: [PATCH] scsi: bnx2fc: Simplify CPU hotplug code
+Git-commit: 1937f8a29f4a650bc27e0311b43b53509a34fd22
+Patch-mainline: v4.13-rc6
+References: bsc#1077989
+
+The CPU hotplug related code of this driver can be simplified by:
+
+1) Consolidating the callbacks into a single state. The CPU thread can be
+ torn down on the CPU which goes offline. There is no point in delaying
+ that to the CPU dead state
+
+2) Let the core code invoke the online/offline callbacks and remove the
+ extra for_each_online_cpu() loops.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Acked-by: Hannes Reinecke <hare@suse.com>
+---
+ drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 69 +++++++++------------------------------
+ include/linux/cpuhotplug.h | 1 -
+ 2 files changed, 15 insertions(+), 55 deletions(-)
+
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+index c4ebf8c5d884..6844ba361616 100644
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+@@ -2624,12 +2624,11 @@ static struct fcoe_transport bnx2fc_transport = {
+ };
+
+ /**
+- * bnx2fc_percpu_thread_create - Create a receive thread for an
+- * online CPU
++ * bnx2fc_cpu_online - Create a receive thread for an online CPU
+ *
+ * @cpu: cpu index for the online cpu
+ */
+-static void bnx2fc_percpu_thread_create(unsigned int cpu)
++static int bnx2fc_cpu_online(unsigned int cpu)
+ {
+ struct bnx2fc_percpu_s *p;
+ struct task_struct *thread;
+@@ -2639,15 +2638,17 @@ static void bnx2fc_percpu_thread_create(unsigned int cpu)
+ thread = kthread_create_on_node(bnx2fc_percpu_io_thread,
+ (void *)p, cpu_to_node(cpu),
+ "bnx2fc_thread/%d", cpu);
++ if (IS_ERR(thread))
++ return PTR_ERR(thread);
++
+ /* bind thread to the cpu */
+- if (likely(!IS_ERR(thread))) {
+- kthread_bind(thread, cpu);
+- p->iothread = thread;
+- wake_up_process(thread);
+- }
++ kthread_bind(thread, cpu);
++ p->iothread = thread;
++ wake_up_process(thread);
++ return 0;
+ }
+
+-static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
++static int bnx2fc_cpu_offline(unsigned int cpu)
+ {
+ struct bnx2fc_percpu_s *p;
+ struct task_struct *thread;
+@@ -2661,7 +2662,6 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
+ thread = p->iothread;
+ p->iothread = NULL;
+
+-
+ /* Free all work in the list */
+ list_for_each_entry_safe(work, tmp, &p->work_list, list) {
+ list_del_init(&work->list);
+@@ -2673,20 +2673,6 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
+
+ if (thread)
+ kthread_stop(thread);
+-}
+-
+-
+-static int bnx2fc_cpu_online(unsigned int cpu)
+-{
+- printk(PFX "CPU %x online: Create Rx thread\n", cpu);
+- bnx2fc_percpu_thread_create(cpu);
+- return 0;
+-}
+-
+-static int bnx2fc_cpu_dead(unsigned int cpu)
+-{
+- printk(PFX "CPU %x offline: Remove Rx thread\n", cpu);
+- bnx2fc_percpu_thread_destroy(cpu);
+ return 0;
+ }
+
+@@ -2761,31 +2747,16 @@ static int __init bnx2fc_mod_init(void)
+ spin_lock_init(&p->fp_work_lock);
+ }
+
+- get_online_cpus();
+-
+- for_each_online_cpu(cpu)
+- bnx2fc_percpu_thread_create(cpu);
+-
+- rc = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN,
+- "scsi/bnx2fc:online",
+- bnx2fc_cpu_online, NULL);
++ rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "scsi/bnx2fc:online",
++ bnx2fc_cpu_online, bnx2fc_cpu_offline);
+ if (rc < 0)
+- goto stop_threads;
++ goto stop_thread;
+ bnx2fc_online_state = rc;
+
+- cpuhp_setup_state_nocalls_cpuslocked(CPUHP_SCSI_BNX2FC_DEAD,
+- "scsi/bnx2fc:dead",
+- NULL, bnx2fc_cpu_dead);
+- put_online_cpus();
+-
+ cnic_register_driver(CNIC_ULP_FCOE, &bnx2fc_cnic_cb);
+-
+ return 0;
+
+-stop_threads:
+- for_each_online_cpu(cpu)
+- bnx2fc_percpu_thread_destroy(cpu);
+- put_online_cpus();
++stop_thread:
+ kthread_stop(l2_thread);
+ free_wq:
+ destroy_workqueue(bnx2fc_wq);
+@@ -2804,7 +2775,6 @@ static void __exit bnx2fc_mod_exit(void)
+ struct fcoe_percpu_s *bg;
+ struct task_struct *l2_thread;
+ struct sk_buff *skb;
+- unsigned int cpu = 0;
+
+ /*
+ * NOTE: Since cnic calls register_driver routine rtnl_lock,
+@@ -2845,16 +2815,7 @@ static void __exit bnx2fc_mod_exit(void)
+ if (l2_thread)
+ kthread_stop(l2_thread);
+
+- get_online_cpus();
+- /* Destroy per cpu threads */
+- for_each_online_cpu(cpu) {
+- bnx2fc_percpu_thread_destroy(cpu);
+- }
+-
+- cpuhp_remove_state_nocalls_cpuslocked(bnx2fc_online_state);
+- cpuhp_remove_state_nocalls_cpuslocked(CPUHP_SCSI_BNX2FC_DEAD);
+-
+- put_online_cpus();
++ cpuhp_remove_state(bnx2fc_online_state);
+
+ destroy_workqueue(bnx2fc_wq);
+ /*
+diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
+index b56573bf440d..2e7b1731ad12 100644
+--- a/include/linux/cpuhotplug.h
++++ b/include/linux/cpuhotplug.h
+@@ -39,7 +39,6 @@ enum cpuhp_state {
+ CPUHP_PCI_XGENE_DEAD,
+ CPUHP_IOMMU_INTEL_DEAD,
+ CPUHP_LUSTRE_CFS_DEAD,
+- CPUHP_SCSI_BNX2FC_DEAD,
+ CPUHP_SCSI_BNX2I_DEAD,
+ CPUHP_WORKQUEUE_PREP,
+ CPUHP_POWER_NUMA_PREPARE,
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-bnx2i-simplify-cpu-hotplug-code b/patches.drivers/scsi-bnx2i-simplify-cpu-hotplug-code
index 886f24209f..564af7afd8 100644
--- a/patches.drivers/scsi-bnx2i-simplify-cpu-hotplug-code
+++ b/patches.drivers/scsi-bnx2i-simplify-cpu-hotplug-code
@@ -19,10 +19,12 @@ Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Lee Duncan <lduncan@suse.com>
---
- drivers/scsi/bnx2i/bnx2i_init.c | 65 +++++++++-------------------------------
- include/linux/cpuhotplug.h | 1
+ drivers/scsi/bnx2i/bnx2i_init.c | 65 ++++++++++-------------------------------
+ include/linux/cpuhotplug.h | 1 -
2 files changed, 15 insertions(+), 51 deletions(-)
+diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c
+index 7487b653e799..4ebcda8d9500 100644
--- a/drivers/scsi/bnx2i/bnx2i_init.c
+++ b/drivers/scsi/bnx2i/bnx2i_init.c
@@ -404,12 +404,11 @@ int bnx2i_get_stats(void *handle)
@@ -40,7 +42,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
{
struct bnx2i_percpu_s *p;
struct task_struct *thread;
-@@ -419,16 +418,17 @@ static void bnx2i_percpu_thread_create(u
+@@ -419,16 +418,17 @@ static void bnx2i_percpu_thread_create(unsigned int cpu)
thread = kthread_create_on_node(bnx2i_percpu_io_thread, (void *)p,
cpu_to_node(cpu),
"bnx2i_thread/%d", cpu);
@@ -65,7 +67,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
{
struct bnx2i_percpu_s *p;
struct task_struct *thread;
-@@ -451,19 +451,6 @@ static void bnx2i_percpu_thread_destroy(
+@@ -451,19 +451,6 @@ static void bnx2i_percpu_thread_destroy(unsigned int cpu)
spin_unlock_bh(&p->p_work_lock);
if (thread)
kthread_stop(thread);
@@ -118,7 +120,7 @@ Acked-by: Lee Duncan <lduncan@suse.com>
cnic_unregister_driver(CNIC_ULP_ISCSI);
unreg_xport:
iscsi_unregister_transport(&bnx2i_iscsi_transport);
-@@ -552,7 +525,6 @@ out:
+@@ -552,7 +525,6 @@ static int __init bnx2i_mod_init(void)
static void __exit bnx2i_mod_exit(void)
{
struct bnx2i_hba *hba;
@@ -142,13 +144,18 @@ Acked-by: Lee Duncan <lduncan@suse.com>
iscsi_unregister_transport(&bnx2i_iscsi_transport);
cnic_unregister_driver(CNIC_ULP_ISCSI);
+diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
+index 2e7b1731ad12..82b30e638430 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
-@@ -40,7 +40,6 @@ enum cpuhp_state {
+@@ -39,7 +39,6 @@ enum cpuhp_state {
+ CPUHP_PCI_XGENE_DEAD,
CPUHP_IOMMU_INTEL_DEAD,
CPUHP_LUSTRE_CFS_DEAD,
- CPUHP_SCSI_BNX2FC_DEAD,
- CPUHP_SCSI_BNX2I_DEAD,
CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE,
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-fc-check-for-rport-presence-in-fc_block_scsi_eh.patch b/patches.drivers/scsi-fc-check-for-rport-presence-in-fc_block_scsi_eh.patch
new file mode 100644
index 0000000000..75297b4905
--- /dev/null
+++ b/patches.drivers/scsi-fc-check-for-rport-presence-in-fc_block_scsi_eh.patch
@@ -0,0 +1,41 @@
+From: Johannes Thumshirn <jthumshirn@suse.de>
+Date: Tue, 10 Oct 2017 17:31:38 +0200
+Subject: [PATCH] scsi: fc: check for rport presence in fc_block_scsi_eh
+References: bsc#1077989
+Git-commit: 8d30371fd7c328e192d7ea3108bd71b903631d6a
+Patch-mainline: v4.14-rc6
+
+Coverity-scan recently found a possible NULL pointer dereference in
+fc_block_scsi_eh() as starget_to_rport() either returns the rport for
+the startget or NULL.
+
+While it is rather unlikely to have fc_block_scsi_eh() called without an
+rport associated it's a good idea to catch potential misuses of the API
+gracefully.
+
+Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
+Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_transport_fc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
+index ad5c60d0f026..dbdd2d63a086 100644
+--- a/drivers/scsi/scsi_transport_fc.c
++++ b/drivers/scsi/scsi_transport_fc.c
+@@ -3319,6 +3319,9 @@ int fc_block_scsi_eh(struct scsi_cmnd *cmnd)
+ {
+ struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
+
++ if (WARN_ON_ONCE(!rport))
++ return FAST_IO_FAIL;
++
+ return fc_block_rport(rport);
+ }
+ EXPORT_SYMBOL(fc_block_scsi_eh);
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-scsi_dh-Return-SCSI_DH_XX-error-code-from-attac.patch b/patches.drivers/scsi-scsi_dh-Return-SCSI_DH_XX-error-code-from-attac.patch
new file mode 100644
index 0000000000..f0401927db
--- /dev/null
+++ b/patches.drivers/scsi-scsi_dh-Return-SCSI_DH_XX-error-code-from-attac.patch
@@ -0,0 +1,198 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Wed, 20 Sep 2017 09:18:51 +0200
+Subject: [PATCH] scsi: scsi_dh: Return SCSI_DH_XX error code from ->attach()
+References: bsc#1077989
+Git-commit: 2a8f7a0344c8b068cf4b13f1bf4bdd65b8787d04
+Patch-mainline: v4.15-rc1
+
+Rather than having each device handler implementing their own error
+mapping, have the ->attach() call return a SCSI_DH_XXX error code and
+implement the mapping in scsi_dh_handler_attach().
+
+Suggested-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/device_handler/scsi_dh_alua.c | 10 ++++------
+ drivers/scsi/device_handler/scsi_dh_emc.c | 6 +++---
+ drivers/scsi/device_handler/scsi_dh_hp_sw.c | 12 ++++++++----
+ drivers/scsi/device_handler/scsi_dh_rdac.c | 6 +++---
+ drivers/scsi/scsi_dh.c | 17 ++++++++++++++---
+ 5 files changed, 32 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
+index 0962fd544401..fd22dc6ab5d9 100644
+--- a/drivers/scsi/device_handler/scsi_dh_alua.c
++++ b/drivers/scsi/device_handler/scsi_dh_alua.c
+@@ -1085,11 +1085,11 @@ static void alua_rescan(struct scsi_device *sdev)
+ static int alua_bus_attach(struct scsi_device *sdev)
+ {
+ struct alua_dh_data *h;
+- int err, ret = -EINVAL;
++ int err;
+
+ h = kzalloc(sizeof(*h) , GFP_KERNEL);
+ if (!h)
+- return -ENOMEM;
++ return SCSI_DH_NOMEM;
+ spin_lock_init(&h->pg_lock);
+ rcu_assign_pointer(h->pg, NULL);
+ h->init_error = SCSI_DH_OK;
+@@ -1098,16 +1098,14 @@ static int alua_bus_attach(struct scsi_device *sdev)
+
+ mutex_init(&h->init_mutex);
+ err = alua_initialize(sdev, h);
+- if (err == SCSI_DH_NOMEM)
+- ret = -ENOMEM;
+ if (err != SCSI_DH_OK && err != SCSI_DH_DEV_OFFLINED)
+ goto failed;
+
+ sdev->handler_data = h;
+- return 0;
++ return SCSI_DH_OK;
+ failed:
+ kfree(h);
+- return ret;
++ return err;
+ }
+
+ /*
+diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
+index 8654e940e1a8..6a2792f3a37e 100644
+--- a/drivers/scsi/device_handler/scsi_dh_emc.c
++++ b/drivers/scsi/device_handler/scsi_dh_emc.c
+@@ -490,7 +490,7 @@ static int clariion_bus_attach(struct scsi_device *sdev)
+
+ h = kzalloc(sizeof(*h) , GFP_KERNEL);
+ if (!h)
+- return -ENOMEM;
++ return SCSI_DH_NOMEM;
+ h->lun_state = CLARIION_LUN_UNINITIALIZED;
+ h->default_sp = CLARIION_UNBOUND_LU;
+ h->current_sp = CLARIION_UNBOUND_LU;
+@@ -510,11 +510,11 @@ static int clariion_bus_attach(struct scsi_device *sdev)
+ h->default_sp + 'A');
+
+ sdev->handler_data = h;
+- return 0;
++ return SCSI_DH_OK;
+
+ failed:
+ kfree(h);
+- return -EINVAL;
++ return err;
+ }
+
+ static void clariion_bus_detach(struct scsi_device *sdev)
+diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
+index 62d314e07d11..e65a0ebb4b54 100644
+--- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
++++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
+@@ -218,24 +218,28 @@ static int hp_sw_bus_attach(struct scsi_device *sdev)
+
+ h = kzalloc(sizeof(*h), GFP_KERNEL);
+ if (!h)
+- return -ENOMEM;
++ return SCSI_DH_NOMEM;
+ h->path_state = HP_SW_PATH_UNINITIALIZED;
+ h->retries = HP_SW_RETRIES;
+ h->sdev = sdev;
+
+ ret = hp_sw_tur(sdev, h);
+- if (ret != SCSI_DH_OK || h->path_state == HP_SW_PATH_UNINITIALIZED)
++ if (ret != SCSI_DH_OK)
+ goto failed;
++ if (h->path_state == HP_SW_PATH_UNINITIALIZED) {
++ ret = SCSI_DH_NOSYS;
++ goto failed;
++ }
+
+ sdev_printk(KERN_INFO, sdev, "%s: attached to %s path\n",
+ HP_SW_NAME, h->path_state == HP_SW_PATH_ACTIVE?
+ "active":"passive");
+
+ sdev->handler_data = h;
+- return 0;
++ return SCSI_DH_OK;
+ failed:
+ kfree(h);
+- return -EINVAL;
++ return ret;
+ }
+
+ static void hp_sw_bus_detach( struct scsi_device *sdev )
+diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
+index 2ceff585f189..7af31a1247ee 100644
+--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
++++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
+@@ -729,7 +729,7 @@ static int rdac_bus_attach(struct scsi_device *sdev)
+
+ h = kzalloc(sizeof(*h) , GFP_KERNEL);
+ if (!h)
+- return -ENOMEM;
++ return SCSI_DH_NOMEM;
+ h->lun = UNINITIALIZED_LUN;
+ h->state = RDAC_STATE_ACTIVE;
+
+@@ -755,7 +755,7 @@ static int rdac_bus_attach(struct scsi_device *sdev)
+ lun_state[(int)h->lun_state]);
+
+ sdev->handler_data = h;
+- return 0;
++ return SCSI_DH_OK;
+
+ clean_ctlr:
+ spin_lock(&list_lock);
+@@ -764,7 +764,7 @@ static int rdac_bus_attach(struct scsi_device *sdev)
+
+ failed:
+ kfree(h);
+- return -EINVAL;
++ return err;
+ }
+
+ static void rdac_bus_detach( struct scsi_device *sdev )
+diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
+index 84addee05be6..ac798d284a7e 100644
+--- a/drivers/scsi/scsi_dh.c
++++ b/drivers/scsi/scsi_dh.c
+@@ -126,20 +126,31 @@ static struct scsi_device_handler *scsi_dh_lookup(const char *name)
+ static int scsi_dh_handler_attach(struct scsi_device *sdev,
+ struct scsi_device_handler *scsi_dh)
+ {
+- int error;
++ int error, ret = 0;
+
+ if (!try_module_get(scsi_dh->module))
+ return -EINVAL;
+
+ error = scsi_dh->attach(sdev);
+- if (error) {
++ if (error != SCSI_DH_OK) {
++ switch (error) {
++ case SCSI_DH_NOMEM:
++ ret = -ENOMEM;
++ break;
++ case SCSI_DH_RES_TEMP_UNAVAIL:
++ ret = -EAGAIN;
++ break;
++ default:
++ ret = -EINVAL;
++ break;
++ }
+ sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
+ scsi_dh->name, error);
+ module_put(scsi_dh->module);
+ } else
+ sdev->handler = scsi_dh;
+
+- return error;
++ return ret;
+ }
+
+ /*
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-scsi_dh-suppress-errors-from-unsupported-device.patch b/patches.drivers/scsi-scsi_dh-suppress-errors-from-unsupported-device.patch
new file mode 100644
index 0000000000..ff7535812b
--- /dev/null
+++ b/patches.drivers/scsi-scsi_dh-suppress-errors-from-unsupported-device.patch
@@ -0,0 +1,109 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Wed, 20 Sep 2017 09:18:52 +0200
+Subject: [PATCH] scsi: scsi_dh: suppress errors from unsupported devices
+References: bsc#1077989
+Git-commit: 2930f817132959254db801fe19e61c477293ad6b
+Patch-mainline: v4.15-rc1
+
+Device handlers are optional, and for some handlers like ALUA only
+implemented for certain device types. So suppress any errors for
+unsupported devices.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_dh.c | 19 +++++++++++++------
+ drivers/scsi/scsi_priv.h | 4 ++--
+ drivers/scsi/scsi_sysfs.c | 8 +-------
+ 3 files changed, 16 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
+index ac798d284a7e..2b785d09d5bd 100644
+--- a/drivers/scsi/scsi_dh.c
++++ b/drivers/scsi/scsi_dh.c
+@@ -140,12 +140,17 @@ static int scsi_dh_handler_attach(struct scsi_device *sdev,
+ case SCSI_DH_RES_TEMP_UNAVAIL:
+ ret = -EAGAIN;
+ break;
++ case SCSI_DH_DEV_UNSUPP:
++ case SCSI_DH_NOSYS:
++ ret = -ENODEV;
++ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+- sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
+- scsi_dh->name, error);
++ if (ret != -ENODEV)
++ sdev_printk(KERN_ERR, sdev, "%s: Attach failed (%d)\n",
++ scsi_dh->name, error);
+ module_put(scsi_dh->module);
+ } else
+ sdev->handler = scsi_dh;
+@@ -164,18 +169,20 @@ static void scsi_dh_handler_detach(struct scsi_device *sdev)
+ module_put(sdev->handler->module);
+ }
+
+-int scsi_dh_add_device(struct scsi_device *sdev)
++void scsi_dh_add_device(struct scsi_device *sdev)
+ {
+ struct scsi_device_handler *devinfo = NULL;
+ const char *drv;
+- int err = 0;
+
+ drv = scsi_dh_find_driver(sdev);
+ if (drv)
+ devinfo = __scsi_dh_lookup(drv);
++ /*
++ * device_handler is optional, so ignore errors
++ * from scsi_dh_handler_attach()
++ */
+ if (devinfo)
+- err = scsi_dh_handler_attach(sdev, devinfo);
+- return err;
++ (void)scsi_dh_handler_attach(sdev, devinfo);
+ }
+
+ void scsi_dh_release_device(struct scsi_device *sdev)
+diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
+index c11c1f9c912c..889f0258e7a5 100644
+--- a/drivers/scsi/scsi_priv.h
++++ b/drivers/scsi/scsi_priv.h
+@@ -176,10 +176,10 @@ extern struct async_domain scsi_sd_probe_domain;
+
+ /* scsi_dh.c */
+ #ifdef CONFIG_SCSI_DH
+-int scsi_dh_add_device(struct scsi_device *sdev);
++void scsi_dh_add_device(struct scsi_device *sdev);
+ void scsi_dh_release_device(struct scsi_device *sdev);
+ #else
+-static inline int scsi_dh_add_device(struct scsi_device *sdev) { return 0; }
++static inline void scsi_dh_add_device(struct scsi_device *sdev) { }
+ static inline void scsi_dh_release_device(struct scsi_device *sdev) { }
+ #endif
+ static inline void scsi_dh_remove_device(struct scsi_device *sdev) { }
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index 4f22f39557fa..8af1f1caf1c5 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -1234,13 +1234,7 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
+
+ scsi_autopm_get_device(sdev);
+
+- error = scsi_dh_add_device(sdev);
+- if (error)
+- /*
+- * device_handler is optional, so any error can be ignored
+- */
+- sdev_printk(KERN_INFO, sdev,
+- "failed to add device handler: %d\n", error);
++ scsi_dh_add_device(sdev);
+
+ error = device_add(&sdev->sdev_gendev);
+ if (error) {
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-scsi_transport_fc-Also-check-for-NOTPRESENT-in-.patch b/patches.drivers/scsi-scsi_transport_fc-Also-check-for-NOTPRESENT-in-.patch
new file mode 100644
index 0000000000..c1e9db3802
--- /dev/null
+++ b/patches.drivers/scsi-scsi_transport_fc-Also-check-for-NOTPRESENT-in-.patch
@@ -0,0 +1,39 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Mon, 25 Sep 2017 13:47:23 +0200
+Subject: [PATCH] scsi: scsi_transport_fc: Also check for NOTPRESENT in
+ fc_remote_port_add()
+References: bsc#1077989
+Git-commit: f091fb8c344ce13cbf058d304c6cbb042be97058
+Patch-mainline: v4.14-rc3
+
+During failover there is a small race window between fc_remote_port_add()
+and fc_timeout_deleted_rport(); the latter drops the lock after setting the
+port to NOTPRESENT, so if fc_remote_port_add() is called right at that time
+it will fail to detect the existing rport and happily adding a new
+structure, causing rports to get registered twice.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_transport_fc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
+index 4182875795cf..ad5c60d0f026 100644
+--- a/drivers/scsi/scsi_transport_fc.c
++++ b/drivers/scsi/scsi_transport_fc.c
+@@ -2740,7 +2740,8 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
+
+ list_for_each_entry(rport, &fc_host->rports, peers) {
+
+- if ((rport->port_state == FC_PORTSTATE_BLOCKED) &&
++ if ((rport->port_state == FC_PORTSTATE_BLOCKED ||
++ rport->port_state == FC_PORTSTATE_NOTPRESENT) &&
+ (rport->channel == channel)) {
+
+ switch (fc_host->tgtid_bind_type) {
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-scsi_transport_fc-set-scsi_target_id-upon-resca.patch b/patches.drivers/scsi-scsi_transport_fc-set-scsi_target_id-upon-resca.patch
new file mode 100644
index 0000000000..cec60d50b8
--- /dev/null
+++ b/patches.drivers/scsi-scsi_transport_fc-set-scsi_target_id-upon-resca.patch
@@ -0,0 +1,53 @@
+From: Hannes Reinecke <hare@suse.com>
+Date: Wed, 20 Sep 2017 08:58:53 +0200
+Subject: [PATCH] scsi: scsi_transport_fc: set scsi_target_id upon rescan
+References: bsc#1077989
+Git-commit: 675195d0be27391d48d8d23c7c62991505168528
+Patch-mainline: v4.14-rc3
+
+When an rport is found in the bindings array there is no guarantee that
+it had been a target port, so we need to call fc_remote_port_rolechg()
+here to ensure the scsi_target_id is set correctly. Otherwise the port
+will never be scanned.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Tested-by: Chad Dupuis <chad.dupuis@cavium.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_transport_fc.c | 11 +----------
+ 1 file changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
+index 6c7d85984822..4182875795cf 100644
+--- a/drivers/scsi/scsi_transport_fc.c
++++ b/drivers/scsi/scsi_transport_fc.c
+@@ -2877,7 +2877,6 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
+ memcpy(&rport->port_name, &ids->port_name,
+ sizeof(rport->port_name));
+ rport->port_id = ids->port_id;
+- rport->roles = ids->roles;
+ rport->port_state = FC_PORTSTATE_ONLINE;
+ rport->flags &= ~FC_RPORT_FAST_FAIL_TIMEDOUT;
+
+@@ -2886,15 +2885,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
+ fci->f->dd_fcrport_size);
+ spin_unlock_irqrestore(shost->host_lock, flags);
+
+- if (ids->roles & FC_PORT_ROLE_FCP_TARGET) {
+- scsi_target_unblock(&rport->dev, SDEV_RUNNING);
+-
+- /* initiate a scan of the target */
+- spin_lock_irqsave(shost->host_lock, flags);
+- rport->flags |= FC_RPORT_SCAN_PENDING;
+- scsi_queue_work(shost, &rport->scan_work);
+- spin_unlock_irqrestore(shost->host_lock, flags);
+- }
++ fc_remote_port_rolechg(rport, ids->roles);
+ return rport;
+ }
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/block-Make-q_usage_counter-also-track-legacy-request.patch b/patches.fixes/block-Make-q_usage_counter-also-track-legacy-request.patch
new file mode 100644
index 0000000000..30ce73b05b
--- /dev/null
+++ b/patches.fixes/block-Make-q_usage_counter-also-track-legacy-request.patch
@@ -0,0 +1,115 @@
+From: Ming Lei <ming.lei@redhat.com>
+Date: Thu, 9 Nov 2017 10:49:53 -0800
+Subject: [PATCH] block: Make q_usage_counter also track legacy requests
+References: bsc#1077989
+Git-commit: 055f6e18e08f5b7fd98171fce857a0bad87a919d
+Patch-mainline: v4.15-rc1
+
+This patch makes it possible to pause request allocation for
+the legacy block layer by calling blk_mq_freeze_queue() and
+blk_mq_unfreeze_queue().
+
+Signed-off-by: Ming Lei <ming.lei@redhat.com>
+[ bvanassche: Combined two patches into one, edited a comment and made sure
+ REQ_NOWAIT is handled properly in blk_old_get_request() ]
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Tested-by: Martin Steigerwald <martin@lichtvoll.de>
+Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
+Cc: Ming Lei <ming.lei@redhat.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ block/blk-core.c | 12 ++++++++++++
+ block/blk-mq.c | 10 ++--------
+ 2 files changed, 14 insertions(+), 8 deletions(-)
+
+diff --git a/block/blk-core.c b/block/blk-core.c
+index b414771a2164..56754d156db8 100644
+--- a/block/blk-core.c
++++ b/block/blk-core.c
+@@ -612,6 +612,9 @@ void blk_set_queue_dying(struct request_queue *q)
+ }
+ spin_unlock_irq(q->queue_lock);
+ }
++
++ /* Make blk_queue_enter() reexamine the DYING flag. */
++ wake_up_all(&q->mq_freeze_wq);
+ }
+ EXPORT_SYMBOL_GPL(blk_set_queue_dying);
+
+@@ -1395,16 +1398,22 @@ static struct request *blk_old_get_request(struct request_queue *q,
+ unsigned int op, gfp_t gfp_mask)
+ {
+ struct request *rq;
++ int ret = 0;
+
+ WARN_ON_ONCE(q->mq_ops);
+
+ /* create ioc upfront */
+ create_io_context(gfp_mask, q->node);
+
++ ret = blk_queue_enter(q, !(gfp_mask & __GFP_DIRECT_RECLAIM) ||
++ (op & REQ_NOWAIT));
++ if (ret)
++ return ERR_PTR(ret);
+ spin_lock_irq(q->queue_lock);
+ rq = get_request(q, op, NULL, gfp_mask);
+ if (IS_ERR(rq)) {
+ spin_unlock_irq(q->queue_lock);
++ blk_queue_exit(q);
+ return rq;
+ }
+
+@@ -1576,6 +1585,7 @@ void __blk_put_request(struct request_queue *q, struct request *req)
+ blk_free_request(rl, req);
+ freed_request(rl, sync, rq_flags);
+ blk_put_rl(rl);
++ blk_queue_exit(q);
+ }
+ }
+ EXPORT_SYMBOL_GPL(__blk_put_request);
+@@ -1857,8 +1867,10 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio)
+ * Grab a free request. This is might sleep but can not fail.
+ * Returns with the queue unlocked.
+ */
++ blk_queue_enter_live(q);
+ req = get_request(q, bio->bi_opf, bio, GFP_NOIO);
+ if (IS_ERR(req)) {
++ blk_queue_exit(q);
+ __wbt_done(q->rq_wb, wb_acct);
+ if (PTR_ERR(req) == -ENOMEM)
+ bio->bi_status = BLK_STS_RESOURCE;
+diff --git a/block/blk-mq.c b/block/blk-mq.c
+index f9ae227d48d8..be6f611fecd9 100644
+--- a/block/blk-mq.c
++++ b/block/blk-mq.c
+@@ -126,7 +126,8 @@ void blk_freeze_queue_start(struct request_queue *q)
+ freeze_depth = atomic_inc_return(&q->mq_freeze_depth);
+ if (freeze_depth == 1) {
+ percpu_ref_kill(&q->q_usage_counter);
+- blk_mq_run_hw_queues(q, false);
++ if (q->mq_ops)
++ blk_mq_run_hw_queues(q, false);
+ }
+ }
+ EXPORT_SYMBOL_GPL(blk_freeze_queue_start);
+@@ -256,13 +257,6 @@ void blk_mq_wake_waiters(struct request_queue *q)
+ queue_for_each_hw_ctx(q, hctx, i)
+ if (blk_mq_hw_queue_mapped(hctx))
+ blk_mq_tag_wakeup_all(hctx->tags, true);
+-
+- /*
+- * If we are called because the queue has now been marked as
+- * dying, we need to ensure that processes currently waiting on
+- * the queue are notified as well.
+- */
+- wake_up_all(&q->mq_freeze_wq);
+ }
+
+ bool blk_mq_can_queue(struct blk_mq_hw_ctx *hctx)
+--
+2.12.3
+
diff --git a/patches.fixes/block-fix-blk_rq_append_bio.patch b/patches.fixes/block-fix-blk_rq_append_bio.patch
new file mode 100644
index 0000000000..fd027bd60c
--- /dev/null
+++ b/patches.fixes/block-fix-blk_rq_append_bio.patch
@@ -0,0 +1,165 @@
+From: Jens Axboe <axboe@kernel.dk>
+Date: Mon, 18 Dec 2017 15:40:44 +0800
+Subject: [PATCH] block: fix blk_rq_append_bio
+References: bsc#1077989
+Git-commit: 0abc2a10389f0c9070f76ca906c7382788036b93
+Patch-mainline: v4.15-rc5
+
+Commit caa4b02476e3(blk-map: call blk_queue_bounce from blk_rq_append_bio)
+moves blk_queue_bounce() into blk_rq_append_bio(), but don't consider
+the fact that the bounced bio becomes invisible to caller since the
+parameter type is 'struct bio *'. Make it a pointer to a pointer to
+a bio, so the caller sees the right bio also after a bounce.
+
+Fixes: caa4b02476e3 ("blk-map: call blk_queue_bounce from blk_rq_append_bio")
+Cc: Christoph Hellwig <hch@lst.de>
+Reported-by: Michele Ballabio <barra_cuda@katamail.com>
+(handling failure of blk_rq_append_bio(), only call bio_get() after
+blk_rq_append_bio() returns OK)
+Tested-by: Michele Ballabio <barra_cuda@katamail.com>
+Signed-off-by: Ming Lei <ming.lei@redhat.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ block/blk-map.c | 38 ++++++++++++++++++++++----------------
+ drivers/scsi/osd/osd_initiator.c | 4 +++-
+ drivers/target/target_core_pscsi.c | 4 ++--
+ include/linux/blkdev.h | 2 +-
+ 4 files changed, 28 insertions(+), 20 deletions(-)
+
+diff --git a/block/blk-map.c b/block/blk-map.c
+index 2547016aa7aa..02c4e3a1befe 100644
+--- a/block/blk-map.c
++++ b/block/blk-map.c
+@@ -11,22 +11,29 @@
+ #include "blk.h"
+
+ /*
+- * Append a bio to a passthrough request. Only works can be merged into
+- * the request based on the driver constraints.
++ * Append a bio to a passthrough request. Only works if the bio can be merged
++ * into the request based on the driver constraints.
+ */
+-int blk_rq_append_bio(struct request *rq, struct bio *bio)
++int blk_rq_append_bio(struct request *rq, struct bio **bio)
+ {
+- blk_queue_bounce(rq->q, &bio);
++ struct bio *orig_bio = *bio;
++
++ blk_queue_bounce(rq->q, bio);
+
+ if (!rq->bio) {
+- blk_rq_bio_prep(rq->q, rq, bio);
++ blk_rq_bio_prep(rq->q, rq, *bio);
+ } else {
+- if (!ll_back_merge_fn(rq->q, rq, bio))
++ if (!ll_back_merge_fn(rq->q, rq, *bio)) {
++ if (orig_bio != *bio) {
++ bio_put(*bio);
++ *bio = orig_bio;
++ }
+ return -EINVAL;
++ }
+
+- rq->biotail->bi_next = bio;
+- rq->biotail = bio;
+- rq->__data_len += bio->bi_iter.bi_size;
++ rq->biotail->bi_next = *bio;
++ rq->biotail = *bio;
++ rq->__data_len += (*bio)->bi_iter.bi_size;
+ }
+
+ return 0;
+@@ -79,14 +86,12 @@ static int __blk_rq_map_user_iov(struct request *rq,
+ * We link the bounce buffer in and could have to traverse it
+ * later so we have to get a ref to prevent it from being freed
+ */
+- ret = blk_rq_append_bio(rq, bio);
+- bio_get(bio);
++ ret = blk_rq_append_bio(rq, &bio);
+ if (ret) {
+- bio_endio(bio);
+ __blk_rq_unmap_user(orig_bio);
+- bio_put(bio);
+ return ret;
+ }
++ bio_get(bio);
+
+ return 0;
+ }
+@@ -219,7 +224,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
+ int reading = rq_data_dir(rq) == READ;
+ unsigned long addr = (unsigned long) kbuf;
+ int do_copy = 0;
+- struct bio *bio;
++ struct bio *bio, *orig_bio;
+ int ret;
+
+ if (len > (queue_max_hw_sectors(q) << 9))
+@@ -242,10 +247,11 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
+ if (do_copy)
+ rq->rq_flags |= RQF_COPY_USER;
+
+- ret = blk_rq_append_bio(rq, bio);
++ orig_bio = bio;
++ ret = blk_rq_append_bio(rq, &bio);
+ if (unlikely(ret)) {
+ /* request is too big */
+- bio_put(bio);
++ bio_put(orig_bio);
+ return ret;
+ }
+
+diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
+index 08c89a718e4a..8ee6d4f6a940 100644
+--- a/drivers/scsi/osd/osd_initiator.c
++++ b/drivers/scsi/osd/osd_initiator.c
+@@ -1576,7 +1576,9 @@ static struct request *_make_request(struct request_queue *q, bool has_write,
+ return req;
+
+ for_each_bio(bio) {
+- ret = blk_rq_append_bio(req, bio);
++ struct bio *bounce_bio = bio;
++
++ ret = blk_rq_append_bio(req, &bounce_bio);
+ if (ret)
+ return ERR_PTR(ret);
+ }
+diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
+index 7c69b4a9694d..0d99b242e82e 100644
+--- a/drivers/target/target_core_pscsi.c
++++ b/drivers/target/target_core_pscsi.c
+@@ -920,7 +920,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
+ " %d i: %d bio: %p, allocating another"
+ " bio\n", bio->bi_vcnt, i, bio);
+
+- rc = blk_rq_append_bio(req, bio);
++ rc = blk_rq_append_bio(req, &bio);
+ if (rc) {
+ pr_err("pSCSI: failed to append bio\n");
+ goto fail;
+@@ -938,7 +938,7 @@ pscsi_map_sg(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
+ }
+
+ if (bio) {
+- rc = blk_rq_append_bio(req, bio);
++ rc = blk_rq_append_bio(req, &bio);
+ if (rc) {
+ pr_err("pSCSI: failed to append bio\n");
+ goto fail;
+diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
+index 88efdb34af59..961e7f8c9810 100644
+--- a/include/linux/blkdev.h
++++ b/include/linux/blkdev.h
+@@ -950,7 +950,7 @@ extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
+ extern void blk_rq_unprep_clone(struct request *rq);
+ extern blk_status_t blk_insert_cloned_request(struct request_queue *q,
+ struct request *rq);
+-extern int blk_rq_append_bio(struct request *rq, struct bio *bio);
++extern int blk_rq_append_bio(struct request *rq, struct bio **bio);
+ extern void blk_delay_queue(struct request_queue *, unsigned long);
+ extern void blk_queue_split(struct request_queue *, struct bio **);
+ extern void blk_recount_segments(struct request_queue *, struct bio *);
+--
+2.12.3
+
diff --git a/patches.fixes/cxlflash-get-rid-of-pointless-access_ok.patch b/patches.fixes/cxlflash-get-rid-of-pointless-access_ok.patch
new file mode 100644
index 0000000000..50f38ceaa7
--- /dev/null
+++ b/patches.fixes/cxlflash-get-rid-of-pointless-access_ok.patch
@@ -0,0 +1,33 @@
+From: Al Viro <viro@zeniv.linux.org.uk>
+Date: Fri, 29 Sep 2017 13:58:09 -0400
+Subject: [PATCH] cxlflash: get rid of pointless access_ok()
+References: bsc#1077989
+Git-commit: a0dbef33863349de5313dff62982d309ded98190
+Patch-mainline: v4.15-rc1
+
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxlflash/main.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
+index 0b6467206f8e..8f609ef9282a 100644
+--- a/drivers/scsi/cxlflash/main.c
++++ b/drivers/scsi/cxlflash/main.c
+@@ -3384,12 +3384,6 @@ static int cxlflash_afu_debug(struct cxlflash_cfg *cfg,
+ goto out;
+ }
+
+- if (unlikely(!access_ok(is_write ? VERIFY_READ : VERIFY_WRITE,
+- ubuf, ulen))) {
+- rc = -EFAULT;
+- goto out;
+- }
+-
+ buf = kmalloc(ulen + cache_line_size() - 1, GFP_KERNEL);
+ if (unlikely(!buf)) {
+ rc = -ENOMEM;
+--
+2.12.3
+
diff --git a/patches.fixes/ibmvscsis-Enable-Logical-Partition-Migration-Support.patch b/patches.fixes/ibmvscsis-Enable-Logical-Partition-Migration-Support.patch
new file mode 100644
index 0000000000..0d48e82e46
--- /dev/null
+++ b/patches.fixes/ibmvscsis-Enable-Logical-Partition-Migration-Support.patch
@@ -0,0 +1,312 @@
+From: Michael Cyr <mikecyr@us.ibm.com>
+Date: Tue, 16 May 2017 17:49:21 -0500
+Subject: [PATCH] ibmvscsis: Enable Logical Partition Migration Support
+References: bsc#1077989
+Git-commit: 464fd6419c68bc6b1697e02f46b6d3dd57dfed28
+Patch-mainline: v4.13-rc1
+
+Changes to support a new mechanism from phyp to better synchronize the
+logical partition migration (LPM) of the client partition.
+This includes a new VIOCTL to register that we support this new
+functionality, and 2 new Transport Event types, and finally another
+new VIOCTL to let phyp know once we're ready for the Suspend.
+
+Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
+Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 148 ++++++++++++++++++++++++++++---
+ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h | 25 +++++-
+ drivers/scsi/ibmvscsi_tgt/libsrp.h | 5 +-
+ 3 files changed, 162 insertions(+), 16 deletions(-)
+
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+index abf6026645dd..35710524d059 100644
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+@@ -155,6 +155,9 @@ static long ibmvscsis_unregister_command_q(struct scsi_info *vscsi)
+ qrc = h_free_crq(vscsi->dds.unit_id);
+ switch (qrc) {
+ case H_SUCCESS:
++ spin_lock_bh(&vscsi->intr_lock);
++ vscsi->flags &= ~PREP_FOR_SUSPEND_FLAGS;
++ spin_unlock_bh(&vscsi->intr_lock);
+ break;
+
+ case H_HARDWARE:
+@@ -422,6 +425,9 @@ static void ibmvscsis_disconnect(struct work_struct *work)
+ new_state = vscsi->new_state;
+ vscsi->new_state = 0;
+
++ vscsi->flags |= DISCONNECT_SCHEDULED;
++ vscsi->flags &= ~SCHEDULE_DISCONNECT;
++
+ pr_debug("disconnect: flags 0x%x, state 0x%hx\n", vscsi->flags,
+ vscsi->state);
+
+@@ -802,6 +808,13 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi)
+ long rc = ADAPT_SUCCESS;
+ uint format;
+
++ rc = h_vioctl(vscsi->dds.unit_id, H_ENABLE_PREPARE_FOR_SUSPEND, 30000,
++ 0, 0, 0, 0);
++ if (rc == H_SUCCESS)
++ vscsi->flags |= PREP_FOR_SUSPEND_ENABLED;
++ else if (rc != H_NOT_FOUND)
++ pr_err("Error from Enable Prepare for Suspend: %ld\n", rc);
++
+ vscsi->flags &= PRESERVE_FLAG_FIELDS;
+ vscsi->rsp_q_timer.timer_pops = 0;
+ vscsi->debit = 0;
+@@ -951,6 +964,63 @@ static void ibmvscsis_free_cmd_resources(struct scsi_info *vscsi,
+ }
+
+ /**
++ * ibmvscsis_ready_for_suspend() - Helper function to call VIOCTL
++ * @vscsi: Pointer to our adapter structure
++ * @idle: Indicates whether we were called from adapter_idle. This
++ * is important to know if we need to do a disconnect, since if
++ * we're called from adapter_idle, we're still processing the
++ * current disconnect, so we can't just call post_disconnect.
++ *
++ * This function is called when the adapter is idle when phyp has sent
++ * us a Prepare for Suspend Transport Event.
++ *
++ * EXECUTION ENVIRONMENT:
++ * Process or interrupt environment called with interrupt lock held
++ */
++static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle)
++{
++ long rc = 0;
++ struct viosrp_crq *crq;
++
++ /* See if there is a Resume event in the queue */
++ crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index;
++
++ pr_debug("ready_suspend: flags 0x%x, state 0x%hx crq_valid:%x\n",
++ vscsi->flags, vscsi->state, (int)crq->valid);
++
++ if (!(vscsi->flags & PREP_FOR_SUSPEND_ABORTED) && !(crq->valid)) {
++ rc = h_vioctl(vscsi->dds.unit_id, H_READY_FOR_SUSPEND, 0, 0, 0,
++ 0, 0);
++ if (rc) {
++ pr_err("Ready for Suspend Vioctl failed: %ld\n", rc);
++ rc = 0;
++ }
++ } else if (((vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE) &&
++ (vscsi->flags & PREP_FOR_SUSPEND_ABORTED)) ||
++ ((crq->valid) && ((crq->valid != VALID_TRANS_EVENT) ||
++ (crq->format != RESUME_FROM_SUSP)))) {
++ if (idle) {
++ vscsi->state = ERR_DISCONNECT_RECONNECT;
++ ibmvscsis_reset_queue(vscsi);
++ rc = -1;
++ } else if (vscsi->state == CONNECTED) {
++ ibmvscsis_post_disconnect(vscsi,
++ ERR_DISCONNECT_RECONNECT, 0);
++ }
++
++ vscsi->flags &= ~PREP_FOR_SUSPEND_OVERWRITE;
++
++ if ((crq->valid) && ((crq->valid != VALID_TRANS_EVENT) ||
++ (crq->format != RESUME_FROM_SUSP)))
++ pr_err("Invalid element in CRQ after Prepare for Suspend");
++ }
++
++ vscsi->flags &= ~(PREP_FOR_SUSPEND_PENDING | PREP_FOR_SUSPEND_ABORTED);
++
++ return rc;
++}
++
++/**
+ * ibmvscsis_trans_event() - Handle a Transport Event
+ * @vscsi: Pointer to our adapter structure
+ * @crq: Pointer to CRQ entry containing the Transport Event
+@@ -974,18 +1044,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+ case PARTNER_FAILED:
+ case PARTNER_DEREGISTER:
+ ibmvscsis_delete_client_info(vscsi, true);
+- break;
+-
+- default:
+- rc = ERROR;
+- dev_err(&vscsi->dev, "trans_event: invalid format %d\n",
+- (uint)crq->format);
+- ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT,
+- RESPONSE_Q_DOWN);
+- break;
+- }
+-
+- if (rc == ADAPT_SUCCESS) {
++ if (crq->format == MIGRATED)
++ vscsi->flags &= ~PREP_FOR_SUSPEND_OVERWRITE;
+ switch (vscsi->state) {
+ case NO_QUEUE:
+ case ERR_DISCONNECTED:
+@@ -1034,6 +1094,60 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+ vscsi->flags |= (RESPONSE_Q_DOWN | TRANS_EVENT);
+ break;
+ }
++ break;
++
++ case PREPARE_FOR_SUSPEND:
++ pr_debug("Prep for Suspend, crq status = 0x%x\n",
++ (int)crq->status);
++ switch (vscsi->state) {
++ case ERR_DISCONNECTED:
++ case WAIT_CONNECTION:
++ case CONNECTED:
++ ibmvscsis_ready_for_suspend(vscsi, false);
++ break;
++ case SRP_PROCESSING:
++ vscsi->resume_state = vscsi->state;
++ vscsi->flags |= PREP_FOR_SUSPEND_PENDING;
++ if (crq->status == CRQ_ENTRY_OVERWRITTEN)
++ vscsi->flags |= PREP_FOR_SUSPEND_OVERWRITE;
++ ibmvscsis_post_disconnect(vscsi, WAIT_IDLE, 0);
++ break;
++ case NO_QUEUE:
++ case UNDEFINED:
++ case UNCONFIGURING:
++ case WAIT_ENABLED:
++ case ERR_DISCONNECT:
++ case ERR_DISCONNECT_RECONNECT:
++ case WAIT_IDLE:
++ pr_err("Invalid state for Prepare for Suspend Trans Event: 0x%x\n",
++ vscsi->state);
++ break;
++ }
++ break;
++
++ case RESUME_FROM_SUSP:
++ pr_debug("Resume from Suspend, crq status = 0x%x\n",
++ (int)crq->status);
++ if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) {
++ vscsi->flags |= PREP_FOR_SUSPEND_ABORTED;
++ } else {
++ if ((crq->status == CRQ_ENTRY_OVERWRITTEN) ||
++ (vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE)) {
++ ibmvscsis_post_disconnect(vscsi,
++ ERR_DISCONNECT_RECONNECT,
++ 0);
++ vscsi->flags &= ~PREP_FOR_SUSPEND_OVERWRITE;
++ }
++ }
++ break;
++
++ default:
++ rc = ERROR;
++ dev_err(&vscsi->dev, "trans_event: invalid format %d\n",
++ (uint)crq->format);
++ ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT,
++ RESPONSE_Q_DOWN);
++ break;
+ }
+
+ rc = vscsi->flags & SCHEDULE_DISCONNECT;
+@@ -1201,6 +1315,7 @@ static struct ibmvscsis_cmd *ibmvscsis_get_free_cmd(struct scsi_info *vscsi)
+ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ {
+ int free_qs = false;
++ long rc = 0;
+
+ pr_debug("adapter_idle: flags 0x%x, state 0x%hx\n", vscsi->flags,
+ vscsi->state);
+@@ -1240,7 +1355,14 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ vscsi->rsp_q_timer.timer_pops = 0;
+ vscsi->debit = 0;
+ vscsi->credit = 0;
+- if (vscsi->flags & TRANS_EVENT) {
++ if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) {
++ vscsi->state = vscsi->resume_state;
++ vscsi->resume_state = 0;
++ rc = ibmvscsis_ready_for_suspend(vscsi, true);
++ vscsi->flags &= ~DISCONNECT_SCHEDULED;
++ if (rc)
++ break;
++ } else if (vscsi->flags & TRANS_EVENT) {
+ vscsi->state = WAIT_CONNECTION;
+ vscsi->flags &= PRESERVE_FLAG_FIELDS;
+ } else {
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
+index b4391a8de456..cc96c2731134 100644
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h
+@@ -262,6 +262,14 @@ struct scsi_info {
+ #define DISCONNECT_SCHEDULED 0x00800
+ /* remove function is sleeping */
+ #define CFG_SLEEPING 0x01000
++ /* Register for Prepare for Suspend Transport Events */
++#define PREP_FOR_SUSPEND_ENABLED 0x02000
++ /* Prepare for Suspend event sent */
++#define PREP_FOR_SUSPEND_PENDING 0x04000
++ /* Resume from Suspend event sent */
++#define PREP_FOR_SUSPEND_ABORTED 0x08000
++ /* Prepare for Suspend event overwrote another CRQ entry */
++#define PREP_FOR_SUSPEND_OVERWRITE 0x10000
+ u32 flags;
+ /* adapter lock */
+ spinlock_t intr_lock;
+@@ -272,6 +280,7 @@ struct scsi_info {
+ /* used in crq, to tag what iu the response is for */
+ u64 empty_iu_tag;
+ uint new_state;
++ uint resume_state;
+ /* control block for the response queue timer */
+ struct timer_cb rsp_q_timer;
+ /* keep last client to enable proper accounting */
+@@ -324,8 +333,13 @@ struct scsi_info {
+ #define TARGET_STOP(VSCSI) (long)(((VSCSI)->state & DONT_PROCESS_STATE) | \
+ ((VSCSI)->flags & BLOCK))
+
++#define PREP_FOR_SUSPEND_FLAGS (PREP_FOR_SUSPEND_ENABLED | \
++ PREP_FOR_SUSPEND_PENDING | \
++ PREP_FOR_SUSPEND_ABORTED | \
++ PREP_FOR_SUSPEND_OVERWRITE)
++
+ /* flag bit that are not reset during disconnect */
+-#define PRESERVE_FLAG_FIELDS 0
++#define PRESERVE_FLAG_FIELDS (PREP_FOR_SUSPEND_FLAGS)
+
+ #define vio_iu(IUE) ((union viosrp_iu *)((IUE)->sbuf->buf))
+
+@@ -333,8 +347,15 @@ struct scsi_info {
+ #define WRITE_CMD(cdb) (((cdb)[0] & 0x1F) == 0xA)
+
+ #ifndef H_GET_PARTNER_INFO
+-#define H_GET_PARTNER_INFO 0x0000000000000008LL
++#define H_GET_PARTNER_INFO 0x0000000000000008LL
++#endif
++#ifndef H_ENABLE_PREPARE_FOR_SUSPEND
++#define H_ENABLE_PREPARE_FOR_SUSPEND 0x000000000000001DLL
+ #endif
++#ifndef H_READY_FOR_SUSPEND
++#define H_READY_FOR_SUSPEND 0x000000000000001ELL
++#endif
++
+
+ #define h_copy_rdma(l, sa, sb, da, db) \
+ plpar_hcall_norets(H_COPY_RDMA, l, sa, sb, da, db)
+diff --git a/drivers/scsi/ibmvscsi_tgt/libsrp.h b/drivers/scsi/ibmvscsi_tgt/libsrp.h
+index 4696f331453e..9fec55b36322 100644
+--- a/drivers/scsi/ibmvscsi_tgt/libsrp.h
++++ b/drivers/scsi/ibmvscsi_tgt/libsrp.h
+@@ -30,10 +30,13 @@ enum srp_trans_event {
+ UNUSED_FORMAT = 0,
+ PARTNER_FAILED = 1,
+ PARTNER_DEREGISTER = 2,
+- MIGRATED = 6
++ MIGRATED = 6,
++ PREPARE_FOR_SUSPEND = 9,
++ RESUME_FROM_SUSP = 0xA
+ };
+
+ enum srp_status {
++ CRQ_ENTRY_OVERWRITTEN = 0x20,
+ HEADER_DESCRIPTOR = 0xF1,
+ PING = 0xF5,
+ PING_RESPONSE = 0xF6
+--
+2.12.3
+
diff --git a/patches.fixes/ibmvscsis-Use-tpgt-passed-in-by-user.patch b/patches.fixes/ibmvscsis-Use-tpgt-passed-in-by-user.patch
new file mode 100644
index 0000000000..827b6a8f23
--- /dev/null
+++ b/patches.fixes/ibmvscsis-Use-tpgt-passed-in-by-user.patch
@@ -0,0 +1,46 @@
+From: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
+Date: Tue, 6 Jun 2017 15:45:49 -0500
+Subject: [PATCH] ibmvscsis: Use tpgt passed in by user
+References: bsc#1077989
+Git-commit: e9447a46e9fba006ff9b0f4e40a4e38bf2d788db
+Patch-mainline: v4.13-rc1
+
+ibmvscsis always returned 0 for the tpg/tag, since it did not
+parse the value passed in by the user.
+
+When functions like ALUA members exports the value, it will
+be incorrect because targetcli/rtslib starts the tpg numbering
+at 1.
+
+Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
+Signed-off-by: Mike Christie <mchristi@redhat.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+index cc48491903b2..1f75d0380516 100644
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+@@ -3914,8 +3914,16 @@ static struct se_portal_group *ibmvscsis_make_tpg(struct se_wwn *wwn,
+ {
+ struct ibmvscsis_tport *tport =
+ container_of(wwn, struct ibmvscsis_tport, tport_wwn);
++ u16 tpgt;
+ int rc;
+
++ if (strstr(name, "tpgt_") != name)
++ return ERR_PTR(-EINVAL);
++ rc = kstrtou16(name + 5, 0, &tpgt);
++ if (rc)
++ return ERR_PTR(rc);
++ tport->tport_tpgt = tpgt;
++
+ tport->releasing = false;
+
+ rc = core_tpg_register(&tport->tport_wwn, &tport->se_tpg,
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-Add-AIX-VDASD-to-blacklist.patch b/patches.fixes/scsi-Add-AIX-VDASD-to-blacklist.patch
deleted file mode 100644
index b90ebda54a..0000000000
--- a/patches.fixes/scsi-Add-AIX-VDASD-to-blacklist.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 09040ffe64b67a66453c7cc7bf2d645a0b27aeaf Mon Sep 17 00:00:00 2001
-From: Hannes Reinecke <hare@suse.de>
-Date: Thu, 27 Oct 2016 09:20:23 +0200
-Subject: [PATCH] scsi: Add 'AIX VDASD' to blacklist
-References: bsc#1006469
-Patch-Mainline: submitted to linux-scsi 2016/10/27
-
-The AIX VDASD devices do support VPD pages, but implement
-only SPC. So set BLIST_TRY_VPD_PAGS to correctly display
-the VPD information in sysfs.
-
-Signed-off-by: Hannes Reinecke <hare@suse.com>
----
- drivers/scsi/scsi_devinfo.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
-index cab178f..8d66051 100644
---- a/drivers/scsi/scsi_devinfo.c
-+++ b/drivers/scsi/scsi_devinfo.c
-@@ -136,6 +136,7 @@ static struct {
- {"3PARdata", "VV", NULL, BLIST_REPORTLUN2},
- {"ADAPTEC", "AACRAID", NULL, BLIST_FORCELUN},
- {"ADAPTEC", "Adaptec 5400S", NULL, BLIST_FORCELUN},
-+ {"AIX", "VDASD", NULL, BLIST_TRY_VPD_PAGES},
- {"AFT PRO", "-IX CF", "0.0>", BLIST_FORCELUN},
- {"BELKIN", "USB 2 HS-CF", "1.95", BLIST_FORCELUN | BLIST_INQUIRY_36},
- {"BROWNIE", "1200U3P", NULL, BLIST_NOREPORTLUN},
---
-1.8.5.6
-
diff --git a/patches.fixes/scsi-Convert-a-strncmp-call-into-a-strcmp-call.patch b/patches.fixes/scsi-Convert-a-strncmp-call-into-a-strcmp-call.patch
new file mode 100644
index 0000000000..56c4f11690
--- /dev/null
+++ b/patches.fixes/scsi-Convert-a-strncmp-call-into-a-strcmp-call.patch
@@ -0,0 +1,37 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Fri, 25 Aug 2017 13:46:30 -0700
+Subject: [PATCH] scsi: Convert a strncmp() call into a strcmp() call
+References: bsc#1077989
+Git-commit: 3991e4605dd3a8c7180a5ddd60d802108e880027
+Patch-mainline: v4.14-rc1
+
+This patch avoids that smatch reports the following warning:
+
+drivers/scsi/scsi_sysfs.c:117: check_set() error: strncmp() '"-"' too small (2 vs 20)
+
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Hannes Reinecke <hare@suse.de>
+Cc: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_sysfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index 4f22f39557fa..40406c162d0d 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -114,7 +114,7 @@ static int check_set(unsigned long long *val, char *src)
+ {
+ char *last;
+
+- if (strncmp(src, "-", 20) == 0) {
++ if (strcmp(src, "-") == 0) {
+ *val = SCAN_WILD_CARD;
+ } else {
+ /*
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-Document-which-queue-type-a-function-is-intende.patch b/patches.fixes/scsi-Document-which-queue-type-a-function-is-intende.patch
new file mode 100644
index 0000000000..ebcdfd43bc
--- /dev/null
+++ b/patches.fixes/scsi-Document-which-queue-type-a-function-is-intende.patch
@@ -0,0 +1,127 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Fri, 25 Aug 2017 13:46:31 -0700
+Subject: [PATCH] scsi: Document which queue type a function is intended for
+References: bsc#1077989
+Git-commit: e7008ff5c61a13e673344d3048baaf8e0652fa87
+Patch-mainline: v4.14-rc1
+
+Rename several functions to make it easy to see which queue type a
+function is intended for.
+
+Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: Hannes Reinecke <hare@suse.com>
+Cc: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_lib.c | 23 ++++++++++++-----------
+ drivers/scsi/scsi_priv.h | 2 +-
+ drivers/scsi/scsi_scan.c | 2 +-
+ 3 files changed, 14 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
+index 301ae2dd2464..6ba1c8192386 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -2007,8 +2007,8 @@ static enum blk_eh_timer_return scsi_timeout(struct request *req,
+ return scsi_times_out(req);
+ }
+
+-static int scsi_init_request(struct blk_mq_tag_set *set, struct request *rq,
+- unsigned int hctx_idx, unsigned int numa_node)
++static int scsi_mq_init_request(struct blk_mq_tag_set *set, struct request *rq,
++ unsigned int hctx_idx, unsigned int numa_node)
+ {
+ struct Scsi_Host *shost = set->driver_data;
+ const bool unchecked_isa_dma = shost->unchecked_isa_dma;
+@@ -2032,8 +2032,8 @@ static int scsi_init_request(struct blk_mq_tag_set *set, struct request *rq,
+ return 0;
+ }
+
+-static void scsi_exit_request(struct blk_mq_tag_set *set, struct request *rq,
+- unsigned int hctx_idx)
++static void scsi_mq_exit_request(struct blk_mq_tag_set *set, struct request *rq,
++ unsigned int hctx_idx)
+ {
+ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
+
+@@ -2110,7 +2110,8 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
+ }
+ EXPORT_SYMBOL_GPL(__scsi_init_queue);
+
+-static int scsi_init_rq(struct request_queue *q, struct request *rq, gfp_t gfp)
++static int scsi_old_init_rq(struct request_queue *q, struct request *rq,
++ gfp_t gfp)
+ {
+ struct Scsi_Host *shost = q->rq_alloc_data;
+ const bool unchecked_isa_dma = shost->unchecked_isa_dma;
+@@ -2140,7 +2141,7 @@ static int scsi_init_rq(struct request_queue *q, struct request *rq, gfp_t gfp)
+ return -ENOMEM;
+ }
+
+-static void scsi_exit_rq(struct request_queue *q, struct request *rq)
++static void scsi_old_exit_rq(struct request_queue *q, struct request *rq)
+ {
+ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
+
+@@ -2150,7 +2151,7 @@ static void scsi_exit_rq(struct request_queue *q, struct request *rq)
+ cmd->sense_buffer);
+ }
+
+-struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
++struct request_queue *scsi_old_alloc_queue(struct scsi_device *sdev)
+ {
+ struct Scsi_Host *shost = sdev->host;
+ struct request_queue *q;
+@@ -2161,8 +2162,8 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
+ q->cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size;
+ q->rq_alloc_data = shost;
+ q->request_fn = scsi_request_fn;
+- q->init_rq_fn = scsi_init_rq;
+- q->exit_rq_fn = scsi_exit_rq;
++ q->init_rq_fn = scsi_old_init_rq;
++ q->exit_rq_fn = scsi_old_exit_rq;
+ q->initialize_rq_fn = scsi_initialize_rq;
+
+ if (blk_init_allocated_queue(q) < 0) {
+@@ -2186,8 +2187,8 @@ static const struct blk_mq_ops scsi_mq_ops = {
+ #ifdef CONFIG_BLK_DEBUG_FS
+ .show_rq = scsi_show_rq,
+ #endif
+- .init_request = scsi_init_request,
+- .exit_request = scsi_exit_request,
++ .init_request = scsi_mq_init_request,
++ .exit_request = scsi_mq_exit_request,
+ .initialize_rq_fn = scsi_initialize_rq,
+ .map_queues = scsi_map_queues,
+ };
+diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
+index c11c1f9c912c..5c6d016a5ae9 100644
+--- a/drivers/scsi/scsi_priv.h
++++ b/drivers/scsi/scsi_priv.h
+@@ -88,7 +88,7 @@ extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
+ extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
+ extern void scsi_run_host_queues(struct Scsi_Host *shost);
+ extern void scsi_requeue_run_queue(struct work_struct *work);
+-extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
++extern struct request_queue *scsi_old_alloc_queue(struct scsi_device *sdev);
+ extern struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev);
+ extern void scsi_start_queue(struct scsi_device *sdev);
+ extern int scsi_mq_setup_tags(struct Scsi_Host *shost);
+diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
+index 3832ba57151b..7948c7f1f70f 100644
+--- a/drivers/scsi/scsi_scan.c
++++ b/drivers/scsi/scsi_scan.c
+@@ -268,7 +268,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
+ if (shost_use_blk_mq(shost))
+ sdev->request_queue = scsi_mq_alloc_queue(sdev);
+ else
+- sdev->request_queue = scsi_alloc_queue(sdev);
++ sdev->request_queue = scsi_old_alloc_queue(sdev);
+ if (!sdev->request_queue) {
+ /* release fn is set up in scsi_sysfs_device_initialise, so
+ * have to free and put manually here */
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-Fix-the-kerneldoc-for-scsi_initialize_rq.patch b/patches.fixes/scsi-Fix-the-kerneldoc-for-scsi_initialize_rq.patch
new file mode 100644
index 0000000000..de0122a139
--- /dev/null
+++ b/patches.fixes/scsi-Fix-the-kerneldoc-for-scsi_initialize_rq.patch
@@ -0,0 +1,38 @@
+From: Jonathan Corbet <corbet@lwn.net>
+Date: Thu, 24 Aug 2017 16:11:09 -0600
+Subject: [PATCH] scsi: Fix the kerneldoc for scsi_initialize_rq()
+References: bsc#1077989
+Git-commit: 35c0506f27f6e3f278592d631901163cbccce28d
+Patch-mainline: v4.14-rc1
+
+The kerneldoc comment for scsi_initialize_rq() neglected to document the
+"rq" parameter, leading to this docs build warning:
+
+ ./drivers/scsi/scsi_lib.c:1116: warning: No description found for parameter 'rq'
+
+Document the parameter and make the build slightly quieter.
+
+[mkp: used wording suggested by Bart]
+
+Signed-off-by: Jonathan Corbet <corbet@lwn.net>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_lib.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
+index 22c12d560ea7..ad2c2c5a990d 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -1114,6 +1114,7 @@ EXPORT_SYMBOL(scsi_init_io);
+
+ /**
+ * scsi_initialize_rq - initialize struct scsi_cmnd.req
++ * @rq: Request associated with the SCSI command to be initialized.
+ *
+ * Called from inside blk_get_request().
+ */
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-ILLEGAL-REQUEST-ASC-27-target-failure.patch b/patches.fixes/scsi-ILLEGAL-REQUEST-ASC-27-target-failure.patch
new file mode 100644
index 0000000000..e1f98d955e
--- /dev/null
+++ b/patches.fixes/scsi-ILLEGAL-REQUEST-ASC-27-target-failure.patch
@@ -0,0 +1,38 @@
+From: Martin Wilck <mwilck@suse.com>
+Date: Wed, 27 Sep 2017 14:44:19 +0200
+Subject: [PATCH] scsi: ILLEGAL REQUEST + ASC==27 => target failure
+References: bsc#1077989
+Git-commit: d0b7a9095c0730b92a0a2eecaba2e6b77ed87339
+Patch-mainline: v4.14-rc3
+
+ASC 0x27 is "WRITE PROTECTED". This error code is returned e.g. by
+Fujitsu ETERNUS systems under certain conditions for WRITE SAME 16
+commands with UNMAP bit set. It should not be treated as a path
+error. In general, it makes sense to assume that being write protected
+is a target rather than a path property.
+
+Signed-off-by: Martin Wilck <mwilck@suse.com>
+Acked-by: Lee Duncan <lduncan@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_error.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
+index b0d5ce1b3f4b..bcc3aa51d0b5 100644
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -581,7 +581,8 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
+ if (sshdr.asc == 0x20 || /* Invalid command operation code */
+ sshdr.asc == 0x21 || /* Logical block address out of range */
+ sshdr.asc == 0x24 || /* Invalid field in cdb */
+- sshdr.asc == 0x26) { /* Parameter value invalid */
++ sshdr.asc == 0x26 || /* Parameter value invalid */
++ sshdr.asc == 0x27) { /* Write protected */
+ set_host_byte(scmd, DID_TARGET_FAILURE);
+ }
+ return SUCCESS;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-Modify-HITACHI-OPEN-V-blacklist.patch b/patches.fixes/scsi-Modify-HITACHI-OPEN-V-blacklist.patch
deleted file mode 100644
index b31a4a2704..0000000000
--- a/patches.fixes/scsi-Modify-HITACHI-OPEN-V-blacklist.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From: Hannes Reinecke <hare@suse.de>
-Date: Mon, 19 Dec 2016 11:44:27 +0100
-Subject: [PATCH] scsi: Modify HITACHI OPEN-V blacklist entry
-References: bsc#1006469
-Patch-Mainline: submitted linux-scsi 2016/12/21
-
-HITACHI is always supporting VPD pages, even though it's claiming
-to support SCSI Revision 3 only.
-
-Signed-off-by: Hannes Reinecke <hare@suse.com>
----
- drivers/scsi/scsi_devinfo.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
-index cab178f..50e6884 100644
---- a/drivers/scsi/scsi_devinfo.c
-+++ b/drivers/scsi/scsi_devinfo.c
-@@ -176,7 +176,7 @@ static struct {
- {"HITACHI", "DF500", "*", BLIST_REPORTLUN2},
- {"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_REPORTLUN2},
- {"HITACHI", "HUS1530", "*", BLIST_NO_DIF},
-- {"HITACHI", "OPEN-", "*", BLIST_REPORTLUN2},
-+ {"HITACHI", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES},
- {"HITACHI", "OP-C-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
- {"HITACHI", "3380-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
- {"HITACHI", "3390-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
---
-1.8.5.6
-
diff --git a/patches.fixes/scsi-Suppress-gcc-7-fall-through-warnings-reported-w.patch b/patches.fixes/scsi-Suppress-gcc-7-fall-through-warnings-reported-w.patch
new file mode 100644
index 0000000000..80da02be17
--- /dev/null
+++ b/patches.fixes/scsi-Suppress-gcc-7-fall-through-warnings-reported-w.patch
@@ -0,0 +1,114 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Fri, 25 Aug 2017 13:46:29 -0700
+Subject: [PATCH] scsi: Suppress gcc 7 fall-through warnings reported with W=1
+References: bsc#1077989
+Git-commit: 3bf2ff6749f0f87d719bf8f67eccecfde742f2b3
+Patch-mainline: v4.14-rc1
+
+The conclusion of a recent discussion about the new warnings
+reported by gcc 7 is that the new warnings reported when building
+with W=1 should be suppressed. However, gcc 7 still warns about
+fall-through in switch statements when building with W=1. Suppress
+these warnings by annotating the SCSI core properly.
+
+See also Linus Torvalds, Lots of new warnings with gcc-7.1.1, 11
+July 2017 (https://www.mail-archive.com/linux-media@vger.kernel.org/msg115428.html).
+
+References: commit bd664f6b3e37 ("disable new gcc-7.1.1 warnings for now")
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Cc: Hannes Reinecke <hare@suse.com>
+Cc: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_error.c | 8 +++++++-
+ drivers/scsi/scsi_ioctl.c | 4 +++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
+index 1aee11396abb..5727b9d2c0ee 100644
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -553,6 +553,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
+ set_host_byte(scmd, DID_ALLOC_FAILURE);
+ return SUCCESS;
+ }
++ /* FALLTHROUGH */
+ case COPY_ABORTED:
+ case VOLUME_OVERFLOW:
+ case MISCOMPARE:
+@@ -574,6 +575,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
+ return ADD_TO_MLQUEUE;
+ else
+ set_host_byte(scmd, DID_TARGET_FAILURE);
++ /* FALLTHROUGH */
+
+ case ILLEGAL_REQUEST:
+ if (sshdr.asc == 0x20 || /* Invalid command operation code */
+@@ -684,6 +686,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
+ switch (status_byte(scmd->result)) {
+ case GOOD:
+ scsi_handle_queue_ramp_up(scmd->device);
++ /* FALLTHROUGH */
+ case COMMAND_TERMINATED:
+ return SUCCESS;
+ case CHECK_CONDITION:
+@@ -1735,6 +1738,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
+ set_host_byte(scmd, DID_TIME_OUT);
+ return SUCCESS;
+ }
++ /* FALLTHROUGH */
+ case DID_NO_CONNECT:
+ case DID_BAD_TARGET:
+ /*
+@@ -1820,6 +1824,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
+ * the case of trying to send too many commands to a
+ * tagged queueing device.
+ */
++ /* FALLTHROUGH */
+ case BUSY:
+ /*
+ * device can't talk to us at the moment. Should only
+@@ -1832,6 +1837,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
+ if (scmd->cmnd[0] == REPORT_LUNS)
+ scmd->device->sdev_target->expecting_lun_change = 0;
+ scsi_handle_queue_ramp_up(scmd->device);
++ /* FALLTHROUGH */
+ case COMMAND_TERMINATED:
+ return SUCCESS;
+ case TASK_ABORTED:
+@@ -2321,8 +2327,8 @@ scsi_ioctl_reset(struct scsi_device *dev, int __user *arg)
+ rtn = scsi_try_host_reset(scmd);
+ if (rtn == SUCCESS)
+ break;
+- default:
+ /* FALLTHROUGH */
++ default:
+ rtn = FAILED;
+ break;
+ }
+diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
+index b6bf3f29a12a..0a875491f5a7 100644
+--- a/drivers/scsi/scsi_ioctl.c
++++ b/drivers/scsi/scsi_ioctl.c
+@@ -116,13 +116,15 @@ static int ioctl_internal_command(struct scsi_device *sdev, char *cmd,
+ case NOT_READY: /* This happens if there is no disc in drive */
+ if (sdev->removable)
+ break;
++ /* FALLTHROUGH */
+ case UNIT_ATTENTION:
+ if (sdev->removable) {
+ sdev->changed = 1;
+ result = 0; /* This is no longer considered an error */
+ break;
+ }
+- default: /* Fall through for non-removable media */
++ /* FALLTHROUGH -- for non-removable media */
++ default:
+ sdev_printk(KERN_INFO, sdev,
+ "ioctl_internal_command return code = %x\n",
+ result);
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-Use-blk_mq_rq_to_pdu-to-convert-a-request-to-a-.patch b/patches.fixes/scsi-Use-blk_mq_rq_to_pdu-to-convert-a-request-to-a-.patch
new file mode 100644
index 0000000000..e5d8607aba
--- /dev/null
+++ b/patches.fixes/scsi-Use-blk_mq_rq_to_pdu-to-convert-a-request-to-a-.patch
@@ -0,0 +1,136 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Fri, 25 Aug 2017 13:46:32 -0700
+Subject: [PATCH] scsi: Use blk_mq_rq_to_pdu() to convert a request to a SCSI
+ command pointer
+References: bsc#1077989
+Git-commit: bed2213d01de474eb8a6f3891070eec6be6fe772
+Patch-mainline: v4.14-rc1
+
+Since commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as
+part of struct request") struct request and struct scsi_cmnd are
+adjacent. This means that there is now an alternative to reading
+req->special to convert a pointer to a prepared request into a
+SCSI command pointer, namely by using blk_mq_rq_to_pdu(). Make
+this change where appropriate. Although this patch does not
+change any functionality, it slightly improves performance and
+slightly improves readability.
+
+Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_error.c | 2 +-
+ drivers/scsi/scsi_lib.c | 18 +++++++++---------
+ include/scsi/scsi_tcq.h | 2 +-
+ 3 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
+index 5727b9d2c0ee..b0d5ce1b3f4b 100644
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -259,7 +259,7 @@ void scsi_eh_scmd_add(struct scsi_cmnd *scmd)
+ */
+ enum blk_eh_timer_return scsi_times_out(struct request *req)
+ {
+- struct scsi_cmnd *scmd = req->special;
++ struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req);
+ enum blk_eh_timer_return rtn = BLK_EH_NOT_HANDLED;
+ struct Scsi_Host *host = scmd->device->host;
+
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
+index 6ba1c8192386..22c12d560ea7 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -635,7 +635,7 @@ static void scsi_release_bidi_buffers(struct scsi_cmnd *cmd)
+ static bool scsi_end_request(struct request *req, blk_status_t error,
+ unsigned int bytes, unsigned int bidi_bytes)
+ {
+- struct scsi_cmnd *cmd = req->special;
++ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
+ struct scsi_device *sdev = cmd->device;
+ struct request_queue *q = sdev->request_queue;
+
+@@ -1177,7 +1177,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
+
+ static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req)
+ {
+- struct scsi_cmnd *cmd = req->special;
++ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
+
+ /*
+ * Passthrough requests may transfer data, in which case they must
+@@ -1208,7 +1208,7 @@ static int scsi_setup_scsi_cmnd(struct scsi_device *sdev, struct request *req)
+ */
+ static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req)
+ {
+- struct scsi_cmnd *cmd = req->special;
++ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
+
+ if (unlikely(sdev->handler && sdev->handler->prep_fn)) {
+ int ret = sdev->handler->prep_fn(sdev, req);
+@@ -1223,7 +1223,7 @@ static int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req)
+
+ static int scsi_setup_cmnd(struct scsi_device *sdev, struct request *req)
+ {
+- struct scsi_cmnd *cmd = req->special;
++ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
+
+ if (!blk_rq_bytes(req))
+ cmd->sc_data_direction = DMA_NONE;
+@@ -1360,7 +1360,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
+
+ static void scsi_unprep_fn(struct request_queue *q, struct request *req)
+ {
+- scsi_uninit_cmd(req->special);
++ scsi_uninit_cmd(blk_mq_rq_to_pdu(req));
+ }
+
+ /*
+@@ -1551,7 +1551,7 @@ static int scsi_lld_busy(struct request_queue *q)
+ */
+ static void scsi_kill_request(struct request *req, struct request_queue *q)
+ {
+- struct scsi_cmnd *cmd = req->special;
++ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(req);
+ struct scsi_device *sdev;
+ struct scsi_target *starget;
+ struct Scsi_Host *shost;
+@@ -1582,7 +1582,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
+
+ static void scsi_softirq_done(struct request *rq)
+ {
+- struct scsi_cmnd *cmd = rq->special;
++ struct scsi_cmnd *cmd = blk_mq_rq_to_pdu(rq);
+ unsigned long wait_for = (cmd->allowed + 1) * rq->timeout;
+ int disposition;
+
+@@ -1770,8 +1770,8 @@ static void scsi_request_fn(struct request_queue *q)
+ blk_start_request(req);
+
+ spin_unlock_irq(q->queue_lock);
+- cmd = req->special;
+- if (unlikely(cmd == NULL)) {
++ cmd = blk_mq_rq_to_pdu(req);
++ if (cmd != req->special) {
+ printk(KERN_CRIT "impossible request in %s.\n"
+ "please mail a stack trace to "
+ "linux-scsi@vger.kernel.org\n",
+diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
+index 4416b1026189..5b416debf101 100644
+--- a/include/scsi/scsi_tcq.h
++++ b/include/scsi/scsi_tcq.h
+@@ -39,7 +39,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
+
+ if (!req)
+ return NULL;
+- return req->special;
++ return blk_mq_rq_to_pdu(req);
+ }
+
+ #endif /* CONFIG_BLOCK */
+--
+2.12.3
+
diff --git a/patches.drivers/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch b/patches.fixes/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch
index 1980c147bc..9e71c3457c 100644
--- a/patches.drivers/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch
+++ b/patches.fixes/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch
@@ -1,9 +1,9 @@
From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
Date: Fri, 17 Nov 2017 19:14:53 -0200
-Subject: scsi: aacraid: Check for PCI state of device in a generic way
-Patch-mainline: v4.15-rc3
-Git-commit: bd257b2f3bc68514fad19763f540fea581c12d22
+Subject: [PATCH] scsi: aacraid: Check for PCI state of device in a generic way
References: bsc#1077989
+Git-commit: bd257b2f3bc68514fad19763f540fea581c12d22
+Patch-mainline: v4.15-rc3
Commit 16ae9dd35d37 ("scsi: aacraid: Fix for excessive prints on EEH")
introduced checks about the state of device before any PCI operations in
@@ -27,14 +27,16 @@ Fixes: 16ae9dd35d37 ("scsi: aacraid: Fix for excessive prints on EEH")
Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
---
- drivers/scsi/aacraid/commsup.c | 33 ++-------------------------------
+ drivers/scsi/aacraid/commsup.c | 33 ++-------------------------------
1 file changed, 2 insertions(+), 31 deletions(-)
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
+index dfe8e70f8d99..d68052653c3a 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
-@@ -467,35 +467,6 @@ int aac_queue_get(struct aac_dev * dev,
+@@ -467,35 +467,6 @@ int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw
return 0;
}
@@ -70,7 +72,7 @@ Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
/*
* Define the highest level of host to adapter communication routines.
* These routines will support host to adapter FS commuication. These
-@@ -701,7 +672,7 @@ int aac_fib_send(u16 command, struct fib
+@@ -701,7 +672,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
return -ETIMEDOUT;
}
@@ -79,7 +81,7 @@ Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
return -EFAULT;
if ((blink = aac_adapter_check_health(dev)) > 0) {
-@@ -801,7 +772,7 @@ int aac_hba_send(u8 command, struct fib
+@@ -801,7 +772,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
spin_unlock_irqrestore(&fibptr->event_lock, flags);
@@ -88,3 +90,6 @@ Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
return -EFAULT;
fibptr->flags |= FIB_CONTEXT_FLAG_WAIT;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-aacraid-Fix-2T-drives-on-SmartIOC-2000.patch b/patches.fixes/scsi-aacraid-Fix-2T-drives-on-SmartIOC-2000.patch
new file mode 100644
index 0000000000..ce5e6a4d7b
--- /dev/null
+++ b/patches.fixes/scsi-aacraid-Fix-2T-drives-on-SmartIOC-2000.patch
@@ -0,0 +1,66 @@
+From: Dave Carroll <david.carroll@microsemi.com>
+Date: Fri, 15 Sep 2017 11:04:28 -0600
+Subject: [PATCH] scsi: aacraid: Fix 2T+ drives on SmartIOC-2000
+References: bsc#1077989
+Git-commit: 6c92f7dbf25c36f35320e4ae0b508676410bac04
+Patch-mainline: v4.14-rc3
+
+The logic for supporting large drives was previously tied to 4Kn support
+for SmartIOC-2000. As SmartIOC-2000 does not support volumes using 4Kn
+drives, use the intended option flag AAC_OPT_NEW_COMM_64 to determine
+support for volumes greater than 2T.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/aacraid/aachba.c | 12 ++++++------
+ drivers/scsi/aacraid/aacraid.h | 5 +++++
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
+index a64285ab0728..af3e4d3f9735 100644
+--- a/drivers/scsi/aacraid/aachba.c
++++ b/drivers/scsi/aacraid/aachba.c
+@@ -699,13 +699,13 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)
+ int status;
+
+ dresp = (struct aac_mount *) fib_data(fibptr);
+- if (!(fibptr->dev->supplement_adapter_info.supported_options2 &
+- AAC_OPTION_VARIABLE_BLOCK_SIZE))
++ if (!aac_supports_2T(fibptr->dev)) {
+ dresp->mnt[0].capacityhigh = 0;
+- if ((le32_to_cpu(dresp->status) != ST_OK) ||
+- (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE)) {
+- _aac_probe_container2(context, fibptr);
+- return;
++ if ((le32_to_cpu(dresp->status) == ST_OK) &&
++ (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE)) {
++ _aac_probe_container2(context, fibptr);
++ return;
++ }
+ }
+ scsicmd = (struct scsi_cmnd *) context;
+
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index 92fabf2b0c24..403a639574e5 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -2701,6 +2701,11 @@ static inline int aac_is_src(struct aac_dev *dev)
+ return 0;
+ }
+
++static inline int aac_supports_2T(struct aac_dev *dev)
++{
++ return (dev->adapter_info.options & AAC_OPT_NEW_COMM_64);
++}
++
+ char * get_container_type(unsigned type);
+ extern int numacb;
+ extern char aac_driver_version[];
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-aacraid-Fix-I-O-drop-during-reset.patch b/patches.fixes/scsi-aacraid-Fix-I-O-drop-during-reset.patch
new file mode 100644
index 0000000000..f659760b51
--- /dev/null
+++ b/patches.fixes/scsi-aacraid-Fix-I-O-drop-during-reset.patch
@@ -0,0 +1,53 @@
+From: Prasad B Munirathnam <prasad.munirathnam@microsemi.com>
+Date: Tue, 12 Dec 2017 11:40:10 -0800
+Subject: [PATCH] scsi: aacraid: Fix I/O drop during reset
+References: bsc#1077989
+Git-commit: 5771cfffdffe709ae9b403b6f80438ca40bf850e
+Patch-mainline: v4.15-rc5
+
+"FIB_CONTEXT_FLAG_TIMEDOUT" flag is set in aac_eh_abort to indicate
+command timeout. Using the same flag in reset handler causes the command
+to time out and the I/Os were dropped.
+
+Define a new flag "FIB_CONTEXT_FLAG_EH_RESET" to make sure I/O is
+properly handled in eh_reset handler.
+
+[mkp: tweaked commit message]
+
+Signed-off-by: Prasad B Munirathnam <prasad.munirathnam@microsemi.com>
+Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/aacraid/aacraid.h | 1 +
+ drivers/scsi/aacraid/linit.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index 6e3d81969a77..d52265416da2 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -1725,6 +1725,7 @@ struct aac_dev
+ #define FIB_CONTEXT_FLAG_NATIVE_HBA (0x00000010)
+ #define FIB_CONTEXT_FLAG_NATIVE_HBA_TMF (0x00000020)
+ #define FIB_CONTEXT_FLAG_SCSI_CMD (0x00000040)
++#define FIB_CONTEXT_FLAG_EH_RESET (0x00000080)
+
+ /*
+ * Define the command values
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
+index bdf127aaab41..d55332de08f9 100644
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -1037,7 +1037,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)
+ info = &aac->hba_map[bus][cid];
+ if (bus >= AAC_MAX_BUSES || cid >= AAC_MAX_TARGETS ||
+ info->devtype != AAC_DEVTYPE_NATIVE_RAW) {
+- fib->flags |= FIB_CONTEXT_FLAG_TIMED_OUT;
++ fib->flags |= FIB_CONTEXT_FLAG_EH_RESET;
+ cmd->SCp.phase = AAC_OWNER_ERROR_HANDLER;
+ }
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-aacraid-Perform-initialization-reset-only-once.patch b/patches.fixes/scsi-aacraid-Perform-initialization-reset-only-once.patch
new file mode 100644
index 0000000000..35cab1dab9
--- /dev/null
+++ b/patches.fixes/scsi-aacraid-Perform-initialization-reset-only-once.patch
@@ -0,0 +1,126 @@
+From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
+Date: Fri, 17 Nov 2017 19:14:54 -0200
+Subject: [PATCH] scsi: aacraid: Perform initialization reset only once
+References: bsc#1077989
+Git-commit: d9b6d85a38df398cfe0ba3f0fae59d58c9a6d433
+Patch-mainline: v4.15-rc3
+
+Currently the driver accepts two ways of requesting an initialization
+reset on the adapter: by passing aac_reset_devices module parameter,
+or the generic kernel parameter reset_devices.
+
+It's working as intended...but if we end up reaching a scsi hang and
+the scsi EH mechanism takes place, aacraid performs resets as part of
+the scsi error recovery procedure. These EH routines might reinitialize
+the device, and if we have provided some of the reset parameters in the
+kernel command-line, we again perform an "initialization" reset.
+
+So, to avoid this duplication of resets in case of scsi EH path, this
+patch adds a field to aac_dev struct to keep per-adapter track of the
+init reset request - once it's done, we set it to false and don't
+proactively reset anymore in case of reinitializations.
+
+Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
+Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/aacraid/aacraid.h | 1 +
+ drivers/scsi/aacraid/linit.c | 3 +++
+ drivers/scsi/aacraid/rx.c | 15 ++++++++++-----
+ drivers/scsi/aacraid/src.c | 20 ++++++++++++++------
+ 4 files changed, 28 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
+index 403a639574e5..6e3d81969a77 100644
+--- a/drivers/scsi/aacraid/aacraid.h
++++ b/drivers/scsi/aacraid/aacraid.h
+@@ -1673,6 +1673,7 @@ struct aac_dev
+ struct aac_hba_map_info hba_map[AAC_MAX_BUSES][AAC_MAX_TARGETS];
+ u8 adapter_shutdown;
+ u32 handle_pci_error;
++ bool init_reset;
+ };
+
+ #define aac_adapter_interrupt(dev) \
+diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
+index c9252b138c1f..bdf127aaab41 100644
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -1680,6 +1680,9 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
+ aac->cardtype = index;
+ INIT_LIST_HEAD(&aac->entry);
+
++ if (aac_reset_devices || reset_devices)
++ aac->init_reset = true;
++
+ aac->fibs = kzalloc(sizeof(struct fib) * (shost->can_queue + AAC_NUM_MGT_FIB), GFP_KERNEL);
+ if (!aac->fibs)
+ goto out_free_host;
+diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
+index 93ef7c37e568..620166694171 100644
+--- a/drivers/scsi/aacraid/rx.c
++++ b/drivers/scsi/aacraid/rx.c
+@@ -561,11 +561,16 @@ int _aac_rx_init(struct aac_dev *dev)
+ dev->a_ops.adapter_sync_cmd = rx_sync_cmd;
+ dev->a_ops.adapter_enable_int = aac_rx_disable_interrupt;
+ dev->OIMR = status = rx_readb (dev, MUnit.OIMR);
+- if ((((status & 0x0c) != 0x0c) || aac_reset_devices || reset_devices) &&
+- !aac_rx_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
+- /* Make sure the Hardware FIFO is empty */
+- while ((++restart < 512) &&
+- (rx_readl(dev, MUnit.OutboundQueue) != 0xFFFFFFFFL));
++
++ if (((status & 0x0c) != 0x0c) || dev->init_reset) {
++ dev->init_reset = false;
++ if (!aac_rx_restart_adapter(dev, 0, IOP_HWSOFT_RESET)) {
++ /* Make sure the Hardware FIFO is empty */
++ while ((++restart < 512) &&
++ (rx_readl(dev, MUnit.OutboundQueue) != 0xFFFFFFFFL));
++ }
++ }
++
+ /*
+ * Check to see if the board panic'd while booting.
+ */
+diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
+index 0c9361c87ec8..fde6b6aa86e3 100644
+--- a/drivers/scsi/aacraid/src.c
++++ b/drivers/scsi/aacraid/src.c
+@@ -868,9 +868,13 @@ int aac_src_init(struct aac_dev *dev)
+ /* Failure to reset here is an option ... */
+ dev->a_ops.adapter_sync_cmd = src_sync_cmd;
+ dev->a_ops.adapter_enable_int = aac_src_disable_interrupt;
+- if ((aac_reset_devices || reset_devices) &&
+- !aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
+- ++restart;
++
++ if (dev->init_reset) {
++ dev->init_reset = false;
++ if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
++ ++restart;
++ }
++
+ /*
+ * Check to see if the board panic'd while booting.
+ */
+@@ -1014,9 +1018,13 @@ int aac_srcv_init(struct aac_dev *dev)
+ /* Failure to reset here is an option ... */
+ dev->a_ops.adapter_sync_cmd = src_sync_cmd;
+ dev->a_ops.adapter_enable_int = aac_src_disable_interrupt;
+- if ((aac_reset_devices || reset_devices) &&
+- !aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
+- ++restart;
++
++ if (dev->init_reset) {
++ dev->init_reset = false;
++ if (!aac_src_restart_adapter(dev, 0, IOP_HWSOFT_RESET))
++ ++restart;
++ }
++
+ /*
+ * Check to see if flash update is running.
+ * Wait for the adapter to be up and running. Wait up to 5 minutes
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-aacraid-Prevent-crash-in-case-of-free-interrupt.patch b/patches.fixes/scsi-aacraid-Prevent-crash-in-case-of-free-interrupt.patch
new file mode 100644
index 0000000000..743295720f
--- /dev/null
+++ b/patches.fixes/scsi-aacraid-Prevent-crash-in-case-of-free-interrupt.patch
@@ -0,0 +1,67 @@
+From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
+Date: Fri, 17 Nov 2017 19:14:55 -0200
+Subject: [PATCH] scsi: aacraid: Prevent crash in case of free interrupt during
+ scsi EH path
+References: bsc#1077989
+Git-commit: e4717292ddebcfe231651b5aff9fa19ca158d178
+Patch-mainline: v4.15-rc3
+
+As part of the scsi EH path, aacraid performs a reinitialization of the
+adapter, which encompass freeing resources and IRQs, NULLifying lots of
+pointers, and then initialize it all over again. We've identified a
+problem during the free IRQ portion of this path if CONFIG_DEBUG_SHIRQ
+is enabled on kernel config file.
+
+Happens that, in case this flag was set, right after free_irq()
+effectively clears the interrupt, it checks if it was requested as
+IRQF_SHARED. In positive case, it performs another call to the IRQ
+handler on driver. Problem is: since aacraid currently free some
+resources *before* freeing the IRQ, once free_irq() path calls the
+handler again (due to CONFIG_DEBUG_SHIRQ), aacraid crashes due to NULL
+pointer dereference with the following trace:
+
+ aac_src_intr_message+0xf8/0x740 [aacraid]
+ __free_irq+0x33c/0x4a0
+ free_irq+0x78/0xb0
+ aac_free_irq+0x13c/0x150 [aacraid]
+ aac_reset_adapter+0x2e8/0x970 [aacraid]
+ aac_eh_reset+0x3a8/0x5d0 [aacraid]
+ scsi_try_host_reset+0x74/0x180
+ scsi_eh_ready_devs+0xc70/0x1510
+ scsi_error_handler+0x624/0xa20
+
+This patch prevents the crash by changing the order of the
+deinitialization in this path of aacraid: first we clear the IRQ, then
+we free other resources. No functional change intended.
+
+Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
+Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/aacraid/commsup.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
+index d68052653c3a..7410792bccf5 100644
+--- a/drivers/scsi/aacraid/commsup.c
++++ b/drivers/scsi/aacraid/commsup.c
+@@ -1554,6 +1554,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
+ * will ensure that i/o is queisced and the card is flushed in that
+ * case.
+ */
++ aac_free_irq(aac);
+ aac_fib_map_free(aac);
+ dma_free_coherent(&aac->pdev->dev, aac->comm_size, aac->comm_addr,
+ aac->comm_phys);
+@@ -1561,7 +1562,6 @@ static int _aac_reset_adapter(struct aac_dev *aac, int forced, u8 reset_type)
+ aac->comm_phys = 0;
+ kfree(aac->queues);
+ aac->queues = NULL;
+- aac_free_irq(aac);
+ kfree(aac->fsa_dev);
+ aac->fsa_dev = NULL;
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-bnx2fc-Fix-hung-task-messages-when-a-cleanup-re.patch b/patches.fixes/scsi-bnx2fc-Fix-hung-task-messages-when-a-cleanup-re.patch
new file mode 100644
index 0000000000..36b5e57254
--- /dev/null
+++ b/patches.fixes/scsi-bnx2fc-Fix-hung-task-messages-when-a-cleanup-re.patch
@@ -0,0 +1,157 @@
+From: Chad Dupuis <chad.dupuis@cavium.com>
+Date: Wed, 15 Nov 2017 07:06:06 -0800
+Subject: [PATCH] scsi: bnx2fc: Fix hung task messages when a cleanup response
+ is not received during abort
+References: bsc#1077989
+Git-commit: faae19be80be7c39c9ce8b04bcc9cc10da82c29e
+Patch-mainline: v4.15-rc1
+
+If a cleanup task is not responded to while we are in bnx2fc_abts_cleanup, it
+will hang the SCSI error handler since we use wait_for_completion instead of
+wait_for_completion_timeout. So, use wait_for_completion_timeout so that we
+don't hang the SCSI error handler thread forever.
+
+Fixes the call trace:
+
+[183373.131468] INFO: task scsi_eh_16:110146 blocked for more than 120 seconds.
+[183373.131469] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
+[183373.131470] scsi_eh_16 D ffff88103f2fca14 0 110146 2 0x00000080
+[183373.131472] ffff880855e77cb0 0000000000000046 ffff881050654e70 ffff880855e77fd8
+[183373.131474] ffff880855e77fd8 ffff880855e77fd8 ffff881050654e70 ffff88103f2fcb48
+[183373.131475] ffff88103f2fcb50 7fffffffffffffff ffff881050654e70 ffff88103f2fca14
+[183373.131477] Call Trace:
+[183373.131479] [<ffffffff8168b579>] schedule+0x29/0x70
+[183373.131481] [<ffffffff81688fc9>] schedule_timeout+0x239/0x2d0
+[183373.131486] [<ffffffff8142821e>] ? __dev_printk+0x3e/0x90
+[183373.131487] [<ffffffff814282cd>] ? dev_printk+0x5d/0x80
+[183373.131490] [<ffffffff8168b956>] wait_for_completion+0x116/0x170
+[183373.131492] [<ffffffff810c4ec0>] ? wake_up_state+0x20/0x20
+[183373.131494] [<ffffffffa048c234>] bnx2fc_abts_cleanup+0x3d/0x62 [bnx2fc]
+[183373.131497] [<ffffffffa0483a80>] bnx2fc_eh_abort+0x470/0x580 [bnx2fc]
+[183373.131500] [<ffffffff814570af>] scsi_error_handler+0x59f/0x8b0
+[183373.131501] [<ffffffff81456b10>] ? scsi_eh_get_sense+0x250/0x250
+[183373.131503] [<ffffffff810b052f>] kthread+0xcf/0xe0
+[183373.131505] [<ffffffff810b0460>] ? kthread_create_on_node+0x140/0x140
+[183373.131507] [<ffffffff81696418>] ret_from_fork+0x58/0x90
+[183373.131509] [<ffffffff810b0460>] ? kthread_create_on_node+0x140/0x140
+
+Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
+Reviewed-by: Laurence Oberman <loberman@redhat.com>
+Tested-by: Laurence Oberman <loberman@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/bnx2fc/bnx2fc_io.c | 40 ++++++++++++++++++++++++++++++++--------
+ 1 file changed, 32 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
+index 5b6153f23f01..8e2f767147cb 100644
+--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
+@@ -1084,24 +1084,35 @@ static int bnx2fc_abts_cleanup(struct bnx2fc_cmd *io_req)
+ {
+ struct bnx2fc_rport *tgt = io_req->tgt;
+ int rc = SUCCESS;
++ unsigned int time_left;
+
+ io_req->wait_for_comp = 1;
+ bnx2fc_initiate_cleanup(io_req);
+
+ spin_unlock_bh(&tgt->tgt_lock);
+
+- wait_for_completion(&io_req->tm_done);
+-
++ /*
++ * Can't wait forever on cleanup response lest we let the SCSI error
++ * handler wait forever
++ */
++ time_left = wait_for_completion_timeout(&io_req->tm_done,
++ BNX2FC_FW_TIMEOUT);
+ io_req->wait_for_comp = 0;
++ if (!time_left)
++ BNX2FC_IO_DBG(io_req, "%s(): Wait for cleanup timed out.\n",
++ __func__);
++
+ /*
+- * release the reference taken in eh_abort to allow the
+- * target to re-login after flushing IOs
++ * Release reference held by SCSI command the cleanup completion
++ * hits the BNX2FC_CLEANUP case in bnx2fc_process_cq_compl() and
++ * thus the SCSI command is not returnedi by bnx2fc_scsi_done().
+ */
+ kref_put(&io_req->refcount, bnx2fc_cmd_release);
+
+ spin_lock_bh(&tgt->tgt_lock);
+ return rc;
+ }
++
+ /**
+ * bnx2fc_eh_abort - eh_abort_handler api to abort an outstanding
+ * SCSI command
+@@ -1118,6 +1129,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
+ struct fc_lport *lport;
+ struct bnx2fc_rport *tgt;
+ int rc;
++ unsigned int time_left;
+
+ rc = fc_block_scsi_eh(sc_cmd);
+ if (rc)
+@@ -1194,6 +1206,11 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
+ if (cancel_delayed_work(&io_req->timeout_work))
+ kref_put(&io_req->refcount,
+ bnx2fc_cmd_release); /* drop timer hold */
++ /*
++ * We don't want to hold off the upper layer timer so simply
++ * cleanup the command and return that I/O was successfully
++ * aborted.
++ */
+ rc = bnx2fc_abts_cleanup(io_req);
+ /* This only occurs when an task abort was requested while ABTS
+ is in progress. Setting the IO_CLEANUP flag will skip the
+@@ -1201,7 +1218,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
+ was a result from the ABTS request rather than the CLEANUP
+ request */
+ set_bit(BNX2FC_FLAG_IO_CLEANUP, &io_req->req_flags);
+- goto out;
++ goto done;
+ }
+
+ /* Cancel the current timer running on this io_req */
+@@ -1221,7 +1238,11 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
+ }
+ spin_unlock_bh(&tgt->tgt_lock);
+
+- wait_for_completion(&io_req->tm_done);
++ /* Wait 2 * RA_TOV + 1 to be sure timeout function hasn't fired */
++ time_left = wait_for_completion_timeout(&io_req->tm_done,
++ (2 * rp->r_a_tov + 1) * HZ);
++ if (time_left)
++ BNX2FC_IO_DBG(io_req, "Timed out in eh_abort waiting for tm_done");
+
+ spin_lock_bh(&tgt->tgt_lock);
+ io_req->wait_for_comp = 0;
+@@ -1233,8 +1254,12 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
+ /* Let the scsi-ml try to recover this command */
+ printk(KERN_ERR PFX "abort failed, xid = 0x%x\n",
+ io_req->xid);
++ /*
++ * Cleanup firmware residuals before returning control back
++ * to SCSI ML.
++ */
+ rc = bnx2fc_abts_cleanup(io_req);
+- goto out;
++ goto done;
+ } else {
+ /*
+ * We come here even when there was a race condition
+@@ -1249,7 +1274,6 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd)
+ done:
+ /* release the reference taken in eh_abort */
+ kref_put(&io_req->refcount, bnx2fc_cmd_release);
+-out:
+ spin_unlock_bh(&tgt->tgt_lock);
+ return rc;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-bnx2fc-Plug-CPU-hotplug-race.patch b/patches.fixes/scsi-bnx2fc-Plug-CPU-hotplug-race.patch
new file mode 100644
index 0000000000..a2c83199ae
--- /dev/null
+++ b/patches.fixes/scsi-bnx2fc-Plug-CPU-hotplug-race.patch
@@ -0,0 +1,91 @@
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 24 Jul 2017 12:52:56 +0200
+Subject: [PATCH] scsi: bnx2fc: Plug CPU hotplug race
+References: bsc#1077989
+Git-commit: 8addebc14a322fa8ca67cd57c6038069acde8ddc
+Patch-mainline: v4.13-rc5
+
+bnx2fc_process_new_cqes() has protection against CPU hotplug, which relies
+on the per cpu thread pointer. This protection is racy because it happens
+only partially with the per cpu fp_work_lock held.
+
+If the CPU is unplugged after the lock is dropped, the wakeup code can
+dereference a NULL pointer or access freed and potentially reused memory.
+
+Restructure the code so the thread check and wakeup happens with the
+fp_work_lock held.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/bnx2fc/bnx2fc_hwi.c | 45 ++++++++++++++++++++--------------------
+ 1 file changed, 23 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+index 913c750205ce..26de61d65a4d 100644
+--- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c
+@@ -1008,6 +1008,28 @@ static struct bnx2fc_work *bnx2fc_alloc_work(struct bnx2fc_rport *tgt, u16 wqe)
+ return work;
+ }
+
++/* Pending work request completion */
++static void bnx2fc_pending_work(struct bnx2fc_rport *tgt, unsigned int wqe)
++{
++ unsigned int cpu = wqe % num_possible_cpus();
++ struct bnx2fc_percpu_s *fps;
++ struct bnx2fc_work *work;
++
++ fps = &per_cpu(bnx2fc_percpu, cpu);
++ spin_lock_bh(&fps->fp_work_lock);
++ if (fps->iothread) {
++ work = bnx2fc_alloc_work(tgt, wqe);
++ if (work) {
++ list_add_tail(&work->list, &fps->work_list);
++ wake_up_process(fps->iothread);
++ spin_unlock_bh(&fps->fp_work_lock);
++ return;
++ }
++ }
++ spin_unlock_bh(&fps->fp_work_lock);
++ bnx2fc_process_cq_compl(tgt, wqe);
++}
++
+ int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt)
+ {
+ struct fcoe_cqe *cq;
+@@ -1042,28 +1064,7 @@ int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt)
+ /* Unsolicited event notification */
+ bnx2fc_process_unsol_compl(tgt, wqe);
+ } else {
+- /* Pending work request completion */
+- struct bnx2fc_work *work = NULL;
+- struct bnx2fc_percpu_s *fps = NULL;
+- unsigned int cpu = wqe % num_possible_cpus();
+-
+- fps = &per_cpu(bnx2fc_percpu, cpu);
+- spin_lock_bh(&fps->fp_work_lock);
+- if (unlikely(!fps->iothread))
+- goto unlock;
+-
+- work = bnx2fc_alloc_work(tgt, wqe);
+- if (work)
+- list_add_tail(&work->list,
+- &fps->work_list);
+-unlock:
+- spin_unlock_bh(&fps->fp_work_lock);
+-
+- /* Pending work request completion */
+- if (fps->iothread && work)
+- wake_up_process(fps->iothread);
+- else
+- bnx2fc_process_cq_compl(tgt, wqe);
++ bnx2fc_pending_work(tgt, wqe);
+ num_free_sqes++;
+ }
+ cqe++;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-bnx2fc-Prevent-recursive-cpuhotplug-locking.patch b/patches.fixes/scsi-bnx2fc-Prevent-recursive-cpuhotplug-locking.patch
new file mode 100644
index 0000000000..560fc739f5
--- /dev/null
+++ b/patches.fixes/scsi-bnx2fc-Prevent-recursive-cpuhotplug-locking.patch
@@ -0,0 +1,63 @@
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 24 Jul 2017 12:52:57 +0200
+Subject: [PATCH] scsi: bnx2fc: Prevent recursive cpuhotplug locking
+References: bsc#1077989
+Git-commit: 2c2b66ae9d11d99f5f6d7010f0d46401ed9031ce
+Patch-mainline: v4.13-rc5
+
+The BNX2FC module init/exit code installs/removes the hotplug callbacks with
+the cpu hotplug lock held. This worked with the old CPU locking
+implementation which allowed recursive locking, but with the new percpu
+rwsem based mechanism this is not longer allowed.
+
+Use the _cpuslocked() variants to fix this.
+
+Reported-by: kernel test robot <fengguang.wu@intel.com>
+Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+index 7dfe709a7138..c4ebf8c5d884 100644
+--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
++++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+@@ -2766,15 +2766,16 @@ static int __init bnx2fc_mod_init(void)
+ for_each_online_cpu(cpu)
+ bnx2fc_percpu_thread_create(cpu);
+
+- rc = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+- "scsi/bnx2fc:online",
+- bnx2fc_cpu_online, NULL);
++ rc = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN,
++ "scsi/bnx2fc:online",
++ bnx2fc_cpu_online, NULL);
+ if (rc < 0)
+ goto stop_threads;
+ bnx2fc_online_state = rc;
+
+- cpuhp_setup_state_nocalls(CPUHP_SCSI_BNX2FC_DEAD, "scsi/bnx2fc:dead",
+- NULL, bnx2fc_cpu_dead);
++ cpuhp_setup_state_nocalls_cpuslocked(CPUHP_SCSI_BNX2FC_DEAD,
++ "scsi/bnx2fc:dead",
++ NULL, bnx2fc_cpu_dead);
+ put_online_cpus();
+
+ cnic_register_driver(CNIC_ULP_FCOE, &bnx2fc_cnic_cb);
+@@ -2850,8 +2851,8 @@ static void __exit bnx2fc_mod_exit(void)
+ bnx2fc_percpu_thread_destroy(cpu);
+ }
+
+- cpuhp_remove_state_nocalls(bnx2fc_online_state);
+- cpuhp_remove_state_nocalls(CPUHP_SCSI_BNX2FC_DEAD);
++ cpuhp_remove_state_nocalls_cpuslocked(bnx2fc_online_state);
++ cpuhp_remove_state_nocalls_cpuslocked(CPUHP_SCSI_BNX2FC_DEAD);
+
+ put_online_cpus();
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-bnx2i-Clean-up-unused-pointers-in-bnx2i_hwi.patch b/patches.fixes/scsi-bnx2i-Clean-up-unused-pointers-in-bnx2i_hwi.patch
new file mode 100644
index 0000000000..3c58367942
--- /dev/null
+++ b/patches.fixes/scsi-bnx2i-Clean-up-unused-pointers-in-bnx2i_hwi.patch
@@ -0,0 +1,87 @@
+From: Christos Gkekas <chris.gekas@gmail.com>
+Date: Sun, 10 Sep 2017 13:18:54 +0100
+Subject: [PATCH] scsi: bnx2i: Clean up unused pointers in bnx2i_hwi
+References: bsc#1077989
+Git-commit: cd6372b614c4504214baab838f77b06503c9cd86
+Patch-mainline: v4.15-rc1
+
+Pointers bnx2i_cmd are set but never used, so they can be removed.
+
+Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
+Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/bnx2i/bnx2i_hwi.c | 10 ----------
+ 1 file changed, 10 deletions(-)
+
+diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c
+index 42921dbba927..e3f22cb4f7fa 100644
+--- a/drivers/scsi/bnx2i/bnx2i_hwi.c
++++ b/drivers/scsi/bnx2i/bnx2i_hwi.c
+@@ -332,12 +332,10 @@ static void bnx2i_ring_dbell_update_sq_params(struct bnx2i_conn *bnx2i_conn,
+ int bnx2i_send_iscsi_login(struct bnx2i_conn *bnx2i_conn,
+ struct iscsi_task *task)
+ {
+- struct bnx2i_cmd *bnx2i_cmd;
+ struct bnx2i_login_request *login_wqe;
+ struct iscsi_login_req *login_hdr;
+ u32 dword;
+
+- bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data;
+ login_hdr = (struct iscsi_login_req *)task->hdr;
+ login_wqe = (struct bnx2i_login_request *)
+ bnx2i_conn->ep->qp.sq_prod_qe;
+@@ -391,12 +389,10 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
+ struct iscsi_tm *tmfabort_hdr;
+ struct scsi_cmnd *ref_sc;
+ struct iscsi_task *ctask;
+- struct bnx2i_cmd *bnx2i_cmd;
+ struct bnx2i_tmf_request *tmfabort_wqe;
+ u32 dword;
+ u32 scsi_lun[2];
+
+- bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data;
+ tmfabort_hdr = (struct iscsi_tm *)mtask->hdr;
+ tmfabort_wqe = (struct bnx2i_tmf_request *)
+ bnx2i_conn->ep->qp.sq_prod_qe;
+@@ -463,12 +459,10 @@ int bnx2i_send_iscsi_tmf(struct bnx2i_conn *bnx2i_conn,
+ int bnx2i_send_iscsi_text(struct bnx2i_conn *bnx2i_conn,
+ struct iscsi_task *mtask)
+ {
+- struct bnx2i_cmd *bnx2i_cmd;
+ struct bnx2i_text_request *text_wqe;
+ struct iscsi_text *text_hdr;
+ u32 dword;
+
+- bnx2i_cmd = (struct bnx2i_cmd *)mtask->dd_data;
+ text_hdr = (struct iscsi_text *)mtask->hdr;
+ text_wqe = (struct bnx2i_text_request *) bnx2i_conn->ep->qp.sq_prod_qe;
+
+@@ -541,11 +535,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
+ char *datap, int data_len, int unsol)
+ {
+ struct bnx2i_endpoint *ep = bnx2i_conn->ep;
+- struct bnx2i_cmd *bnx2i_cmd;
+ struct bnx2i_nop_out_request *nopout_wqe;
+ struct iscsi_nopout *nopout_hdr;
+
+- bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data;
+ nopout_hdr = (struct iscsi_nopout *)task->hdr;
+ nopout_wqe = (struct bnx2i_nop_out_request *)ep->qp.sq_prod_qe;
+
+@@ -602,11 +594,9 @@ int bnx2i_send_iscsi_nopout(struct bnx2i_conn *bnx2i_conn,
+ int bnx2i_send_iscsi_logout(struct bnx2i_conn *bnx2i_conn,
+ struct iscsi_task *task)
+ {
+- struct bnx2i_cmd *bnx2i_cmd;
+ struct bnx2i_logout_request *logout_wqe;
+ struct iscsi_logout *logout_hdr;
+
+- bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data;
+ logout_hdr = (struct iscsi_logout *)task->hdr;
+
+ logout_wqe = (struct bnx2i_logout_request *)
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-csiostor-enable-PCIe-relaxed-ordering-if-suppor.patch b/patches.fixes/scsi-csiostor-enable-PCIe-relaxed-ordering-if-suppor.patch
new file mode 100644
index 0000000000..a223110dc9
--- /dev/null
+++ b/patches.fixes/scsi-csiostor-enable-PCIe-relaxed-ordering-if-suppor.patch
@@ -0,0 +1,71 @@
+From: Varun Prakash <varun@chelsio.com>
+Date: Tue, 29 Aug 2017 21:18:46 +0530
+Subject: [PATCH] scsi: csiostor: enable PCIe relaxed ordering if supported
+References: bsc#1077989
+Git-commit: ff6e88f193c654449bf222450553a7fa16a75ca7
+Patch-mainline: v4.15-rc1
+
+Set PCIe relaxed ordering bits in FW_IQ_CMD if relaxed ordering is
+enabled in the PCIe device.
+
+Signed-off-by: Varun Prakash <varun@chelsio.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/csiostor/csio_hw.h | 3 +++
+ drivers/scsi/csiostor/csio_init.c | 3 +++
+ drivers/scsi/csiostor/csio_mb.c | 3 +++
+ 3 files changed, 9 insertions(+)
+
+diff --git a/drivers/scsi/csiostor/csio_hw.h b/drivers/scsi/csiostor/csio_hw.h
+index 667046419b19..30f5f523c8cc 100644
+--- a/drivers/scsi/csiostor/csio_hw.h
++++ b/drivers/scsi/csiostor/csio_hw.h
+@@ -368,6 +368,9 @@ struct csio_hw_stats {
+ #define CSIO_HWF_HOST_INTR_ENABLED 0x00000200 /* Are host interrupts
+ * enabled?
+ */
++#define CSIO_HWF_ROOT_NO_RELAXED_ORDERING 0x00000400 /* Is PCIe relaxed
++ * ordering enabled
++ */
+
+ #define csio_is_hw_intr_enabled(__hw) \
+ ((__hw)->flags & CSIO_HWF_HW_INTR_ENABLED)
+diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
+index 28a9c7d706cb..cb1711a5d7a3 100644
+--- a/drivers/scsi/csiostor/csio_init.c
++++ b/drivers/scsi/csiostor/csio_init.c
+@@ -968,6 +968,9 @@ static int csio_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
+ goto err_pci_exit;
+ }
+
++ if (!pcie_relaxed_ordering_enabled(pdev))
++ hw->flags |= CSIO_HWF_ROOT_NO_RELAXED_ORDERING;
++
+ pci_set_drvdata(pdev, hw);
+
+ rv = csio_hw_start(hw);
+diff --git a/drivers/scsi/csiostor/csio_mb.c b/drivers/scsi/csiostor/csio_mb.c
+index 9451787ca7f2..7e74ec859228 100644
+--- a/drivers/scsi/csiostor/csio_mb.c
++++ b/drivers/scsi/csiostor/csio_mb.c
+@@ -491,6 +491,7 @@ csio_mb_iq_write(struct csio_hw *hw, struct csio_mb *mbp, void *priv,
+ uint32_t iq_start_stop = (iq_params->iq_start) ?
+ FW_IQ_CMD_IQSTART_F :
+ FW_IQ_CMD_IQSTOP_F;
++ int relaxed = !(hw->flags & CSIO_HWF_ROOT_NO_RELAXED_ORDERING);
+
+ /*
+ * If this IQ write is cascaded with IQ alloc request, do not
+@@ -537,6 +538,8 @@ csio_mb_iq_write(struct csio_hw *hw, struct csio_mb *mbp, void *priv,
+ cmdp->iqns_to_fl0congen |= htonl(
+ FW_IQ_CMD_FL0HOSTFCMODE_V(iq_params->fl0hostfcmode)|
+ FW_IQ_CMD_FL0CPRIO_V(iq_params->fl0cprio) |
++ FW_IQ_CMD_FL0FETCHRO_V(relaxed) |
++ FW_IQ_CMD_FL0DATARO_V(relaxed) |
+ FW_IQ_CMD_FL0PADEN_V(iq_params->fl0paden) |
+ FW_IQ_CMD_FL0PACKEN_V(iq_params->fl0packen));
+ cmdp->fl0dcaen_to_fl0cidxfthresh |= htons(
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-cxgb4i-call-neigh_event_send-to-update-MAC-addr.patch b/patches.fixes/scsi-cxgb4i-call-neigh_event_send-to-update-MAC-addr.patch
new file mode 100644
index 0000000000..7135dfcea7
--- /dev/null
+++ b/patches.fixes/scsi-cxgb4i-call-neigh_event_send-to-update-MAC-addr.patch
@@ -0,0 +1,34 @@
+From: Varun Prakash <varun@chelsio.com>
+Date: Wed, 16 Aug 2017 19:40:32 +0530
+Subject: [PATCH] scsi: cxgb4i: call neigh_event_send() to update MAC address
+References: bsc#1077989
+Git-commit: 71eb2ac58aa52f7948deda4d9a75754b6898e5c9
+Patch-mainline: v4.13-rc7
+
+If nud_state is not valid then call neigh_event_send() to update MAC
+address.
+
+Signed-off-by: Varun Prakash <varun@chelsio.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+index 472338c0b73b..30d5f0ef29bb 100644
+--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
++++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+@@ -1636,6 +1636,9 @@ static int init_act_open(struct cxgbi_sock *csk)
+ goto rel_resource;
+ }
+
++ if (!(n->nud_state & NUD_VALID))
++ neigh_event_send(n, NULL);
++
+ csk->atid = cxgb4_alloc_atid(lldi->tids, csk);
+ if (csk->atid < 0) {
+ pr_err("%s, NO atid available.\n", ndev->name);
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-cxlflash-Allow-cards-without-WWPN-VPD-to-config.patch b/patches.fixes/scsi-cxlflash-Allow-cards-without-WWPN-VPD-to-config.patch
new file mode 100644
index 0000000000..f98bd1a5bf
--- /dev/null
+++ b/patches.fixes/scsi-cxlflash-Allow-cards-without-WWPN-VPD-to-config.patch
@@ -0,0 +1,101 @@
+From: "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>
+Date: Wed, 25 Oct 2017 16:36:20 -0500
+Subject: [PATCH] scsi: cxlflash: Allow cards without WWPN VPD to configure
+References: bsc#1077989
+Git-commit: 0d4191305e69e42b3f7f11bbcf077d1d42929f94
+Patch-mainline: v4.15-rc1
+
+Currently, all adapters that cxlflash supports must have WWPN VPD
+keywords to complete configuration. This was required as cards with
+external FC ports needed to be programmed with WWPNs.
+
+Newer supported cards do not have an external FC interface and therefore
+do not require WWPN. To support backwards compatibility, these devices
+have included 'dummy' WWPN VPD with WWPN values of zero. This however
+places a dependency that all future cards have WWPN VPD, which may not
+always be the case.
+
+Allow for cards to not have WWPN, designating which cards are expected
+to have it in order to configure properly.
+
+Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
+Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxlflash/main.c | 24 +++++++++++++++++-------
+ drivers/scsi/cxlflash/main.h | 3 ++-
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
+index 8f609ef9282a..48d366304582 100644
+--- a/drivers/scsi/cxlflash/main.c
++++ b/drivers/scsi/cxlflash/main.c
+@@ -1635,7 +1635,10 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
+ ssize_t vpd_size;
+ char vpd_data[CXLFLASH_VPD_LEN];
+ char tmp_buf[WWPN_BUF_LEN] = { 0 };
+- char *wwpn_vpd_tags[MAX_FC_PORTS] = { "V5", "V6", "V7", "V8" };
++ const struct dev_dependent_vals *ddv = (struct dev_dependent_vals *)
++ cfg->dev_id->driver_data;
++ const bool wwpn_vpd_required = ddv->flags & CXLFLASH_WWPN_VPD_REQUIRED;
++ const char *wwpn_vpd_tags[MAX_FC_PORTS] = { "V5", "V6", "V7", "V8" };
+
+ /* Get the VPD data from the device */
+ vpd_size = cxl_read_adapter_vpd(pdev, vpd_data, sizeof(vpd_data));
+@@ -1672,17 +1675,24 @@ static int read_vpd(struct cxlflash_cfg *cfg, u64 wwpn[])
+ * value. Note that we must copy to a temporary buffer
+ * because the conversion service requires that the ASCII
+ * string be terminated.
++ *
++ * Allow for WWPN not being found for all devices, setting
++ * the returned WWPN to zero when not found. Notify with a
++ * log error for cards that should have had WWPN keywords
++ * in the VPD - cards requiring WWPN will not have their
++ * ports programmed and operate in an undefined state.
+ */
+ for (k = 0; k < cfg->num_fc_ports; k++) {
+ j = ro_size;
+ i = ro_start + PCI_VPD_LRDT_TAG_SIZE;
+
+ i = pci_vpd_find_info_keyword(vpd_data, i, j, wwpn_vpd_tags[k]);
+- if (unlikely(i < 0)) {
+- dev_err(dev, "%s: Port %d WWPN not found in VPD\n",
+- __func__, k);
+- rc = -ENODEV;
+- goto out;
++ if (i < 0) {
++ if (wwpn_vpd_required)
++ dev_err(dev, "%s: Port %d WWPN not found\n",
++ __func__, k);
++ wwpn[k] = 0ULL;
++ continue;
+ }
+
+ j = pci_vpd_info_field_size(&vpd_data[i]);
+@@ -3146,7 +3156,7 @@ static struct scsi_host_template driver_template = {
+ * Device dependent values
+ */
+ static struct dev_dependent_vals dev_corsa_vals = { CXLFLASH_MAX_SECTORS,
+- 0ULL };
++ CXLFLASH_WWPN_VPD_REQUIRED };
+ static struct dev_dependent_vals dev_flash_gt_vals = { CXLFLASH_MAX_SECTORS,
+ CXLFLASH_NOTIFY_SHUTDOWN };
+ static struct dev_dependent_vals dev_briard_vals = { CXLFLASH_MAX_SECTORS,
+diff --git a/drivers/scsi/cxlflash/main.h b/drivers/scsi/cxlflash/main.h
+index 880e348ed5c9..ba0108a7a9c2 100644
+--- a/drivers/scsi/cxlflash/main.h
++++ b/drivers/scsi/cxlflash/main.h
+@@ -95,7 +95,8 @@ enum undo_level {
+ struct dev_dependent_vals {
+ u64 max_sectors;
+ u64 flags;
+-#define CXLFLASH_NOTIFY_SHUTDOWN 0x0000000000000001ULL
++#define CXLFLASH_NOTIFY_SHUTDOWN 0x0000000000000001ULL
++#define CXLFLASH_WWPN_VPD_REQUIRED 0x0000000000000002ULL
+ };
+
+ struct asyc_intr_info {
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-cxlflash-Derive-pid-through-accessors.patch b/patches.fixes/scsi-cxlflash-Derive-pid-through-accessors.patch
new file mode 100644
index 0000000000..51012ceca2
--- /dev/null
+++ b/patches.fixes/scsi-cxlflash-Derive-pid-through-accessors.patch
@@ -0,0 +1,59 @@
+From: "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>
+Date: Wed, 25 Oct 2017 16:36:29 -0500
+Subject: [PATCH] scsi: cxlflash: Derive pid through accessors
+References: bsc#1077989
+Git-commit: d84c198f43c50c6c0bd57571acbf0f000165bd56
+Patch-mainline: v4.15-rc1
+
+The cxlflash driver tracks process IDs alongside contexts to validate
+context ownership. Currently, the process IDs are derived by directly
+accessing values from the 'current' task pointer. While this method of
+access is fine for the current process, it is incorrect when the parent
+process ID is needed as the access requires serialization.
+
+To address the incorrect issue and provide a consistent means of
+deriving the process ID within the cxlflash driver, use the task
+accessors defined linux/sched.h.
+
+Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
+Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxlflash/superpipe.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c
+index ed46e8df2e42..170fff5aeff6 100644
+--- a/drivers/scsi/cxlflash/superpipe.c
++++ b/drivers/scsi/cxlflash/superpipe.c
+@@ -165,7 +165,7 @@ struct ctx_info *get_context(struct cxlflash_cfg *cfg, u64 rctxid,
+ struct llun_info *lli = arg;
+ u64 ctxid = DECODE_CTXID(rctxid);
+ int rc;
+- pid_t pid = current->tgid, ctxpid = 0;
++ pid_t pid = task_tgid_nr(current), ctxpid = 0;
+
+ if (ctx_ctrl & CTX_CTRL_FILE) {
+ lli = NULL;
+@@ -173,7 +173,7 @@ struct ctx_info *get_context(struct cxlflash_cfg *cfg, u64 rctxid,
+ }
+
+ if (ctx_ctrl & CTX_CTRL_CLONE)
+- pid = current->parent->tgid;
++ pid = task_ppid_nr(current);
+
+ if (likely(ctxid < MAX_CONTEXT)) {
+ while (true) {
+@@ -824,7 +824,7 @@ static void init_context(struct ctx_info *ctxi, struct cxlflash_cfg *cfg,
+ ctxi->rht_perms = perms;
+ ctxi->ctrl_map = &afu->afu_map->ctrls[ctxid].ctrl;
+ ctxi->ctxid = ENCODE_CTXID(ctxi, ctxid);
+- ctxi->pid = current->tgid; /* tgid = pid */
++ ctxi->pid = task_tgid_nr(current); /* tgid = pid */
+ ctxi->ctx = ctx;
+ ctxi->cfg = cfg;
+ ctxi->file = file;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-cxlflash-Use-derived-maximum-write-same-length.patch b/patches.fixes/scsi-cxlflash-Use-derived-maximum-write-same-length.patch
new file mode 100644
index 0000000000..a0139501da
--- /dev/null
+++ b/patches.fixes/scsi-cxlflash-Use-derived-maximum-write-same-length.patch
@@ -0,0 +1,66 @@
+From: "Matthew R. Ochs" <mrochs@linux.vnet.ibm.com>
+Date: Wed, 25 Oct 2017 16:35:57 -0500
+Subject: [PATCH] scsi: cxlflash: Use derived maximum write same length
+References: bsc#1077989
+Git-commit: 285e6670d0229b0157a9167eb8b2626b445a5a0e
+Patch-mainline: v4.15-rc1
+
+The existing write same routine within the cxlflash driver uses a
+statically defined value for the maximum write same transfer length.
+While this is close to the value reflected by the original device that
+was supported by cxlflash, newer devices are capable of much larger
+lengths. Supporting what the device is capable of offers substantial
+performance improvement as the scrub routine within cxlflash operates on
+'chunk size' units (256MB with a 4K sector size).
+
+Instead of a #define, use the write same maximum length that is stored
+in the block layer in units of 512 byte sectors. This value is initially
+determined from the block limits VPD page during device discovery and
+can also be manipulated from sysfs. As a general cleanup, designate the
+timeout used when executing the write same command as constant.
+
+Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
+Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxlflash/sislite.h | 3 ---
+ drivers/scsi/cxlflash/vlun.c | 6 ++++--
+ 2 files changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/cxlflash/sislite.h b/drivers/scsi/cxlflash/sislite.h
+index 09daa86670fc..bedf1ce2f33c 100644
+--- a/drivers/scsi/cxlflash/sislite.h
++++ b/drivers/scsi/cxlflash/sislite.h
+@@ -548,7 +548,4 @@ struct sisl_rht_entry_f1 {
+ #define TMF_LUN_RESET 0x1U
+ #define TMF_CLEAR_ACA 0x2U
+
+-
+-#define SISLITE_MAX_WS_BLOCKS 512
+-
+ #endif /* _SISLITE_H */
+diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c
+index 703bf1e9a64a..5deef57a7834 100644
+--- a/drivers/scsi/cxlflash/vlun.c
++++ b/drivers/scsi/cxlflash/vlun.c
+@@ -428,12 +428,14 @@ static int write_same16(struct scsi_device *sdev,
+ u8 *sense_buf = NULL;
+ int rc = 0;
+ int result = 0;
+- int ws_limit = SISLITE_MAX_WS_BLOCKS;
+ u64 offset = lba;
+ int left = nblks;
+- u32 to = sdev->request_queue->rq_timeout;
+ struct cxlflash_cfg *cfg = shost_priv(sdev->host);
+ struct device *dev = &cfg->dev->dev;
++ const u32 s = ilog2(sdev->sector_size) - 9;
++ const u32 to = sdev->request_queue->rq_timeout;
++ const u32 ws_limit = blk_queue_get_max_sectors(sdev->request_queue,
++ REQ_OP_WRITE_SAME) >> s;
+
+ cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
+ scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-devinfo-Apply-to-HP-rebranded-the-same-flags-as.patch b/patches.fixes/scsi-devinfo-Apply-to-HP-rebranded-the-same-flags-as.patch
new file mode 100644
index 0000000000..a2a03bdff1
--- /dev/null
+++ b/patches.fixes/scsi-devinfo-Apply-to-HP-rebranded-the-same-flags-as.patch
@@ -0,0 +1,51 @@
+From: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Date: Fri, 17 Nov 2017 21:19:14 +0100
+Subject: [PATCH] scsi: devinfo: Apply to HP-rebranded the same flags as
+ Hitachi
+References: bsc#1077989
+Git-commit: 41764fa6223183126675bb16cccbc8ba361d2e7d
+Patch-mainline: v4.16-rc1
+
+Commit 627511e3e675 ("[SCSI] scsi_devinfo: update Hitachi entries (v2)")
+modified some Hitachi entries:
+
+ Four models, OPEN-/DF400/DF500/DISK-SUBSYSTEM, can handle
+ REPORT_LUN, and the BLIST_REPORTLUN2 flag needs to be set. And DF600
+ doesn't require any flags because it returns ANSI 03h (SPC).
+
+The same should have been done also for HP counterparts.
+
+[mkp: checkpatch and tweaked commit message]
+
+Cc: Takahiro Yasui <takahiro.yasui@hds.com>
+Cc: Mike Christie <michaelc@cs.wisc.edu>
+Cc: Matthias Rudolph <Matthias.Rudolph@hds.com>
+Cc: Martin K. Petersen <martin.petersen@oracle.com>
+Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
+Cc: SCSI ML <linux-scsi@vger.kernel.org>
+Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_devinfo.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
+index a1b524988ad9..3f905339e1e8 100644
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -186,9 +186,8 @@ static struct {
+ {"HP", "C1557A", NULL, BLIST_FORCELUN},
+ {"HP", "C3323-300", "4269", BLIST_NOTQ},
+ {"HP", "C5713A", NULL, BLIST_NOREPORTLUN},
+- {"HP", "DF400", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+- {"HP", "DF500", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+- {"HP", "DF600", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
++ {"HP", "DF400", "*", BLIST_REPORTLUN2},
++ {"HP", "DF500", "*", BLIST_REPORTLUN2},
+ {"HP", "OP-C-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"HP", "3380-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"HP", "3390-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-devinfo-apply-to-HP-XP-the-same-flags-as-Hitach.patch b/patches.fixes/scsi-devinfo-apply-to-HP-XP-the-same-flags-as-Hitach.patch
new file mode 100644
index 0000000000..7736f436b6
--- /dev/null
+++ b/patches.fixes/scsi-devinfo-apply-to-HP-XP-the-same-flags-as-Hitach.patch
@@ -0,0 +1,46 @@
+From: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Date: Fri, 17 Nov 2017 21:31:36 +0100
+Subject: [PATCH] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP
+References: bsc#1077989
+Git-commit: b369a0471503130cfc74f9f62071db97f48948c3
+Patch-mainline: v4.16-rc1
+
+Commit 56f3d383f37b ("scsi: scsi_devinfo: Add TRY_VPD_PAGES to HITACHI
+OPEN-V blacklist entry") modified some Hitachi entries:
+
+ HITACHI is always supporting VPD pages, even though it's claiming to
+ support SCSI Revision 3 only.
+
+The same should have been done also for HP-rebranded.
+
+[mkp: checkpatch and tweaked commit message]
+
+Cc: Hannes Reinecke <hare@suse.de>
+Cc: Takahiro Yasui <takahiro.yasui@hds.com>
+Cc: Matthias Rudolph <Matthias.Rudolph@hitachivantara.com>
+Cc: Martin K. Petersen <martin.petersen@oracle.com>
+Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
+Cc: SCSI ML <linux-scsi@vger.kernel.org>
+Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_devinfo.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
+index 3f905339e1e8..b53b3428ee06 100644
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -180,7 +180,7 @@ static struct {
+ {"HITACHI", "6586-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"HITACHI", "6588-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"HP", "A6189A", NULL, BLIST_SPARSELUN | BLIST_LARGELUN}, /* HP VA7400 */
+- {"HP", "OPEN-", "*", BLIST_REPORTLUN2}, /* HP XP Arrays */
++ {"HP", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES}, /* HP XP Arrays */
+ {"HP", "NetRAID-4M", NULL, BLIST_FORCELUN},
+ {"HP", "HSV100", NULL, BLIST_REPORTLUN2 | BLIST_NOSTARTONADD},
+ {"HP", "C1557A", NULL, BLIST_FORCELUN},
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-devinfo-replace-Dell-PV-650F-with-EMC-CLARiiON.patch b/patches.fixes/scsi-devinfo-replace-Dell-PV-650F-with-EMC-CLARiiON.patch
new file mode 100644
index 0000000000..9cf2362b3a
--- /dev/null
+++ b/patches.fixes/scsi-devinfo-replace-Dell-PV-650F-with-EMC-CLARiiON.patch
@@ -0,0 +1,38 @@
+From: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Date: Thu, 23 Nov 2017 20:16:14 +0100
+Subject: [PATCH] scsi: devinfo: replace "Dell PV 650F" with "EMC CLARiiON"
+References: bsc#1077989
+Git-commit: 0b7509c76d010128b9ad133a742fb32c71e426d4
+Patch-mainline: v4.16-rc1
+
+The Dell PV650F is a re-branded CLARiiON FC5700. And DGC/RAID,DISK
+identifies all CLARiiON family.
+
+Cc: Martin K. Petersen <martin.petersen@oracle.com>
+Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
+Cc: SCSI ML <linux-scsi@vger.kernel.org>
+Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_devinfo.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
+index b53b3428ee06..c3785ff5dcc2 100644
+--- a/drivers/scsi/scsi_devinfo.c
++++ b/drivers/scsi/scsi_devinfo.c
+@@ -157,8 +157,8 @@ static struct {
+ {"DELL", "PSEUDO DEVICE .", NULL, BLIST_SPARSELUN}, /* Dell PV 530F */
+ {"DELL", "PV530F", NULL, BLIST_SPARSELUN},
+ {"DELL", "PERCRAID", NULL, BLIST_FORCELUN},
+- {"DGC", "RAID", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, storage on LUN 0 */
+- {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* Dell PV 650F, no storage on LUN 0 */
++ {"DGC", "RAID", NULL, BLIST_SPARSELUN}, /* EMC CLARiiON, storage on LUN 0 */
++ {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* EMC CLARiiON, no storage on LUN 0 */
+ {"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
+ {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_REPORTLUN2},
+ {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN},
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-dh-add-new-rdac-devices.patch b/patches.fixes/scsi-dh-add-new-rdac-devices.patch
new file mode 100644
index 0000000000..ae6f012676
--- /dev/null
+++ b/patches.fixes/scsi-dh-add-new-rdac-devices.patch
@@ -0,0 +1,52 @@
+From: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Date: Fri, 17 Nov 2017 22:05:13 +0100
+Subject: [PATCH] scsi: dh: add new rdac devices
+References: bsc#1077989
+Git-commit: 4b3aec2bbbce1c35f50e7475a9fd78d24b9ea4ea
+Patch-mainline: v4.16-rc1
+
+Add IBM 3542 and 3552, arrays: FAStT200 and FAStT500.
+
+Add full STK OPENstorage family, arrays: 9176, D173, D178, D210, D220,
+D240 and D280.
+
+Add STK BladeCtlr family, arrays: B210, B220, B240 and B280.
+
+These changes were done in multipath-tools time ago.
+
+Cc: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
+Cc: Hannes Reinecke <hare@suse.de>
+Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
+Cc: Martin K. Petersen <martin.petersen@oracle.com>
+Cc: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
+Cc: SCSI ML <linux-scsi@vger.kernel.org>
+Cc: device-mapper development <dm-devel@redhat.com>
+Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_dh.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/scsi_dh.c b/drivers/scsi/scsi_dh.c
+index 84addee05be6..a5e30e9449ef 100644
+--- a/drivers/scsi/scsi_dh.c
++++ b/drivers/scsi/scsi_dh.c
+@@ -56,10 +56,13 @@ static const struct scsi_dh_blist scsi_dh_blist[] = {
+ {"IBM", "1815", "rdac", },
+ {"IBM", "1818", "rdac", },
+ {"IBM", "3526", "rdac", },
++ {"IBM", "3542", "rdac", },
++ {"IBM", "3552", "rdac", },
+ {"SGI", "TP9", "rdac", },
+ {"SGI", "IS", "rdac", },
+- {"STK", "OPENstorage D280", "rdac", },
++ {"STK", "OPENstorage", "rdac", },
+ {"STK", "FLEXLINE 380", "rdac", },
++ {"STK", "BladeCtlr", "rdac", },
+ {"SUN", "CSM", "rdac", },
+ {"SUN", "LCSM100", "rdac", },
+ {"SUN", "STK6580_6780", "rdac", },
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-do-not-retry-invalid-function-error.patch b/patches.fixes/scsi-do-not-retry-invalid-function-error.patch
deleted file mode 100644
index 88d98c1b5b..0000000000
--- a/patches.fixes/scsi-do-not-retry-invalid-function-error.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From: Hannes Reinecke <hare@suse.de>
-Date: Wed, 17 Jul 2013 15:05:11 +0200
-Subject: scsi: Do not retry invalid function error
-References: bnc#809122
-Git-commit: 444e90e5d720cada056710d6d4ecaeede0d9fed0
-Patch-Mainline: v4.15
-
-Hitachi USP-V returns 'Invalid function' when the internal
-staging mechanism encountered an error. These errors should
-not be retried on another path.
-
-Signed-off-by: Hannes Reinecke <hare@suse.de>
-Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-
-diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
-index 86d3975..33cadee 100644
---- a/drivers/scsi/scsi_error.c
-+++ b/drivers/scsi/scsi_error.c
-@@ -497,6 +497,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
- case ILLEGAL_REQUEST:
- if (sshdr.asc == 0x20 || /* Invalid command operation code */
- sshdr.asc == 0x21 || /* Logical block address out of range */
-+ sshdr.asc == 0x22 || /* Invalid function */
- sshdr.asc == 0x24 || /* Invalid field in cdb */
- sshdr.asc == 0x26) { /* Parameter value invalid */
- set_host_byte(scmd, DID_TARGET_FAILURE);
diff --git a/patches.fixes/scsi-esas2r-Replace-semaphore-fm_api_semaphore-with-.patch b/patches.fixes/scsi-esas2r-Replace-semaphore-fm_api_semaphore-with-.patch
new file mode 100644
index 0000000000..1addd1f68f
--- /dev/null
+++ b/patches.fixes/scsi-esas2r-Replace-semaphore-fm_api_semaphore-with-.patch
@@ -0,0 +1,71 @@
+From: Binoy Jayan <binoy.jayan@linaro.org>
+Date: Thu, 8 Jun 2017 15:37:30 +0530
+Subject: [PATCH] scsi: esas2r: Replace semaphore fm_api_semaphore with mutex
+References: bsc#1077989
+Git-commit: 74d2fd488d77ab4ff15a7fe0b3b6900f2382b42b
+Patch-mainline: v4.13-rc1
+
+The semaphore 'fm_api_semaphore' is used as a simple mutex, so it should
+be written as one. Semaphores are going away in the future.
+
+Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
+Reviewed-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/esas2r/esas2r.h | 2 +-
+ drivers/scsi/esas2r/esas2r_init.c | 2 +-
+ drivers/scsi/esas2r/esas2r_ioctl.c | 4 ++--
+ 3 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
+index b6030e3edd01..c5013de964e6 100644
+--- a/drivers/scsi/esas2r/esas2r.h
++++ b/drivers/scsi/esas2r/esas2r.h
+@@ -945,7 +945,7 @@ struct esas2r_adapter {
+ struct list_head vrq_mds_head;
+ struct esas2r_mem_desc *vrq_mds;
+ int num_vrqs;
+- struct semaphore fm_api_semaphore;
++ struct mutex fm_api_mutex;
+ struct semaphore fs_api_semaphore;
+ struct semaphore nvram_semaphore;
+ struct atto_ioctl *local_atto_ioctl;
+diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
+index 6432a50b26d8..ad85b33ab6b4 100644
+--- a/drivers/scsi/esas2r/esas2r_init.c
++++ b/drivers/scsi/esas2r/esas2r_init.c
+@@ -327,7 +327,7 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
+ esas2r_debug("new adapter %p, name %s", a, a->name);
+ spin_lock_init(&a->request_lock);
+ spin_lock_init(&a->fw_event_lock);
+- sema_init(&a->fm_api_semaphore, 1);
++ mutex_init(&a->fm_api_mutex);
+ sema_init(&a->fs_api_semaphore, 1);
+ sema_init(&a->nvram_semaphore, 1);
+
+diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
+index 2d4b7f049a68..c6b041a9f007 100644
+--- a/drivers/scsi/esas2r/esas2r_ioctl.c
++++ b/drivers/scsi/esas2r/esas2r_ioctl.c
+@@ -110,7 +110,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
+ {
+ struct esas2r_request *rq;
+
+- if (down_interruptible(&a->fm_api_semaphore)) {
++ if (mutex_lock_interruptible(&a->fm_api_mutex)) {
+ fi->status = FI_STAT_BUSY;
+ return;
+ }
+@@ -173,7 +173,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
+ free_req:
+ esas2r_free_request(a, (struct esas2r_request *)rq);
+ free_sem:
+- up(&a->fm_api_semaphore);
++ mutex_unlock(&a->fm_api_mutex);
+ return;
+
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-esas2r-Replace-semaphore-fs_api_semaphore-with-.patch b/patches.fixes/scsi-esas2r-Replace-semaphore-fs_api_semaphore-with-.patch
new file mode 100644
index 0000000000..3107d2768e
--- /dev/null
+++ b/patches.fixes/scsi-esas2r-Replace-semaphore-fs_api_semaphore-with-.patch
@@ -0,0 +1,80 @@
+From: Binoy Jayan <binoy.jayan@linaro.org>
+Date: Thu, 8 Jun 2017 15:37:31 +0530
+Subject: [PATCH] scsi: esas2r: Replace semaphore fs_api_semaphore with mutex
+References: bsc#1077989
+Git-commit: 249cf320bd5dd3490252cb9f3cdef41f7d1caacc
+Patch-mainline: v4.13-rc1
+
+The semaphore 'fs_api_semaphore' is used as a simple mutex, so it should
+be written as one. Semaphores are going away in the future.
+
+Signed-off-by: Binoy Jayan <binoy.jayan@linaro.org>
+Reviewed-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/esas2r/esas2r.h | 2 +-
+ drivers/scsi/esas2r/esas2r_init.c | 2 +-
+ drivers/scsi/esas2r/esas2r_ioctl.c | 6 +++---
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/esas2r/esas2r.h b/drivers/scsi/esas2r/esas2r.h
+index c5013de964e6..1da6407ee142 100644
+--- a/drivers/scsi/esas2r/esas2r.h
++++ b/drivers/scsi/esas2r/esas2r.h
+@@ -946,7 +946,7 @@ struct esas2r_adapter {
+ struct esas2r_mem_desc *vrq_mds;
+ int num_vrqs;
+ struct mutex fm_api_mutex;
+- struct semaphore fs_api_semaphore;
++ struct mutex fs_api_mutex;
+ struct semaphore nvram_semaphore;
+ struct atto_ioctl *local_atto_ioctl;
+ u8 fw_coredump_buff[ESAS2R_FWCOREDUMP_SZ];
+diff --git a/drivers/scsi/esas2r/esas2r_init.c b/drivers/scsi/esas2r/esas2r_init.c
+index ad85b33ab6b4..5b14dd29b764 100644
+--- a/drivers/scsi/esas2r/esas2r_init.c
++++ b/drivers/scsi/esas2r/esas2r_init.c
+@@ -328,7 +328,7 @@ int esas2r_init_adapter(struct Scsi_Host *host, struct pci_dev *pcid,
+ spin_lock_init(&a->request_lock);
+ spin_lock_init(&a->fw_event_lock);
+ mutex_init(&a->fm_api_mutex);
+- sema_init(&a->fs_api_semaphore, 1);
++ mutex_init(&a->fs_api_mutex);
+ sema_init(&a->nvram_semaphore, 1);
+
+ esas2r_fw_event_off(a);
+diff --git a/drivers/scsi/esas2r/esas2r_ioctl.c b/drivers/scsi/esas2r/esas2r_ioctl.c
+index c6b041a9f007..97623002908f 100644
+--- a/drivers/scsi/esas2r/esas2r_ioctl.c
++++ b/drivers/scsi/esas2r/esas2r_ioctl.c
+@@ -1962,7 +1962,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count)
+ (struct esas2r_ioctl_fs *)a->fs_api_buffer;
+
+ /* If another flash request is already in progress, return. */
+- if (down_interruptible(&a->fs_api_semaphore)) {
++ if (mutex_lock_interruptible(&a->fs_api_mutex)) {
+ busy:
+ fs->status = ATTO_STS_OUT_OF_RSRC;
+ return -EBUSY;
+@@ -1978,7 +1978,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count)
+ rq = esas2r_alloc_request(a);
+ if (rq == NULL) {
+ esas2r_debug("esas2r_read_fs: out of requests");
+- up(&a->fs_api_semaphore);
++ mutex_unlock(&a->fs_api_mutex);
+ goto busy;
+ }
+
+@@ -2006,7 +2006,7 @@ int esas2r_read_fs(struct esas2r_adapter *a, char *buf, long off, int count)
+ ;
+ dont_wait:
+ /* Free the request and keep going */
+- up(&a->fs_api_semaphore);
++ mutex_unlock(&a->fs_api_mutex);
+ esas2r_free_request(a, (struct esas2r_request *)rq);
+
+ /* Pick up possible error code from above */
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-esp_scsi-Always-clear-msg_out_len-after-MESSAGE.patch b/patches.fixes/scsi-esp_scsi-Always-clear-msg_out_len-after-MESSAGE.patch
new file mode 100644
index 0000000000..4708233b7a
--- /dev/null
+++ b/patches.fixes/scsi-esp_scsi-Always-clear-msg_out_len-after-MESSAGE.patch
@@ -0,0 +1,36 @@
+From: Finn Thain <fthain@telegraphics.com.au>
+Date: Fri, 4 Aug 2017 01:43:20 -0400
+Subject: [PATCH] scsi: esp_scsi: Always clear msg_out_len after MESSAGE OUT
+ phase
+References: bsc#1077989
+Git-commit: d60e9eec95d2e81253eaf3c39ac8baf4830d0472
+Patch-mainline: v4.14-rc1
+
+After sending a message, always clear esp->msg_out_len. Otherwise,
+eh_abort_handler may subsequently fail to send an ABORT TASK SET
+message.
+
+Tested-by: Stan Johnson <userm57@yahoo.com>
+Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/esp_scsi.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
+index 4d1e08a87274..c3fc34b9964d 100644
+--- a/drivers/scsi/esp_scsi.c
++++ b/drivers/scsi/esp_scsi.c
+@@ -1951,6 +1951,8 @@ static int esp_process_event(struct esp *esp)
+ scsi_esp_cmd(esp, ESP_CMD_NULL);
+ }
+
++ esp->msg_out_len = 0;
++
+ esp_event(esp, ESP_EVENT_CHECK_PHASE);
+ goto again;
+ case ESP_EVENT_MSGIN:
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-esp_scsi-Avoid-sending-ABORT-TASK-SET-messages.patch b/patches.fixes/scsi-esp_scsi-Avoid-sending-ABORT-TASK-SET-messages.patch
new file mode 100644
index 0000000000..4b4063f324
--- /dev/null
+++ b/patches.fixes/scsi-esp_scsi-Avoid-sending-ABORT-TASK-SET-messages.patch
@@ -0,0 +1,136 @@
+From: Finn Thain <fthain@telegraphics.com.au>
+Date: Fri, 4 Aug 2017 01:43:20 -0400
+Subject: [PATCH] scsi: esp_scsi: Avoid sending ABORT TASK SET messages
+References: bsc#1077989
+Git-commit: c69edff5c5a7ee539b353c4266cccb9080ab55b4
+Patch-mainline: v4.14-rc1
+
+If an LLD aborts a task set, it should complete the affected commands
+with the appropriate result code. In a couple of cases esp_scsi doesn't
+do so.
+
+When the initiator receives an unhandled message, just respond by sending
+a MESSAGE REJECT instead of ABORT TASK SET, and thus avoid the issue.
+
+OTOH, a MESSAGE REJECT sent by a target can be taken as an indication
+that the initiator messed up somehow. It isn't always possible to abort
+correctly, so just fall back on a SCSI bus reset, which will complete the
+affected commands with the appropriate result code.
+
+For example, certain Apple (Sony) CD-ROM drives, when the non-existent
+LUN 1 is scanned, can't handle the INQUIRY command. The problem is not
+detected until the initiator gets a MESSAGE REJECT. Whenever esp_scsi
+sees that message, it raises ATN and sends ABORT TASK SET -- but
+neglects to complete the failed scmd.
+
+The target then goes into DATA OUT phase (probably bogus), while the ESP
+device goes into disconnected mode (surprising, given the bus phase).
+The next Transfer Information command from esp_scsi then causes
+an Invalid Command interrupt because that command is not valid when in
+disconnected mode:
+
+mac_esp: using PDMA for controller 0
+mac_esp mac_esp.0: esp0: regs[50f10000:(null)] irq[19]
+mac_esp mac_esp.0: esp0: is a ESP236, 16 MHz (ccf=4), SCSI ID 7
+scsi host0: esp
+scsi 0:0:0:0: Direct-Access SEAGATE ST318416N 0010 PQ: 0 ANSI: 3
+scsi target0:0:0: Beginning Domain Validation
+scsi target0:0:0: asynchronous
+scsi target0:0:0: Domain Validation skipping write tests
+scsi target0:0:0: Ending Domain Validation
+scsi 0:0:3:0: CD-ROM SONY CD-ROM CDU-8003A 1.9a PQ: 0 ANSI: 2 CCS
+scsi target0:0:3: Beginning Domain Validation
+scsi target0:0:3: FAST-5 SCSI 2.0 MB/s ST (500 ns, offset 15)
+scsi target0:0:3: Domain Validation skipping write tests
+scsi target0:0:3: Ending Domain Validation
+scsi host0: unexpected IREG 40
+scsi host0: Dumping command log
+scsi host0: ent[2] CMD val[c2] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[01] event[0c]
+scsi host0: ent[3] CMD val[00] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c]
+scsi host0: ent[4] EVENT val[0d] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c]
+scsi host0: ent[5] EVENT val[03] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[0d]
+scsi host0: ent[6] CMD val[90] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[03]
+scsi host0: ent[7] EVENT val[05] sreg[91] seqreg[04] sreg2[00] ireg[18] ss[00] event[03]
+scsi host0: ent[8] EVENT val[0d] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[05]
+scsi host0: ent[9] CMD val[01] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[0d]
+scsi host0: ent[10] CMD val[11] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[0d]
+scsi host0: ent[11] EVENT val[0b] sreg[93] seqreg[cc] sreg2[00] ireg[10] ss[00] event[0d]
+scsi host0: ent[12] CMD val[12] sreg[97] seqreg[cc] sreg2[00] ireg[08] ss[00] event[0b]
+scsi host0: ent[13] EVENT val[0c] sreg[97] seqreg[cc] sreg2[00] ireg[08] ss[00] event[0b]
+scsi host0: ent[14] CMD val[44] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[00] event[0c]
+scsi host0: ent[15] CMD val[01] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[01] event[0c]
+scsi host0: ent[16] CMD val[c2] sreg[90] seqreg[cc] sreg2[00] ireg[20] ss[01] event[0c]
+scsi host0: ent[17] CMD val[00] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[0c]
+scsi host0: ent[18] EVENT val[0d] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[0c]
+scsi host0: ent[19] EVENT val[06] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[0d]
+scsi host0: ent[20] CMD val[01] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[06]
+scsi host0: ent[21] CMD val[10] sreg[87] seqreg[02] sreg2[00] ireg[18] ss[00] event[06]
+scsi host0: ent[22] CMD val[1a] sreg[87] seqreg[ca] sreg2[00] ireg[08] ss[00] event[06]
+scsi host0: ent[23] CMD val[12] sreg[87] seqreg[ca] sreg2[00] ireg[08] ss[00] event[06]
+scsi host0: ent[24] EVENT val[0d] sreg[87] seqreg[ca] sreg2[00] ireg[08] ss[00] event[06]
+scsi host0: ent[25] EVENT val[09] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[0d]
+scsi host0: ent[26] CMD val[01] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[09]
+scsi host0: ent[27] CMD val[10] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[09]
+scsi host0: ent[28] EVENT val[0a] sreg[86] seqreg[ca] sreg2[00] ireg[10] ss[00] event[09]
+scsi host0: ent[29] EVENT val[0d] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[0a]
+scsi host0: ent[30] EVENT val[04] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[0d]
+scsi host0: ent[31] CMD val[01] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[04]
+scsi host0: ent[0] CMD val[90] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[04]
+scsi host0: ent[1] EVENT val[05] sreg[80] seqreg[ca] sreg2[00] ireg[20] ss[00] event[04]
+scsi target0:0:3: FAST-5 SCSI 2.0 MB/s ST (500 ns, offset 15)
+scsi target0:0:0: asynchronous
+sr 0:0:3:0: [sr0] scsi-1 drive
+cdrom: Uniform CD-ROM driver Revision: 3.20
+sd 0:0:0:0: Attached scsi generic sg0 type 0
+sr 0:0:3:0: Attached scsi generic sg1 type 5
+
+This patch resolves this issue because the bus reset causes the INQUIRY
+command to fail earlier, and return the appropriate result code.
+
+Tested-by: Stan Johnson <userm57@yahoo.com>
+Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/esp_scsi.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
+index 93fef2b3d357..4d1e08a87274 100644
+--- a/drivers/scsi/esp_scsi.c
++++ b/drivers/scsi/esp_scsi.c
+@@ -1485,9 +1485,8 @@ static void esp_msgin_reject(struct esp *esp)
+ return;
+ }
+
+- esp->msg_out[0] = ABORT_TASK_SET;
+- esp->msg_out_len = 1;
+- scsi_esp_cmd(esp, ESP_CMD_SATN);
++ shost_printk(KERN_INFO, esp->host, "Unexpected MESSAGE REJECT\n");
++ esp_schedule_reset(esp);
+ }
+
+ static void esp_msgin_sdtr(struct esp *esp, struct esp_target_data *tp)
+@@ -1610,7 +1609,7 @@ static void esp_msgin_extended(struct esp *esp)
+ shost_printk(KERN_INFO, esp->host,
+ "Unexpected extended msg type %x\n", esp->msg_in[2]);
+
+- esp->msg_out[0] = ABORT_TASK_SET;
++ esp->msg_out[0] = MESSAGE_REJECT;
+ esp->msg_out_len = 1;
+ scsi_esp_cmd(esp, ESP_CMD_SATN);
+ }
+@@ -1988,6 +1987,10 @@ static int esp_process_event(struct esp *esp)
+
+ scsi_esp_cmd(esp, ESP_CMD_MOK);
+
++ /* Check whether a bus reset is to be done next */
++ if (esp->event == ESP_EVENT_RESET)
++ return 0;
++
+ if (esp->event != ESP_EVENT_FREE_BUS)
+ esp_event(esp, ESP_EVENT_CHECK_PHASE);
+ } else {
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-esp_scsi-Clean-up-control-flow-and-dead-code.patch b/patches.fixes/scsi-esp_scsi-Clean-up-control-flow-and-dead-code.patch
new file mode 100644
index 0000000000..ebc88459bb
--- /dev/null
+++ b/patches.fixes/scsi-esp_scsi-Clean-up-control-flow-and-dead-code.patch
@@ -0,0 +1,150 @@
+From: Finn Thain <fthain@telegraphics.com.au>
+Date: Fri, 4 Aug 2017 01:43:19 -0400
+Subject: [PATCH] scsi: esp_scsi: Clean up control flow and dead code
+References: bsc#1077989
+Git-commit: 201c37d7bf121474ab08212ec0a1e9b163bdd74f
+Patch-mainline: v4.14-rc1
+
+This patch improves readability. There are no functional changes.
+
+Since this touches on a questionable ESP_INTR_DC conditional, add some
+commentary to help others who may (as I did) find themselves chasing an
+"Invalid Command" error after the device flags this condition.
+
+This cleanup also eliminates a warning from "make W=1":
+drivers/scsi/esp_scsi.c: In function 'esp_finish_select':
+drivers/scsi/esp_scsi.c:1233:5: warning: variable 'orig_select_state' set but not used [-Wunused-but-set-variable]
+ u8 orig_select_state;
+
+Tested-by: Stan Johnson <userm57@yahoo.com>
+Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/esp_scsi.c | 40 ++++++++++++++--------------------------
+ drivers/scsi/esp_scsi.h | 1 -
+ 2 files changed, 14 insertions(+), 27 deletions(-)
+
+diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
+index 71cb05b1c3eb..93fef2b3d357 100644
+--- a/drivers/scsi/esp_scsi.c
++++ b/drivers/scsi/esp_scsi.c
+@@ -597,14 +597,12 @@ static int esp_alloc_lun_tag(struct esp_cmd_entry *ent,
+
+ lp->non_tagged_cmd = ent;
+ return 0;
+- } else {
+- /* Tagged command, see if blocked by a
+- * non-tagged one.
+- */
+- if (lp->non_tagged_cmd || lp->hold)
+- return -EBUSY;
+ }
+
++ /* Tagged command. Check that it isn't blocked by a non-tagged one. */
++ if (lp->non_tagged_cmd || lp->hold)
++ return -EBUSY;
++
+ BUG_ON(lp->tagged_cmds[ent->orig_tag[1]]);
+
+ lp->tagged_cmds[ent->orig_tag[1]] = ent;
+@@ -1210,12 +1208,6 @@ static int esp_reconnect(struct esp *esp)
+
+ esp->active_cmd = ent;
+
+- if (ent->flags & ESP_CMD_FLAG_ABORT) {
+- esp->msg_out[0] = ABORT_TASK_SET;
+- esp->msg_out_len = 1;
+- scsi_esp_cmd(esp, ESP_CMD_SATN);
+- }
+-
+ esp_event(esp, ESP_EVENT_CHECK_PHASE);
+ esp_restore_pointers(esp, ent);
+ esp->flags |= ESP_FLAG_QUICKIRQ_CHECK;
+@@ -1230,9 +1222,6 @@ static int esp_finish_select(struct esp *esp)
+ {
+ struct esp_cmd_entry *ent;
+ struct scsi_cmnd *cmd;
+- u8 orig_select_state;
+-
+- orig_select_state = esp->select_state;
+
+ /* No longer selecting. */
+ esp->select_state = ESP_SELECT_NONE;
+@@ -1745,7 +1734,6 @@ static int esp_process_event(struct esp *esp)
+ return 0;
+ }
+ goto again;
+- break;
+
+ case ESP_EVENT_DATA_IN:
+ write = 1;
+@@ -1956,12 +1944,14 @@ static int esp_process_event(struct esp *esp)
+ } else {
+ if (esp->msg_out_len > 1)
+ esp->ops->dma_invalidate(esp);
+- }
+
+- if (!(esp->ireg & ESP_INTR_DC)) {
+- if (esp->rev != FASHME)
++ /* XXX if the chip went into disconnected mode,
++ * we can't run the phase state machine anyway.
++ */
++ if (!(esp->ireg & ESP_INTR_DC))
+ scsi_esp_cmd(esp, ESP_CMD_NULL);
+ }
++
+ esp_event(esp, ESP_EVENT_CHECK_PHASE);
+ goto again;
+ case ESP_EVENT_MSGIN:
+@@ -2022,7 +2012,6 @@ static int esp_process_event(struct esp *esp)
+ }
+ esp_schedule_reset(esp);
+ return 0;
+- break;
+
+ case ESP_EVENT_RESET:
+ scsi_esp_cmd(esp, ESP_CMD_RS);
+@@ -2033,7 +2022,6 @@ static int esp_process_event(struct esp *esp)
+ "Unexpected event %x, resetting\n", esp->event);
+ esp_schedule_reset(esp);
+ return 0;
+- break;
+ }
+ return 1;
+ }
+@@ -2170,14 +2158,14 @@ static void __esp_interrupt(struct esp *esp)
+
+ esp_schedule_reset(esp);
+ } else {
+- if (!(esp->ireg & ESP_INTR_RSEL)) {
+- /* Some combination of FDONE, BSERV, DC. */
+- if (esp->select_state != ESP_SELECT_NONE)
+- intr_done = esp_finish_select(esp);
+- } else if (esp->ireg & ESP_INTR_RSEL) {
++ if (esp->ireg & ESP_INTR_RSEL) {
+ if (esp->active_cmd)
+ (void) esp_finish_select(esp);
+ intr_done = esp_reconnect(esp);
++ } else {
++ /* Some combination of FDONE, BSERV, DC. */
++ if (esp->select_state != ESP_SELECT_NONE)
++ intr_done = esp_finish_select(esp);
+ }
+ }
+ while (!intr_done)
+diff --git a/drivers/scsi/esp_scsi.h b/drivers/scsi/esp_scsi.h
+index 84dcbe4a6268..7e8932ae91f8 100644
+--- a/drivers/scsi/esp_scsi.h
++++ b/drivers/scsi/esp_scsi.h
+@@ -281,7 +281,6 @@ struct esp_cmd_entry {
+
+ u8 flags;
+ #define ESP_CMD_FLAG_WRITE 0x01 /* DMA is a write */
+-#define ESP_CMD_FLAG_ABORT 0x02 /* being aborted */
+ #define ESP_CMD_FLAG_AUTOSENSE 0x04 /* Doing automatic REQUEST_SENSE */
+ #define ESP_CMD_FLAG_RESIDUAL 0x08 /* AM53c974 BLAST residual */
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-fcoe-move-fcoe_interface_remove-out-of-fcoe_int.patch b/patches.fixes/scsi-fcoe-move-fcoe_interface_remove-out-of-fcoe_int.patch
new file mode 100644
index 0000000000..d7034a4089
--- /dev/null
+++ b/patches.fixes/scsi-fcoe-move-fcoe_interface_remove-out-of-fcoe_int.patch
@@ -0,0 +1,60 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Fri, 15 Sep 2017 13:12:12 +0200
+Subject: [PATCH] scsi: fcoe: move fcoe_interface_remove() out of
+ fcoe_interface_cleanup()
+References: bsc#1077989
+Git-commit: 9eed785b02fec925fd6ed7272ad774a803647758
+Patch-mainline: v4.15-rc1
+
+This closes a possible race condition in _fcoe_create() where we drop
+the rtnl_lock() before calling fcoe_interface_remove().
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Lee Duncan <lduncan@suse.com>
+Acked-by: Johannes Thumshirn <jth@kernel.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/fcoe/fcoe.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
+index 7c18fad99347..a96d266b38f8 100644
+--- a/drivers/scsi/fcoe/fcoe.c
++++ b/drivers/scsi/fcoe/fcoe.c
+@@ -501,11 +501,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
+ struct net_device *netdev = fcoe->netdev;
+ struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
+
+- rtnl_lock();
+- if (!fcoe->removed)
+- fcoe_interface_remove(fcoe);
+- rtnl_unlock();
+-
+ /* Release the self-reference taken during fcoe_interface_create() */
+ /* tear-down the FCoE controller */
+ fcoe_ctlr_destroy(fip);
+@@ -2120,6 +2115,11 @@ static void fcoe_destroy_work(struct work_struct *work)
+ cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
+
+ fcoe_if_destroy(port->lport);
++
++ rtnl_lock();
++ if (!fcoe->removed)
++ fcoe_interface_remove(fcoe);
++ rtnl_unlock();
+ fcoe_interface_cleanup(fcoe);
+
+ mutex_unlock(&fcoe_config_mutex);
+@@ -2234,6 +2234,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_mode fip_mode,
+ printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
+ netdev->name);
+ rc = -EIO;
++ if (!fcoe->removed)
++ fcoe_interface_remove(fcoe);
+ rtnl_unlock();
+ fcoe_interface_cleanup(fcoe);
+ mutex_unlock(&fcoe_config_mutex);
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-fcoe-open-code-fcoe_destroy_work-for-NETDEV_UNR.patch b/patches.fixes/scsi-fcoe-open-code-fcoe_destroy_work-for-NETDEV_UNR.patch
new file mode 100644
index 0000000000..51d83858a6
--- /dev/null
+++ b/patches.fixes/scsi-fcoe-open-code-fcoe_destroy_work-for-NETDEV_UNR.patch
@@ -0,0 +1,96 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Fri, 15 Sep 2017 13:12:14 +0200
+Subject: [PATCH] scsi: fcoe: open-code fcoe_destroy_work() for
+ NETDEV_UNREGISTER
+References: bsc#1077989
+Git-commit: 7eccdf005b2f240b9e9f53c72eb19367e21a8cf8
+Patch-mainline: v4.15-rc1
+
+When a NETDEV_UNREGISTER notification is received the network device is
+_deleted_ after the callback returns. So we cannot use a workqueue
+here, as this would cause an inversion when removing the device as the
+netdev is already gone. This manifests with a nasty warning during
+shutdown:
+
+sysfs group ffffffff81eff0e0 not found for kobject 'fc_host7'
+
+So open-code fcoe_destroy_work() when receiving the notification to
+avoid this inversion.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Lee Duncan <lduncan@suse.com>
+Acked-by: Johannes Thumshirn <jth@kernel.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/fcoe/fcoe.c | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
+index a96d266b38f8..f91e264cbffb 100644
+--- a/drivers/scsi/fcoe/fcoe.c
++++ b/drivers/scsi/fcoe/fcoe.c
+@@ -1009,6 +1009,8 @@ static inline int fcoe_em_config(struct fc_lport *lport)
+ * fcoe_if_destroy() - Tear down a SW FCoE instance
+ * @lport: The local port to be destroyed
+ *
++ * Locking: Must be called with the RTNL mutex held.
++ *
+ */
+ static void fcoe_if_destroy(struct fc_lport *lport)
+ {
+@@ -1030,14 +1032,12 @@ static void fcoe_if_destroy(struct fc_lport *lport)
+ /* Free existing transmit skbs */
+ fcoe_clean_pending_queue(lport);
+
+- rtnl_lock();
+ if (!is_zero_ether_addr(port->data_src_addr))
+ dev_uc_del(netdev, port->data_src_addr);
+ if (lport->vport)
+ synchronize_net();
+ else
+ fcoe_interface_remove(fcoe);
+- rtnl_unlock();
+
+ /* Free queued packets for the per-CPU receive threads */
+ fcoe_percpu_clean(lport);
+@@ -1898,7 +1898,14 @@ static int fcoe_device_notification(struct notifier_block *notifier,
+ case NETDEV_UNREGISTER:
+ list_del(&fcoe->list);
+ port = lport_priv(ctlr->lp);
+- queue_work(fcoe_wq, &port->destroy_work);
++ fcoe_vport_remove(lport);
++ mutex_lock(&fcoe_config_mutex);
++ fcoe_if_destroy(lport);
++ if (!fcoe->removed)
++ fcoe_interface_remove(fcoe);
++ fcoe_interface_cleanup(fcoe);
++ mutex_unlock(&fcoe_config_mutex);
++ fcoe_ctlr_device_delete(fcoe_ctlr_to_ctlr_dev(ctlr));
+ goto out;
+ break;
+ case NETDEV_FEAT_CHANGE:
+@@ -2114,9 +2121,8 @@ static void fcoe_destroy_work(struct work_struct *work)
+ ctlr = fcoe_to_ctlr(fcoe);
+ cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
+
+- fcoe_if_destroy(port->lport);
+-
+ rtnl_lock();
++ fcoe_if_destroy(port->lport);
+ if (!fcoe->removed)
+ fcoe_interface_remove(fcoe);
+ rtnl_unlock();
+@@ -2720,7 +2726,9 @@ static int fcoe_vport_destroy(struct fc_vport *vport)
+ mutex_unlock(&n_port->lp_mutex);
+
+ mutex_lock(&fcoe_config_mutex);
++ rtnl_lock();
+ fcoe_if_destroy(vn_port);
++ rtnl_unlock();
+ mutex_unlock(&fcoe_config_mutex);
+
+ return 0;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-fcoe-separate-out-fcoe_vport_remove.patch b/patches.fixes/scsi-fcoe-separate-out-fcoe_vport_remove.patch
new file mode 100644
index 0000000000..6e25b52414
--- /dev/null
+++ b/patches.fixes/scsi-fcoe-separate-out-fcoe_vport_remove.patch
@@ -0,0 +1,105 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Fri, 15 Sep 2017 13:12:13 +0200
+Subject: [PATCH] scsi: fcoe: separate out fcoe_vport_remove()
+References: bsc#1077989
+Git-commit: 6f7f74abaec12af6becf0a471d5968bce2f389b6
+Patch-mainline: v4.15-rc1
+
+Separate out fcoe_vport_remove() from fcoe_destroy_work(). Required for
+the next patch.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Lee Duncan <lduncan@suse.com>
+Acked-by: Johannes Thumshirn <jth@kernel.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/fcoe/fcoe.c | 55 +++++++++++++++++++++++++++++-------------------
+ 1 file changed, 33 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
+index 2a39d7124c0e..7c18fad99347 100644
+--- a/drivers/scsi/fcoe/fcoe.c
++++ b/drivers/scsi/fcoe/fcoe.c
+@@ -155,7 +155,7 @@ static int fcoe_vport_disable(struct fc_vport *, bool disable);
+ static void fcoe_set_vport_symbolic_name(struct fc_vport *);
+ static void fcoe_set_port_id(struct fc_lport *, u32, struct fc_frame *);
+ static void fcoe_fcf_get_vlan_id(struct fcoe_fcf_device *);
+-
++static void fcoe_vport_remove(struct fc_lport *);
+
+ static struct fcoe_sysfs_function_template fcoe_sysfs_templ = {
+ .set_fcoe_ctlr_mode = fcoe_ctlr_mode,
+@@ -2108,30 +2108,10 @@ static void fcoe_destroy_work(struct work_struct *work)
+ struct fcoe_ctlr *ctlr;
+ struct fcoe_port *port;
+ struct fcoe_interface *fcoe;
+- struct Scsi_Host *shost;
+- struct fc_host_attrs *fc_host;
+- unsigned long flags;
+- struct fc_vport *vport;
+- struct fc_vport *next_vport;
+
+ port = container_of(work, struct fcoe_port, destroy_work);
+- shost = port->lport->host;
+- fc_host = shost_to_fc_host(shost);
+-
+- /* Loop through all the vports and mark them for deletion */
+- spin_lock_irqsave(shost->host_lock, flags);
+- list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
+- if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) {
+- continue;
+- } else {
+- vport->flags |= FC_VPORT_DELETING;
+- queue_work(fc_host_work_q(shost),
+- &vport->vport_delete_work);
+- }
+- }
+- spin_unlock_irqrestore(shost->host_lock, flags);
+
+- flush_workqueue(fc_host_work_q(shost));
++ fcoe_vport_remove(port->lport);
+
+ mutex_lock(&fcoe_config_mutex);
+
+@@ -2745,6 +2725,37 @@ static int fcoe_vport_destroy(struct fc_vport *vport)
+ }
+
+ /**
++ * fcoe_vport_remove() - remove attached vports
++ * @lport: lport for which the vports should be removed
++ */
++static void fcoe_vport_remove(struct fc_lport *lport)
++{
++ struct Scsi_Host *shost;
++ struct fc_host_attrs *fc_host;
++ unsigned long flags;
++ struct fc_vport *vport;
++ struct fc_vport *next_vport;
++
++ shost = lport->host;
++ fc_host = shost_to_fc_host(shost);
++
++ /* Loop through all the vports and mark them for deletion */
++ spin_lock_irqsave(shost->host_lock, flags);
++ list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
++ if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) {
++ continue;
++ } else {
++ vport->flags |= FC_VPORT_DELETING;
++ queue_work(fc_host_work_q(shost),
++ &vport->vport_delete_work);
++ }
++ }
++ spin_unlock_irqrestore(shost->host_lock, flags);
++
++ flush_workqueue(fc_host_work_q(shost));
++}
++
++/**
+ * fcoe_vport_disable() - change vport state
+ * @vport: vport to bring online/offline
+ * @disable: should the vport be disabled?
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-fnic-add-a-space-after-p-in-printf-format.patch b/patches.fixes/scsi-fnic-add-a-space-after-p-in-printf-format.patch
new file mode 100644
index 0000000000..7288341560
--- /dev/null
+++ b/patches.fixes/scsi-fnic-add-a-space-after-p-in-printf-format.patch
@@ -0,0 +1,40 @@
+From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
+Date: Sun, 10 Dec 2017 20:23:11 +0100
+Subject: [PATCH] scsi: fnic: add a space after %p in printf format
+References: bsc#1077989
+Git-commit: f280c77dc9bb850bc49a126ef5a088e7340a61b6
+Patch-mainline: v4.16-rc1
+
+fnic_fcpio_icmnd_cmpl_handler() displays the value of sc with:
+
+ FNIC_SCSI_DBG(KERN_INFO...
+ "... sc = 0x%p"
+ "scsi_status ..."
+ ...
+
+As the literal strings get merged, the function uses %ps instead of the
+intended raw %p format. Fix this by inserting a space.
+
+Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/fnic/fnic_scsi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
+index 242e2ee494a1..8cbd3c9f0b4c 100644
+--- a/drivers/scsi/fnic/fnic_scsi.c
++++ b/drivers/scsi/fnic/fnic_scsi.c
+@@ -906,7 +906,7 @@ static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
+
+ FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
+ "icmnd_cmpl abts pending "
+- "hdr status = %s tag = 0x%x sc = 0x%p"
++ "hdr status = %s tag = 0x%x sc = 0x%p "
+ "scsi_status = %x residual = %d\n",
+ fnic_fcpio_status_to_str(hdr_status),
+ id, sc,
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-Fix-configured_logical_drive_count-check.patch b/patches.fixes/scsi-hpsa-Fix-configured_logical_drive_count-check.patch
new file mode 100644
index 0000000000..7b8374ee25
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-Fix-configured_logical_drive_count-check.patch
@@ -0,0 +1,38 @@
+From: Christos Gkekas <chris.gekas@gmail.com>
+Date: Mon, 16 Oct 2017 20:28:02 +0100
+Subject: [PATCH] =?UTF-8?q?scsi:=20hpsa:=20Fix=20configured=5Flogical=5Fdr?=
+ =?UTF-8?q?ive=5Fcount=C2=B7check?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+References: bsc#1077989
+Git-commit: c99dfd20f295b2b8c46da5185c0889493ba1f291
+Patch-mainline: v4.14-rc7
+
+Check whether configured_logical_drive_count is less than 255. Previous
+check was always evaluating to true as this variable is defined as u8.
+
+Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
+Acked-by: Don Brace <don.brace@microsemi.com
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 9abe81021484..4ed3d26ffdde 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -4091,7 +4091,7 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h,
+ memset(id_ctlr, 0, sizeof(*id_ctlr));
+ rc = hpsa_bmic_id_controller(h, id_ctlr, sizeof(*id_ctlr));
+ if (!rc)
+- if (id_ctlr->configured_logical_drive_count < 256)
++ if (id_ctlr->configured_logical_drive_count < 255)
+ *nlocals = id_ctlr->configured_logical_drive_count;
+ else
+ *nlocals = le16_to_cpu(
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-add-controller-checkpoint.patch b/patches.fixes/scsi-hpsa-add-controller-checkpoint.patch
new file mode 100644
index 0000000000..33d6bdd90b
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-add-controller-checkpoint.patch
@@ -0,0 +1,51 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:26 -0500
+Subject: [PATCH] scsi: hpsa: add controller checkpoint
+References: bsc#1077989
+Git-commit: b9b08cade0a6a523c185c5e371f05df63c623c34
+Patch-mainline: v4.15-rc1
+
+Tell hpsa controller to generate a checkpoint for rare lockup
+conditions.
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 4 ++++
+ drivers/scsi/hpsa_cmd.h | 1 +
+ 2 files changed, 5 insertions(+)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 40bb01d33a3b..34061dddebbb 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -8009,6 +8009,10 @@ static void controller_lockup_detected(struct ctlr_info *h)
+ spin_unlock_irqrestore(&h->lock, flags);
+ dev_warn(&h->pdev->dev, "Controller lockup detected: 0x%08x after %d\n",
+ lockup_detected, h->heartbeat_sample_interval / HZ);
++ if (lockup_detected == 0xffff0000) {
++ dev_warn(&h->pdev->dev, "Telling controller to do a CHKPT\n");
++ writel(DOORBELL_GENERATE_CHKPT, h->vaddr + SA5_DOORBELL);
++ }
+ pci_disable_device(h->pdev);
+ fail_all_outstanding_cmds(h);
+ }
+diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
+index 078afe448115..78c3b64b0b97 100644
+--- a/drivers/scsi/hpsa_cmd.h
++++ b/drivers/scsi/hpsa_cmd.h
+@@ -142,6 +142,7 @@
+ #define DOORBELL_CTLR_RESET 0x00000004l
+ #define DOORBELL_CTLR_RESET2 0x00000020l
+ #define DOORBELL_CLEAR_EVENTS 0x00000040l
++#define DOORBELL_GENERATE_CHKPT 0x00000080l
+
+ #define CFGTBL_Trans_Simple 0x00000002l
+ #define CFGTBL_Trans_Performant 0x00000004l
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-add-enclosure-logical-identifier.patch b/patches.fixes/scsi-hpsa-add-enclosure-logical-identifier.patch
new file mode 100644
index 0000000000..583d60fc19
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-add-enclosure-logical-identifier.patch
@@ -0,0 +1,130 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:52:10 -0500
+Subject: [PATCH] scsi: hpsa: add enclosure logical identifier
+References: bsc#1077989
+Git-commit: 0a7c3bb8951278aae25b3b53eb5f97cca4147cf3
+Patch-mainline: v4.15-rc1
+
+Add support for enclosure logical identifier
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 67 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index af0a5a91554b..c2e57b7dae93 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -2965,6 +2965,57 @@ static void hpsa_scsi_interpret_error(struct ctlr_info *h,
+ }
+ }
+
++static int hpsa_do_receive_diagnostic(struct ctlr_info *h, u8 *scsi3addr,
++ u8 page, u8 *buf, size_t bufsize)
++{
++ int rc = IO_OK;
++ struct CommandList *c;
++ struct ErrorInfo *ei;
++
++ c = cmd_alloc(h);
++ if (fill_cmd(c, RECEIVE_DIAGNOSTIC, h, buf, bufsize,
++ page, scsi3addr, TYPE_CMD)) {
++ rc = -1;
++ goto out;
++ }
++ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
++ if (rc)
++ goto out;
++ ei = c->err_info;
++ if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
++ hpsa_scsi_interpret_error(h, c);
++ rc = -1;
++ }
++out:
++ cmd_free(h, c);
++ return rc;
++}
++
++static u64 hpsa_get_enclosure_logical_identifier(struct ctlr_info *h,
++ u8 *scsi3addr)
++{
++ u8 *buf;
++ u64 sa = 0;
++ int rc = 0;
++
++ buf = kzalloc(1024, GFP_KERNEL);
++ if (!buf)
++ return 0;
++
++ rc = hpsa_do_receive_diagnostic(h, scsi3addr, RECEIVE_DIAGNOSTIC,
++ buf, 1024);
++
++ if (rc)
++ goto out;
++
++ sa = get_unaligned_be64(buf+12);
++
++out:
++ kfree(buf);
++ return sa;
++}
++
+ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
+ u16 page, unsigned char *buf,
+ unsigned char bufsize)
+@@ -3400,6 +3451,9 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h,
+
+ bmic_device_index = GET_BMIC_DRIVE_NUMBER(&rle->lunid[0]);
+
++ encl_dev->sas_address =
++ hpsa_get_enclosure_logical_identifier(h, scsi3addr);
++
+ if (encl_dev->target == -1 || encl_dev->lun == -1) {
+ rc = IO_OK;
+ goto out;
+@@ -6571,6 +6625,17 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
+ c->Request.CDB[0] = HPSA_INQUIRY;
+ c->Request.CDB[4] = size & 0xFF;
+ break;
++ case RECEIVE_DIAGNOSTIC:
++ c->Request.CDBLen = 6;
++ c->Request.type_attr_dir =
++ TYPE_ATTR_DIR(cmd_type, ATTR_SIMPLE, XFER_READ);
++ c->Request.Timeout = 0;
++ c->Request.CDB[0] = cmd;
++ c->Request.CDB[1] = 1;
++ c->Request.CDB[2] = 1;
++ c->Request.CDB[3] = (size >> 8) & 0xFF;
++ c->Request.CDB[4] = size & 0xFF;
++ break;
+ case HPSA_REPORT_LOG:
+ case HPSA_REPORT_PHYS:
+ /* Talking to controller so It's a physical command
+@@ -9508,7 +9573,7 @@ static int hpsa_add_sas_host(struct ctlr_info *h)
+ struct hpsa_sas_port *hpsa_sas_port;
+ struct hpsa_sas_phy *hpsa_sas_phy;
+
+- parent_dev = &h->scsi_host->shost_gendev;
++ parent_dev = &h->scsi_host->shost_dev;
+
+ hpsa_sas_node = hpsa_alloc_sas_node(parent_dev);
+ if (!hpsa_sas_node)
+@@ -9599,7 +9664,7 @@ hpsa_sas_get_linkerrors(struct sas_phy *phy)
+ static int
+ hpsa_sas_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier)
+ {
+- *identifier = 0;
++ *identifier = rphy->identify.sas_address;
+ return 0;
+ }
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-bump-driver-version.patch b/patches.fixes/scsi-hpsa-bump-driver-version.patch
new file mode 100644
index 0000000000..c82a70f76a
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-bump-driver-version.patch
@@ -0,0 +1,32 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:52:17 -0500
+Subject: [PATCH] scsi: hpsa: bump driver version
+References: bsc#1077989
+Git-commit: c9edcb2e17bb5532ac09cc627e133c3d94b69e53
+Patch-mainline: v4.15-rc1
+
+Reviewed-by: Gerry Morong <gerry.morong@microsemi.com>
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index c2e57b7dae93..287e5eb0723f 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -60,7 +60,7 @@
+ * HPSA_DRIVER_VERSION must be 3 byte values (0-255) separated by '.'
+ * with an optional trailing '-' followed by a byte value (0-255).
+ */
+-#define HPSA_DRIVER_VERSION "3.4.20-0"
++#define HPSA_DRIVER_VERSION "3.4.20-125"
+ #define DRIVER_NAME "HP HPSA Driver (v " HPSA_DRIVER_VERSION ")"
+ #define HPSA "hpsa"
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-change-timeout-for-internal-cmds.patch b/patches.fixes/scsi-hpsa-change-timeout-for-internal-cmds.patch
new file mode 100644
index 0000000000..bf6f92c6c8
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-change-timeout-for-internal-cmds.patch
@@ -0,0 +1,125 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:38 -0500
+Subject: [PATCH] scsi: hpsa: change timeout for internal cmds
+References: bsc#1077989
+Git-commit: 3026ff9b0339a64d6bdef8858636174d453dce54
+Patch-mainline: v4.15-rc1
+
+There are times when the DEFAULT_TIMEOUT (30 seconds) is not enough.
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 56a7a02463d1..c4f548113c39 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -2929,7 +2929,7 @@ static int hpsa_scsi_do_inquiry(struct ctlr_info *h, unsigned char *scsi3addr,
+ goto out;
+ }
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if (rc)
+ goto out;
+ ei = c->err_info;
+@@ -3213,7 +3213,7 @@ static int hpsa_get_raid_map(struct ctlr_info *h,
+ return -1;
+ }
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if (rc)
+ goto out;
+ ei = c->err_info;
+@@ -3256,7 +3256,7 @@ static int hpsa_bmic_sense_subsystem_information(struct ctlr_info *h,
+ c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
+
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if (rc)
+ goto out;
+ ei = c->err_info;
+@@ -3284,7 +3284,7 @@ static int hpsa_bmic_id_controller(struct ctlr_info *h,
+ goto out;
+
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if (rc)
+ goto out;
+ ei = c->err_info;
+@@ -3315,7 +3315,7 @@ static int hpsa_bmic_id_physical_device(struct ctlr_info *h,
+ c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
+
+ hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
+- DEFAULT_TIMEOUT);
++ NO_TIMEOUT);
+ ei = c->err_info;
+ if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
+ hpsa_scsi_interpret_error(h, c);
+@@ -3388,7 +3388,7 @@ static void hpsa_get_enclosure_info(struct ctlr_info *h,
+ c->Request.CDB[5] = 0;
+
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
+- DEFAULT_TIMEOUT);
++ NO_TIMEOUT);
+ if (rc)
+ goto out;
+
+@@ -3628,7 +3628,7 @@ static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical,
+ if (extended_response)
+ c->Request.CDB[1] = extended_response;
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if (rc)
+ goto out;
+ ei = c->err_info;
+@@ -3763,7 +3763,7 @@ static unsigned char hpsa_volume_offline(struct ctlr_info *h,
+
+ (void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD);
+ rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
+- DEFAULT_TIMEOUT);
++ NO_TIMEOUT);
+ if (rc) {
+ cmd_free(h, c);
+ return HPSA_VPD_LV_STATUS_UNSUPPORTED;
+@@ -8620,7 +8620,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
+ goto errout;
+
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if ((rc != 0) || (c->err_info->CommandStatus != 0))
+ goto errout;
+
+@@ -8632,7 +8632,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
+ goto errout;
+
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_TODEVICE, NO_TIMEOUT);
+ if ((rc != 0) || (c->err_info->CommandStatus != 0))
+ goto errout;
+
+@@ -8642,7 +8642,7 @@ static void hpsa_disable_rld_caching(struct ctlr_info *h)
+ goto errout;
+
+ rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
+- PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
++ PCI_DMA_FROMDEVICE, NO_TIMEOUT);
+ if ((rc != 0) || (c->err_info->CommandStatus != 0))
+ goto errout;
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-cleanup-sas_phy-structures-in-sysfs-when-u.patch b/patches.fixes/scsi-hpsa-cleanup-sas_phy-structures-in-sysfs-when-u.patch
new file mode 100644
index 0000000000..92c298e573
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-cleanup-sas_phy-structures-in-sysfs-when-u.patch
@@ -0,0 +1,58 @@
+From: Martin Wilck <mwilck@suse.de>
+Date: Fri, 20 Oct 2017 16:51:14 -0500
+Subject: [PATCH] scsi: hpsa: cleanup sas_phy structures in sysfs when
+ unloading
+References: bsc#1077989
+Git-commit: 55ca38b4255bb336c2d35990bdb2b368e19b435a
+Patch-mainline: v4.15-rc1
+
+I am resubmitting this patch on behalf of Martin Wilck with his
+permission.
+
+The original patch can be found here:
+https://www.spinics.net/lists/linux-scsi/msg102083.html
+
+This patch did not help until Hannes's
+commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
+was applied to the kernel.
+
+--------------------------------------
+Original patch description from Martin:
+--------------------------------------
+
+When the hpsa module is unloaded using rmmod, dangling
+symlinks remain under /sys/class/sas_phy. Fix this by
+calling sas_phy_delete() rather than sas_phy_free (which,
+according to comments, should not be called for PHYs that
+have been set up successfully, anyway).
+
+Tested-by: Don Brace <don.brace@microsemi.com>
+Reviewed-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin Wilck <mwilck@suse.de>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 4992710d8dfb..5fbaf13781b6 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -9207,9 +9207,9 @@ static void hpsa_free_sas_phy(struct hpsa_sas_phy *hpsa_sas_phy)
+ struct sas_phy *phy = hpsa_sas_phy->phy;
+
+ sas_port_delete_phy(hpsa_sas_phy->parent_port->port, phy);
+- sas_phy_free(phy);
+ if (hpsa_sas_phy->added_to_port)
+ list_del(&hpsa_sas_phy->phy_list_entry);
++ sas_phy_delete(phy);
+ kfree(hpsa_sas_phy);
+ }
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-clear-tmpdevice-in-scan-thread.patch b/patches.fixes/scsi-hpsa-clear-tmpdevice-in-scan-thread.patch
new file mode 100644
index 0000000000..eb77a465ce
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-clear-tmpdevice-in-scan-thread.patch
@@ -0,0 +1,35 @@
+From: Scott Teel <scott.teel@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:20 -0500
+Subject: [PATCH] scsi: hpsa: clear tmpdevice in scan thread
+References: bsc#1077989
+Git-commit: 421bf80cc2e421ea8efd7bc47f595169d67ae92f
+Patch-mainline: v4.15-rc1
+
+clean up stale information.
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 5fbaf13781b6..40bb01d33a3b 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -4258,6 +4258,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
+ int phys_dev_index = i - (raid_ctlr_position == 0);
+ bool skip_device = false;
+
++ memset(tmpdevice, 0, sizeof(*tmpdevice));
++
+ physical_device = i < nphysicals + (raid_ctlr_position == 0);
+
+ /* Figure out where the LUN ID info is coming from */
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-correct-logical-volume-removal.patch b/patches.fixes/scsi-hpsa-correct-logical-volume-removal.patch
new file mode 100644
index 0000000000..4b0ed4a05a
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-correct-logical-volume-removal.patch
@@ -0,0 +1,48 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:52:04 -0500
+Subject: [PATCH] scsi: hpsa: correct logical volume removal
+References: bsc#1077989
+Git-commit: 0ff365f51a4290a63f1044c599df98196223d4bc
+Patch-mainline: v4.15-rc1
+
+Suggested-by: Martin Wilck <mwilck@suse.com>
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 7f6c7a8ffe25..af0a5a91554b 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -1882,6 +1882,12 @@ static void hpsa_remove_device(struct ctlr_info *h,
+ if (!h->scsi_host)
+ return;
+
++ /*
++ * Allow for commands to drain
++ */
++ device->removed = 1;
++ hpsa_wait_for_outstanding_commands_for_dev(h, device);
++
+ if (is_logical_device(device)) { /* RAID */
+ sdev = scsi_device_lookup(h->scsi_host, device->bus,
+ device->target, device->lun);
+@@ -1899,9 +1905,6 @@ static void hpsa_remove_device(struct ctlr_info *h,
+ }
+ } else { /* HBA */
+
+- device->removed = 1;
+- hpsa_wait_for_outstanding_commands_for_dev(h, device);
+-
+ hpsa_remove_sas_device(device);
+ }
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-correct-smart-path-enabled.patch b/patches.fixes/scsi-hpsa-correct-smart-path-enabled.patch
new file mode 100644
index 0000000000..14f7a83f1c
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-correct-smart-path-enabled.patch
@@ -0,0 +1,370 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:45 -0500
+Subject: [PATCH] scsi: hpsa: correct smart path enabled
+References: bsc#1077989
+Git-commit: b2582a65755b342dcc26b1c9398b6a1e6bdfc9a2
+Patch-mainline: v4.15-rc1
+
+Correct re-enabling ioaccel after:
+ 1) RAID transformations and
+ 2) multi-path fail-overs.
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 189 +++++++++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 151 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index c4f548113c39..133b509457b3 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -787,7 +787,12 @@ static ssize_t host_show_hp_ssd_smart_path_enabled(struct device *dev,
+ }
+ offload_enabled = hdev->offload_enabled;
+ spin_unlock_irqrestore(&h->lock, flags);
+- return snprintf(buf, 20, "%d\n", offload_enabled);
++
++ if (hdev->devtype == TYPE_DISK || hdev->devtype == TYPE_ZBC)
++ return snprintf(buf, 20, "%d\n", offload_enabled);
++ else
++ return snprintf(buf, 40, "%s\n",
++ "Not applicable for a controller");
+ }
+
+ #define MAX_PATHS 8
+@@ -1270,7 +1275,7 @@ static void hpsa_show_dev_msg(const char *level, struct ctlr_info *h,
+ dev->model,
+ label,
+ dev->offload_config ? '+' : '-',
+- dev->offload_enabled ? '+' : '-',
++ dev->offload_to_be_enabled ? '+' : '-',
+ dev->expose_device);
+ }
+
+@@ -1345,36 +1350,42 @@ static int hpsa_scsi_add_entry(struct ctlr_info *h,
+ (*nadded)++;
+ hpsa_show_dev_msg(KERN_INFO, h, device,
+ device->expose_device ? "added" : "masked");
+- device->offload_to_be_enabled = device->offload_enabled;
+- device->offload_enabled = 0;
+ return 0;
+ }
+
+-/* Update an entry in h->dev[] array. */
++/*
++ * Called during a scan operation.
++ *
++ * Update an entry in h->dev[] array.
++ */
+ static void hpsa_scsi_update_entry(struct ctlr_info *h,
+ int entry, struct hpsa_scsi_dev_t *new_entry)
+ {
+- int offload_enabled;
+ /* assumes h->devlock is held */
+ BUG_ON(entry < 0 || entry >= HPSA_MAX_DEVICES);
+
+ /* Raid level changed. */
+ h->dev[entry]->raid_level = new_entry->raid_level;
+
++ /*
++ * ioacccel_handle may have changed for a dual domain disk
++ */
++ h->dev[entry]->ioaccel_handle = new_entry->ioaccel_handle;
++
+ /* Raid offload parameters changed. Careful about the ordering. */
+- if (new_entry->offload_config && new_entry->offload_enabled) {
++ if (new_entry->offload_config && new_entry->offload_to_be_enabled) {
+ /*
+ * if drive is newly offload_enabled, we want to copy the
+ * raid map data first. If previously offload_enabled and
+ * offload_config were set, raid map data had better be
+- * the same as it was before. if raid map data is changed
++ * the same as it was before. If raid map data has changed
+ * then it had better be the case that
+ * h->dev[entry]->offload_enabled is currently 0.
+ */
+ h->dev[entry]->raid_map = new_entry->raid_map;
+ h->dev[entry]->ioaccel_handle = new_entry->ioaccel_handle;
+ }
+- if (new_entry->hba_ioaccel_enabled) {
++ if (new_entry->offload_to_be_enabled) {
+ h->dev[entry]->ioaccel_handle = new_entry->ioaccel_handle;
+ wmb(); /* set ioaccel_handle *before* hba_ioaccel_enabled */
+ }
+@@ -1385,17 +1396,18 @@ static void hpsa_scsi_update_entry(struct ctlr_info *h,
+
+ /*
+ * We can turn off ioaccel offload now, but need to delay turning
+- * it on until we can update h->dev[entry]->phys_disk[], but we
++ * ioaccel on until we can update h->dev[entry]->phys_disk[], but we
+ * can't do that until all the devices are updated.
+ */
+- h->dev[entry]->offload_to_be_enabled = new_entry->offload_enabled;
+- if (!new_entry->offload_enabled)
++ h->dev[entry]->offload_to_be_enabled = new_entry->offload_to_be_enabled;
++
++ /*
++ * turn ioaccel off immediately if told to do so.
++ */
++ if (!new_entry->offload_to_be_enabled)
+ h->dev[entry]->offload_enabled = 0;
+
+- offload_enabled = h->dev[entry]->offload_enabled;
+- h->dev[entry]->offload_enabled = h->dev[entry]->offload_to_be_enabled;
+ hpsa_show_dev_msg(KERN_INFO, h, h->dev[entry], "updated");
+- h->dev[entry]->offload_enabled = offload_enabled;
+ }
+
+ /* Replace an entry from h->dev[] array. */
+@@ -1421,9 +1433,8 @@ static void hpsa_scsi_replace_entry(struct ctlr_info *h,
+ h->dev[entry] = new_entry;
+ added[*nadded] = new_entry;
+ (*nadded)++;
++
+ hpsa_show_dev_msg(KERN_INFO, h, new_entry, "replaced");
+- new_entry->offload_to_be_enabled = new_entry->offload_enabled;
+- new_entry->offload_enabled = 0;
+ }
+
+ /* Remove an entry from h->dev[] array. */
+@@ -1513,11 +1524,22 @@ static inline int device_updated(struct hpsa_scsi_dev_t *dev1,
+ return 1;
+ if (dev1->offload_config != dev2->offload_config)
+ return 1;
+- if (dev1->offload_enabled != dev2->offload_enabled)
++ if (dev1->offload_to_be_enabled != dev2->offload_to_be_enabled)
+ return 1;
+ if (!is_logical_dev_addr_mode(dev1->scsi3addr))
+ if (dev1->queue_depth != dev2->queue_depth)
+ return 1;
++ /*
++ * This can happen for dual domain devices. An active
++ * path change causes the ioaccel handle to change
++ *
++ * for example note the handle differences between p0 and p1
++ * Device WWN ,WWN hash,Handle
++ * D016 p0|0x3 [02]P2E:01:01,0x5000C5005FC4DACA,0x9B5616,0x01030003
++ * p1 0x5000C5005FC4DAC9,0x6798C0,0x00040004
++ */
++ if (dev1->ioaccel_handle != dev2->ioaccel_handle)
++ return 1;
+ return 0;
+ }
+
+@@ -1727,6 +1749,11 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h,
+ * be 0, but we'll turn it off here just in case
+ */
+ if (!logical_drive->phys_disk[i]) {
++ dev_warn(&h->pdev->dev,
++ "%s: [%d:%d:%d:%d] A phys disk component of LV is missing, turning off offload_enabled for LV.\n",
++ __func__,
++ h->scsi_host->host_no, logical_drive->bus,
++ logical_drive->target, logical_drive->lun);
+ logical_drive->offload_enabled = 0;
+ logical_drive->offload_to_be_enabled = 0;
+ logical_drive->queue_depth = 8;
+@@ -1759,13 +1786,24 @@ static void hpsa_update_log_drive_phys_drive_ptrs(struct ctlr_info *h,
+ /*
+ * If offload is currently enabled, the RAID map and
+ * phys_disk[] assignment *better* not be changing
+- * and since it isn't changing, we do not need to
+- * update it.
++ * because we would be changing ioaccel phsy_disk[] pointers
++ * on a ioaccel volume processing I/O requests.
++ *
++ * If an ioaccel volume status changed, initially because it was
++ * re-configured and thus underwent a transformation, or
++ * a drive failed, we would have received a state change
++ * request and ioaccel should have been turned off. When the
++ * transformation completes, we get another state change
++ * request to turn ioaccel back on. In this case, we need
++ * to update the ioaccel information.
++ *
++ * Thus: If it is not currently enabled, but will be after
++ * the scan completes, make sure the ioaccel pointers
++ * are up to date.
+ */
+- if (dev[i]->offload_enabled)
+- continue;
+
+- hpsa_figure_phys_disk_ptrs(h, dev, ndevices, dev[i]);
++ if (!dev[i]->offload_enabled && dev[i]->offload_to_be_enabled)
++ hpsa_figure_phys_disk_ptrs(h, dev, ndevices, dev[i]);
+ }
+ }
+
+@@ -1965,8 +2003,13 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h,
+ }
+ hpsa_update_log_drive_phys_drive_ptrs(h, h->dev, h->ndevices);
+
+- /* Now that h->dev[]->phys_disk[] is coherent, we can enable
++ /*
++ * Now that h->dev[]->phys_disk[] is coherent, we can enable
+ * any logical drives that need it enabled.
++ *
++ * The raid map should be current by now.
++ *
++ * We are updating the device list used for I/O requests.
+ */
+ for (i = 0; i < h->ndevices; i++) {
+ if (h->dev[i] == NULL)
+@@ -2441,7 +2484,7 @@ static void process_ioaccel2_completion(struct ctlr_info *h,
+
+ /*
+ * Any RAID offload error results in retry which will use
+- * the normal I/O path so the controller can handle whatever's
++ * the normal I/O path so the controller can handle whatever is
+ * wrong.
+ */
+ if (is_logical_device(dev) &&
+@@ -3540,6 +3583,13 @@ static bool hpsa_vpd_page_supported(struct ctlr_info *h,
+ return true;
+ }
+
++/*
++ * Called during a scan operation.
++ * Sets ioaccel status on the new device list, not the existing device list
++ *
++ * The device list used during I/O will be updated later in
++ * adjust_hpsa_scsi_table.
++ */
+ static void hpsa_get_ioaccel_status(struct ctlr_info *h,
+ unsigned char *scsi3addr, struct hpsa_scsi_dev_t *this_device)
+ {
+@@ -3568,12 +3618,12 @@ static void hpsa_get_ioaccel_status(struct ctlr_info *h,
+ this_device->offload_config =
+ !!(ioaccel_status & OFFLOAD_CONFIGURED_BIT);
+ if (this_device->offload_config) {
+- this_device->offload_enabled =
++ this_device->offload_to_be_enabled =
+ !!(ioaccel_status & OFFLOAD_ENABLED_BIT);
+ if (hpsa_get_raid_map(h, scsi3addr, this_device))
+- this_device->offload_enabled = 0;
++ this_device->offload_to_be_enabled = 0;
+ }
+- this_device->offload_to_be_enabled = this_device->offload_enabled;
++
+ out:
+ kfree(buf);
+ return;
+@@ -4307,7 +4357,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
+ continue;
+ }
+
+- /* Get device type, vendor, model, device id */
++ /* Get device type, vendor, model, device id, raid_map */
+ rc = hpsa_update_device_info(h, lunaddrbytes, tmpdevice,
+ &is_OBDR);
+ if (rc == -ENOMEM) {
+@@ -8067,9 +8117,79 @@ static int detect_controller_lockup(struct ctlr_info *h)
+ return false;
+ }
+
+-static void hpsa_ack_ctlr_events(struct ctlr_info *h)
++/*
++ * Set ioaccel status for all ioaccel volumes.
++ *
++ * Called from monitor controller worker (hpsa_event_monitor_worker)
++ *
++ * A Volume (or Volumes that comprise an Array set may be undergoing a
++ * transformation, so we will be turning off ioaccel for all volumes that
++ * make up the Array.
++ */
++static void hpsa_set_ioaccel_status(struct ctlr_info *h)
+ {
++ int rc;
+ int i;
++ u8 ioaccel_status;
++ unsigned char *buf;
++ struct hpsa_scsi_dev_t *device;
++
++ if (!h)
++ return;
++
++ buf = kmalloc(64, GFP_KERNEL);
++ if (!buf)
++ return;
++
++ /*
++ * Run through current device list used during I/O requests.
++ */
++ for (i = 0; i < h->ndevices; i++) {
++ device = h->dev[i];
++
++ if (!device)
++ continue;
++ if (!device->scsi3addr)
++ continue;
++ if (!hpsa_vpd_page_supported(h, device->scsi3addr,
++ HPSA_VPD_LV_IOACCEL_STATUS))
++ continue;
++
++ memset(buf, 0, 64);
++
++ rc = hpsa_scsi_do_inquiry(h, device->scsi3addr,
++ VPD_PAGE | HPSA_VPD_LV_IOACCEL_STATUS,
++ buf, 64);
++ if (rc != 0)
++ continue;
++
++ ioaccel_status = buf[IOACCEL_STATUS_BYTE];
++ device->offload_config =
++ !!(ioaccel_status & OFFLOAD_CONFIGURED_BIT);
++ if (device->offload_config)
++ device->offload_to_be_enabled =
++ !!(ioaccel_status & OFFLOAD_ENABLED_BIT);
++
++ /*
++ * Immediately turn off ioaccel for any volume the
++ * controller tells us to. Some of the reasons could be:
++ * transformation - change to the LVs of an Array.
++ * degraded volume - component failure
++ *
++ * If ioaccel is to be re-enabled, re-enable later during the
++ * scan operation so the driver can get a fresh raidmap
++ * before turning ioaccel back on.
++ *
++ */
++ if (!device->offload_to_be_enabled)
++ device->offload_enabled = 0;
++ }
++
++ kfree(buf);
++}
++
++static void hpsa_ack_ctlr_events(struct ctlr_info *h)
++{
+ char *event_type;
+
+ if (!(h->fw_support & MISC_FW_EVENT_NOTIFY))
+@@ -8087,10 +8207,7 @@ static void hpsa_ack_ctlr_events(struct ctlr_info *h)
+ event_type = "configuration change";
+ /* Stop sending new RAID offload reqs via the IO accelerator */
+ scsi_block_requests(h->scsi_host);
+- for (i = 0; i < h->ndevices; i++) {
+- h->dev[i]->offload_enabled = 0;
+- h->dev[i]->offload_to_be_enabled = 0;
+- }
++ hpsa_set_ioaccel_status(h);
+ hpsa_drain_accel_commands(h);
+ /* Set 'accelerator path config change' bit */
+ dev_warn(&h->pdev->dev,
+@@ -8107,10 +8224,6 @@ static void hpsa_ack_ctlr_events(struct ctlr_info *h)
+ writel(h->events, &(h->cfgtable->clear_event_notify));
+ writel(DOORBELL_CLEAR_EVENTS, h->vaddr + SA5_DOORBELL);
+ hpsa_wait_for_clear_event_notify_ack(h);
+-#if 0
+- writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL);
+- hpsa_wait_for_mode_change_ack(h);
+-#endif
+ }
+ return;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-destroy-sas-transport-properties-before-sc.patch b/patches.fixes/scsi-hpsa-destroy-sas-transport-properties-before-sc.patch
new file mode 100644
index 0000000000..0411995b7e
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-destroy-sas-transport-properties-before-sc.patch
@@ -0,0 +1,87 @@
+From: Martin Wilck <mwilck@suse.de>
+Date: Fri, 20 Oct 2017 16:51:08 -0500
+Subject: [PATCH] scsi: hpsa: destroy sas transport properties before scsi_host
+References: bsc#1077989
+Git-commit: dfb2e6f46b3074eb85203d8f0888b71ec1c2e37a
+Patch-mainline: v4.15-rc1
+
+This patch cleans up a lot of warnings when unloading the driver.
+
+A current example of the stack trace starts with:
+ [ 142.570715] sysfs group 'power' not found for kobject 'port-5:0'
+There can be hundreds of these messages during a driver unload.
+
+I am resubmitting this patch on behalf of Martin Wilck with his
+permission.
+
+His original patch can be found here:
+https://www.spinics.net/lists/linux-scsi/msg102085.html
+
+This patch did not help until Hannes's
+commit 9441284fbc39 ("scsi-fixup-kernel-warning-during-rmmod")
+was applied to the kernel.
+
+---------------------------
+Original patch description:
+---------------------------
+
+Unloading the hpsa driver causes warnings
+
+[ 1063.793652] WARNING: CPU: 1 PID: 4850 at ../fs/sysfs/group.c:237 device_del+0x54/0x240()
+[ 1063.793659] sysfs group ffffffff81cf21a0 not found for kobject 'port-2:0'
+
+with two different stacks:
+1)
+[ 1063.793774] [<ffffffff81448af4>] device_del+0x54/0x240
+[ 1063.793780] [<ffffffff8145178a>] transport_remove_classdev+0x4a/0x60
+[ 1063.793784] [<ffffffff81451216>] attribute_container_device_trigger+0xa6/0xb0
+[ 1063.793802] [<ffffffffa0105d46>] sas_port_delete+0x126/0x160 [scsi_transport_sas]
+[ 1063.793819] [<ffffffffa036ebcc>] hpsa_free_sas_port+0x3c/0x70 [hpsa]
+
+2)
+[ 1063.797103] [<ffffffff81448af4>] device_del+0x54/0x240
+[ 1063.797118] [<ffffffffa0105d4e>] sas_port_delete+0x12e/0x160 [scsi_transport_sas]
+[ 1063.797134] [<ffffffffa036ebcc>] hpsa_free_sas_port+0x3c/0x70 [hpsa]
+
+This is caused by the fact that host device hostX is deleted before the
+SAS transport devices hostX/port-a:b.
+
+This patch fixes this by reverting the order of device deletions.
+
+Tested-by: Don Brace <don.brace@microsemi.com>
+Reviewed-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin Wilck <mwilck@suse.de>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+
+
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 4ed3d26ffdde..4992710d8dfb 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -8684,6 +8684,8 @@ static void hpsa_remove_one(struct pci_dev *pdev)
+ destroy_workqueue(h->rescan_ctlr_wq);
+ destroy_workqueue(h->resubmit_wq);
+
++ hpsa_delete_sas_host(h);
++
+ /*
+ * Call before disabling interrupts.
+ * scsi_remove_host can trigger I/O operations especially
+@@ -8718,8 +8720,6 @@ static void hpsa_remove_one(struct pci_dev *pdev)
+ h->lockup_detected = NULL; /* init_one 2 */
+ /* (void) pci_disable_pcie_error_reporting(pdev); */ /* init_one 1 */
+
+- hpsa_delete_sas_host(h);
+-
+ kfree(h); /* init_one 1 */
+ }
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-fix-spelling-mistake-encrypytion-encryptio.patch b/patches.fixes/scsi-hpsa-fix-spelling-mistake-encrypytion-encryptio.patch
new file mode 100644
index 0000000000..67f2a65d37
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-fix-spelling-mistake-encrypytion-encryptio.patch
@@ -0,0 +1,33 @@
+From: Colin Ian King <colin.king@canonical.com>
+Date: Mon, 26 Jun 2017 14:31:10 +0100
+Subject: [PATCH] scsi: hpsa: fix spelling mistake: "encrypytion" ->
+ "encryption"
+References: bsc#1077989
+Git-commit: ba82d91b7567774242534460910530289192d212
+Patch-mainline: v4.13-rc1
+
+Trivial fix to spelling mistake in dev_info message
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 4370b1faa8c1..9abe81021484 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -3160,7 +3160,7 @@ static void hpsa_debug_map_buff(struct ctlr_info *h, int rc,
+ le16_to_cpu(map_buff->layout_map_count));
+ dev_info(&h->pdev->dev, "flags = 0x%x\n",
+ le16_to_cpu(map_buff->flags));
+- dev_info(&h->pdev->dev, "encrypytion = %s\n",
++ dev_info(&h->pdev->dev, "encryption = %s\n",
+ le16_to_cpu(map_buff->flags) &
+ RAID_MAP_FLAG_ENCRYPT_ON ? "ON" : "OFF");
+ dev_info(&h->pdev->dev, "dekindex = %u\n",
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-reduce-warning-messages-on-device-removal.patch b/patches.fixes/scsi-hpsa-reduce-warning-messages-on-device-removal.patch
new file mode 100644
index 0000000000..b86b40b01e
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-reduce-warning-messages-on-device-removal.patch
@@ -0,0 +1,40 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:57 -0500
+Subject: [PATCH] scsi: hpsa: reduce warning messages on device removal
+References: bsc#1077989
+Git-commit: 9211a07fc1b25d9d437c5ccd39cb1596eb9adb06
+Patch-mainline: v4.15-rc1
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index c52a35b0d776..7f6c7a8ffe25 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -1865,11 +1865,13 @@ static void hpsa_wait_for_outstanding_commands_for_dev(struct ctlr_info *h,
+ break;
+ if (++waits > 20)
+ break;
++ msleep(1000);
++ }
++
++ if (waits > 20)
+ dev_warn(&h->pdev->dev,
+ "%s: removing device with %d outstanding commands!\n",
+ __func__, cmds);
+- msleep(1000);
+- }
+ }
+
+ static void hpsa_remove_device(struct ctlr_info *h,
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-update-discovery-polling.patch b/patches.fixes/scsi-hpsa-update-discovery-polling.patch
new file mode 100644
index 0000000000..dfd2a2a5c4
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-update-discovery-polling.patch
@@ -0,0 +1,113 @@
+From: Bader Ali Saleh <bader.alisaleh@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:32 -0500
+Subject: [PATCH] scsi: hpsa: update discovery polling
+References: bsc#1077989
+Git-commit: 4e1881840933587f42e3ad3788f2c392d19827a6
+Patch-mainline: v4.15-rc1
+
+Correct a corner case where newly created volumes are not detected
+automatically on an external RAID controller that has no configured
+volumes during initial device discovery.
+
+The fix is to set the discovery_polling flag when an external RAID
+controller is detected. This causes a device rescan every 20-30 seconds,
+so that newly created volumes will be detected automatically.
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 39 ++++++++++++++++++++++++++-------------
+ drivers/scsi/hpsa_cmd.h | 2 ++
+ 2 files changed, 28 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 34061dddebbb..56a7a02463d1 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -3472,6 +3472,30 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr,
+ dev->sas_address = sa;
+ }
+
++static void hpsa_ext_ctrl_present(struct ctlr_info *h,
++ struct ReportExtendedLUNdata *physdev)
++{
++ u32 nphysicals;
++ int i;
++
++ if (h->discovery_polling)
++ return;
++
++ nphysicals = (get_unaligned_be32(physdev->LUNListLength) / 24) + 1;
++
++ for (i = 0; i < nphysicals; i++) {
++ if (physdev->LUN[i].device_type ==
++ BMIC_DEVICE_TYPE_CONTROLLER
++ && !is_hba_lunid(physdev->LUN[i].lunid)) {
++ dev_info(&h->pdev->dev,
++ "External controller present, activate discovery polling and disable rld caching\n");
++ hpsa_disable_rld_caching(h);
++ h->discovery_polling = 1;
++ break;
++ }
++ }
++}
++
+ /* Get a device id from inquiry page 0x83 */
+ static bool hpsa_vpd_page_supported(struct ctlr_info *h,
+ unsigned char scsi3addr[], u8 page)
+@@ -4228,6 +4252,8 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
+ */
+ ndevs_to_allocate = nphysicals + nlogicals + MAX_EXT_TARGETS + 1;
+
++ hpsa_ext_ctrl_present(h, physdev_list);
++
+ /* Allocate the per device structures */
+ for (i = 0; i < ndevs_to_allocate; i++) {
+ if (i >= HPSA_MAX_DEVICES) {
+@@ -4298,18 +4324,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
+ figure_bus_target_lun(h, lunaddrbytes, tmpdevice);
+ this_device = currentsd[ncurrent];
+
+- /* Turn on discovery_polling if there are ext target devices.
+- * Event-based change notification is unreliable for those.
+- */
+- if (!h->discovery_polling) {
+- if (tmpdevice->external) {
+- h->discovery_polling = 1;
+- dev_info(&h->pdev->dev,
+- "External target, activate discovery polling.\n");
+- }
+- }
+-
+-
+ *this_device = *tmpdevice;
+ this_device->physical_device = physical_device;
+
+@@ -8247,7 +8261,6 @@ static void hpsa_rescan_ctlr_worker(struct work_struct *work)
+ if (h->drv_req_rescan || hpsa_offline_devices_ready(h)) {
+ hpsa_perform_rescan(h);
+ } else if (h->discovery_polling) {
+- hpsa_disable_rld_caching(h);
+ if (hpsa_luns_changed(h)) {
+ dev_info(&h->pdev->dev,
+ "driver discovery polling rescan.\n");
+diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
+index 78c3b64b0b97..21a726e2eec6 100644
+--- a/drivers/scsi/hpsa_cmd.h
++++ b/drivers/scsi/hpsa_cmd.h
+@@ -780,6 +780,8 @@ struct bmic_identify_physical_device {
+ u8 phys_bay_in_box; /* phys drv bay this drive resides */
+ __le32 rpm; /* Drive rotational speed in rpm */
+ u8 device_type; /* type of drive */
++#define BMIC_DEVICE_TYPE_CONTROLLER 0x07
++
+ u8 sata_version; /* only valid when drive_type is SATA */
+ __le64 big_total_block_count;
+ __le64 ris_starting_lba;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hpsa-update-queue-depth-for-externals.patch b/patches.fixes/scsi-hpsa-update-queue-depth-for-externals.patch
new file mode 100644
index 0000000000..9ea96b0ca0
--- /dev/null
+++ b/patches.fixes/scsi-hpsa-update-queue-depth-for-externals.patch
@@ -0,0 +1,41 @@
+From: Don Brace <don.brace@microsemi.com>
+Date: Fri, 20 Oct 2017 16:51:51 -0500
+Subject: [PATCH] scsi: hpsa: update queue depth for externals
+References: bsc#1077989
+Git-commit: 2c5fc3639eb4dd21f91770b16d9df8466f42f0b2
+Patch-mainline: v4.15-rc1
+
+Preserve external device queue depth during a scan operation.
+
+Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
+Reviewed-by: Scott Teel <scott.teel@microsemi.com>
+Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
+Signed-off-by: Don Brace <don.brace@microsemi.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hpsa.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
+index 133b509457b3..c52a35b0d776 100644
+--- a/drivers/scsi/hpsa.c
++++ b/drivers/scsi/hpsa.c
+@@ -1765,8 +1765,12 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h,
+ * way too high for partial stripe writes
+ */
+ logical_drive->queue_depth = qdepth;
+- else
+- logical_drive->queue_depth = h->nr_cmds;
++ else {
++ if (logical_drive->external)
++ logical_drive->queue_depth = EXTERNAL_QD;
++ else
++ logical_drive->queue_depth = h->nr_cmds;
++ }
+ }
+
+ static void hpsa_update_log_drive_phys_drive_ptrs(struct ctlr_info *h,
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-hptiop-make-function-hptiop_iop_request_callbac.patch b/patches.fixes/scsi-hptiop-make-function-hptiop_iop_request_callbac.patch
new file mode 100644
index 0000000000..fabb542238
--- /dev/null
+++ b/patches.fixes/scsi-hptiop-make-function-hptiop_iop_request_callbac.patch
@@ -0,0 +1,38 @@
+From: Colin Ian King <colin.king@canonical.com>
+Date: Thu, 22 Jun 2017 16:52:19 +0100
+Subject: [PATCH] scsi: hptiop: make function hptiop_iop_request_callback_itl
+ static
+References: bsc#1077989
+Git-commit: 06d9eb4e71c316f231dc079e66b58592d733c737
+Patch-mainline: v4.13-rc1
+
+The function hptiop_iop_request_callback_itl does not need to be in
+global scope, so make it static.
+
+Cleans up sparse warning:
+"symbol 'hptiop_iop_request_callback_itl' was not declared. Should it
+ be static?"
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/hptiop.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
+index db17ad15b0c1..7226226f7383 100644
+--- a/drivers/scsi/hptiop.c
++++ b/drivers/scsi/hptiop.c
+@@ -800,7 +800,7 @@ static void hptiop_host_request_callback_itl(struct hptiop_hba *hba, u32 _tag)
+ hptiop_finish_scsi_req(hba, tag, req);
+ }
+
+-void hptiop_iop_request_callback_itl(struct hptiop_hba *hba, u32 tag)
++static void hptiop_iop_request_callback_itl(struct hptiop_hba *hba, u32 tag)
+ {
+ struct hpt_iop_request_header __iomem *req;
+ struct hpt_iop_request_ioctl_command __iomem *p;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-ibmvscsi_tgt-remove-use-of-class_attrs.patch b/patches.fixes/scsi-ibmvscsi_tgt-remove-use-of-class_attrs.patch
new file mode 100644
index 0000000000..039291e081
--- /dev/null
+++ b/patches.fixes/scsi-ibmvscsi_tgt-remove-use-of-class_attrs.patch
@@ -0,0 +1,48 @@
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Thu, 8 Jun 2017 10:12:37 +0200
+Subject: [PATCH] scsi: ibmvscsi_tgt: remove use of class_attrs
+References: bsc#1077989
+Git-commit: f62014fcb9e4af6267dce6e3bf5dc40fdc58f255
+Patch-mainline: v4.13-rc1
+
+The class_attrs pointer is going away and it's not even being used in
+this driver, so just remove it entirely.
+
+Acked-by: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
+Cc: Michael Cyr <mikecyr@linux.vnet.ibm.com>
+Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
+Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
+Cc: <linux-scsi@vger.kernel.org>
+Cc: <target-devel@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+index 35710524d059..cc48491903b2 100644
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+@@ -4056,10 +4056,6 @@ static const struct target_core_fabric_ops ibmvscsis_ops = {
+
+ static void ibmvscsis_dev_release(struct device *dev) {};
+
+-static struct class_attribute ibmvscsis_class_attrs[] = {
+- __ATTR_NULL,
+-};
+-
+ static struct device_attribute dev_attr_system_id =
+ __ATTR(system_id, S_IRUGO, system_id_show, NULL);
+
+@@ -4079,7 +4075,6 @@ ATTRIBUTE_GROUPS(ibmvscsis_dev);
+ static struct class ibmvscsis_class = {
+ .name = "ibmvscsis",
+ .dev_release = ibmvscsis_dev_release,
+- .class_attrs = ibmvscsis_class_attrs,
+ .dev_groups = ibmvscsis_dev_groups,
+ };
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-ibmvscsis-Fix-write_pending-failure-path.patch b/patches.fixes/scsi-ibmvscsis-Fix-write_pending-failure-path.patch
new file mode 100644
index 0000000000..5c4df23d38
--- /dev/null
+++ b/patches.fixes/scsi-ibmvscsis-Fix-write_pending-failure-path.patch
@@ -0,0 +1,36 @@
+From: "Bryant G. Ly" <bgly@us.ibm.com>
+Date: Mon, 2 Oct 2017 12:59:38 -0500
+Subject: [PATCH] scsi: ibmvscsis: Fix write_pending failure path
+References: bsc#1077989
+Git-commit: 88e65389fce1f68ba6d13ae2fc0f8d7e5c338c52
+Patch-mainline: v4.14-rc4
+
+For write_pending if the queue is down or client failed then return -EIO
+so that LIO can properly process the completed command. Prior we
+returned 0 since LIO could not handle it properly. Now with commit
+fa7e25cf13a6 ("target: Fix unknown fabric callback queue-full errors")
+that patch addresses LIO's ability to handle things right.
+
+Signed-off-by: Bryant G. Ly <bgly@us.ibm.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+index 1f75d0380516..fe5b9d7bc06d 100644
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+@@ -3767,7 +3767,7 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
+ */
+ if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) {
+ pr_err("write_pending failed since: %d\n", vscsi->flags);
+- return 0;
++ return -EIO;
+ }
+
+ rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma,
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-ibmvscsis-add-DRC-indices-to-debug-statements.patch b/patches.fixes/scsi-ibmvscsis-add-DRC-indices-to-debug-statements.patch
new file mode 100644
index 0000000000..46ee271414
--- /dev/null
+++ b/patches.fixes/scsi-ibmvscsis-add-DRC-indices-to-debug-statements.patch
@@ -0,0 +1,938 @@
+From: "Bryant G. Ly" <bryantly@linux.vnet.ibm.com>
+Date: Mon, 4 Dec 2017 16:07:28 -0600
+Subject: [PATCH] scsi: ibmvscsis: add DRC indices to debug statements
+References: bsc#1077989
+Git-commit: 417dff6cc15cdbeae71f8c127b3d0371c92a34ea
+Patch-mainline: v4.16-rc1
+
+Where applicable, changes pr_debug, pr_info, pr_err, etc. calls to the
+dev_* versions. This adds the DRC index of the device to the
+corresponding trace statement.
+
+Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
+Signed-off-by: Brad Warrum <bwarrum@us.ibm.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 320 ++++++++++++++++---------------
+ 1 file changed, 170 insertions(+), 150 deletions(-)
+
+diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+index fe5b9d7bc06d..ed9abd61cbcd 100644
+--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
++++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+@@ -122,7 +122,7 @@ static bool connection_broken(struct scsi_info *vscsi)
+ cpu_to_be64(buffer[MSG_HI]),
+ cpu_to_be64(buffer[MSG_LOW]));
+
+- pr_debug("connection_broken: rc %ld\n", h_return_code);
++ dev_dbg(&vscsi->dev, "Connection_broken: rc %ld\n", h_return_code);
+
+ if (h_return_code == H_CLOSED)
+ rc = true;
+@@ -210,7 +210,7 @@ static long ibmvscsis_unregister_command_q(struct scsi_info *vscsi)
+ }
+ } while (qrc != H_SUCCESS && rc == ADAPT_SUCCESS);
+
+- pr_debug("Freeing CRQ: phyp rc %ld, rc %ld\n", qrc, rc);
++ dev_dbg(&vscsi->dev, "Freeing CRQ: phyp rc %ld, rc %ld\n", qrc, rc);
+
+ return rc;
+ }
+@@ -291,9 +291,9 @@ static long ibmvscsis_free_command_q(struct scsi_info *vscsi)
+ ibmvscsis_delete_client_info(vscsi, false);
+ }
+
+- pr_debug("free_command_q: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n",
+- vscsi->flags, vscsi->state, vscsi->phyp_acr_flags,
+- vscsi->phyp_acr_state);
++ dev_dbg(&vscsi->dev, "free_command_q: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n",
++ vscsi->flags, vscsi->state, vscsi->phyp_acr_flags,
++ vscsi->phyp_acr_state);
+ }
+ return rc;
+ }
+@@ -428,8 +428,8 @@ static void ibmvscsis_disconnect(struct work_struct *work)
+ vscsi->flags |= DISCONNECT_SCHEDULED;
+ vscsi->flags &= ~SCHEDULE_DISCONNECT;
+
+- pr_debug("disconnect: flags 0x%x, state 0x%hx\n", vscsi->flags,
+- vscsi->state);
++ dev_dbg(&vscsi->dev, "disconnect: flags 0x%x, state 0x%hx\n",
++ vscsi->flags, vscsi->state);
+
+ /*
+ * check which state we are in and see if we
+@@ -540,13 +540,14 @@ static void ibmvscsis_disconnect(struct work_struct *work)
+ }
+
+ if (wait_idle) {
+- pr_debug("disconnect start wait, active %d, sched %d\n",
+- (int)list_empty(&vscsi->active_q),
+- (int)list_empty(&vscsi->schedule_q));
++ dev_dbg(&vscsi->dev, "disconnect start wait, active %d, sched %d\n",
++ (int)list_empty(&vscsi->active_q),
++ (int)list_empty(&vscsi->schedule_q));
+ if (!list_empty(&vscsi->active_q) ||
+ !list_empty(&vscsi->schedule_q)) {
+ vscsi->flags |= WAIT_FOR_IDLE;
+- pr_debug("disconnect flags 0x%x\n", vscsi->flags);
++ dev_dbg(&vscsi->dev, "disconnect flags 0x%x\n",
++ vscsi->flags);
+ /*
+ * This routine is can not be called with the interrupt
+ * lock held.
+@@ -555,7 +556,7 @@ static void ibmvscsis_disconnect(struct work_struct *work)
+ wait_for_completion(&vscsi->wait_idle);
+ spin_lock_bh(&vscsi->intr_lock);
+ }
+- pr_debug("disconnect stop wait\n");
++ dev_dbg(&vscsi->dev, "disconnect stop wait\n");
+
+ ibmvscsis_adapter_idle(vscsi);
+ }
+@@ -597,8 +598,8 @@ static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state,
+
+ vscsi->flags |= flag_bits;
+
+- pr_debug("post_disconnect: new_state 0x%x, flag_bits 0x%x, vscsi->flags 0x%x, state %hx\n",
+- new_state, flag_bits, vscsi->flags, vscsi->state);
++ dev_dbg(&vscsi->dev, "post_disconnect: new_state 0x%x, flag_bits 0x%x, vscsi->flags 0x%x, state %hx\n",
++ new_state, flag_bits, vscsi->flags, vscsi->state);
+
+ if (!(vscsi->flags & (DISCONNECT_SCHEDULED | SCHEDULE_DISCONNECT))) {
+ vscsi->flags |= SCHEDULE_DISCONNECT;
+@@ -648,8 +649,8 @@ static void ibmvscsis_post_disconnect(struct scsi_info *vscsi, uint new_state,
+ }
+ }
+
+- pr_debug("Leaving post_disconnect: flags 0x%x, new_state 0x%x\n",
+- vscsi->flags, vscsi->new_state);
++ dev_dbg(&vscsi->dev, "Leaving post_disconnect: flags 0x%x, new_state 0x%x\n",
++ vscsi->flags, vscsi->new_state);
+ }
+
+ /**
+@@ -724,7 +725,8 @@ static long ibmvscsis_handle_init_msg(struct scsi_info *vscsi)
+ break;
+
+ case H_CLOSED:
+- pr_warn("init_msg: failed to send, rc %ld\n", rc);
++ dev_warn(&vscsi->dev, "init_msg: failed to send, rc %ld\n",
++ rc);
+ rc = 0;
+ break;
+ }
+@@ -768,7 +770,7 @@ static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq)
+ {
+ long rc = ADAPT_SUCCESS;
+
+- pr_debug("init_msg: state 0x%hx\n", vscsi->state);
++ dev_dbg(&vscsi->dev, "init_msg: state 0x%hx\n", vscsi->state);
+
+ rc = h_vioctl(vscsi->dds.unit_id, H_GET_PARTNER_INFO,
+ (u64)vscsi->map_ioba | ((u64)PAGE_SIZE << 32), 0, 0, 0,
+@@ -776,10 +778,10 @@ static long ibmvscsis_init_msg(struct scsi_info *vscsi, struct viosrp_crq *crq)
+ if (rc == H_SUCCESS) {
+ vscsi->client_data.partition_number =
+ be64_to_cpu(*(u64 *)vscsi->map_buf);
+- pr_debug("init_msg, part num %d\n",
+- vscsi->client_data.partition_number);
++ dev_dbg(&vscsi->dev, "init_msg, part num %d\n",
++ vscsi->client_data.partition_number);
+ } else {
+- pr_debug("init_msg h_vioctl rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "init_msg h_vioctl rc %ld\n", rc);
+ rc = ADAPT_SUCCESS;
+ }
+
+@@ -813,7 +815,8 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi)
+ if (rc == H_SUCCESS)
+ vscsi->flags |= PREP_FOR_SUSPEND_ENABLED;
+ else if (rc != H_NOT_FOUND)
+- pr_err("Error from Enable Prepare for Suspend: %ld\n", rc);
++ dev_err(&vscsi->dev, "Error from Enable Prepare for Suspend: %ld\n",
++ rc);
+
+ vscsi->flags &= PRESERVE_FLAG_FIELDS;
+ vscsi->rsp_q_timer.timer_pops = 0;
+@@ -822,8 +825,8 @@ static long ibmvscsis_establish_new_q(struct scsi_info *vscsi)
+
+ rc = vio_enable_interrupts(vscsi->dma_dev);
+ if (rc) {
+- pr_warn("establish_new_q: failed to enable interrupts, rc %ld\n",
+- rc);
++ dev_warn(&vscsi->dev, "establish_new_q: failed to enable interrupts, rc %ld\n",
++ rc);
+ return rc;
+ }
+
+@@ -883,7 +886,7 @@ static void ibmvscsis_reset_queue(struct scsi_info *vscsi)
+ int bytes;
+ long rc = ADAPT_SUCCESS;
+
+- pr_debug("reset_queue: flags 0x%x\n", vscsi->flags);
++ dev_dbg(&vscsi->dev, "reset_queue: flags 0x%x\n", vscsi->flags);
+
+ /* don't reset, the client did it for us */
+ if (vscsi->flags & (CLIENT_FAILED | TRANS_EVENT)) {
+@@ -906,7 +909,8 @@ static void ibmvscsis_reset_queue(struct scsi_info *vscsi)
+ }
+
+ if (rc != ADAPT_SUCCESS) {
+- pr_debug("reset_queue: reg_crq rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "reset_queue: reg_crq rc %ld\n",
++ rc);
+
+ vscsi->state = ERR_DISCONNECTED;
+ vscsi->flags |= RESPONSE_Q_DOWN;
+@@ -985,14 +989,15 @@ static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle)
+ /* See if there is a Resume event in the queue */
+ crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index;
+
+- pr_debug("ready_suspend: flags 0x%x, state 0x%hx crq_valid:%x\n",
+- vscsi->flags, vscsi->state, (int)crq->valid);
++ dev_dbg(&vscsi->dev, "ready_suspend: flags 0x%x, state 0x%hx crq_valid:%x\n",
++ vscsi->flags, vscsi->state, (int)crq->valid);
+
+ if (!(vscsi->flags & PREP_FOR_SUSPEND_ABORTED) && !(crq->valid)) {
+ rc = h_vioctl(vscsi->dds.unit_id, H_READY_FOR_SUSPEND, 0, 0, 0,
+ 0, 0);
+ if (rc) {
+- pr_err("Ready for Suspend Vioctl failed: %ld\n", rc);
++ dev_err(&vscsi->dev, "Ready for Suspend Vioctl failed: %ld\n",
++ rc);
+ rc = 0;
+ }
+ } else if (((vscsi->flags & PREP_FOR_SUSPEND_OVERWRITE) &&
+@@ -1012,7 +1017,7 @@ static long ibmvscsis_ready_for_suspend(struct scsi_info *vscsi, bool idle)
+
+ if ((crq->valid) && ((crq->valid != VALID_TRANS_EVENT) ||
+ (crq->format != RESUME_FROM_SUSP)))
+- pr_err("Invalid element in CRQ after Prepare for Suspend");
++ dev_err(&vscsi->dev, "Invalid element in CRQ after Prepare for Suspend");
+ }
+
+ vscsi->flags &= ~(PREP_FOR_SUSPEND_PENDING | PREP_FOR_SUSPEND_ABORTED);
+@@ -1036,8 +1041,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+ {
+ long rc = ADAPT_SUCCESS;
+
+- pr_debug("trans_event: format %d, flags 0x%x, state 0x%hx\n",
+- (int)crq->format, vscsi->flags, vscsi->state);
++ dev_dbg(&vscsi->dev, "trans_event: format %d, flags 0x%x, state 0x%hx\n",
++ (int)crq->format, vscsi->flags, vscsi->state);
+
+ switch (crq->format) {
+ case MIGRATED:
+@@ -1073,14 +1078,14 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+ !list_empty(&vscsi->schedule_q) ||
+ !list_empty(&vscsi->waiting_rsp) ||
+ !list_empty(&vscsi->active_q)) {
+- pr_debug("debit %d, sched %d, wait %d, active %d\n",
+- vscsi->debit,
+- (int)list_empty(&vscsi->schedule_q),
+- (int)list_empty(&vscsi->waiting_rsp),
+- (int)list_empty(&vscsi->active_q));
+- pr_warn("connection lost with outstanding work\n");
++ dev_dbg(&vscsi->dev, "debit %d, sched %d, wait %d, active %d\n",
++ vscsi->debit,
++ (int)list_empty(&vscsi->schedule_q),
++ (int)list_empty(&vscsi->waiting_rsp),
++ (int)list_empty(&vscsi->active_q));
++ dev_warn(&vscsi->dev, "connection lost with outstanding work\n");
+ } else {
+- pr_debug("trans_event: SRP Processing, but no outstanding work\n");
++ dev_dbg(&vscsi->dev, "trans_event: SRP Processing, but no outstanding work\n");
+ }
+
+ ibmvscsis_post_disconnect(vscsi, WAIT_IDLE,
+@@ -1097,8 +1102,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+ break;
+
+ case PREPARE_FOR_SUSPEND:
+- pr_debug("Prep for Suspend, crq status = 0x%x\n",
+- (int)crq->status);
++ dev_dbg(&vscsi->dev, "Prep for Suspend, crq status = 0x%x\n",
++ (int)crq->status);
+ switch (vscsi->state) {
+ case ERR_DISCONNECTED:
+ case WAIT_CONNECTION:
+@@ -1119,15 +1124,15 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+ case ERR_DISCONNECT:
+ case ERR_DISCONNECT_RECONNECT:
+ case WAIT_IDLE:
+- pr_err("Invalid state for Prepare for Suspend Trans Event: 0x%x\n",
+- vscsi->state);
++ dev_err(&vscsi->dev, "Invalid state for Prepare for Suspend Trans Event: 0x%x\n",
++ vscsi->state);
+ break;
+ }
+ break;
+
+ case RESUME_FROM_SUSP:
+- pr_debug("Resume from Suspend, crq status = 0x%x\n",
+- (int)crq->status);
++ dev_dbg(&vscsi->dev, "Resume from Suspend, crq status = 0x%x\n",
++ (int)crq->status);
+ if (vscsi->flags & PREP_FOR_SUSPEND_PENDING) {
+ vscsi->flags |= PREP_FOR_SUSPEND_ABORTED;
+ } else {
+@@ -1152,8 +1157,8 @@ static long ibmvscsis_trans_event(struct scsi_info *vscsi,
+
+ rc = vscsi->flags & SCHEDULE_DISCONNECT;
+
+- pr_debug("Leaving trans_event: flags 0x%x, state 0x%hx, rc %ld\n",
+- vscsi->flags, vscsi->state, rc);
++ dev_dbg(&vscsi->dev, "Leaving trans_event: flags 0x%x, state 0x%hx, rc %ld\n",
++ vscsi->flags, vscsi->state, rc);
+
+ return rc;
+ }
+@@ -1175,8 +1180,8 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
+ bool ack = true;
+ volatile u8 valid;
+
+- pr_debug("poll_cmd_q: flags 0x%x, state 0x%hx, q index %ud\n",
+- vscsi->flags, vscsi->state, vscsi->cmd_q.index);
++ dev_dbg(&vscsi->dev, "poll_cmd_q: flags 0x%x, state 0x%hx, q index %ud\n",
++ vscsi->flags, vscsi->state, vscsi->cmd_q.index);
+
+ rc = vscsi->flags & SCHEDULE_DISCONNECT;
+ crq = vscsi->cmd_q.base_addr + vscsi->cmd_q.index;
+@@ -1204,7 +1209,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
+ * if a tranport event has occurred leave
+ * everything but transport events on the queue
+ */
+- pr_debug("poll_cmd_q, ignoring\n");
++ dev_dbg(&vscsi->dev, "poll_cmd_q, ignoring\n");
+
+ /*
+ * need to decrement the queue index so we can
+@@ -1233,7 +1238,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
+ if (ack) {
+ vio_enable_interrupts(vscsi->dma_dev);
+ ack = false;
+- pr_debug("poll_cmd_q, reenabling interrupts\n");
++ dev_dbg(&vscsi->dev, "poll_cmd_q, reenabling interrupts\n");
+ }
+ valid = crq->valid;
+ dma_rmb();
+@@ -1241,7 +1246,7 @@ static void ibmvscsis_poll_cmd_q(struct scsi_info *vscsi)
+ goto poll_work;
+ }
+
+- pr_debug("Leaving poll_cmd_q: rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "Leaving poll_cmd_q: rc %ld\n", rc);
+ }
+
+ /**
+@@ -1258,9 +1263,9 @@ static void ibmvscsis_free_cmd_qs(struct scsi_info *vscsi)
+ {
+ struct ibmvscsis_cmd *cmd, *nxt;
+
+- pr_debug("free_cmd_qs: waiting_rsp empty %d, timer starter %d\n",
+- (int)list_empty(&vscsi->waiting_rsp),
+- vscsi->rsp_q_timer.started);
++ dev_dbg(&vscsi->dev, "free_cmd_qs: waiting_rsp empty %d, timer starter %d\n",
++ (int)list_empty(&vscsi->waiting_rsp),
++ vscsi->rsp_q_timer.started);
+
+ list_for_each_entry_safe(cmd, nxt, &vscsi->waiting_rsp, list) {
+ list_del(&cmd->list);
+@@ -1317,8 +1322,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ int free_qs = false;
+ long rc = 0;
+
+- pr_debug("adapter_idle: flags 0x%x, state 0x%hx\n", vscsi->flags,
+- vscsi->state);
++ dev_dbg(&vscsi->dev, "adapter_idle: flags 0x%x, state 0x%hx\n",
++ vscsi->flags, vscsi->state);
+
+ /* Only need to free qs if we're disconnecting from client */
+ if (vscsi->state != WAIT_CONNECTION || vscsi->flags & TRANS_EVENT)
+@@ -1336,7 +1341,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ break;
+ case ERR_DISCONNECT_RECONNECT:
+ ibmvscsis_reset_queue(vscsi);
+- pr_debug("adapter_idle, disc_rec: flags 0x%x\n", vscsi->flags);
++ dev_dbg(&vscsi->dev, "adapter_idle, disc_rec: flags 0x%x\n",
++ vscsi->flags);
+ break;
+
+ case ERR_DISCONNECT:
+@@ -1347,8 +1353,8 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ vscsi->state = ERR_DISCONNECTED;
+ else
+ vscsi->state = WAIT_ENABLED;
+- pr_debug("adapter_idle, disc: flags 0x%x, state 0x%hx\n",
+- vscsi->flags, vscsi->state);
++ dev_dbg(&vscsi->dev, "adapter_idle, disc: flags 0x%x, state 0x%hx\n",
++ vscsi->flags, vscsi->state);
+ break;
+
+ case WAIT_IDLE:
+@@ -1370,15 +1376,15 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ vscsi->flags &= ~DISCONNECT_SCHEDULED;
+ }
+
+- pr_debug("adapter_idle, wait: flags 0x%x, state 0x%hx\n",
+- vscsi->flags, vscsi->state);
++ dev_dbg(&vscsi->dev, "adapter_idle, wait: flags 0x%x, state 0x%hx\n",
++ vscsi->flags, vscsi->state);
+ ibmvscsis_poll_cmd_q(vscsi);
+ break;
+
+ case ERR_DISCONNECTED:
+ vscsi->flags &= ~DISCONNECT_SCHEDULED;
+- pr_debug("adapter_idle, disconnected: flags 0x%x, state 0x%hx\n",
+- vscsi->flags, vscsi->state);
++ dev_dbg(&vscsi->dev, "adapter_idle, disconnected: flags 0x%x, state 0x%hx\n",
++ vscsi->flags, vscsi->state);
+ break;
+
+ default:
+@@ -1419,13 +1425,13 @@ static void ibmvscsis_adapter_idle(struct scsi_info *vscsi)
+ vscsi->phyp_acr_state = 0;
+ vscsi->phyp_acr_flags = 0;
+
+- pr_debug("adapter_idle: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n",
+- vscsi->flags, vscsi->state, vscsi->phyp_acr_flags,
+- vscsi->phyp_acr_state);
++ dev_dbg(&vscsi->dev, "adapter_idle: flags 0x%x, state 0x%hx, acr_flags 0x%x, acr_state 0x%hx\n",
++ vscsi->flags, vscsi->state, vscsi->phyp_acr_flags,
++ vscsi->phyp_acr_state);
+ }
+
+- pr_debug("Leaving adapter_idle: flags 0x%x, state 0x%hx, new_state 0x%x\n",
+- vscsi->flags, vscsi->state, vscsi->new_state);
++ dev_dbg(&vscsi->dev, "Leaving adapter_idle: flags 0x%x, state 0x%hx, new_state 0x%x\n",
++ vscsi->flags, vscsi->state, vscsi->new_state);
+ }
+
+ /**
+@@ -1464,8 +1470,8 @@ static long ibmvscsis_copy_crq_packet(struct scsi_info *vscsi,
+ cmd->init_time = mftb();
+ iue->remote_token = crq->IU_data_ptr;
+ iue->iu_len = len;
+- pr_debug("copy_crq: ioba 0x%llx, init_time 0x%llx\n",
+- be64_to_cpu(crq->IU_data_ptr), cmd->init_time);
++ dev_dbg(&vscsi->dev, "copy_crq: ioba 0x%llx, init_time 0x%llx\n",
++ be64_to_cpu(crq->IU_data_ptr), cmd->init_time);
+ break;
+ case H_PERMISSION:
+ if (connection_broken(vscsi))
+@@ -1536,10 +1542,10 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
+ if (connection_broken(vscsi))
+ flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
+ }
+- pr_warn("adapter_info: h_copy_rdma from client failed, rc %ld\n",
+- rc);
+- pr_debug("adapter_info: ioba 0x%llx, flags 0x%x, flag_bits 0x%x\n",
+- be64_to_cpu(mad->buffer), vscsi->flags, flag_bits);
++ dev_warn(&vscsi->dev, "adapter_info: h_copy_rdma from client failed, rc %ld\n",
++ rc);
++ dev_dbg(&vscsi->dev, "adapter_info: ioba 0x%llx, flags 0x%x, flag_bits 0x%x\n",
++ be64_to_cpu(mad->buffer), vscsi->flags, flag_bits);
+ ibmvscsis_post_disconnect(vscsi, ERR_DISCONNECT_RECONNECT,
+ flag_bits);
+ goto free_dma;
+@@ -1595,7 +1601,7 @@ static long ibmvscsis_adapter_info(struct scsi_info *vscsi,
+
+ free_dma:
+ dma_free_coherent(&vscsi->dma_dev->dev, sizeof(*info), info, token);
+- pr_debug("Leaving adapter_info, rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "Leaving adapter_info, rc %ld\n", rc);
+
+ return rc;
+ }
+@@ -1629,7 +1635,7 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+ */
+ min_len = offsetof(struct capabilities, migration);
+ if ((olen < min_len) || (olen > PAGE_SIZE)) {
+- pr_warn("cap_mad: invalid len %d\n", olen);
++ dev_warn(&vscsi->dev, "cap_mad: invalid len %d\n", olen);
+ mad->common.status = cpu_to_be16(VIOSRP_MAD_FAILED);
+ return 0;
+ }
+@@ -1654,9 +1660,9 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+ common = (struct mad_capability_common *)&cap->migration;
+
+ while ((len > 0) && (status == VIOSRP_MAD_SUCCESS) && !rc) {
+- pr_debug("cap_mad: len left %hd, cap type %d, cap len %hd\n",
+- len, be32_to_cpu(common->cap_type),
+- be16_to_cpu(common->length));
++ dev_dbg(&vscsi->dev, "cap_mad: len left %hd, cap type %d, cap len %hd\n",
++ len, be32_to_cpu(common->cap_type),
++ be16_to_cpu(common->length));
+
+ cap_len = be16_to_cpu(common->length);
+ if (cap_len > len) {
+@@ -1673,7 +1679,7 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+
+ switch (common->cap_type) {
+ default:
+- pr_debug("cap_mad: unsupported capability\n");
++ dev_dbg(&vscsi->dev, "cap_mad: unsupported capability\n");
+ common->server_support = 0;
+ flag = cpu_to_be32((u32)CAP_LIST_SUPPORTED);
+ cap->flags &= ~flag;
+@@ -1693,8 +1699,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+ be64_to_cpu(mad->buffer));
+
+ if (rc != H_SUCCESS) {
+- pr_debug("cap_mad: failed to copy to client, rc %ld\n",
+- rc);
++ dev_dbg(&vscsi->dev, "cap_mad: failed to copy to client, rc %ld\n",
++ rc);
+
+ if (rc == H_PERMISSION) {
+ if (connection_broken(vscsi))
+@@ -1702,8 +1708,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+ CLIENT_FAILED);
+ }
+
+- pr_warn("cap_mad: error copying data to client, rc %ld\n",
+- rc);
++ dev_warn(&vscsi->dev, "cap_mad: error copying data to client, rc %ld\n",
++ rc);
+ ibmvscsis_post_disconnect(vscsi,
+ ERR_DISCONNECT_RECONNECT,
+ flag_bits);
+@@ -1712,8 +1718,8 @@ static int ibmvscsis_cap_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+
+ dma_free_coherent(&vscsi->dma_dev->dev, olen, cap, token);
+
+- pr_debug("Leaving cap_mad, rc %ld, client_cap 0x%x\n",
+- rc, vscsi->client_cap);
++ dev_dbg(&vscsi->dev, "Leaving cap_mad, rc %ld, client_cap 0x%x\n",
++ rc, vscsi->client_cap);
+
+ return rc;
+ }
+@@ -1749,7 +1755,7 @@ static long ibmvscsis_process_mad(struct scsi_info *vscsi, struct iu_entry *iue)
+ vscsi->fast_fail = true;
+ mad->status = cpu_to_be16(VIOSRP_MAD_SUCCESS);
+ } else {
+- pr_warn("fast fail mad sent after login\n");
++ dev_warn(&vscsi->dev, "fast fail mad sent after login\n");
+ mad->status = cpu_to_be16(VIOSRP_MAD_FAILED);
+ }
+ break;
+@@ -1809,9 +1815,9 @@ static void srp_snd_msg_failed(struct scsi_info *vscsi, long rc)
+ */
+ if ((vscsi->rsp_q_timer.timer_pops < MAX_TIMER_POPS) ||
+ (vscsi->state == SRP_PROCESSING)) {
+- pr_debug("snd_msg_failed: response queue full, flags 0x%x, timer started %d, pops %d\n",
+- vscsi->flags, (int)vscsi->rsp_q_timer.started,
+- vscsi->rsp_q_timer.timer_pops);
++ dev_dbg(&vscsi->dev, "snd_msg_failed: response queue full, flags 0x%x, timer started %d, pops %d\n",
++ vscsi->flags, (int)vscsi->rsp_q_timer.started,
++ vscsi->rsp_q_timer.timer_pops);
+
+ /*
+ * Check if the timer is running; if it
+@@ -1947,8 +1953,9 @@ static void ibmvscsis_send_messages(struct scsi_info *vscsi)
+ be64_to_cpu(msg_hi),
+ be64_to_cpu(cmd->rsp.tag));
+
+- pr_debug("send_messages: cmd %p, tag 0x%llx, rc %ld\n",
+- cmd, be64_to_cpu(cmd->rsp.tag), rc);
++ dev_dbg(&vscsi->dev, "send_messages: cmd %p, tag 0x%llx, rc %ld\n",
++ cmd, be64_to_cpu(cmd->rsp.tag),
++ rc);
+
+ /* if all ok free up the command
+ * element resources
+@@ -2003,7 +2010,8 @@ static void ibmvscsis_send_mad_resp(struct scsi_info *vscsi,
+ list_add_tail(&cmd->list, &vscsi->waiting_rsp);
+ ibmvscsis_send_messages(vscsi);
+ } else {
+- pr_debug("Error sending mad response, rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "Error sending mad response, rc %ld\n",
++ rc);
+ if (rc == H_PERMISSION) {
+ if (connection_broken(vscsi))
+ flag_bits = (RESPONSE_Q_DOWN | CLIENT_FAILED);
+@@ -2039,8 +2047,8 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
+ * expecting a response.
+ */
+ case WAIT_CONNECTION:
+- pr_debug("mad: in Wait Connection state, ignoring MAD, flags %d\n",
+- vscsi->flags);
++ dev_dbg(&vscsi->dev, "mad: in Wait Connection state, ignoring MAD, flags %d\n",
++ vscsi->flags);
+ return ADAPT_SUCCESS;
+
+ case SRP_PROCESSING:
+@@ -2075,12 +2083,12 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
+ if (!rc) {
+ mad = (struct mad_common *)&vio_iu(iue)->mad;
+
+- pr_debug("mad: type %d\n", be32_to_cpu(mad->type));
++ dev_dbg(&vscsi->dev, "mad: type %d\n", be32_to_cpu(mad->type));
+
+ rc = ibmvscsis_process_mad(vscsi, iue);
+
+- pr_debug("mad: status %hd, rc %ld\n", be16_to_cpu(mad->status),
+- rc);
++ dev_dbg(&vscsi->dev, "mad: status %hd, rc %ld\n",
++ be16_to_cpu(mad->status), rc);
+
+ if (!rc)
+ ibmvscsis_send_mad_resp(vscsi, cmd, crq);
+@@ -2088,7 +2096,7 @@ static long ibmvscsis_mad(struct scsi_info *vscsi, struct viosrp_crq *crq)
+ ibmvscsis_free_cmd_resources(vscsi, cmd);
+ }
+
+- pr_debug("Leaving mad, rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "Leaving mad, rc %ld\n", rc);
+ return rc;
+ }
+
+@@ -2211,16 +2219,17 @@ static int ibmvscsis_make_nexus(struct ibmvscsis_tport *tport)
+ {
+ char *name = tport->tport_name;
+ struct ibmvscsis_nexus *nexus;
++ struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport);
+ int rc;
+
+ if (tport->ibmv_nexus) {
+- pr_debug("tport->ibmv_nexus already exists\n");
++ dev_dbg(&vscsi->dev, "tport->ibmv_nexus already exists\n");
+ return 0;
+ }
+
+ nexus = kzalloc(sizeof(*nexus), GFP_KERNEL);
+ if (!nexus) {
+- pr_err("Unable to allocate struct ibmvscsis_nexus\n");
++ dev_err(&vscsi->dev, "Unable to allocate struct ibmvscsis_nexus\n");
+ return -ENOMEM;
+ }
+
+@@ -2316,7 +2325,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi,
+ cmd->rsp.format = VIOSRP_SRP_FORMAT;
+ cmd->rsp.tag = req->tag;
+
+- pr_debug("srp_login: reason 0x%x\n", reason);
++ dev_dbg(&vscsi->dev, "srp_login: reason 0x%x\n", reason);
+
+ if (reason)
+ rc = ibmvscsis_srp_login_rej(vscsi, cmd, reason);
+@@ -2333,7 +2342,7 @@ static long ibmvscsis_srp_login(struct scsi_info *vscsi,
+ ibmvscsis_free_cmd_resources(vscsi, cmd);
+ }
+
+- pr_debug("Leaving srp_login, rc %ld\n", rc);
++ dev_dbg(&vscsi->dev, "Leaving srp_login, rc %ld\n", rc);
+ return rc;
+ }
+
+@@ -2415,8 +2424,8 @@ static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq)
+
+ case SRP_TSK_MGMT:
+ tsk = &vio_iu(iue)->srp.tsk_mgmt;
+- pr_debug("tsk_mgmt tag: %llu (0x%llx)\n", tsk->tag,
+- tsk->tag);
++ dev_dbg(&vscsi->dev, "tsk_mgmt tag: %llu (0x%llx)\n",
++ tsk->tag, tsk->tag);
+ cmd->rsp.tag = tsk->tag;
+ vscsi->debit += 1;
+ cmd->type = TASK_MANAGEMENT;
+@@ -2425,8 +2434,8 @@ static void ibmvscsis_srp_cmd(struct scsi_info *vscsi, struct viosrp_crq *crq)
+ break;
+
+ case SRP_CMD:
+- pr_debug("srp_cmd tag: %llu (0x%llx)\n", srp->tag,
+- srp->tag);
++ dev_dbg(&vscsi->dev, "srp_cmd tag: %llu (0x%llx)\n",
++ srp->tag, srp->tag);
+ cmd->rsp.tag = srp->tag;
+ vscsi->debit += 1;
+ cmd->type = SCSI_CDB;
+@@ -2603,7 +2612,7 @@ static int read_dma_window(struct scsi_info *vscsi)
+ "ibm,my-dma-window",
+ NULL);
+ if (!dma_window) {
+- pr_err("Couldn't find ibm,my-dma-window property\n");
++ dev_err(&vscsi->dev, "Couldn't find ibm,my-dma-window property\n");
+ return -1;
+ }
+
+@@ -2613,7 +2622,7 @@ static int read_dma_window(struct scsi_info *vscsi)
+ prop = (const __be32 *)vio_get_attribute(vdev, "ibm,#dma-address-cells",
+ NULL);
+ if (!prop) {
+- pr_warn("Couldn't find ibm,#dma-address-cells property\n");
++ dev_warn(&vscsi->dev, "Couldn't find ibm,#dma-address-cells property\n");
+ dma_window++;
+ } else {
+ dma_window += be32_to_cpu(*prop);
+@@ -2622,7 +2631,7 @@ static int read_dma_window(struct scsi_info *vscsi)
+ prop = (const __be32 *)vio_get_attribute(vdev, "ibm,#dma-size-cells",
+ NULL);
+ if (!prop) {
+- pr_warn("Couldn't find ibm,#dma-size-cells property\n");
++ dev_warn(&vscsi->dev, "Couldn't find ibm,#dma-size-cells property\n");
+ dma_window++;
+ } else {
+ dma_window += be32_to_cpu(*prop);
+@@ -2808,8 +2817,8 @@ static void ibmvscsis_parse_task(struct scsi_info *vscsi,
+
+ srp_tsk->lun.scsi_lun[0] &= 0x3f;
+
+- pr_debug("calling submit_tmr, func %d\n",
+- srp_tsk->tsk_mgmt_func);
++ dev_dbg(&vscsi->dev, "calling submit_tmr, func %d\n",
++ srp_tsk->tsk_mgmt_func);
+ rc = target_submit_tmr(&cmd->se_cmd, nexus->se_sess, NULL,
+ scsilun_to_int(&srp_tsk->lun), srp_tsk,
+ tcm_type, GFP_KERNEL, tag_to_abort, 0);
+@@ -3113,8 +3122,8 @@ static long srp_build_response(struct scsi_info *vscsi,
+ if (cmd->type == SCSI_CDB) {
+ rsp->status = ibmvscsis_fast_fail(vscsi, cmd);
+ if (rsp->status) {
+- pr_debug("build_resp: cmd %p, scsi status %d\n", cmd,
+- (int)rsp->status);
++ dev_dbg(&vscsi->dev, "build_resp: cmd %p, scsi status %d\n",
++ cmd, (int)rsp->status);
+ ibmvscsis_determine_resid(se_cmd, rsp);
+ if (se_cmd->scsi_sense_length && se_cmd->sense_buffer) {
+ rsp->sense_data_len =
+@@ -3127,7 +3136,8 @@ static long srp_build_response(struct scsi_info *vscsi,
+ rsp->sol_not = (cmd->rsp.sol_not & UCSOLNT) >>
+ UCSOLNT_RESP_SHIFT;
+ } else if (cmd->flags & CMD_FAST_FAIL) {
+- pr_debug("build_resp: cmd %p, fast fail\n", cmd);
++ dev_dbg(&vscsi->dev, "build_resp: cmd %p, fast fail\n",
++ cmd);
+ rsp->sol_not = (cmd->rsp.sol_not & UCSOLNT) >>
+ UCSOLNT_RESP_SHIFT;
+ } else {
+@@ -3340,7 +3350,7 @@ static void ibmvscsis_handle_crq(unsigned long data)
+
+ spin_lock_bh(&vscsi->intr_lock);
+
+- pr_debug("got interrupt\n");
++ dev_dbg(&vscsi->dev, "got interrupt\n");
+
+ /*
+ * if we are in a path where we are waiting for all pending commands
+@@ -3350,8 +3360,8 @@ static void ibmvscsis_handle_crq(unsigned long data)
+ if (TARGET_STOP(vscsi)) {
+ vio_enable_interrupts(vscsi->dma_dev);
+
+- pr_debug("handle_crq, don't process: flags 0x%x, state 0x%hx\n",
+- vscsi->flags, vscsi->state);
++ dev_dbg(&vscsi->dev, "handle_crq, don't process: flags 0x%x, state 0x%hx\n",
++ vscsi->flags, vscsi->state);
+ spin_unlock_bh(&vscsi->intr_lock);
+ return;
+ }
+@@ -3414,20 +3424,20 @@ static void ibmvscsis_handle_crq(unsigned long data)
+ if (ack) {
+ vio_enable_interrupts(vscsi->dma_dev);
+ ack = false;
+- pr_debug("handle_crq, reenabling interrupts\n");
++ dev_dbg(&vscsi->dev, "handle_crq, reenabling interrupts\n");
+ }
+ valid = crq->valid;
+ dma_rmb();
+ if (valid)
+ goto cmd_work;
+ } else {
+- pr_debug("handle_crq, error: flags 0x%x, state 0x%hx, crq index 0x%x\n",
+- vscsi->flags, vscsi->state, vscsi->cmd_q.index);
++ dev_dbg(&vscsi->dev, "handle_crq, error: flags 0x%x, state 0x%hx, crq index 0x%x\n",
++ vscsi->flags, vscsi->state, vscsi->cmd_q.index);
+ }
+
+- pr_debug("Leaving handle_crq: schedule_q empty %d, flags 0x%x, state 0x%hx\n",
+- (int)list_empty(&vscsi->schedule_q), vscsi->flags,
+- vscsi->state);
++ dev_dbg(&vscsi->dev, "Leaving handle_crq: schedule_q empty %d, flags 0x%x, state 0x%hx\n",
++ (int)list_empty(&vscsi->schedule_q), vscsi->flags,
++ vscsi->state);
+
+ spin_unlock_bh(&vscsi->intr_lock);
+ }
+@@ -3443,7 +3453,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
+ vscsi = kzalloc(sizeof(*vscsi), GFP_KERNEL);
+ if (!vscsi) {
+ rc = -ENOMEM;
+- pr_err("probe: allocation of adapter failed\n");
++ dev_err(&vdev->dev, "probe: allocation of adapter failed\n");
+ return rc;
+ }
+
+@@ -3456,14 +3466,14 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
+ snprintf(vscsi->tport.tport_name, IBMVSCSIS_NAMELEN, "%s",
+ dev_name(&vdev->dev));
+
+- pr_debug("probe tport_name: %s\n", vscsi->tport.tport_name);
++ dev_dbg(&vscsi->dev, "probe tport_name: %s\n", vscsi->tport.tport_name);
+
+ rc = read_dma_window(vscsi);
+ if (rc)
+ goto free_adapter;
+- pr_debug("Probe: liobn 0x%x, riobn 0x%x\n",
+- vscsi->dds.window[LOCAL].liobn,
+- vscsi->dds.window[REMOTE].liobn);
++ dev_dbg(&vscsi->dev, "Probe: liobn 0x%x, riobn 0x%x\n",
++ vscsi->dds.window[LOCAL].liobn,
++ vscsi->dds.window[REMOTE].liobn);
+
+ strcpy(vscsi->eye, "VSCSI ");
+ strncat(vscsi->eye, vdev->name, MAX_EYE);
+@@ -3541,8 +3551,8 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
+ * client can connect" and the client isn't activated yet.
+ * We'll make the call again when he sends an init msg.
+ */
+- pr_debug("probe hrc %ld, client partition num %d\n",
+- hrc, vscsi->client_data.partition_number);
++ dev_dbg(&vscsi->dev, "probe hrc %ld, client partition num %d\n",
++ hrc, vscsi->client_data.partition_number);
+
+ tasklet_init(&vscsi->work_task, ibmvscsis_handle_crq,
+ (unsigned long)vscsi);
+@@ -3602,7 +3612,7 @@ static int ibmvscsis_remove(struct vio_dev *vdev)
+ {
+ struct scsi_info *vscsi = dev_get_drvdata(&vdev->dev);
+
+- pr_debug("remove (%s)\n", dev_name(&vscsi->dma_dev->dev));
++ dev_dbg(&vscsi->dev, "remove (%s)\n", dev_name(&vscsi->dma_dev->dev));
+
+ spin_lock_bh(&vscsi->intr_lock);
+ ibmvscsis_post_disconnect(vscsi, UNCONFIGURING, 0);
+@@ -3766,14 +3776,16 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd)
+ * attempt an srp_transfer_data.
+ */
+ if ((vscsi->flags & (CLIENT_FAILED | RESPONSE_Q_DOWN))) {
+- pr_err("write_pending failed since: %d\n", vscsi->flags);
++ dev_err(&vscsi->dev, "write_pending failed since: %d\n",
++ vscsi->flags);
+ return -EIO;
++
+ }
+
+ rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma,
+ 1, 1);
+ if (rc) {
+- pr_err("srp_transfer_data() failed: %d\n", rc);
++ dev_err(&vscsi->dev, "srp_transfer_data() failed: %d\n", rc);
+ return -EIO;
+ }
+ /*
+@@ -3811,7 +3823,7 @@ static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd)
+ rc = srp_transfer_data(cmd, &vio_iu(iue)->srp.cmd, ibmvscsis_rdma, 1,
+ 1);
+ if (rc) {
+- pr_err("srp_transfer_data failed: %d\n", rc);
++ dev_err(&vscsi->dev, "srp_transfer_data failed: %d\n", rc);
+ sd = se_cmd->sense_buffer;
+ se_cmd->scsi_sense_length = 18;
+ memset(se_cmd->sense_buffer, 0, se_cmd->scsi_sense_length);
+@@ -3834,7 +3846,7 @@ static int ibmvscsis_queue_status(struct se_cmd *se_cmd)
+ struct scsi_info *vscsi = cmd->adapter;
+ uint len;
+
+- pr_debug("queue_status %p\n", se_cmd);
++ dev_dbg(&vscsi->dev, "queue_status %p\n", se_cmd);
+
+ srp_build_response(vscsi, cmd, &len);
+ cmd->rsp.format = SRP_FORMAT;
+@@ -3854,8 +3866,8 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd)
+ u64 tag_to_abort = be64_to_cpu(srp_tsk->task_tag);
+ uint len;
+
+- pr_debug("queue_tm_rsp %p, status %d\n",
+- se_cmd, (int)se_cmd->se_tmr_req->response);
++ dev_dbg(&vscsi->dev, "queue_tm_rsp %p, status %d\n",
++ se_cmd, (int)se_cmd->se_tmr_req->response);
+
+ if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK &&
+ cmd->se_cmd.se_tmr_req->response == TMR_TASK_DOES_NOT_EXIST) {
+@@ -3877,8 +3889,12 @@ static void ibmvscsis_queue_tm_rsp(struct se_cmd *se_cmd)
+
+ static void ibmvscsis_aborted_task(struct se_cmd *se_cmd)
+ {
+- pr_debug("ibmvscsis_aborted_task %p task_tag: %llu\n",
+- se_cmd, se_cmd->tag);
++ struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd,
++ se_cmd);
++ struct scsi_info *vscsi = cmd->adapter;
++
++ dev_dbg(&vscsi->dev, "ibmvscsis_aborted_task %p task_tag: %llu\n",
++ se_cmd, se_cmd->tag);
+ }
+
+ static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf,
+@@ -3886,12 +3902,14 @@ static struct se_wwn *ibmvscsis_make_tport(struct target_fabric_configfs *tf,
+ const char *name)
+ {
+ struct ibmvscsis_tport *tport;
++ struct scsi_info *vscsi;
+
+ tport = ibmvscsis_lookup_port(name);
+ if (tport) {
++ vscsi = container_of(tport, struct scsi_info, tport);
+ tport->tport_proto_id = SCSI_PROTOCOL_SRP;
+- pr_debug("make_tport(%s), pointer:%p, tport_id:%x\n",
+- name, tport, tport->tport_proto_id);
++ dev_dbg(&vscsi->dev, "make_tport(%s), pointer:%p, tport_id:%x\n",
++ name, tport, tport->tport_proto_id);
+ return &tport->tport_wwn;
+ }
+
+@@ -3903,9 +3921,10 @@ static void ibmvscsis_drop_tport(struct se_wwn *wwn)
+ struct ibmvscsis_tport *tport = container_of(wwn,
+ struct ibmvscsis_tport,
+ tport_wwn);
++ struct scsi_info *vscsi = container_of(tport, struct scsi_info, tport);
+
+- pr_debug("drop_tport(%s)\n",
+- config_item_name(&tport->tport_wwn.wwn_group.cg_item));
++ dev_dbg(&vscsi->dev, "drop_tport(%s)\n",
++ config_item_name(&tport->tport_wwn.wwn_group.cg_item));
+ }
+
+ static struct se_portal_group *ibmvscsis_make_tpg(struct se_wwn *wwn,
+@@ -3990,12 +4009,12 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
+
+ rc = kstrtoul(page, 0, &tmp);
+ if (rc < 0) {
+- pr_err("Unable to extract srpt_tpg_store_enable\n");
++ dev_err(&vscsi->dev, "Unable to extract srpt_tpg_store_enable\n");
+ return -EINVAL;
+ }
+
+ if ((tmp != 0) && (tmp != 1)) {
+- pr_err("Illegal value for srpt_tpg_store_enable\n");
++ dev_err(&vscsi->dev, "Illegal value for srpt_tpg_store_enable\n");
+ return -EINVAL;
+ }
+
+@@ -4004,8 +4023,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
+ tport->enabled = true;
+ lrc = ibmvscsis_enable_change_state(vscsi);
+ if (lrc)
+- pr_err("enable_change_state failed, rc %ld state %d\n",
+- lrc, vscsi->state);
++ dev_err(&vscsi->dev, "enable_change_state failed, rc %ld state %d\n",
++ lrc, vscsi->state);
+ spin_unlock_bh(&vscsi->intr_lock);
+ } else {
+ spin_lock_bh(&vscsi->intr_lock);
+@@ -4015,7 +4034,8 @@ static ssize_t ibmvscsis_tpg_enable_store(struct config_item *item,
+ spin_unlock_bh(&vscsi->intr_lock);
+ }
+
+- pr_debug("tpg_enable_store, tmp %ld, state %d\n", tmp, vscsi->state);
++ dev_dbg(&vscsi->dev, "tpg_enable_store, tmp %ld, state %d\n", tmp,
++ vscsi->state);
+
+ return count;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-libcxgbi-in-case-of-vlan-pass-0-as-ifindex-to-f.patch b/patches.fixes/scsi-libcxgbi-in-case-of-vlan-pass-0-as-ifindex-to-f.patch
new file mode 100644
index 0000000000..4d828fd1ec
--- /dev/null
+++ b/patches.fixes/scsi-libcxgbi-in-case-of-vlan-pass-0-as-ifindex-to-f.patch
@@ -0,0 +1,39 @@
+From: Varun Prakash <varun@chelsio.com>
+Date: Tue, 10 Oct 2017 19:25:30 +0530
+Subject: [PATCH] scsi: libcxgbi: in case of vlan pass 0 as ifindex to find
+ route
+References: bsc#1077989
+Git-commit: 4c2a02157fdd5dc71de7cf42eff07576746eb450
+Patch-mainline: v4.15-rc1
+
+In case of vlan pass 0 as ifindex to find route instead of passing
+real_dev ifindex, if we pass real_dev ifindex then
+ip_route_output_ports() and ip6_route_output() will check for route
+through real_dev not through vlan interface.
+
+Signed-off-by: Varun Prakash <varun@chelsio.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxgbi/libcxgbi.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
+index 11735f8051b8..66c0d9816d44 100644
+--- a/drivers/scsi/cxgbi/libcxgbi.c
++++ b/drivers/scsi/cxgbi/libcxgbi.c
+@@ -2567,7 +2567,10 @@ struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
+ goto err_out;
+ }
+
+- ifindex = hba->ndev->ifindex;
++ rtnl_lock();
++ if (!vlan_uses_dev(hba->ndev))
++ ifindex = hba->ndev->ifindex;
++ rtnl_unlock();
+ }
+
+ if (dst_addr->sa_family == AF_INET) {
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-libcxgbi-remove-redundant-check-and-close-on-cs.patch b/patches.fixes/scsi-libcxgbi-remove-redundant-check-and-close-on-cs.patch
new file mode 100644
index 0000000000..345fd0a8c1
--- /dev/null
+++ b/patches.fixes/scsi-libcxgbi-remove-redundant-check-and-close-on-cs.patch
@@ -0,0 +1,36 @@
+From: Colin Ian King <colin.king@canonical.com>
+Date: Thu, 7 Sep 2017 14:51:33 +0100
+Subject: [PATCH] scsi: libcxgbi: remove redundant check and close on csk
+References: bsc#1077989
+Git-commit: 7c82532dcce8b39991ef5f486c2b54d7bb3e171b
+Patch-mainline: v4.15-rc1
+
+csk is always null on the error return path and so the non-null check
+and call to cxgbi_sock_closed on csk is redundant and can be removed.
+
+Detected by: CoverityScan CID#114329 ("Logically dead code")
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Acked-by: Varun Prakash <varun@chelsio.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxgbi/libcxgbi.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
+index e399a9a7d0cb..11735f8051b8 100644
+--- a/drivers/scsi/cxgbi/libcxgbi.c
++++ b/drivers/scsi/cxgbi/libcxgbi.c
+@@ -688,8 +688,6 @@ cxgbi_check_route(struct sockaddr *dst_addr, int ifindex)
+
+ rel_rt:
+ ip_rt_put(rt);
+- if (csk)
+- cxgbi_sock_closed(csk);
+ err_out:
+ return ERR_PTR(err);
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-libcxgbi-use-ndev-ifindex-to-find-route.patch b/patches.fixes/scsi-libcxgbi-use-ndev-ifindex-to-find-route.patch
new file mode 100644
index 0000000000..1cbabb607a
--- /dev/null
+++ b/patches.fixes/scsi-libcxgbi-use-ndev-ifindex-to-find-route.patch
@@ -0,0 +1,119 @@
+From: Varun Prakash <varun@chelsio.com>
+Date: Sat, 5 Aug 2017 19:36:11 +0530
+Subject: [PATCH] scsi: libcxgbi: use ndev->ifindex to find route
+References: bsc#1077989
+Git-commit: 4737c5a0676218000e9c8874ea9ecbc9916fa278
+Patch-mainline: v4.14-rc1
+
+If cxgbi_ep_connect() is called with valid shost then find associated
+ndev and use ndev->ifindex to find route.
+
+Signed-off-by: Varun Prakash <varun@chelsio.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/cxgbi/libcxgbi.c | 27 ++++++++++++++++++---------
+ 1 file changed, 18 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
+index b57643e053eb..e399a9a7d0cb 100644
+--- a/drivers/scsi/cxgbi/libcxgbi.c
++++ b/drivers/scsi/cxgbi/libcxgbi.c
+@@ -585,19 +585,21 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev)
+
+ static struct rtable *find_route_ipv4(struct flowi4 *fl4,
+ __be32 saddr, __be32 daddr,
+- __be16 sport, __be16 dport, u8 tos)
++ __be16 sport, __be16 dport, u8 tos,
++ int ifindex)
+ {
+ struct rtable *rt;
+
+ rt = ip_route_output_ports(&init_net, fl4, NULL, daddr, saddr,
+- dport, sport, IPPROTO_TCP, tos, 0);
++ dport, sport, IPPROTO_TCP, tos, ifindex);
+ if (IS_ERR(rt))
+ return NULL;
+
+ return rt;
+ }
+
+-static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
++static struct cxgbi_sock *
++cxgbi_check_route(struct sockaddr *dst_addr, int ifindex)
+ {
+ struct sockaddr_in *daddr = (struct sockaddr_in *)dst_addr;
+ struct dst_entry *dst;
+@@ -611,7 +613,8 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
+ int port = 0xFFFF;
+ int err = 0;
+
+- rt = find_route_ipv4(&fl4, 0, daddr->sin_addr.s_addr, 0, daddr->sin_port, 0);
++ rt = find_route_ipv4(&fl4, 0, daddr->sin_addr.s_addr, 0,
++ daddr->sin_port, 0, ifindex);
+ if (!rt) {
+ pr_info("no route to ipv4 0x%x, port %u.\n",
+ be32_to_cpu(daddr->sin_addr.s_addr),
+@@ -693,11 +696,13 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
+
+ #if IS_ENABLED(CONFIG_IPV6)
+ static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr,
+- const struct in6_addr *daddr)
++ const struct in6_addr *daddr,
++ int ifindex)
+ {
+ struct flowi6 fl;
+
+ memset(&fl, 0, sizeof(fl));
++ fl.flowi6_oif = ifindex;
+ if (saddr)
+ memcpy(&fl.saddr, saddr, sizeof(struct in6_addr));
+ if (daddr)
+@@ -705,7 +710,8 @@ static struct rt6_info *find_route_ipv6(const struct in6_addr *saddr,
+ return (struct rt6_info *)ip6_route_output(&init_net, NULL, &fl);
+ }
+
+-static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
++static struct cxgbi_sock *
++cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex)
+ {
+ struct sockaddr_in6 *daddr6 = (struct sockaddr_in6 *)dst_addr;
+ struct dst_entry *dst;
+@@ -719,7 +725,7 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr)
+ int port = 0xFFFF;
+ int err = 0;
+
+- rt = find_route_ipv6(NULL, &daddr6->sin6_addr);
++ rt = find_route_ipv6(NULL, &daddr6->sin6_addr, ifindex);
+
+ if (!rt) {
+ pr_info("no route to ipv6 %pI6 port %u\n",
+@@ -2549,6 +2555,7 @@ struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
+ struct cxgbi_endpoint *cep;
+ struct cxgbi_hba *hba = NULL;
+ struct cxgbi_sock *csk;
++ int ifindex = 0;
+ int err = -EINVAL;
+
+ log_debug(1 << CXGBI_DBG_ISCSI | 1 << CXGBI_DBG_SOCK,
+@@ -2561,13 +2568,15 @@ struct iscsi_endpoint *cxgbi_ep_connect(struct Scsi_Host *shost,
+ pr_info("shost 0x%p, priv NULL.\n", shost);
+ goto err_out;
+ }
++
++ ifindex = hba->ndev->ifindex;
+ }
+
+ if (dst_addr->sa_family == AF_INET) {
+- csk = cxgbi_check_route(dst_addr);
++ csk = cxgbi_check_route(dst_addr, ifindex);
+ #if IS_ENABLED(CONFIG_IPV6)
+ } else if (dst_addr->sa_family == AF_INET6) {
+- csk = cxgbi_check_route6(dst_addr);
++ csk = cxgbi_check_route6(dst_addr, ifindex);
+ #endif
+ } else {
+ pr_info("address family 0x%x NOT supported.\n",
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-libiscsi-Fix-use-after-free-race-during-iscsi_s.patch b/patches.fixes/scsi-libiscsi-Fix-use-after-free-race-during-iscsi_s.patch
new file mode 100644
index 0000000000..98fa758aec
--- /dev/null
+++ b/patches.fixes/scsi-libiscsi-Fix-use-after-free-race-during-iscsi_s.patch
@@ -0,0 +1,56 @@
+From: Khazhismel Kumykov <khazhy@google.com>
+Date: Thu, 13 Jul 2017 09:11:21 -0700
+Subject: [PATCH] scsi: libiscsi: Fix use-after-free race during
+ iscsi_session_teardown
+References: bsc#1077989
+Git-commit: 9e10b5121ad991ea6e84ca40b15a04cdc551bfe9
+Patch-mainline: v4.14-rc4
+
+Session attributes exposed through sysfs were freed before the device
+was destroyed, resulting in a potential use-after-free. Free these
+attributes after removing the device.
+
+Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
+Acked-by: Chris Leech <cleech@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/libiscsi.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
+index 51b446c8638f..0d416aacd8b9 100644
+--- a/drivers/scsi/libiscsi.c
++++ b/drivers/scsi/libiscsi.c
+@@ -2873,9 +2873,6 @@ EXPORT_SYMBOL_GPL(iscsi_session_setup);
+ /**
+ * iscsi_session_teardown - destroy session, host, and cls_session
+ * @cls_session: iscsi session
+- *
+- * The driver must have called iscsi_remove_session before
+- * calling this.
+ */
+ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
+ {
+@@ -2885,6 +2882,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
+
+ iscsi_pool_free(&session->cmdpool);
+
++ iscsi_remove_session(cls_session);
++
+ kfree(session->password);
+ kfree(session->password_in);
+ kfree(session->username);
+@@ -2899,7 +2898,8 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
+ kfree(session->portal_type);
+ kfree(session->discovery_parent_type);
+
+- iscsi_destroy_session(cls_session);
++ iscsi_free_session(cls_session);
++
+ iscsi_host_dec_session_cnt(shost);
+ module_put(owner);
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-libiscsi-Remove-iscsi_destroy_session.patch b/patches.fixes/scsi-libiscsi-Remove-iscsi_destroy_session.patch
new file mode 100644
index 0000000000..db7c335f69
--- /dev/null
+++ b/patches.fixes/scsi-libiscsi-Remove-iscsi_destroy_session.patch
@@ -0,0 +1,61 @@
+From: Khazhismel Kumykov <khazhy@google.com>
+Date: Thu, 13 Jul 2017 09:11:22 -0700
+Subject: [PATCH] scsi: libiscsi: Remove iscsi_destroy_session
+References: bsc#1077989
+Git-commit: 1c048a250aae1aaab0ba9dbec908f0c6cdb8614f
+Patch-mainline: v4.14-rc4
+
+iscsi_session_teardown was the only user of this function. Function
+currently is just short for iscsi_remove_session + iscsi_free_session.
+
+Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
+Acked-by: Chris Leech <cleech@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_transport_iscsi.c | 16 ----------------
+ include/scsi/scsi_transport_iscsi.h | 1 -
+ 2 files changed, 17 deletions(-)
+
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
+index c55c6f3147ae..eddcd2738287 100644
+--- a/drivers/scsi/scsi_transport_iscsi.c
++++ b/drivers/scsi/scsi_transport_iscsi.c
+@@ -2211,22 +2211,6 @@ void iscsi_free_session(struct iscsi_cls_session *session)
+ EXPORT_SYMBOL_GPL(iscsi_free_session);
+
+ /**
+- * iscsi_destroy_session - destroy iscsi session
+- * @session: iscsi_session
+- *
+- * Can be called by a LLD or iscsi_transport. There must not be
+- * any running connections.
+- */
+-int iscsi_destroy_session(struct iscsi_cls_session *session)
+-{
+- iscsi_remove_session(session);
+- ISCSI_DBG_TRANS_SESSION(session, "Completing session destruction\n");
+- iscsi_free_session(session);
+- return 0;
+-}
+-EXPORT_SYMBOL_GPL(iscsi_destroy_session);
+-
+-/**
+ * iscsi_create_conn - create iscsi class connection
+ * @session: iscsi cls session
+ * @dd_size: private driver data size
+diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
+index 6183d20a01fb..b266d2a3bcb1 100644
+--- a/include/scsi/scsi_transport_iscsi.h
++++ b/include/scsi/scsi_transport_iscsi.h
+@@ -434,7 +434,6 @@ extern struct iscsi_cls_session *iscsi_create_session(struct Scsi_Host *shost,
+ unsigned int target_id);
+ extern void iscsi_remove_session(struct iscsi_cls_session *session);
+ extern void iscsi_free_session(struct iscsi_cls_session *session);
+-extern int iscsi_destroy_session(struct iscsi_cls_session *session);
+ extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *sess,
+ int dd_size, uint32_t cid);
+ extern int iscsi_destroy_conn(struct iscsi_cls_conn *conn);
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-libiscsi-use-kvzalloc-for-iscsi_pool_init.patch b/patches.fixes/scsi-libiscsi-use-kvzalloc-for-iscsi_pool_init.patch
new file mode 100644
index 0000000000..6db2d70825
--- /dev/null
+++ b/patches.fixes/scsi-libiscsi-use-kvzalloc-for-iscsi_pool_init.patch
@@ -0,0 +1,97 @@
+From: Kyle Fortin <kyle.fortin@oracle.com>
+Date: Wed, 17 May 2017 16:21:54 -0400
+Subject: [PATCH] scsi: libiscsi: use kvzalloc for iscsi_pool_init
+References: bsc#1077989
+Git-commit: bfcc62ed7066268349e8e7955925bdaf4be0eec0
+Patch-mainline: v4.13-rc1
+
+iscsiadm session login can fail with the following error:
+
+iscsiadm: Could not login to [iface: default, target: iqn.1986-03.com...
+iscsiadm: initiator reported error (9 - internal error)
+
+When /etc/iscsi/iscsid.conf sets node.session.cmds_max = 4096, it
+results in 64K-sized kmallocs per session. A system under fragmented
+slab pressure may not have any 64K objects available and fail iscsiadm
+session login. Even though memory objects of a smaller size are
+available, the large order allocation ends up failing.
+
+The kernel prints a warning and does dump_stack, like below:
+
+iscsid: page allocation failure: order:4, mode:0xc0d0
+CPU: 0 PID: 2456 Comm: iscsid Not tainted 4.1.12-61.1.28.el6uek.x86_64 #2
+Call Trace:
+ [<ffffffff816c6e40>] dump_stack+0x63/0x83
+ [<ffffffff8118e58a>] warn_alloc_failed+0xea/0x140
+ [<ffffffff81191df9>] __alloc_pages_slowpath+0x409/0x760
+ [<ffffffff81192401>] __alloc_pages_nodemask+0x2b1/0x2d0
+ [<ffffffffa048f6c0>] ? dev_attr_host_ipaddress+0x20/0xffffffffffffc722
+ [<ffffffff811dc38f>] alloc_pages_current+0xaf/0x170
+ [<ffffffff81192581>] alloc_kmem_pages+0x31/0xd0
+ [<ffffffffa048f600>] ? iscsi_transport_group+0x20/0xffffffffffffc7e2
+ [<ffffffff811ad738>] kmalloc_order+0x18/0x50
+ [<ffffffff811ad7a4>] kmalloc_order_trace+0x34/0xe0
+ [<ffffffff8146ee30>] ? transport_remove_classdev+0x70/0x70
+ [<ffffffff811e843d>] __kmalloc+0x27d/0x2a0
+ [<ffffffff810c8cbd>] ? complete_all+0x4d/0x60
+ [<ffffffffa04af299>] iscsi_pool_init+0x69/0x160 [libiscsi]
+ [<ffffffff81465d90>] ? device_initialize+0xb0/0xd0
+ [<ffffffffa04af510>] iscsi_session_setup+0x180/0x2f4 [libiscsi]
+ [<ffffffffa04c5a60>] ? iscsi_max_lun+0x20/0xfffffffffffffa9e [iscsi_tcp]
+ [<ffffffffa04c531f>] iscsi_sw_tcp_session_create+0xcf/0x150 [iscsi_tcp]
+ [<ffffffffa04c5a60>] ? iscsi_max_lun+0x20/0xfffffffffffffa9e [iscsi_tcp]
+ [<ffffffffa048a633>] iscsi_if_create_session+0x33/0xd0
+ [<ffffffffa04c5a60>] ? iscsi_max_lun+0x20/0xfffffffffffffa9e [iscsi_tcp]
+ [<ffffffffa048abd8>] iscsi_if_recv_msg+0x508/0x8c0 [scsi_transport_iscsi]
+ [<ffffffff811922eb>] ? __alloc_pages_nodemask+0x19b/0x2d0
+ [<ffffffff811e6d69>] ? __kmalloc_node_track_caller+0x209/0x2c0
+ [<ffffffffa048b00c>] iscsi_if_rx+0x7c/0x200 [scsi_transport_iscsi]
+ [<ffffffff81623dc6>] netlink_unicast+0x126/0x1c0
+ [<ffffffff8162468c>] netlink_sendmsg+0x36c/0x400
+ [<ffffffff815d2fed>] sock_sendmsg+0x4d/0x60
+ [<ffffffff815d596a>] ___sys_sendmsg+0x30a/0x330
+ [<ffffffff811bc72c>] ? handle_pte_fault+0x20c/0x230
+ [<ffffffff811bc90c>] ? __handle_mm_fault+0x1bc/0x330
+ [<ffffffff811bcb32>] ? handle_mm_fault+0xb2/0x1a0
+ [<ffffffff815d5b99>] __sys_sendmsg+0x49/0x90
+ [<ffffffff815d5bf9>] SyS_sendmsg+0x19/0x20
+ [<ffffffff816cbb2e>] system_call_fastpath+0x12/0x71
+
+Use kvzalloc for iscsi_pool in iscsi_pool_init.
+
+Signed-off-by: Kyle Fortin <kyle.fortin@oracle.com>
+Tested-by: Kyle Fortin <kyle.fortin@oracle.com>
+Reviewed-by: Joseph Slember <joe.slember@oracle.com>
+Reviewed-by: Lance Hartmann <lance.hartmann@oracle.com>
+Acked-by: Lee Duncan <lduncan@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/libiscsi.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
+index 9258cb2d7db4..51b446c8638f 100644
+--- a/drivers/scsi/libiscsi.c
++++ b/drivers/scsi/libiscsi.c
+@@ -2578,7 +2578,7 @@ iscsi_pool_init(struct iscsi_pool *q, int max, void ***items, int item_size)
+ * the array. */
+ if (items)
+ num_arrays++;
+- q->pool = kzalloc(num_arrays * max * sizeof(void*), GFP_KERNEL);
++ q->pool = kvzalloc(num_arrays * max * sizeof(void*), GFP_KERNEL);
+ if (q->pool == NULL)
+ return -ENOMEM;
+
+@@ -2612,7 +2612,7 @@ void iscsi_pool_free(struct iscsi_pool *q)
+
+ for (i = 0; i < q->max; i++)
+ kfree(q->pool[i]);
+- kfree(q->pool);
++ kvfree(q->pool);
+ }
+ EXPORT_SYMBOL_GPL(iscsi_pool_free);
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-mpt3sas-Fix-memory-allocation-failure-test-in-m.patch b/patches.fixes/scsi-mpt3sas-Fix-memory-allocation-failure-test-in-m.patch
new file mode 100644
index 0000000000..051c927b05
--- /dev/null
+++ b/patches.fixes/scsi-mpt3sas-Fix-memory-allocation-failure-test-in-m.patch
@@ -0,0 +1,42 @@
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Date: Mon, 7 Aug 2017 00:51:29 +0200
+Subject: [PATCH] scsi: mpt3sas: Fix memory allocation failure test in
+ 'mpt3sas_base_attach()'
+References: bsc#1077989
+Git-commit: a5dd7efd356abeaf268ef5e260a99453ebe01b82
+Patch-mainline: v4.14-rc1
+
+In the lines above this test, 8 'kzalloc' are performed, but only 7
+results are tested.
+
+Add the missing one (i.e. '!ioc->port_enable_cmds.reply').
+
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/mpt3sas/mpt3sas_base.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
+index caf39af47fb7..15b805b94eda 100644
+--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
+@@ -6122,10 +6122,10 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
+ ioc->ctl_cmds.status = MPT3_CMD_NOT_USED;
+ mutex_init(&ioc->ctl_cmds.mutex);
+
+- if (!ioc->base_cmds.reply || !ioc->transport_cmds.reply ||
+- !ioc->scsih_cmds.reply || !ioc->tm_cmds.reply ||
+- !ioc->config_cmds.reply || !ioc->ctl_cmds.reply ||
+- !ioc->ctl_cmds.sense) {
++ if (!ioc->base_cmds.reply || !ioc->port_enable_cmds.reply ||
++ !ioc->transport_cmds.reply || !ioc->scsih_cmds.reply ||
++ !ioc->tm_cmds.reply || !ioc->config_cmds.reply ||
++ !ioc->ctl_cmds.reply || !ioc->ctl_cmds.sense) {
+ r = -ENOMEM;
+ goto out_free_resources;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-mpt3sas-Proper-handling-of-set-clear-of-ATA-com.patch b/patches.fixes/scsi-mpt3sas-Proper-handling-of-set-clear-of-ATA-com.patch
new file mode 100644
index 0000000000..9505b96782
--- /dev/null
+++ b/patches.fixes/scsi-mpt3sas-Proper-handling-of-set-clear-of-ATA-com.patch
@@ -0,0 +1,101 @@
+From: Chaitra P B <chaitra.basappa@broadcom.com>
+Date: Wed, 27 Dec 2017 23:09:11 -0800
+Subject: [PATCH] scsi: mpt3sas: Proper handling of set/clear of "ATA command
+ pending" flag.
+References: bsc#1077989
+Git-commit: f49d4aed1315a7b766d855f1367142e682b0cc87
+Patch-mainline: v4.16-rc1
+
+1. In IO path, setting of "ATA command pending" flag early before device
+ removal, invalid device handle etc., checks causes any new commands
+ to be always returned with SAM_STAT_BUSY and when the driver removes
+ the drive the SML issues SYNC Cache command and that command is
+ always returned with SAM_STAT_BUSY and thus making SYNC Cache command
+ to requeued.
+
+2. If the driver gets an ATA PT command for a SATA drive then the driver
+ set "ATA command pending" flag in device specific data structure not
+ to allow any further commands until the ATA PT command is completed.
+ However, after setting the flag if the driver decides to return the
+ command back to upper layers without actually issuing to the firmware
+ (i.e., returns from qcmd failure return paths) then the corresponding
+ flag is not cleared and this prevents the driver from sending any new
+ commands to the drive.
+
+This patch fixes above two issues by setting of "ATA command pending"
+flag after checking for whether device deleted, invalid device handle,
+device busy with task management. And by setting "ATA command pending"
+flag to false in all of the qcmd failure return paths after setting the
+flag.
+
+Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
+Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/mpt3sas/mpt3sas_scsih.c | 28 +++++++++++++++-------------
+ 1 file changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+index 362f406a285e..58432193b421 100644
+--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
++++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+@@ -4758,19 +4758,6 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
+ return 0;
+ }
+
+- /*
+- * Bug work around for firmware SATL handling. The loop
+- * is based on atomic operations and ensures consistency
+- * since we're lockless at this point
+- */
+- do {
+- if (test_bit(0, &sas_device_priv_data->ata_command_pending)) {
+- scmd->result = SAM_STAT_BUSY;
+- scmd->scsi_done(scmd);
+- return 0;
+- }
+- } while (_scsih_set_satl_pending(scmd, true));
+-
+ sas_target_priv_data = sas_device_priv_data->sas_target;
+
+ /* invalid device handle */
+@@ -4796,6 +4783,19 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
+ sas_device_priv_data->block)
+ return SCSI_MLQUEUE_DEVICE_BUSY;
+
++ /*
++ * Bug work around for firmware SATL handling. The loop
++ * is based on atomic operations and ensures consistency
++ * since we're lockless at this point
++ */
++ do {
++ if (test_bit(0, &sas_device_priv_data->ata_command_pending)) {
++ scmd->result = SAM_STAT_BUSY;
++ scmd->scsi_done(scmd);
++ return 0;
++ }
++ } while (_scsih_set_satl_pending(scmd, true));
++
+ if (scmd->sc_data_direction == DMA_FROM_DEVICE)
+ mpi_control = MPI2_SCSIIO_CONTROL_READ;
+ else if (scmd->sc_data_direction == DMA_TO_DEVICE)
+@@ -4823,6 +4823,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
+ if (!smid) {
+ pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
+ ioc->name, __func__);
++ _scsih_set_satl_pending(scmd, false);
+ goto out;
+ }
+ mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+@@ -4854,6 +4855,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
+ pcie_device = sas_target_priv_data->pcie_dev;
+ if (ioc->build_sg_scmd(ioc, scmd, smid, pcie_device)) {
+ mpt3sas_base_free_smid(ioc, smid);
++ _scsih_set_satl_pending(scmd, false);
+ goto out;
+ }
+ } else
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-mpt3sas-fix-format-overflow-warning.patch b/patches.fixes/scsi-mpt3sas-fix-format-overflow-warning.patch
new file mode 100644
index 0000000000..af32e69e82
--- /dev/null
+++ b/patches.fixes/scsi-mpt3sas-fix-format-overflow-warning.patch
@@ -0,0 +1,47 @@
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 14 Jul 2017 14:06:55 +0200
+Subject: [PATCH] scsi: mpt3sas: fix format overflow warning
+References: bsc#1077989
+Git-commit: bbfd8e8b241bdb4f4f53df1ba36d839441e5fd89
+Patch-mainline: v4.14-rc1
+
+We print the driver name into one string and then add and ID
+and copy it into a second string of the same length, at which
+point gcc complains about a possible overflow:
+
+drivers/scsi/mpt3sas/mpt3sas_scsih.c: In function '_scsih_probe':
+drivers/scsi/mpt3sas/mpt3sas_scsih.c:8884:21: error: '_cm' directive writing 3 bytes into a region of size between 1 and 32 [-Werror=format-overflow=]
+printf(ioc->name, "%s_cm%d", ioc->driver_name, ioc->id);
+ ^~~~~~~~~
+drivers/scsi/mpt3sas/mpt3sas_scsih.c:8884:21: note: directive argument in the range [0, 255]
+drivers/scsi/mpt3sas/mpt3sas_scsih.c:8884:2: note: 'sprintf' output between 5 and 38 bytes into a destination of size 32
+ sprintf(ioc->name, "%s_cm%d", ioc->driver_name, ioc->id);
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Making the first string shorter is sufficient to avoid the
+warning here, as we know it can only contain either "mpt2sas"
+or "mpt3sas".
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/mpt3sas/mpt3sas_base.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
+index eef0fadbc688..60f42ca3954f 100644
+--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
++++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
+@@ -1098,7 +1098,7 @@ struct MPT3SAS_ADAPTER {
+ u8 id;
+ int cpu_count;
+ char name[MPT_NAME_LENGTH];
+- char driver_name[MPT_NAME_LENGTH];
++ char driver_name[MPT_NAME_LENGTH - 8];
+ char tmp_string[MPT_STRING_LENGTH];
+ struct pci_dev *pdev;
+ Mpi2SystemInterfaceRegs_t __iomem *chip;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-mvsas-replace-kfree-with-scsi_host_put.patch b/patches.fixes/scsi-mvsas-replace-kfree-with-scsi_host_put.patch
new file mode 100644
index 0000000000..937f95a499
--- /dev/null
+++ b/patches.fixes/scsi-mvsas-replace-kfree-with-scsi_host_put.patch
@@ -0,0 +1,44 @@
+From: Pan Bian <bianpan2016@163.com>
+Date: Tue, 8 Aug 2017 20:02:51 +0800
+Subject: [PATCH] scsi: mvsas: replace kfree with scsi_host_put
+References: bsc#1077989
+Git-commit: cf99dc30bcc56c33243b5bbfef9d8ea943dd2e1c
+Patch-mainline: v4.14-rc1
+
+The return value of scsi_host_alloc() should be released by
+scsi_host_put(). However, in function mvs_pci_init(), kfree()
+is used. This patch replaces kfree() with scsi_host_put() to avoid
+possible memory leaks.
+
+Signed-off-by: Pan Bian <bianpan2016@163.com>
+Reviewed-by: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/mvsas/mv_init.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
+index a3533eaedd65..2db7e9bf8196 100644
+--- a/drivers/scsi/mvsas/mv_init.c
++++ b/drivers/scsi/mvsas/mv_init.c
+@@ -557,14 +557,14 @@ static int mvs_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent)
+ SHOST_TO_SAS_HA(shost) =
+ kcalloc(1, sizeof(struct sas_ha_struct), GFP_KERNEL);
+ if (!SHOST_TO_SAS_HA(shost)) {
+- kfree(shost);
++ scsi_host_put(shost);
+ rc = -ENOMEM;
+ goto err_out_regions;
+ }
+
+ rc = mvs_prep_sas_ha_init(shost, chip);
+ if (rc) {
+- kfree(shost);
++ scsi_host_put(shost);
+ rc = -ENOMEM;
+ goto err_out_regions;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-pmcraid-fix-duplicated-code-for-different-branc.patch b/patches.fixes/scsi-pmcraid-fix-duplicated-code-for-different-branc.patch
new file mode 100644
index 0000000000..f54cccce0b
--- /dev/null
+++ b/patches.fixes/scsi-pmcraid-fix-duplicated-code-for-different-branc.patch
@@ -0,0 +1,39 @@
+From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
+Date: Sat, 12 Aug 2017 20:26:32 -0500
+Subject: [PATCH] scsi: pmcraid: fix duplicated code for different branches
+References: bsc#1077989
+Git-commit: db269932b97e8e7d2bc974dc6a63cb795ddd7e54
+Patch-mainline: v4.14-rc1
+
+Refactor code in order to avoid identical code for different branches.
+
+This issue was detected with the help of Coccinelle.
+
+Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/pmcraid.c | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
+index 1cc814f1505a..11d1a2d3d58a 100644
+--- a/drivers/scsi/pmcraid.c
++++ b/drivers/scsi/pmcraid.c
+@@ -1595,12 +1595,7 @@ static void pmcraid_handle_config_change(struct pmcraid_instance *pinstance)
+ if (pinstance->ccn.hcam->notification_type ==
+ NOTIFICATION_TYPE_ENTRY_CHANGED &&
+ cfg_entry->resource_type == RES_TYPE_VSET) {
+-
+- if (fw_version <= PMCRAID_FW_VERSION_1)
+- hidden_entry = (cfg_entry->unique_flags1 & 0x80) != 0;
+- else
+- hidden_entry = (cfg_entry->unique_flags1 & 0x80) != 0;
+-
++ hidden_entry = (cfg_entry->unique_flags1 & 0x80) != 0;
+ } else if (!pmcraid_expose_resource(fw_version, cfg_entry)) {
+ goto out_notify_apps;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-pmcraid-use-correct-size-unit-when-calling-find.patch b/patches.fixes/scsi-pmcraid-use-correct-size-unit-when-calling-find.patch
new file mode 100644
index 0000000000..7fe5002b67
--- /dev/null
+++ b/patches.fixes/scsi-pmcraid-use-correct-size-unit-when-calling-find.patch
@@ -0,0 +1,34 @@
+From: Niklas Cassel <niklas.cassel@axis.com>
+Date: Thu, 16 Nov 2017 18:38:06 +0100
+Subject: [PATCH] scsi: pmcraid: use correct size unit when calling
+ find_first_zero_bit()
+References: bsc#1077989
+Git-commit: 36d9e0e8a77cfe6983940a266288f7c9d34c0b37
+Patch-mainline: v4.16-rc1
+
+find_first_zero_bit()'s parameter 'size' is defined in bits, not in
+bytes.
+
+Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/pmcraid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
+index 11d1a2d3d58a..512afe207143 100644
+--- a/drivers/scsi/pmcraid.c
++++ b/drivers/scsi/pmcraid.c
+@@ -5223,7 +5223,7 @@ static unsigned short pmcraid_get_minor(void)
+ {
+ int minor;
+
+- minor = find_first_zero_bit(pmcraid_minor, sizeof(pmcraid_minor));
++ minor = find_first_zero_bit(pmcraid_minor, PMCRAID_MAX_ADAPTERS);
+ __set_bit(minor, pmcraid_minor);
+ return minor;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-qedf-Fix-error-return-code-in-__qedf_probe.patch b/patches.fixes/scsi-qedf-Fix-error-return-code-in-__qedf_probe.patch
new file mode 100644
index 0000000000..a80546b77b
--- /dev/null
+++ b/patches.fixes/scsi-qedf-Fix-error-return-code-in-__qedf_probe.patch
@@ -0,0 +1,49 @@
+From: Wei Yongjun <weiyongjun1@huawei.com>
+Date: Wed, 17 Jan 2018 12:42:41 +0000
+Subject: [PATCH] scsi: qedf: Fix error return code in __qedf_probe()
+References: bsc#1077989
+Git-commit: e89cabf26e1cdd5c612b6c21547b3e79b4ac1038
+Patch-mainline: v4.16-rc1
+
+Fix to return error code -ENOMEM from the error handling case instead of
+0, as done elsewhere in this function.
+
+Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
+Acked-by: Chad Dupuis <chad.dupuis@cavium.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/qedf/qedf_main.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
+index 7c0064500cc5..4809debc6110 100644
+--- a/drivers/scsi/qedf/qedf_main.c
++++ b/drivers/scsi/qedf/qedf_main.c
+@@ -3126,6 +3126,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
+ qedf->cmd_mgr = qedf_cmd_mgr_alloc(qedf);
+ if (!qedf->cmd_mgr) {
+ QEDF_ERR(&(qedf->dbg_ctx), "Failed to allocate cmd mgr.\n");
++ rc = -ENOMEM;
+ goto err5;
+ }
+
+@@ -3149,6 +3150,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
+ create_workqueue(host_buf);
+ if (!qedf->ll2_recv_wq) {
+ QEDF_ERR(&(qedf->dbg_ctx), "Failed to LL2 workqueue.\n");
++ rc = -ENOMEM;
+ goto err7;
+ }
+
+@@ -3192,6 +3194,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
+ if (!qedf->timer_work_queue) {
+ QEDF_ERR(&(qedf->dbg_ctx), "Failed to start timer "
+ "workqueue.\n");
++ rc = -ENOMEM;
+ goto err7;
+ }
+
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-scsi-Export-blacklist-flags-to-sysfs.patch b/patches.fixes/scsi-scsi-Export-blacklist-flags-to-sysfs.patch
new file mode 100644
index 0000000000..67c2561429
--- /dev/null
+++ b/patches.fixes/scsi-scsi-Export-blacklist-flags-to-sysfs.patch
@@ -0,0 +1,120 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Mon, 2 Oct 2017 16:26:34 +0200
+Subject: [PATCH] scsi: scsi: Export blacklist flags to sysfs
+References: bsc#1077989
+Git-commit: 345e29608b4bb4b68c6c30667dda02d51484769e
+Patch-mainline: v4.15-rc1
+
+Each scsi device is scanned according to the found blacklist flags, but
+this information is never presented to sysfs. This makes it quite hard
+to figure out if blacklisting worked as expected. With this patch we're
+exporting an additional attribute 'blacklist' containing the blacklist
+flags for this device.
+
+Signed-off-by: Hannes Reinecke <hare@suse.com>
+Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/Makefile | 8 ++++++++
+ drivers/scsi/scsi_scan.c | 1 +
+ drivers/scsi/scsi_sysfs.c | 37 +++++++++++++++++++++++++++++++++++++
+ 3 files changed, 46 insertions(+)
+
+diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
+index 93dbe58c47c8..c4298c7fe819 100644
+--- a/drivers/scsi/Makefile
++++ b/drivers/scsi/Makefile
+@@ -191,6 +191,14 @@ clean-files := 53c700_d.h 53c700_u.h
+
+ $(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h
+
++$(obj)/scsi_sysfs.o: $(obj)/scsi_devinfo_tbl.c
++
++quiet_cmd_bflags = GEN $@
++ cmd_bflags = sed -n 's/.*BLIST_\([A-Z0-9_]*\) *.*/BLIST_FLAG_NAME(\1),/p' $< > $@
++
++$(obj)/scsi_devinfo_tbl.c: include/scsi/scsi_devinfo.h
++ $(call if_changed,bflags)
++
+ # If you want to play with the firmware, uncomment
+ # GENERATE_FIRMWARE := 1
+
+diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
+index 9ae0df45b4de..b9d25df044d2 100644
+--- a/drivers/scsi/scsi_scan.c
++++ b/drivers/scsi/scsi_scan.c
+@@ -987,6 +987,7 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
+ scsi_attach_vpd(sdev);
+
+ sdev->max_queue_depth = sdev->queue_depth;
++ sdev->sdev_bflags = *bflags;
+
+ /*
+ * Ok, the device is now all set up, we can
+diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
+index 40406c162d0d..efac658866a0 100644
+--- a/drivers/scsi/scsi_sysfs.c
++++ b/drivers/scsi/scsi_sysfs.c
+@@ -20,6 +20,7 @@
+ #include <scsi/scsi_dh.h>
+ #include <scsi/scsi_transport.h>
+ #include <scsi/scsi_driver.h>
++#include <scsi/scsi_devinfo.h>
+
+ #include "scsi_priv.h"
+ #include "scsi_logging.h"
+@@ -966,6 +967,41 @@ sdev_show_wwid(struct device *dev, struct device_attribute *attr,
+ }
+ static DEVICE_ATTR(wwid, S_IRUGO, sdev_show_wwid, NULL);
+
++#define BLIST_FLAG_NAME(name) [ilog2(BLIST_##name)] = #name
++static const char *const sdev_bflags_name[] = {
++#include "scsi_devinfo_tbl.c"
++};
++#undef BLIST_FLAG_NAME
++
++static ssize_t
++sdev_show_blacklist(struct device *dev, struct device_attribute *attr,
++ char *buf)
++{
++ struct scsi_device *sdev = to_scsi_device(dev);
++ int i;
++ ssize_t len = 0;
++
++ for (i = 0; i < sizeof(sdev->sdev_bflags) * BITS_PER_BYTE; i++) {
++ const char *name = NULL;
++
++ if (!(sdev->sdev_bflags & BIT(i)))
++ continue;
++ if (i < ARRAY_SIZE(sdev_bflags_name) && sdev_bflags_name[i])
++ name = sdev_bflags_name[i];
++
++ if (name)
++ len += snprintf(buf + len, PAGE_SIZE - len,
++ "%s%s", len ? " " : "", name);
++ else
++ len += snprintf(buf + len, PAGE_SIZE - len,
++ "%sINVALID_BIT(%d)", len ? " " : "", i);
++ }
++ if (len)
++ len += snprintf(buf + len, PAGE_SIZE - len, "\n");
++ return len;
++}
++static DEVICE_ATTR(blacklist, S_IRUGO, sdev_show_blacklist, NULL);
++
+ #ifdef CONFIG_SCSI_DH
+ static ssize_t
+ sdev_show_dh_state(struct device *dev, struct device_attribute *attr,
+@@ -1151,6 +1187,7 @@ static struct attribute *scsi_sdev_attrs[] = {
+ &dev_attr_queue_depth.attr,
+ &dev_attr_queue_type.attr,
+ &dev_attr_wwid.attr,
++ &dev_attr_blacklist.attr,
+ #ifdef CONFIG_SCSI_DH
+ &dev_attr_dh_state.attr,
+ &dev_attr_access_state.attr,
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-scsi_devinfo-Add-scsi_devinfo_tbl.c.patch b/patches.fixes/scsi-scsi_devinfo-Add-scsi_devinfo_tbl.c.patch
new file mode 100644
index 0000000000..92b4045b5f
--- /dev/null
+++ b/patches.fixes/scsi-scsi_devinfo-Add-scsi_devinfo_tbl.c.patch
@@ -0,0 +1,28 @@
+From: Jeffy Chen <jeffy.chen@rock-chips.com>
+Date: Wed, 25 Oct 2017 15:39:10 +0800
+Subject: [PATCH] scsi: scsi_devinfo: Add scsi_devinfo_tbl.c
+References: bsc#1077989
+Git-commit: b2035d813fb97632ec40cf1ce90aa3a325bbd15d
+Patch-mainline: v4.15-rc1
+
+Add generated scsi_devinfo_tbl.c into .gitignore.
+
+Fixes: 345e29608b4b ("scsi: scsi: Export blacklist flags to sysfs")
+Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
+Reviewed-by: Hannes Reinecke <hare@suse.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/.gitignore | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/scsi/.gitignore b/drivers/scsi/.gitignore
+index c89ae9a04399..e2956741fbd1 100644
+--- a/drivers/scsi/.gitignore
++++ b/drivers/scsi/.gitignore
+@@ -1 +1,2 @@
+ 53c700_d.h
++scsi_devinfo_tbl.c
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-scsi_error-DID_SOFT_ERROR-comment-clean-up.patch b/patches.fixes/scsi-scsi_error-DID_SOFT_ERROR-comment-clean-up.patch
new file mode 100644
index 0000000000..129e4ca0bd
--- /dev/null
+++ b/patches.fixes/scsi-scsi_error-DID_SOFT_ERROR-comment-clean-up.patch
@@ -0,0 +1,45 @@
+From: Petros Koutoupis <petros@petroskoutoupis.com>
+Date: Mon, 30 Oct 2017 16:38:10 -0500
+Subject: [PATCH] scsi: scsi_error: DID_SOFT_ERROR comment clean up
+References: bsc#1077989
+Git-commit: ad95028a2e88e59fadda79141e74546d12ba3b4b
+Patch-mainline: v4.15-rc1
+
+Updated comment. We are keeping track of maximum number of retries per
+command via retries/allowed in struct scsi_cmnd. Corrected comment
+positioning.
+
+[mkp: applied by hand]
+
+Signed-off-by: Petros Koutoupis <petros@petroskoutoupis.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_error.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
+index 09a3ec0c2d14..667a2a92ed6b 100644
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -1755,16 +1755,12 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
+ * that it indicates SUCCESS.
+ */
+ return SUCCESS;
++ case DID_SOFT_ERROR:
+ /*
+ * when the low level driver returns did_soft_error,
+ * it is responsible for keeping an internal retry counter
+ * in order to avoid endless loops (db)
+- *
+- * actually this is a bug in this function here. we should
+- * be mindful of the maximum number of retries specified
+- * and not get stuck in a loop.
+ */
+- case DID_SOFT_ERROR:
+ goto maybe_retry;
+ case DID_IMM_RETRY:
+ return NEEDS_RETRY;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-scsi_error-Do-not-retry-illegal-function-error.patch b/patches.fixes/scsi-scsi_error-Do-not-retry-illegal-function-error.patch
new file mode 100644
index 0000000000..4aebd187a4
--- /dev/null
+++ b/patches.fixes/scsi-scsi_error-Do-not-retry-illegal-function-error.patch
@@ -0,0 +1,34 @@
+From: Hannes Reinecke <hare@suse.de>
+Date: Tue, 17 Oct 2017 09:10:56 +0200
+Subject: [PATCH] scsi: scsi_error: Do not retry illegal function error
+References: bsc#1077989
+Git-commit: a8bbb2ab4e4fac8ebd2a402d5d81500cbeaaebaf
+Patch-mainline: v4.15-rc1
+
+Hitachi USP-V returns 'ILLEGAL FUNCTION' when the internal staging
+mechanism encountered an error. These errors should not be retried on
+another path.
+
+[mkp: s/invalid/illegal/]
+
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+---
+ drivers/scsi/scsi_error.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
+index bcc3aa51d0b5..a6c2b41b607f 100644
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -580,6 +580,7 @@ int scsi_check_sense(struct scsi_cmnd *scmd)
+ case ILLEGAL_REQUEST:
+ if (sshdr.asc == 0x20 || /* Invalid command operation code */
+ sshdr.asc == 0x21 || /* Logical block address out of range */
++ sshdr.asc == 0x22 || /* Invalid function */
+ sshdr.asc == 0x24 || /* Invalid field in cdb */
+ sshdr.asc == 0x26 || /* Parameter value invalid */
+ sshdr.asc == 0x27) { /* Write protected */
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-Handle-power-on-reset-unit-attention.patch b/patches.fixes/scsi-scsi_error-Handle-power-on-reset-unit-attention.patch
index 90ec2f2a51..ac72cd2cfc 100644
--- a/patches.fixes/scsi-Handle-power-on-reset-unit-attention.patch
+++ b/patches.fixes/scsi-scsi_error-Handle-power-on-reset-unit-attention.patch
@@ -1,20 +1,20 @@
From: Hannes Reinecke <hare@suse.de>
-Date: Thu, 5 Jun 2014 08:24:10 +0200
-Subject: scsi: Handle power-on reset unit attention
-References: FATE#315120, bnc#852358
-Patch-Mainline: submitted to linux-scsi
+Date: Tue, 17 Oct 2017 09:11:24 +0200
+Subject: [PATCH] scsi: scsi_error: Handle power-on reset unit attention
+References: bsc#1077989
+Git-commit: cf3431bba1df3b4f25b04900cb804d7e6e5eb6a9
+Patch-mainline: v4.15-rc1
As per SAM there is a status precedence, with any sense code 29/XX
-taking second place just after an ACA ACTIVE status.
-Additionally, each target might prefer to not queue any unit
-attention conditions, but just report one.
-Due to the above this will be that one with the highest precedence.
-This results in the sense code 29/XX effectively overwriting any
-other unit attention.
-Hence we should report the power-on reset to userland so that
-it can take appropriate action.
+taking second place just after an ACA ACTIVE status. Additionally, each
+target might prefer to not queue any unit attention conditions, but just
+report one. Due to the above, this will be that one with the highest
+precedence. This results in the sense code 29/XX effectively
+overwriting any other unit attention. Hence we should report the
+power-on reset to userland so that it can take appropriate action.
Signed-off-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
drivers/scsi/scsi_error.c | 6 ++++++
drivers/scsi/scsi_lib.c | 4 ++++
@@ -22,10 +22,10 @@ Signed-off-by: Hannes Reinecke <hare@suse.de>
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
-index ef90518..29068d4 100644
+index a6c2b41b607f..09a3ec0c2d14 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
-@@ -418,6 +418,12 @@ static void scsi_report_sense(struct scsi_device *sdev,
+@@ -403,6 +403,12 @@ static void scsi_report_sense(struct scsi_device *sdev,
"threshold.\n");
}
@@ -39,10 +39,10 @@ index ef90518..29068d4 100644
evt_type = SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED;
sdev_printk(KERN_WARNING, sdev,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
-index d46193a..0ce2f98 100644
+index fbdaf0558375..39bb6433c2a6 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
-@@ -2717,6 +2717,9 @@ static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
+@@ -2714,6 +2714,9 @@ static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
envp[idx++] = "SDEV_UA=ASYMMETRIC_ACCESS_STATE_CHANGED";
break;
@@ -52,7 +52,7 @@ index d46193a..0ce2f98 100644
default:
/* do nothing */
break;
-@@ -2821,6 +2824,7 @@ struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
+@@ -2818,6 +2821,7 @@ struct scsi_event *sdev_evt_alloc(enum scsi_device_event evt_type,
case SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED:
case SDEV_EVT_LUN_CHANGE_REPORTED:
case SDEV_EVT_ALUA_STATE_CHANGE_REPORTED:
@@ -61,10 +61,10 @@ index d46193a..0ce2f98 100644
/* do nothing */
break;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
-index a5fc682..dbfd594 100644
+index f3655f425cf2..bcba30125529 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
-@@ -58,9 +58,10 @@ enum scsi_device_event {
+@@ -64,9 +64,10 @@ enum scsi_device_event {
SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED, /* 2A 01 UA reported */
SDEV_EVT_LUN_CHANGE_REPORTED, /* 3F 0E UA reported */
SDEV_EVT_ALUA_STATE_CHANGE_REPORTED, /* 2A 06 UA reported */
@@ -77,5 +77,5 @@ index a5fc682..dbfd594 100644
SDEV_EVT_MAXBITS = SDEV_EVT_LAST + 1
};
--
-1.8.5.6
+2.12.3
diff --git a/patches.fixes/scsi-sd-Align-maximum-write-same-blocks-to-physical-.patch b/patches.fixes/scsi-sd-Align-maximum-write-same-blocks-to-physical-.patch
new file mode 100644
index 0000000000..ed7dc9ad5e
--- /dev/null
+++ b/patches.fixes/scsi-sd-Align-maximum-write-same-blocks-to-physical-.patch
@@ -0,0 +1,63 @@
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Tue, 5 Sep 2017 20:55:35 +0900
+Subject: [PATCH] scsi: sd: Align maximum write same blocks to physical block
+ size
+References: bsc#1077989
+Git-commit: b7af62a945706e32b987f1dd0cc86bb41a8210c3
+Patch-mainline: v4.15-rc1
+
+Reporting a maximum number of blocks that is not aligned on the device
+physical size would cause a large write same request to be split into
+physically unaligned chunks by __blkdev_issue_write_zeroes() and
+__blkdev_issue_write_same(), even if the caller of these functions took
+care to align its request to physical sectors.
+
+Make sure the maximum reported is aligned to the device physical block
+size. This is only an optional optimization for regular disks, but this
+is mandatory to avoid failure of large write same requests directed at
+sequential write required zones of host-managed ZBC disks.
+
+[mkp: tweaked commit message]
+
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index 9a131a8d0d7b..b838cd69d7f3 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -898,6 +898,26 @@ static void sd_config_write_same(struct scsi_disk *sdkp)
+ else
+ sdkp->zeroing_mode = SD_ZERO_WRITE;
+
++ if (sdkp->max_ws_blocks &&
++ sdkp->physical_block_size > logical_block_size) {
++ /*
++ * Reporting a maximum number of blocks that is not aligned
++ * on the device physical size would cause a large write same
++ * request to be split into physically unaligned chunks by
++ * __blkdev_issue_write_zeroes() and __blkdev_issue_write_same()
++ * even if the caller of these functions took care to align the
++ * large request. So make sure the maximum reported is aligned
++ * to the device physical block size. This is only an optional
++ * optimization for regular disks, but this is mandatory to
++ * avoid failure of large write same requests directed at
++ * sequential write required zones of host-managed ZBC disks.
++ */
++ sdkp->max_ws_blocks =
++ round_down(sdkp->max_ws_blocks,
++ bytes_to_logical(sdkp->device,
++ sdkp->physical_block_size));
++ }
++
+ out:
+ blk_queue_max_write_same_sectors(q, sdkp->max_ws_blocks *
+ (logical_block_size >> 9));
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd-Implement-blacklist-option-for-WRITE-SAME-w-.patch b/patches.fixes/scsi-sd-Implement-blacklist-option-for-WRITE-SAME-w-.patch
new file mode 100644
index 0000000000..1b6ba92407
--- /dev/null
+++ b/patches.fixes/scsi-sd-Implement-blacklist-option-for-WRITE-SAME-w-.patch
@@ -0,0 +1,107 @@
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+Date: Wed, 27 Sep 2017 21:35:12 -0400
+Subject: [PATCH] scsi: sd: Implement blacklist option for WRITE SAME w/ UNMAP
+References: bsc#1077989
+Git-commit: 28a0bc4120d38a394499382ba21d6965a67a3703
+Patch-mainline: v4.14-rc4
+
+SBC-4 states:
+
+ "A MAXIMUM UNMAP LBA COUNT field set to a non-zero value indicates the
+ maximum number of LBAs that may be unmapped by an UNMAP command"
+
+ "A MAXIMUM WRITE SAME LENGTH field set to a non-zero value indicates
+ the maximum number of contiguous logical blocks that the device server
+ allows to be unmapped or written in a single WRITE SAME command."
+
+Despite the spec being clear on the topic, some devices incorrectly
+expect WRITE SAME commands with the UNMAP bit set to be limited to the
+value reported in MAXIMUM UNMAP LBA COUNT in the Block Limits VPD.
+
+Implement a blacklist option that can be used to accommodate devices
+with this behavior.
+
+Cc: <stable@vger.kernel.org>
+Reported-by: Bill Kuzeja <William.Kuzeja@stratus.com>
+Reported-by: Ewan D. Milne <emilne@redhat.com>
+Reviewed-by: Ewan D. Milne <emilne@redhat.com>
+Tested-by: Laurence Oberman <loberman@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_scan.c | 3 +++
+ drivers/scsi/sd.c | 16 ++++++++++++----
+ include/scsi/scsi_device.h | 1 +
+ include/scsi/scsi_devinfo.h | 1 +
+ 4 files changed, 17 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
+index 7948c7f1f70f..9ae0df45b4de 100644
+--- a/drivers/scsi/scsi_scan.c
++++ b/drivers/scsi/scsi_scan.c
+@@ -956,6 +956,9 @@ static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
+ if (*bflags & BLIST_NO_DIF)
+ sdev->no_dif = 1;
+
++ if (*bflags & BLIST_UNMAP_LIMIT_WS)
++ sdev->unmap_limit_for_ws = 1;
++
+ sdev->eh_timeout = SCSI_DEFAULT_EH_TIMEOUT;
+
+ if (*bflags & BLIST_TRY_VPD_PAGES)
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index b838cd69d7f3..99e1415fc2ca 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -715,13 +715,21 @@ static void sd_config_discard(struct scsi_disk *sdkp, unsigned int mode)
+ break;
+
+ case SD_LBP_WS16:
+- max_blocks = min_not_zero(sdkp->max_ws_blocks,
+- (u32)SD_MAX_WS16_BLOCKS);
++ if (sdkp->device->unmap_limit_for_ws)
++ max_blocks = sdkp->max_unmap_blocks;
++ else
++ max_blocks = sdkp->max_ws_blocks;
++
++ max_blocks = min_not_zero(max_blocks, (u32)SD_MAX_WS16_BLOCKS);
+ break;
+
+ case SD_LBP_WS10:
+- max_blocks = min_not_zero(sdkp->max_ws_blocks,
+- (u32)SD_MAX_WS10_BLOCKS);
++ if (sdkp->device->unmap_limit_for_ws)
++ max_blocks = sdkp->max_unmap_blocks;
++ else
++ max_blocks = sdkp->max_ws_blocks;
++
++ max_blocks = min_not_zero(max_blocks, (u32)SD_MAX_WS10_BLOCKS);
+ break;
+
+ case SD_LBP_ZERO:
+diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
+index c47aa914d1c8..f3655f425cf2 100644
+--- a/include/scsi/scsi_device.h
++++ b/include/scsi/scsi_device.h
+@@ -192,6 +192,7 @@ struct scsi_device {
+ unsigned no_dif:1; /* T10 PI (DIF) should be disabled */
+ unsigned broken_fua:1; /* Don't set FUA bit */
+ unsigned lun_in_cdb:1; /* Store LUN bits in CDB[1] */
++ unsigned unmap_limit_for_ws:1; /* Use the UNMAP limit for WRITE SAME */
+
+ atomic_t disk_events_disable_depth; /* disable depth for disk events */
+
+diff --git a/include/scsi/scsi_devinfo.h b/include/scsi/scsi_devinfo.h
+index 9592570e092a..36b03013d629 100644
+--- a/include/scsi/scsi_devinfo.h
++++ b/include/scsi/scsi_devinfo.h
+@@ -29,5 +29,6 @@
+ #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 */
++#define BLIST_UNMAP_LIMIT_WS 0x80000000 /* Use UNMAP limit for WRITE SAME */
+
+ #endif
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd-change-allow_restart-to-bool-in-sysfs-interf.patch b/patches.fixes/scsi-sd-change-allow_restart-to-bool-in-sysfs-interf.patch
new file mode 100644
index 0000000000..460f1c8869
--- /dev/null
+++ b/patches.fixes/scsi-sd-change-allow_restart-to-bool-in-sysfs-interf.patch
@@ -0,0 +1,46 @@
+From: weiping zhang <zhangweiping@didichuxing.com>
+Date: Thu, 12 Oct 2017 14:56:44 +0800
+Subject: [PATCH] scsi: sd: change allow_restart to bool in sysfs interface
+References: bsc#1077989
+Git-commit: 658e9a6dc1126f21fa417cd213e1cdbff8be0ba2
+Patch-mainline: v4.15-rc1
+
+/sys/class/scsi_disk/0:2:0:0/allow_restart can be changed to 0
+unexpectedly by writing an invalid string such as the following:
+
+echo asdf > /sys/class/scsi_disk/0:2:0:0/allow_restart
+
+Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index 99e1415fc2ca..0888fe33d4db 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -253,6 +253,7 @@ static ssize_t
+ allow_restart_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+ {
++ bool v;
+ struct scsi_disk *sdkp = to_scsi_disk(dev);
+ struct scsi_device *sdp = sdkp->device;
+
+@@ -262,7 +263,10 @@ allow_restart_store(struct device *dev, struct device_attribute *attr,
+ if (sdp->type != TYPE_DISK && sdp->type != TYPE_ZBC)
+ return -EINVAL;
+
+- sdp->allow_restart = simple_strtoul(buf, NULL, 10);
++ if (kstrtobool(buf, &v))
++ return -EINVAL;
++
++ sdp->allow_restart = v;
+
+ return count;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd-change-manage_start_stop-to-bool-in-sysfs-in.patch b/patches.fixes/scsi-sd-change-manage_start_stop-to-bool-in-sysfs-in.patch
new file mode 100644
index 0000000000..5921b250d2
--- /dev/null
+++ b/patches.fixes/scsi-sd-change-manage_start_stop-to-bool-in-sysfs-in.patch
@@ -0,0 +1,41 @@
+From: weiping zhang <zhangweiping@didichuxing.com>
+Date: Thu, 12 Oct 2017 14:57:06 +0800
+Subject: [PATCH] scsi: sd: change manage_start_stop to bool in sysfs interface
+References: bsc#1077989
+Git-commit: 623401ee33e42cee64d333877892be8db02951eb
+Patch-mainline: v4.15-rc1
+
+/sys/class/scsi_disk/0:2:0:0/manage_start_stop can be changed to 0
+unexpectly by writing an invalid string.
+
+Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+index 0888fe33d4db..d31ba58cd8d0 100644
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -231,11 +231,15 @@ manage_start_stop_store(struct device *dev, struct device_attribute *attr,
+ {
+ struct scsi_disk *sdkp = to_scsi_disk(dev);
+ struct scsi_device *sdp = sdkp->device;
++ bool v;
+
+ if (!capable(CAP_SYS_ADMIN))
+ return -EACCES;
+
+- sdp->manage_start_stop = simple_strtoul(buf, NULL, 10);
++ if (kstrtobool(buf, &v))
++ return -EINVAL;
++
++ sdp->manage_start_stop = v;
+
+ return count;
+ }
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd_zbc-Fix-comments-and-indentation.patch b/patches.fixes/scsi-sd_zbc-Fix-comments-and-indentation.patch
new file mode 100644
index 0000000000..f3f2b612cd
--- /dev/null
+++ b/patches.fixes/scsi-sd_zbc-Fix-comments-and-indentation.patch
@@ -0,0 +1,273 @@
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Wed, 11 Oct 2017 05:54:22 +0900
+Subject: [PATCH] scsi: sd_zbc: Fix comments and indentation
+References: bsc#1077989
+Git-commit: e98f42bcad202a7e89be37be556383b5de0a65d5
+Patch-mainline: v4.15-rc1
+
+Fix comments style (use kernel-doc style) and content to clarify some
+functions. Also fix some functions signature indentation and remove a
+useless blank line in sd_zbc_read_zones().
+
+No functional change is introduced by this patch.
+
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/scsi_lib.c | 5 ++-
+ drivers/scsi/sd_zbc.c | 117 +++++++++++++++++++++++++++++++++++++++++-------
+ 2 files changed, 104 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
+index ad2c2c5a990d..fbdaf0558375 100644
+--- a/drivers/scsi/scsi_lib.c
++++ b/drivers/scsi/scsi_lib.c
+@@ -1727,7 +1727,10 @@ static void scsi_done(struct scsi_cmnd *cmd)
+ *
+ * Returns: Nothing
+ *
+- * Lock status: IO request lock assumed to be held when called.
++ * Lock status: request queue lock assumed to be held when called.
++ *
++ * Note: See sd_zbc.c sd_zbc_write_lock_zone() for write order
++ * protection for ZBC disks.
+ */
+ static void scsi_request_fn(struct request_queue *q)
+ __releases(q->queue_lock)
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
+index eee16366c681..aa5e57a64259 100644
+--- a/drivers/scsi/sd_zbc.c
++++ b/drivers/scsi/sd_zbc.c
+@@ -32,10 +32,14 @@
+ #include "sd.h"
+
+ /**
+- * Convert a zone descriptor to a zone struct.
++ * sd_zbc_parse_report - Convert a zone descriptor to a struct blk_zone,
++ * @sdkp: The disk the report originated from
++ * @buf: Address of the report zone descriptor
++ * @zone: the destination zone structure
++ *
++ * All LBA sized values are converted to 512B sectors unit.
+ */
+-static void sd_zbc_parse_report(struct scsi_disk *sdkp,
+- u8 *buf,
++static void sd_zbc_parse_report(struct scsi_disk *sdkp, u8 *buf,
+ struct blk_zone *zone)
+ {
+ struct scsi_device *sdp = sdkp->device;
+@@ -58,7 +62,13 @@ static void sd_zbc_parse_report(struct scsi_disk *sdkp,
+ }
+
+ /**
+- * Issue a REPORT ZONES scsi command.
++ * sd_zbc_report_zones - Issue a REPORT ZONES scsi command.
++ * @sdkp: The target disk
++ * @buf: Buffer to use for the reply
++ * @buflen: the buffer size
++ * @lba: Start LBA of the report
++ *
++ * For internal use during device validation.
+ */
+ static int sd_zbc_report_zones(struct scsi_disk *sdkp, unsigned char *buf,
+ unsigned int buflen, sector_t lba)
+@@ -99,6 +109,12 @@ static int sd_zbc_report_zones(struct scsi_disk *sdkp, unsigned char *buf,
+ return 0;
+ }
+
++/**
++ * sd_zbc_setup_report_cmnd - Prepare a REPORT ZONES scsi command
++ * @cmd: The command to setup
++ *
++ * Call in sd_init_command() for a REQ_OP_ZONE_REPORT request.
++ */
+ int sd_zbc_setup_report_cmnd(struct scsi_cmnd *cmd)
+ {
+ struct request *rq = cmd->request;
+@@ -141,6 +157,14 @@ int sd_zbc_setup_report_cmnd(struct scsi_cmnd *cmd)
+ return BLKPREP_OK;
+ }
+
++/**
++ * sd_zbc_report_zones_complete - Process a REPORT ZONES scsi command reply.
++ * @scmd: The completed report zones command
++ * @good_bytes: reply size in bytes
++ *
++ * Convert all reported zone descriptors to struct blk_zone. The conversion
++ * is done in-place, directly in the request specified sg buffer.
++ */
+ static void sd_zbc_report_zones_complete(struct scsi_cmnd *scmd,
+ unsigned int good_bytes)
+ {
+@@ -196,17 +220,32 @@ static void sd_zbc_report_zones_complete(struct scsi_cmnd *scmd,
+ local_irq_restore(flags);
+ }
+
++/**
++ * sd_zbc_zone_sectors - Get the device zone size in number of 512B sectors.
++ * @sdkp: The target disk
++ */
+ static inline sector_t sd_zbc_zone_sectors(struct scsi_disk *sdkp)
+ {
+ return logical_to_sectors(sdkp->device, sdkp->zone_blocks);
+ }
+
++/**
++ * sd_zbc_zone_no - Get the number of the zone conataining a sector.
++ * @sdkp: The target disk
++ * @sector: 512B sector address contained in the zone
++ */
+ static inline unsigned int sd_zbc_zone_no(struct scsi_disk *sdkp,
+ sector_t sector)
+ {
+ return sectors_to_logical(sdkp->device, sector) >> sdkp->zone_shift;
+ }
+
++/**
++ * sd_zbc_setup_reset_cmnd - Prepare a RESET WRITE POINTER scsi command.
++ * @cmd: the command to setup
++ *
++ * Called from sd_init_command() for a REQ_OP_ZONE_RESET request.
++ */
+ int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd)
+ {
+ struct request *rq = cmd->request;
+@@ -239,6 +278,23 @@ int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd)
+ return BLKPREP_OK;
+ }
+
++/**
++ * sd_zbc_write_lock_zone - Write lock a sequential zone.
++ * @cmd: write command
++ *
++ * Called from sd_init_cmd() for write requests (standard write, write same or
++ * write zeroes operations). If the request target zone is not already locked,
++ * the zone is locked and BLKPREP_OK returned, allowing the request to proceed
++ * through dispatch in scsi_request_fn(). Otherwise, BLKPREP_DEFER is returned,
++ * forcing the request to wait for the zone to be unlocked, that is, for the
++ * previously issued write request targeting the same zone to complete.
++ *
++ * This is called from blk_peek_request() context with the queue lock held and
++ * before the request is removed from the scheduler. As a result, multiple
++ * contexts executing concurrently scsi_request_fn() cannot result in write
++ * sequence reordering as only a single write request per zone is allowed to
++ * proceed.
++ */
+ int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
+ {
+ struct request *rq = cmd->request;
+@@ -261,10 +317,7 @@ int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
+ * Do not issue more than one write at a time per
+ * zone. This solves write ordering problems due to
+ * the unlocking of the request queue in the dispatch
+- * path in the non scsi-mq case. For scsi-mq, this
+- * also avoids potential write reordering when multiple
+- * threads running on different CPUs write to the same
+- * zone (with a synchronized sequential pattern).
++ * path in the non scsi-mq case.
+ */
+ if (sdkp->zones_wlock &&
+ test_and_set_bit(zno, sdkp->zones_wlock))
+@@ -276,6 +329,13 @@ int sd_zbc_write_lock_zone(struct scsi_cmnd *cmd)
+ return BLKPREP_OK;
+ }
+
++/**
++ * sd_zbc_write_unlock_zone - Write unlock a sequential zone.
++ * @cmd: write command
++ *
++ * Called from sd_uninit_cmd(). Unlocking the request target zone will allow
++ * dispatching the next write request for the zone.
++ */
+ void sd_zbc_write_unlock_zone(struct scsi_cmnd *cmd)
+ {
+ struct request *rq = cmd->request;
+@@ -290,8 +350,16 @@ void sd_zbc_write_unlock_zone(struct scsi_cmnd *cmd)
+ }
+ }
+
+-void sd_zbc_complete(struct scsi_cmnd *cmd,
+- unsigned int good_bytes,
++/**
++ * sd_zbc_complete - ZBC command post processing.
++ * @cmd: Completed command
++ * @good_bytes: Command reply bytes
++ * @sshdr: command sense header
++ *
++ * Called from sd_done(). Process report zones reply and handle reset zone
++ * and write commands errors.
++ */
++void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
+ struct scsi_sense_hdr *sshdr)
+ {
+ int result = cmd->result;
+@@ -336,7 +404,11 @@ void sd_zbc_complete(struct scsi_cmnd *cmd,
+ }
+
+ /**
+- * Read zoned block device characteristics (VPD page B6).
++ * sd_zbc_read_zoned_characteristics - Read zoned block device characteristics
++ * @sdkp: Target disk
++ * @buf: Buffer where to store the VPD page data
++ *
++ * Read VPD page B6.
+ */
+ static int sd_zbc_read_zoned_characteristics(struct scsi_disk *sdkp,
+ unsigned char *buf)
+@@ -366,10 +438,16 @@ static int sd_zbc_read_zoned_characteristics(struct scsi_disk *sdkp,
+ }
+
+ /**
+- * Check reported capacity.
++ * sd_zbc_check_capacity - Check reported capacity.
++ * @sdkp: Target disk
++ * @buf: Buffer to use for commands
++ *
++ * ZBC drive may report only the capacity of the first conventional zones at
++ * LBA 0. This is indicated by the RC_BASIS field of the read capacity reply.
++ * Check this here. If the disk reported only its conventional zones capacity,
++ * get the total capacity by doing a report zones.
+ */
+-static int sd_zbc_check_capacity(struct scsi_disk *sdkp,
+- unsigned char *buf)
++static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf)
+ {
+ sector_t lba;
+ int ret;
+@@ -399,6 +477,13 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp,
+
+ #define SD_ZBC_BUF_SIZE 131072
+
++/**
++ * sd_zbc_check_zone_size - Check the device zone sizes
++ * @sdkp: Target disk
++ *
++ * Check that all zones of the device are equal. The last zone can however
++ * be smaller. The zone size must also be a power of two number of LBAs.
++ */
+ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
+ {
+ u64 zone_blocks;
+@@ -525,8 +610,7 @@ static int sd_zbc_setup(struct scsi_disk *sdkp)
+ return 0;
+ }
+
+-int sd_zbc_read_zones(struct scsi_disk *sdkp,
+- unsigned char *buf)
++int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
+ {
+ int ret;
+
+@@ -537,7 +621,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp,
+ */
+ return 0;
+
+-
+ /* Get zoned block device characteristics */
+ ret = sd_zbc_read_zoned_characteristics(sdkp, buf);
+ if (ret)
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd_zbc-Fix-sd_zbc_read_zoned_characteristics.patch b/patches.fixes/scsi-sd_zbc-Fix-sd_zbc_read_zoned_characteristics.patch
new file mode 100644
index 0000000000..cdabc61c06
--- /dev/null
+++ b/patches.fixes/scsi-sd_zbc-Fix-sd_zbc_read_zoned_characteristics.patch
@@ -0,0 +1,50 @@
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Wed, 11 Oct 2017 05:54:25 +0900
+Subject: [PATCH] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()
+References: bsc#1077989
+Git-commit: 4a109032e3941413d8a029f619543fc5aec1d26d
+Patch-mainline: v4.15-rc1
+
+The three values starting at byte 8 of the Zoned Block Device
+Characteristics VPD page B6h are 32 bits values, not 64bits. So use
+get_unaligned_be32() to retrieve the values and not get_unaligned_be64()
+
+Fixes: 89d947561077 ("sd: Implement support for ZBC devices")
+Cc: <stable@vger.kernel.org>
+
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd_zbc.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
+index 8aa54779aac1..2eb61d54bbb4 100644
+--- a/drivers/scsi/sd_zbc.c
++++ b/drivers/scsi/sd_zbc.c
+@@ -375,15 +375,15 @@ static int sd_zbc_read_zoned_characteristics(struct scsi_disk *sdkp,
+ if (sdkp->device->type != TYPE_ZBC) {
+ /* Host-aware */
+ sdkp->urswrz = 1;
+- sdkp->zones_optimal_open = get_unaligned_be64(&buf[8]);
+- sdkp->zones_optimal_nonseq = get_unaligned_be64(&buf[12]);
++ sdkp->zones_optimal_open = get_unaligned_be32(&buf[8]);
++ sdkp->zones_optimal_nonseq = get_unaligned_be32(&buf[12]);
+ sdkp->zones_max_open = 0;
+ } else {
+ /* Host-managed */
+ sdkp->urswrz = buf[4] & 1;
+ sdkp->zones_optimal_open = 0;
+ sdkp->zones_optimal_nonseq = 0;
+- sdkp->zones_max_open = get_unaligned_be64(&buf[16]);
++ sdkp->zones_max_open = get_unaligned_be32(&buf[16]);
+ }
+
+ return 0;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd_zbc-Move-ZBC-declarations-to-scsi_proto.h.patch b/patches.fixes/scsi-sd_zbc-Move-ZBC-declarations-to-scsi_proto.h.patch
new file mode 100644
index 0000000000..5220771f5b
--- /dev/null
+++ b/patches.fixes/scsi-sd_zbc-Move-ZBC-declarations-to-scsi_proto.h.patch
@@ -0,0 +1,124 @@
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Wed, 11 Oct 2017 05:54:21 +0900
+Subject: [PATCH] scsi: sd_zbc: Move ZBC declarations to scsi_proto.h
+References: bsc#1077989
+Git-commit: aa8a84566282ac47bd861c3cc2538e1014228345
+Patch-mainline: v4.15-rc1
+
+Move standard macro definitions for the zone types and zone conditions
+to scsi_proto.h together with the definitions related to the REPORT
+ZONES command. While at it, define all values in the enums to be clear.
+
+Also remove unnecessary includes in sd_zbc.c.
+
+No functional change is introduced by this patch.
+
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd_zbc.c | 24 ------------------------
+ include/scsi/scsi_proto.h | 45 ++++++++++++++++++++++++++++++++++-----------
+ 2 files changed, 34 insertions(+), 35 deletions(-)
+
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
+index 2eb61d54bbb4..eee16366c681 100644
+--- a/drivers/scsi/sd_zbc.c
++++ b/drivers/scsi/sd_zbc.c
+@@ -28,32 +28,8 @@
+
+ #include <scsi/scsi.h>
+ #include <scsi/scsi_cmnd.h>
+-#include <scsi/scsi_dbg.h>
+-#include <scsi/scsi_device.h>
+-#include <scsi/scsi_driver.h>
+-#include <scsi/scsi_host.h>
+-#include <scsi/scsi_eh.h>
+
+ #include "sd.h"
+-#include "scsi_priv.h"
+-
+-enum zbc_zone_type {
+- ZBC_ZONE_TYPE_CONV = 0x1,
+- ZBC_ZONE_TYPE_SEQWRITE_REQ,
+- ZBC_ZONE_TYPE_SEQWRITE_PREF,
+- ZBC_ZONE_TYPE_RESERVED,
+-};
+-
+-enum zbc_zone_cond {
+- ZBC_ZONE_COND_NO_WP,
+- ZBC_ZONE_COND_EMPTY,
+- ZBC_ZONE_COND_IMP_OPEN,
+- ZBC_ZONE_COND_EXP_OPEN,
+- ZBC_ZONE_COND_CLOSED,
+- ZBC_ZONE_COND_READONLY = 0xd,
+- ZBC_ZONE_COND_FULL,
+- ZBC_ZONE_COND_OFFLINE,
+-};
+
+ /**
+ * Convert a zone descriptor to a zone struct.
+diff --git a/include/scsi/scsi_proto.h b/include/scsi/scsi_proto.h
+index 5e3fe037938e..6a2453f39a81 100644
+--- a/include/scsi/scsi_proto.h
++++ b/include/scsi/scsi_proto.h
+@@ -303,19 +303,42 @@ struct scsi_lun {
+
+ /* Reporting options for REPORT ZONES */
+ enum zbc_zone_reporting_options {
+- ZBC_ZONE_REPORTING_OPTION_ALL = 0,
+- ZBC_ZONE_REPORTING_OPTION_EMPTY,
+- ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN,
+- ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN,
+- ZBC_ZONE_REPORTING_OPTION_CLOSED,
+- ZBC_ZONE_REPORTING_OPTION_FULL,
+- ZBC_ZONE_REPORTING_OPTION_READONLY,
+- ZBC_ZONE_REPORTING_OPTION_OFFLINE,
+- ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP = 0x10,
+- ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE,
+- ZBC_ZONE_REPORTING_OPTION_NON_WP = 0x3f,
++ ZBC_ZONE_REPORTING_OPTION_ALL = 0x00,
++ ZBC_ZONE_REPORTING_OPTION_EMPTY = 0x01,
++ ZBC_ZONE_REPORTING_OPTION_IMPLICIT_OPEN = 0x02,
++ ZBC_ZONE_REPORTING_OPTION_EXPLICIT_OPEN = 0x03,
++ ZBC_ZONE_REPORTING_OPTION_CLOSED = 0x04,
++ ZBC_ZONE_REPORTING_OPTION_FULL = 0x05,
++ ZBC_ZONE_REPORTING_OPTION_READONLY = 0x06,
++ ZBC_ZONE_REPORTING_OPTION_OFFLINE = 0x07,
++ /* 0x08 to 0x0f are reserved */
++ ZBC_ZONE_REPORTING_OPTION_NEED_RESET_WP = 0x10,
++ ZBC_ZONE_REPORTING_OPTION_NON_SEQWRITE = 0x11,
++ /* 0x12 to 0x3e are reserved */
++ ZBC_ZONE_REPORTING_OPTION_NON_WP = 0x3f,
+ };
+
+ #define ZBC_REPORT_ZONE_PARTIAL 0x80
+
++/* Zone types of REPORT ZONES zone descriptors */
++enum zbc_zone_type {
++ ZBC_ZONE_TYPE_CONV = 0x1,
++ ZBC_ZONE_TYPE_SEQWRITE_REQ = 0x2,
++ ZBC_ZONE_TYPE_SEQWRITE_PREF = 0x3,
++ /* 0x4 to 0xf are reserved */
++};
++
++/* Zone conditions of REPORT ZONES zone descriptors */
++enum zbc_zone_cond {
++ ZBC_ZONE_COND_NO_WP = 0x0,
++ ZBC_ZONE_COND_EMPTY = 0x1,
++ ZBC_ZONE_COND_IMP_OPEN = 0x2,
++ ZBC_ZONE_COND_EXP_OPEN = 0x3,
++ ZBC_ZONE_COND_CLOSED = 0x4,
++ /* 0x5 to 0xc are reserved */
++ ZBC_ZONE_COND_READONLY = 0xd,
++ ZBC_ZONE_COND_FULL = 0xe,
++ ZBC_ZONE_COND_OFFLINE = 0xf,
++};
++
+ #endif /* _SCSI_PROTO_H_ */
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd_zbc-Rearrange-code.patch b/patches.fixes/scsi-sd_zbc-Rearrange-code.patch
new file mode 100644
index 0000000000..0e99dd2de7
--- /dev/null
+++ b/patches.fixes/scsi-sd_zbc-Rearrange-code.patch
@@ -0,0 +1,64 @@
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Wed, 11 Oct 2017 05:54:23 +0900
+Subject: [PATCH] scsi: sd_zbc: Rearrange code
+References: bsc#1077989
+Git-commit: 5eed92d173e0bf695c690d6b903441bde36879fb
+Patch-mainline: v4.15-rc1
+
+Rearrange sd_zbc_setup() to include use_16_for_rw and use_10_for_rw
+assignments and move the calculation of sdkp->zone_shift together with
+the assignment of the verified zone_blocks value in
+sd_zbc_check_zone_size().
+
+No functional change is introduced by this patch.
+
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd_zbc.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
+index aa5e57a64259..8884cc5075c0 100644
+--- a/drivers/scsi/sd_zbc.c
++++ b/drivers/scsi/sd_zbc.c
+@@ -584,6 +584,7 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
+ }
+
+ sdkp->zone_blocks = zone_blocks;
++ sdkp->zone_shift = ilog2(zone_blocks);
+
+ return 0;
+ }
+@@ -591,10 +592,13 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
+ static int sd_zbc_setup(struct scsi_disk *sdkp)
+ {
+
++ /* READ16/WRITE16 is mandatory for ZBC disks */
++ sdkp->device->use_16_for_rw = 1;
++ sdkp->device->use_10_for_rw = 0;
++
+ /* chunk_sectors indicates the zone size */
+ blk_queue_chunk_sectors(sdkp->disk->queue,
+ logical_to_sectors(sdkp->device, sdkp->zone_blocks));
+- sdkp->zone_shift = ilog2(sdkp->zone_blocks);
+ sdkp->nr_zones = sdkp->capacity >> sdkp->zone_shift;
+ if (sdkp->capacity & (sdkp->zone_blocks - 1))
+ sdkp->nr_zones++;
+@@ -657,10 +661,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
+ if (ret)
+ goto err;
+
+- /* READ16/WRITE16 is mandatory for ZBC disks */
+- sdkp->device->use_16_for_rw = 1;
+- sdkp->device->use_10_for_rw = 0;
+-
+ return 0;
+
+ err:
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sd_zbc-Use-well-defined-macros.patch b/patches.fixes/scsi-sd_zbc-Use-well-defined-macros.patch
new file mode 100644
index 0000000000..20f25921c0
--- /dev/null
+++ b/patches.fixes/scsi-sd_zbc-Use-well-defined-macros.patch
@@ -0,0 +1,63 @@
+From: Damien Le Moal <damien.lemoal@wdc.com>
+Date: Wed, 11 Oct 2017 05:54:24 +0900
+Subject: [PATCH] scsi: sd_zbc: Use well defined macros
+References: bsc#1077989
+Git-commit: e8c77ec483b0bb3c9e6ee9144b9bcdde340647ca
+Patch-mainline: v4.15-rc1
+
+Instead of open coding, use the min() macro to calculate a report zones
+reply buffer length in sd_zbc_check_zone_size() and the round_up() macro
+for calculating the number of zones in sd_zbc_setup().
+
+No functional change is introduced by this patch.
+
+Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sd_zbc.c | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
+index 8884cc5075c0..27793b9f54c0 100644
+--- a/drivers/scsi/sd_zbc.c
++++ b/drivers/scsi/sd_zbc.c
+@@ -475,7 +475,7 @@ static int sd_zbc_check_capacity(struct scsi_disk *sdkp, unsigned char *buf)
+ return 0;
+ }
+
+-#define SD_ZBC_BUF_SIZE 131072
++#define SD_ZBC_BUF_SIZE 131072U
+
+ /**
+ * sd_zbc_check_zone_size - Check the device zone sizes
+@@ -526,10 +526,7 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp)
+ /* Parse REPORT ZONES header */
+ list_length = get_unaligned_be32(&buf[0]) + 64;
+ rec = buf + 64;
+- if (list_length < SD_ZBC_BUF_SIZE)
+- buf_len = list_length;
+- else
+- buf_len = SD_ZBC_BUF_SIZE;
++ buf_len = min(list_length, SD_ZBC_BUF_SIZE);
+
+ /* Parse zone descriptors */
+ while (rec < buf + buf_len) {
+@@ -599,9 +596,8 @@ static int sd_zbc_setup(struct scsi_disk *sdkp)
+ /* chunk_sectors indicates the zone size */
+ blk_queue_chunk_sectors(sdkp->disk->queue,
+ logical_to_sectors(sdkp->device, sdkp->zone_blocks));
+- sdkp->nr_zones = sdkp->capacity >> sdkp->zone_shift;
+- if (sdkp->capacity & (sdkp->zone_blocks - 1))
+- sdkp->nr_zones++;
++ sdkp->nr_zones =
++ round_up(sdkp->capacity, sdkp->zone_blocks) >> sdkp->zone_shift;
+
+ if (!sdkp->zones_wlock) {
+ sdkp->zones_wlock = kcalloc(BITS_TO_LONGS(sdkp->nr_zones),
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sg-off-by-one-in-sg_ioctl.patch b/patches.fixes/scsi-sg-off-by-one-in-sg_ioctl.patch
new file mode 100644
index 0000000000..70cdaabcfd
--- /dev/null
+++ b/patches.fixes/scsi-sg-off-by-one-in-sg_ioctl.patch
@@ -0,0 +1,35 @@
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Thu, 17 Aug 2017 10:09:54 +0300
+Subject: [PATCH] scsi: sg: off by one in sg_ioctl()
+References: bsc#1077989
+Git-commit: bd46fc406b30d1db1aff8dabaff8d18bb423fdcf
+Patch-mainline: v4.13
+
+If "val" is SG_MAX_QUEUE then we are one element beyond the end of the
+"rinfo" array so the > should be >=.
+
+Fixes: 109bade9c625 ("scsi: sg: use standard lists for sg_requests")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Acked-by: Douglas Gilbert <dgilbert@interlog.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sg.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
+index 156eadc9af7a..aad6ebb51735 100644
+--- a/drivers/scsi/sg.c
++++ b/drivers/scsi/sg.c
+@@ -1021,7 +1021,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
+ read_lock_irqsave(&sfp->rq_list_lock, iflags);
+ val = 0;
+ list_for_each_entry(srp, &sfp->rq_list, entry) {
+- if (val > SG_MAX_QUEUE)
++ if (val >= SG_MAX_QUEUE)
+ break;
+ memset(&rinfo[val], 0, SZ_SG_REQ_INFO);
+ rinfo[val].req_state = srp->done + 1;
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-sym53c8xx-Avoid-undefined-behaviour.patch b/patches.fixes/scsi-sym53c8xx-Avoid-undefined-behaviour.patch
new file mode 100644
index 0000000000..82f37bcd9a
--- /dev/null
+++ b/patches.fixes/scsi-sym53c8xx-Avoid-undefined-behaviour.patch
@@ -0,0 +1,40 @@
+From: Helge Deller <deller@gmx.de>
+Date: Thu, 10 Aug 2017 21:08:49 +0200
+Subject: [PATCH] scsi: sym53c8xx: Avoid undefined behaviour
+References: bsc#1077989
+Git-commit: c0e8ed04b32307c192bcf37f5810e490e4d2739e
+Patch-mainline: v4.14-rc1
+
+On parisc I see this UBSAN warning with a sym53c896:
+
+ UBSAN: Undefined behaviour in ./drivers/scsi/sym53c8xx_2/sym_hipd.c:762:24
+ index -1903078336 is out of range for type 'u32 [7]'
+
+Avoid this warning by switching to div64_ul().
+
+[mkp: fix typo]
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/sym53c8xx_2/sym_hipd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
+index 6b349e301869..15ff285a9f8f 100644
+--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
++++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
+@@ -759,7 +759,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
+ /*
+ * Maximum synchronous period factor supported by the chip.
+ */
+- period = (11 * div_10M[np->clock_divn - 1]) / (4 * np->clock_khz);
++ period = div64_ul(11 * div_10M[np->clock_divn - 1], 4 * np->clock_khz);
+ np->maxsync = period > 2540 ? 254 : period / 10;
+
+ /*
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-ufs-reqs-and-tasks-were-put-in-the-wrong-order.patch b/patches.fixes/scsi-ufs-reqs-and-tasks-were-put-in-the-wrong-order.patch
new file mode 100644
index 0000000000..0f3e631b21
--- /dev/null
+++ b/patches.fixes/scsi-ufs-reqs-and-tasks-were-put-in-the-wrong-order.patch
@@ -0,0 +1,30 @@
+From: Zang Leigang <zangleigang@hisilicon.com>
+Date: Thu, 24 Aug 2017 10:57:15 +0800
+Subject: [PATCH] scsi: ufs: reqs and tasks were put in the wrong order
+References: bsc#1077989
+Git-commit: e002e65188e0b01adf24da0a0dfed4fd39281e19
+Patch-mainline: v4.14-rc1
+
+Signed-off-by: Zang Leigang <zangleigang@hisilicon.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/ufs/ufshcd.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
+index 5bc9dc14e075..794a4600e952 100644
+--- a/drivers/scsi/ufs/ufshcd.c
++++ b/drivers/scsi/ufs/ufshcd.c
+@@ -438,7 +438,7 @@ static void ufshcd_print_host_state(struct ufs_hba *hba)
+ {
+ dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state);
+ dev_err(hba->dev, "lrb in use=0x%lx, outstanding reqs=0x%lx tasks=0x%lx\n",
+- hba->lrb_in_use, hba->outstanding_tasks, hba->outstanding_reqs);
++ hba->lrb_in_use, hba->outstanding_reqs, hba->outstanding_tasks);
+ dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n",
+ hba->saved_err, hba->saved_uic_err);
+ dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n",
+--
+2.12.3
+
diff --git a/patches.fixes/scsi-virtio-virtio_scsi-Set-can_queue-to-the-length-.patch b/patches.fixes/scsi-virtio-virtio_scsi-Set-can_queue-to-the-length-.patch
new file mode 100644
index 0000000000..727bd7a91d
--- /dev/null
+++ b/patches.fixes/scsi-virtio-virtio_scsi-Set-can_queue-to-the-length-.patch
@@ -0,0 +1,60 @@
+From: "Richard W.M. Jones" <rjones@redhat.com>
+Date: Thu, 10 Aug 2017 17:56:52 +0100
+Subject: [PATCH] scsi: virtio: virtio_scsi: Set can_queue to the length of the
+ virtqueue.
+References: bsc#1077989
+Git-commit: 582b0ab200105b06704cef6da814fbde4c2ca00b
+Patch-mainline: v4.14-rc1
+
+Since switching to blk-mq as the default in commit 5c279bd9e406
+("scsi: default to scsi-mq"), virtio-scsi LUNs consume about 10x as
+much kernel memory.
+
+qemu currently allocates a fixed 128 entry virtqueue. can_queue
+currently is set to 1024. But with indirect descriptors, each command
+in the queue takes 1 virtqueue entry, so the number of commands which
+can be queued is equal to the length of the virtqueue.
+
+Note I intend to send a patch to qemu to allow the virtqueue size to be
+configured from the qemu command line.
+
+Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
+Acked-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+---
+ drivers/scsi/virtio_scsi.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
+index 9be211d68b15..7c28e8d4955a 100644
+--- a/drivers/scsi/virtio_scsi.c
++++ b/drivers/scsi/virtio_scsi.c
+@@ -818,7 +818,6 @@ static struct scsi_host_template virtscsi_host_template_single = {
+ .eh_timed_out = virtscsi_eh_timed_out,
+ .slave_alloc = virtscsi_device_alloc,
+
+- .can_queue = 1024,
+ .dma_boundary = UINT_MAX,
+ .use_clustering = ENABLE_CLUSTERING,
+ .target_alloc = virtscsi_target_alloc,
+@@ -839,7 +838,6 @@ static struct scsi_host_template virtscsi_host_template_multi = {
+ .eh_timed_out = virtscsi_eh_timed_out,
+ .slave_alloc = virtscsi_device_alloc,
+
+- .can_queue = 1024,
+ .dma_boundary = UINT_MAX,
+ .use_clustering = ENABLE_CLUSTERING,
+ .target_alloc = virtscsi_target_alloc,
+@@ -972,6 +970,8 @@ static int virtscsi_probe(struct virtio_device *vdev)
+ if (err)
+ goto virtscsi_init_failed;
+
++ shost->can_queue = virtqueue_get_vring_size(vscsi->req_vqs[0].vq);
++
+ cmd_per_lun = virtscsi_config_get(vdev, cmd_per_lun) ?: 1;
+ shost->cmd_per_lun = min_t(u32, cmd_per_lun, shost->can_queue);
+ shost->max_sectors = virtscsi_config_get(vdev, max_sectors) ?: 0xFFFF;
+--
+2.12.3
+
diff --git a/patches.suse/dm-mpath-accept-failed-paths b/patches.suse/dm-mpath-accept-failed-paths
index 25d28c794c..c17f298d0e 100644
--- a/patches.suse/dm-mpath-accept-failed-paths
+++ b/patches.suse/dm-mpath-accept-failed-paths
@@ -69,9 +69,9 @@ index 0e8ab5b..0d277f9 100644
/* EBUSY, ENODEV or EWOULDBLOCK: requeue */
- bool queue_dying = blk_queue_dying(q);
+ bool queue_dying = q ? blk_queue_dying(q) : false;
- DMERR_LIMIT("blk_get_request() returned %ld%s - requeuing",
- PTR_ERR(clone), queue_dying ? " (path offline)" : "");
if (queue_dying) {
+ atomic_inc(&m->pg_init_in_progress);
+ activate_or_offline_path(pgpath);
@@ -555,7 +563,7 @@ static int __multipath_map_bio(struct multipath *m, struct bio *bio, struct dm_m
return DM_MAPIO_SUBMITTED;
}
diff --git a/series.conf b/series.conf
index 09cb64613e..a60e45d35b 100644
--- a/series.conf
+++ b/series.conf
@@ -3218,6 +3218,7 @@
patches.drivers/iio-inkern-fix-a-static-checker-error
patches.fixes/iio-hid-sensor-fix-return-of-EINVAL-on-invalid-value
patches.drivers/Fix-serial-console-on-SNI-RM400-machines.patch
+ patches.fixes/scsi-ibmvscsi_tgt-remove-use-of-class_attrs.patch
patches.suse/0047-pktcdvd-use-class_groups-instead-of-class_attrs.patch
patches.drivers/IB-nes-convert-to-use-DRIVER_ATTR_RW.patch
patches.drivers/s390-drivers-convert-to-use-DRIVER_ATTR_RO-WO.patch
@@ -4196,6 +4197,7 @@
patches.drivers/0034-scsi-smartpqi-add-module-parameters.patch
patches.drivers/0035-scsi-smartpqi-remove-writeq-readq-function-definitio.patch
patches.drivers/0036-scsi-smartpqi-bump-driver-version.patch
+ patches.fixes/scsi-libiscsi-use-kvzalloc-for-iscsi_pool_init.patch
patches.drivers/scsi-csiostor-add-support-for-Chelsio-T6-adapters.patch
patches.drivers/scsi-csiostor-Avoid-content-leaks-and-casts.patch
patches.drivers/scsi-smartpqi-mark-PM-functions-as-__maybe_unused.patch
@@ -4254,6 +4256,8 @@
patches.drivers/0006-scsi-ufshcd-pci-Add-Intel-CNL-support.patch
patches.drivers/0017-scsi-qla2xxx-remove-redundant-null-check-on-tgt.patch
patches.drivers/0018-scsi-qla2xxx-Fix-compile-warning.patch
+ patches.fixes/scsi-esas2r-Replace-semaphore-fm_api_semaphore-with-.patch
+ patches.fixes/scsi-esas2r-Replace-semaphore-fs_api_semaphore-with-.patch
patches.drivers/scsi-qedf-Fix-a-return-value-in-case-of-error-in-qed.patch
patches.drivers/scsi-qedf-Use-dma_zalloc_coherent-to-reduce-code-ver.patch
patches.drivers/scsi-qedf-Merge-a-few-quoted-strings-split-across-li.patch
@@ -4317,9 +4321,11 @@
patches.drivers/scsi-lpfc-fix-refcount-error-on-node-list.patch
patches.drivers/scsi-fix-typos-and-grammar-in-comments-of-scsi_trans.patch
patches.drivers/scsi-cxgb4i-assign-rxqs-in-round-robin-mode
+ patches.fixes/scsi-hptiop-make-function-hptiop_iop_request_callbac.patch
patches.drivers/scsi-bnx2i-missing-error-code-in-bnx2i_ep_connect
patches.drivers/0021-scsi-aacraid-Don-t-copy-uninitialized-stack-memory-t.patch
patches.drivers/scsi-hisi_sas-redefine-hisi_sas_phy.phy_type-as-u32.patch
+ patches.fixes/scsi-hpsa-fix-spelling-mistake-encrypytion-encryptio.patch
patches.drivers/scsi-qedi-Remove-comparison-of-u16-idx-with-zero.patch
patches.drivers/scsi-cxlflash-01-Combine-the-send-queue-locks.patch
patches.drivers/scsi-cxlflash-02-Update-cxlflash_afu_sync-to-return-err.patch
@@ -5042,6 +5048,7 @@
patches.drivers/IB-rxe-do-not-copy-extra-stack-memory-to-skb.patch
patches.drivers/drivers-s390-move-static-and-inline-before-return-ty.patch
patches.drivers/0001-target-remove-dead-code
+ patches.fixes/ibmvscsis-Enable-Logical-Partition-Migration-Support.patch
patches.drivers/0002-target-iblock-convert-write_same-to-blkdev_issue_zeroout
patches.drivers/0003-target-configfs-kill-se_device-dev_link_magic
patches.drivers/0004-target-configfs-kill-se_lun-lun_link_magic
@@ -5065,6 +5072,7 @@
patches.drivers/0021-target-iscsi-remove-second-argument-of-_iscsit_free_cmd
patches.drivers/0022-target-iscsi-simplify-iscsit_free_cmd
patches.drivers/0023-target-iscsi-remove-dead-code-from-iscsit_process_scsi_cmd
+ patches.fixes/ibmvscsis-Use-tpgt-passed-in-by-user.patch
patches.drivers/0024-tcmu-support-emulate_write_cache
patches.drivers/0025-tcmu-add-netlink-for-device-reconfiguration
patches.drivers/0026-tcmu-make-dev_size-configurable-via-userspace
@@ -5310,7 +5318,10 @@
patches.suse/KVM-arm-arm64-Fix-bug-in-advertising-KVM_CAP_MSI_DEV.patch
patches.suse/KVM-arm-arm64-PMU-Fix-overflow-interrupt-injection.patch
patches.suse/KVM-arm-arm64-vgic-Use-READ_ONCE-fo-cmpxchg.patch
+ patches.fixes/scsi-bnx2fc-Plug-CPU-hotplug-race.patch
+ patches.fixes/scsi-bnx2fc-Prevent-recursive-cpuhotplug-locking.patch
patches.drivers/scsi-bnx2i-prevent-recursive-cpuhotplug-locking
+ patches.drivers/scsi-bnx2fc-Simplify-CPU-hotplug-code.patch
patches.drivers/scsi-bnx2i-simplify-cpu-hotplug-code
patches.drivers/scsi-qedf-Limit-number-of-CQs.patch
patches.drivers/0022-scsi-aacraid-reading-out-of-bounds.patch
@@ -5440,6 +5451,7 @@
patches.drivers/scsi-csiostor-fail-probe-if-fw-does-not-support-FCoE.patch
patches.drivers/0023-scsi-aacraid-Fix-out-of-bounds-in-aac_get_name_resp.patch
patches.fixes/scsi-sd_zbc-Write-unlock-zone-from-sd_uninit_cmnd.patch
+ patches.fixes/scsi-cxgb4i-call-neigh_event_send-to-update-MAC-addr.patch
patches.drivers/IB-core-Avoid-accessing-non-allocated-memory-when-in.patch
patches.drivers/IB-mlx5-Fix-Raw-Packet-QP-event-handler-assignment.patch
patches.drivers/IB-mlx5-Always-return-success-for-RoCE-modify-port.patch
@@ -5452,6 +5464,7 @@
patches.drivers/bsg-lib-fix-kernel-panic-resulting-from-missing-allo.patch
patches.suse/KVM-PPC-Book3S-Fix-race-and-leak-in-kvm_vm_ioctl_cre.patch
patches.fixes/libata-check-for-trusted-computing-in-IDENTIFY-DEVIC.patch
+ patches.fixes/scsi-sg-off-by-one-in-sg_ioctl.patch
patches.drivers/scsi-qedf-Fix-a-potential-NULL-pointer-dereference.patch
patches.drivers/drm-bridge-sii8620-Fix-memory-corruption
patches.drivers/IB-umem-update-to-new-mmu_notifier-semantic.patch
@@ -6722,6 +6735,7 @@
patches.drivers/scsi-lpfc-Replace-PCI-pool-old-API.patch
patches.drivers/scsi-megaraid-Replace-PCI-pool-old-API.patch
patches.drivers/scsi-megaraid-fix-format-overflow-warning.patch
+ patches.fixes/scsi-mpt3sas-fix-format-overflow-warning.patch
patches.drivers/scsi-fnic-fix-format-string-overflow-warning.patch
patches.fixes/scsi-remove-DRIVER_ATTR-usage.patch
patches.drivers/0047-scsi-qla2xxx-Cleanup-FC-NVMe-code.patch
@@ -6730,6 +6744,8 @@
patches.drivers/0050-scsi-qla2xxx-Simpify-unregistration-of-FC-NVMe-local.patch
patches.drivers/0051-scsi-qla2xxx-Fix-remoteport-disconnect-for-FC-NVMe.patch
patches.fixes/scsi-fc-start-decoupling-fc_block_scsi_eh-from-scsi_.patch
+ patches.fixes/scsi-mpt3sas-Fix-memory-allocation-failure-test-in-m.patch
+ patches.fixes/scsi-libcxgbi-use-ndev-ifindex-to-find-route.patch
patches.arch/s390-sles15-01-02-zfcp-fix-queuecommand-scsi_eh-commands-DIX.patch
patches.drivers/zfcp-add-handling-for-FCP_RESID_OVER-to-the-fcp.patch
patches.arch/s390-sles15-01-03-01-zfcp-fix-capping-unsuccessful-GPN_FT-SAN-resp-trace.patch
@@ -6738,8 +6754,12 @@
patches.arch/s390-sles15-01-03-04-zfcp-fix-payload-with-full-FCP_RSP-IU-in-SCSI-trace.patch
patches.arch/s390-sles15-01-03-05-zfcp-trace-HBA-FSF-resp-by-default-on-dismiss-or-timedout.patch
patches.arch/s390-sles15-01-04-zfcp-trace-high-part-of-new-64-bit-SCSI-LUN.patch
+ patches.fixes/scsi-esp_scsi-Clean-up-control-flow-and-dead-code.patch
+ patches.fixes/scsi-esp_scsi-Avoid-sending-ABORT-TASK-SET-messages.patch
+ patches.fixes/scsi-esp_scsi-Always-clear-msg_out_len-after-MESSAGE.patch
patches.drivers/scsi-megaraid_sas-fix-allocate-instance-pd_info-twic.patch
patches.drivers/scsi-pm8001-fix-double-free-in-pm8001_pci_probe.patch
+ patches.fixes/scsi-mvsas-replace-kfree-with-scsi_host_put.patch
patches.drivers/0052-scsi-qla2xxx-use-dma_mapping_error-to-check-map-erro.patch
patches.drivers/scsi-smartpqi-add-pqi-reset-quiesce-support.patch
patches.drivers/scsi-smartpqi-enhance-BMIC-cache-flush.patch
@@ -6768,8 +6788,10 @@
patches.drivers/0008-scsi-hisi_sas-replace-kfree-with-scsi_host_put.patch
patches.drivers/scsi-hisi_sas-remove-driver-versioning.patch
patches.drivers/scsi-qedi-Limit-number-for-CQ-queues.patch
+ patches.fixes/scsi-virtio-virtio_scsi-Set-can_queue-to-the-length-.patch
patches.fixes/scsi-scsi_lib-rework-scsi_internal_device_unblock_no.patch
patches.fixes/scsi-make-state-device-attribute-pollable.patch
+ patches.fixes/scsi-sym53c8xx-Avoid-undefined-behaviour.patch
patches.drivers/scsi-cxlflash-22-Fix-an-error-handling-path-in-cxlflash.patch
patches.drivers/scsi-hpsa-add-support-for-legacy-boards.patch
patches.drivers/scsi-hpsa-disable-volume-status-check-for-legacy-boa.patch
@@ -6788,6 +6810,7 @@
patches.drivers/scsi-qedf-Covert-single-threaded-workqueues-to-regul.patch
patches.drivers/scsi-qedf-Fix-up-modinfo-parameter-name-for-debug-in.patch
patches.drivers/scsi-qedf-Update-driver-version-to-8.20.5.0.patch
+ patches.fixes/scsi-pmcraid-fix-duplicated-code-for-different-branc.patch
patches.fixes/scsi-ch-add-refcounting.patch
patches.fixes/scsi-scsi-sysfs-Adjust-error-returned-for-adapter-re.patch
patches.drivers/scsi-hpsa-fix-the-device_id-in-hpsa_update_device_in.patch
@@ -6857,6 +6880,11 @@
patches.drivers/scsi-lpfc-Add-Buffer-to-Buffer-credit-recovery-suppo.patch
patches.drivers/scsi-lpfc-fix-integer-constant-too-large-error-on-32.patch
patches.drivers/scsi-lpfc-lpfc-version-bump-11.4.0.3.patch
+ patches.fixes/scsi-ufs-reqs-and-tasks-were-put-in-the-wrong-order.patch
+ patches.fixes/scsi-Suppress-gcc-7-fall-through-warnings-reported-w.patch
+ patches.fixes/scsi-Convert-a-strncmp-call-into-a-strcmp-call.patch
+ patches.fixes/scsi-Document-which-queue-type-a-function-is-intende.patch
+ patches.fixes/scsi-Use-blk_mq_rq_to_pdu-to-convert-a-request-to-a-.patch
patches.drivers/0009-scsi-libsas-Remove-a-set-but-not-used-variable.patch
patches.drivers/0010-scsi-libsas-Annotate-fall-through-in-a-switch-statem.patch
patches.drivers/scsi-fnic-do-not-call-host-reset-from-command-abort.patch
@@ -6864,6 +6892,7 @@
patches.drivers/scsi-qedf-drop-bus-reset-handler.patch
patches.drivers/scsi-megaraid_mbox-drop-duplicate-bus-reset-and-devi.patch
patches.fixes/scsi-ses-Fix-racy-cleanup-of-sys-in-remove_dev.patch
+ patches.fixes/scsi-Fix-the-kerneldoc-for-scsi_initialize_rq.patch
patches.drivers/scsi-cxlflash-23-Remove-unnecessary-existence-check.patch
patches.drivers/scsi-cxlflash-24-Avoid-double-mutex-unlock.patch
patches.drivers/scsi-cxlflash-25-Fix-vlun-resize-failure-in-the-shrink-.patch
@@ -7234,10 +7263,14 @@
patches.drivers/qxl-fix-primary-surface-handling.patch
patches.drivers/qxl-fix-pinning.patch
patches.suse/btrfs-fix-null-pointer-dereference-from-free_reloc_roots.patch
+ patches.fixes/scsi-aacraid-Fix-2T-drives-on-SmartIOC-2000.patch
patches.drivers/scsi-lpfc-Don-t-return-internal-MBXERR_ERROR-code-fr.patch
patches.drivers/scsi-aacraid-error-testing-array-offset-bus-after-us.patch
patches.drivers/scsi-scsi_transport_iscsi-fix-the-issue-that.patch
+ patches.drivers/scsi-scsi_transport_fc-set-scsi_target_id-upon-resca.patch
+ patches.drivers/scsi-scsi_transport_fc-Also-check-for-NOTPRESENT-in-.patch
patches.drivers/scsi-aacraid-Add-a-small-delay-after-IOP-reset.patch
+ patches.fixes/scsi-ILLEGAL-REQUEST-ASC-27-target-failure.patch
patches.drivers/staging-rtl8723bs-avoid-null-pointer-dereference-on-
patches.drivers/iio-trigger-stm32-timer-fix-a-corner-case-to-write-p
patches.suse/mm-device-public-memory-fix-edge-case-in-vm_normal_page.patch
@@ -7293,7 +7326,11 @@
patches.suse/0014-bcache-use-llist_for_each_entry_safe-in-__closure_wa.patch
patches.drivers/bsg-lib-fix-use-after-free-under-memory-pressure.patch
patches.drivers/nvme-pci-Use-PCI-bus-address-for-data-queues-in-CMB.patch
+ patches.fixes/scsi-sd-Implement-blacklist-option-for-WRITE-SAME-w-.patch
patches.drivers/scsi-sd-Do-not-override-max_sectors_kb-sysfs-setting.patch
+ patches.fixes/scsi-libiscsi-Fix-use-after-free-race-during-iscsi_s.patch
+ patches.fixes/scsi-libiscsi-Remove-iscsi_destroy_session.patch
+ patches.fixes/scsi-ibmvscsis-Fix-write_pending-failure-path.patch
patches.drivers/bpf-fix-liveness-marking.patch
patches.drivers/gso-fix-payload-length-when-gso_size-is-zero.patch
patches.fixes/ipv6-Fix-traffic-triggered-IPsec-connections.patch
@@ -7339,6 +7376,7 @@
patches.drivers/scsi-libfc-fix-a-deadlock-in-fc_rport_work.patch
patches.fixes/scsi-libiscsi-fix-shifting-of-did_requeue-host-byte
patches.drivers/scsi-qla2xxx-Fix-uninitialized-work-element.patch
+ patches.drivers/scsi-fc-check-for-rport-presence-in-fc_block_scsi_eh.patch
patches.arch/s390-sles15-01-10-s390_cputime_fix_stat_after_CPU_hotplug.patch
patches.drivers/ALSA-usb-audio-Add-native-DSD-support-for-Pro-Ject-P
patches.drivers/ALSA-seq-Enable-use-locking-in-all-configurations
@@ -7405,6 +7443,7 @@
patches.drivers/kvm-fix-detection-of-guest-machine-checks.patch
patches.arch/s390-sles15-01-08-zfcp-fix-erp_action-use-before-initialize-in-REC-action-trace.patch
patches.drivers/scsi-qla2xxx-Initialize-Work-element-before-requesti.patch
+ patches.fixes/scsi-hpsa-Fix-configured_logical_drive_count-check.patch
patches.drivers/aacraid-Fix-controller-initialization-failure.patch
patches.drivers/drm-i915-perf-fix-perf-enable-disable-ioctls-with-32
patches.drivers/drm-i915-gvt-properly-check-per_ctx-bb-valid-state
@@ -7634,6 +7673,7 @@
patches.drivers/nvme-pci-avoid-dereference-of-symbol-from-unloaded-m.patch
patches.drivers/nvmet-better-data-length-validation.patch
patches.drivers/nvmet-kill-nvmet_inline_bio_init.patch
+ patches.fixes/block-Make-q_usage_counter-also-track-legacy-request.patch
patches.drivers/nvme-track-subsystems.patch
patches.drivers/nvme-introduce-a-nvme_ns_ids-structure.patch
patches.drivers/nvme-track-shared-namespaces.patch
@@ -7648,11 +7688,20 @@
patches.drivers/0002-raid5-ppl-don-t-resync-after-rebuild.patch
patches.drivers/0001-raid5-ppl-check-recovery_offset-when-performing-ppl-.patch
patches.drivers/scsi-lpfc-remove-redundant-null-check-on-eqe.patch
+ patches.fixes/scsi-bnx2i-Clean-up-unused-pointers-in-bnx2i_hwi.patch
+ patches.fixes/scsi-fcoe-move-fcoe_interface_remove-out-of-fcoe_int.patch
+ patches.fixes/scsi-fcoe-separate-out-fcoe_vport_remove.patch
+ patches.fixes/scsi-fcoe-open-code-fcoe_destroy_work-for-NETDEV_UNR.patch
patches.drivers/0011-scsi-libsas-kill-useless-ha_event-and-do-some-cleanu.patch
patches.drivers/0012-scsi-libsas-remove-the-numbering-for-each-event-enum.patch
patches.drivers/0013-scsi-libsas-remove-unused-port_gone_completion-and-D.patch
patches.drivers/0014-scsi-libsas-rename-notify_port_event-for-consistency.patch
patches.drivers/0015-scsi-libsas-add-event-to-defer-list-tail-instead-of-.patch
+ patches.fixes/scsi-libcxgbi-remove-redundant-check-and-close-on-cs.patch
+ patches.fixes/scsi-csiostor-enable-PCIe-relaxed-ordering-if-suppor.patch
+ patches.fixes/scsi-sd-Align-maximum-write-same-blocks-to-physical-.patch
+ patches.drivers/scsi-scsi_dh-Return-SCSI_DH_XX-error-code-from-attac.patch
+ patches.drivers/scsi-scsi_dh-suppress-errors-from-unsupported-device.patch
patches.drivers/scsi-lpfc-Cocci-spatch-pool_zalloc-simple.patch
patches.drivers/scsi-qla2xxx-Cocci-spatch-pool_zalloc-simple.patch
patches.drivers/scsi-mpt3sas-remove-redundant-copy_from_user-in-_ctl.patch
@@ -7701,6 +7750,7 @@
patches.drivers/0008-scsi-be2iscsi-fix-misc-static-analysis-errors
patches.drivers/0009-scsi-be2iscsi-remove-a-circumflex-character-in-copyright-marking
patches.drivers/0010-scsi-be2iscsi-update-driver-version
+ patches.fixes/scsi-libcxgbi-in-case-of-vlan-pass-0-as-ifindex-to-f.patch
patches.drivers/scsi-cxgb4i-fix-tx-skb-leak
patches.drivers/scsi-libcxgbi-simplify-task-hdr-allocation-for-mgmt-cmds
patches.drivers/bfa-integer-overflow-in-debugfs.patch
@@ -7714,11 +7764,21 @@
patches.drivers/scsi-qla2xxx-Query-FC4-type-during-RSCN-processing.patch
patches.fixes/scsi-qedi-delete-redundant-variables
patches.drivers/scsi-qla2xxx-don-t-break-the-bsg-lib-abstractions.patch
+ patches.fixes/scsi-sd_zbc-Move-ZBC-declarations-to-scsi_proto.h.patch
+ patches.fixes/scsi-sd_zbc-Fix-comments-and-indentation.patch
+ patches.fixes/scsi-sd_zbc-Rearrange-code.patch
+ patches.fixes/scsi-sd_zbc-Use-well-defined-macros.patch
+ patches.fixes/scsi-sd_zbc-Fix-sd_zbc_read_zoned_characteristics.patch
+ patches.fixes/scsi-scsi-Export-blacklist-flags-to-sysfs.patch
patches.fixes/scsi-scsi_devinfo-whitespace-fixes.patch
patches.fixes/scsi-scsi_devinfo-fixup-string-compare.patch
+ patches.fixes/scsi-sd-change-allow_restart-to-bool-in-sysfs-interf.patch
+ patches.fixes/scsi-sd-change-manage_start_stop-to-bool-in-sysfs-in.patch
patches.fixes/scsi-scsi_devinfo-add-aix-vdasd-to-blacklist.patch
patches.fixes/scsi-scsi_devinfo-add-try_vpd_pages-to-hitachi-open-v-blacklist-entry.patch
patches.fixes/scsi-scsi_devinfo-add-reportlun2-to-emc-symmetrix-blacklist-entry.patch
+ patches.fixes/scsi-scsi_error-Do-not-retry-illegal-function-error.patch
+ patches.fixes/scsi-scsi_error-Handle-power-on-reset-unit-attention.patch
patches.drivers/scsi-pm80xx-redefine-sas_identify_frame-structure.patch
patches.drivers/scsi-pm80xx-ILA-and-inactive-firmware-version-throug.patch
patches.drivers/scsi-pm80xx-Different-SAS-addresses-for-phys.patch
@@ -7728,6 +7788,18 @@
patches.drivers/scsi-pm80xx-corrected-SATA-abort-handling-sequence.patch
patches.drivers/scsi-pm80xx-panic-on-ncq-error-cleaning-up-the-read-.patch
patches.drivers/scsi-pm80xx-corrected-linkrate-value.patch
+ patches.fixes/scsi-hpsa-destroy-sas-transport-properties-before-sc.patch
+ patches.fixes/scsi-hpsa-cleanup-sas_phy-structures-in-sysfs-when-u.patch
+ patches.fixes/scsi-hpsa-clear-tmpdevice-in-scan-thread.patch
+ patches.fixes/scsi-hpsa-add-controller-checkpoint.patch
+ patches.fixes/scsi-hpsa-update-discovery-polling.patch
+ patches.fixes/scsi-hpsa-change-timeout-for-internal-cmds.patch
+ patches.fixes/scsi-hpsa-correct-smart-path-enabled.patch
+ patches.fixes/scsi-hpsa-update-queue-depth-for-externals.patch
+ patches.fixes/scsi-hpsa-reduce-warning-messages-on-device-removal.patch
+ patches.fixes/scsi-hpsa-correct-logical-volume-removal.patch
+ patches.fixes/scsi-hpsa-add-enclosure-logical-identifier.patch
+ patches.fixes/scsi-hpsa-bump-driver-version.patch
patches.drivers/megaraid_sas-use-adapter_type-for-all-gen-contr.patch
patches.drivers/megaraid_sas-Add-support-for-Crusader-controlle.patch
patches.drivers/megaraid_sas-replace-instance-ctrl_context-chec.patch
@@ -7747,6 +7819,7 @@
patches.drivers/megaraid_sas-Do-not-limit-queue_depth-to-1k-in-.patch
patches.drivers/megaraid_sas-Add-support-for-64bit-consistent-D.patch
patches.drivers/megaraid_sas-driver-version-upgrade.patch
+ patches.fixes/scsi-scsi_devinfo-Add-scsi_devinfo_tbl.c.patch
patches.drivers/0017-scsi-hisi_sas-delete-get_ncq_tag_v3_hw.patch
patches.drivers/scsi-hisi_sas-fix-internal-abort-slot-timeout-bug.patch
patches.drivers/0018-scsi-hisi_sas-use-spin_lock_irqsave-for-hisi_hba.loc.patch
@@ -7764,6 +7837,10 @@
patches.drivers/0030-scsi-hisi_sas-complete-all-tasklets-prior-to-host-re.patch
patches.drivers/0031-scsi-hisi_sas-add-v3-hw-support-for-AXI-fatal-error.patch
patches.drivers/0032-scsi-hisi_sas-add-v3-hw-port-AXI-error-handling.patch
+ patches.fixes/scsi-cxlflash-Use-derived-maximum-write-same-length.patch
+ patches.fixes/scsi-cxlflash-Allow-cards-without-WWPN-VPD-to-config.patch
+ patches.fixes/scsi-cxlflash-Derive-pid-through-accessors.patch
+ patches.fixes/scsi-scsi_error-DID_SOFT_ERROR-comment-clean-up.patch
patches.drivers/scsi-mpt3sas-Add-nvme-device-support-in-slave-alloc-.patch
patches.drivers/scsi-mpt3sas-SGL-to-PRP-Translation-for-I-Os-to-NVMe.patch
patches.drivers/scsi-mpt3sas-Added-support-for-nvme-encapsulated-req.patch
@@ -8588,6 +8665,7 @@
patches.suse/KVM-s390-abstract-conversion-between-isc-and-enum-ir.patch
patches.suse/KVM-s390-clear_io_irq-requests-are-not-expected-for-.patch
patches.suse/KVM-s390-provide-a-capability-for-AIS-state-migratio.patch
+ patches.drivers/dm-mpath-remove-annoying-message-of-blk_get_request-.patch
patches.drivers/libnvdimm-region-make-resource-attribute-only-readab.patch
patches.drivers/libnvdimm-namespace-make-resource-attribute-only-rea.patch
patches.drivers/libnvdimm-pfn-make-resource-attribute-only-readable-.patch
@@ -8622,6 +8700,7 @@
patches.fixes/dax-fix-general-protection-fault-in-dax_alloc_inode.patch
patches.drivers/nvmet_fc-fix-better-length-checking.patch
patches.suse/bio-ensure-__bio_clone_fast-copies-bi_partno.patch
+ patches.fixes/cxlflash-get-rid-of-pointless-access_ok.patch
patches.fixes/ecryptfs-remove-unnecessary-i_version-bump.patch
patches.arch/s390-sles15-02-01-s390-disassembler-increase-show_code-buffer-size.patch
patches.fixes/nilfs2-remove-inode-i_version-initialization.patch
@@ -8656,6 +8735,7 @@
patches.drivers/ALSA-hda-Fix-yet-remaining-issue-with-vmaster-0dB-in
patches.drivers/ALSA-hda-realtek-Fix-ALC700-family-no-sound-issue
patches.drivers/ALSA-hda-Add-Raven-PCI-ID
+ patches.fixes/scsi-bnx2fc-Fix-hung-task-messages-when-a-cleanup-re.patch
patches.drivers/net-sched-fix-crash-when-deleting-secondary-chains.patch
patches.fixes/ipv6-Do-not-consider-linkdown-nexthops-during-multip.patch
patches.fixes/net-accept-UFO-datagrams-from-tuntap-and-packet.patch
@@ -8805,7 +8885,9 @@
patches.drivers/i40iw-Move-MPA-request-event-for-loopback-after-conn.patch
patches.drivers/i40iw-Notify-user-of-established-connection-after-QP.patch
patches.drivers/IB-core-Only-enforce-security-for-InfiniBand.patch
- patches.drivers/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch
+ patches.fixes/scsi-aacraid-Check-for-PCI-state-of-device-in-a-gene.patch
+ patches.fixes/scsi-aacraid-Perform-initialization-reset-only-once.patch
+ patches.fixes/scsi-aacraid-Prevent-crash-in-case-of-free-interrupt.patch
patches.drivers/0033-scsi-libsas-align-sata_device-s-rps_resp-on-a-cachel.patch
patches.drivers/ALSA-seq-Remove-spurious-WARN_ON-at-timer-check
patches.drivers/ALSA-usb-audio-Fix-out-of-bound-error
@@ -8906,6 +8988,7 @@
patches.drivers/ALSA-rawmidi-Avoid-racy-info-ioctl-via-ctl-device
patches.drivers/ALSA-hda-realtek-Fix-Dell-AIO-LineOut-issue
patches.drivers/ALSA-usb-audio-Fix-the-missing-ctl-name-suffix-at-pa
+ patches.fixes/scsi-aacraid-Fix-I-O-drop-during-reset.patch
patches.suse/KVM-MMU-Fix-infinite-loop-when-there-is-no-available.patch
patches.suse/KVM-X86-Fix-load-RFLAGS-w-o-the-fixed-bit.patch
patches.suse/kvm-x86-fix-WARN-due-to-uninitialized-guest-FPU-stat.patch
@@ -8922,6 +9005,7 @@
patches.drivers/nvme-call-blk_integrity_unregister-after-queue-is-cl.patch
patches.drivers/nvme-check-hw-sectors-before-setting-chunk-sectors.patch
patches.drivers/nvme-setup-streams-after-initializing-namespace-head.patch
+ patches.fixes/block-fix-blk_rq_append_bio.patch
patches.drivers/bpf-s390x-do-not-reload-skb-pointers-in-non-skb-cont.patch
patches.drivers/bpf-ppc64-do-not-reload-skb-pointers-in-non-skb-cont.patch
patches.fixes/sctp-add-SCTP_CID_RECONF-conversion-in-sctp_cname.patch
@@ -9187,6 +9271,7 @@
patches.drivers/lpfc-Fix-driver-handling-of-nvme-resources-duri.patch
patches.drivers/lpfc-small-sg-cnt-cleanup.patch
patches.drivers/lpfc-update-driver-version-to-11.4.0.5.patch
+ patches.fixes/scsi-ibmvscsis-add-DRC-indices-to-debug-statements.patch
patches.drivers/scsi-qla2xxx-Fix-system-crash-for-Notify-ack-timeout.patch
patches.drivers/scsi-qla2xxx-Fix-gpnid-error-processing.patch
patches.drivers/scsi-qla2xxx-Move-session-delete-to-driver-work-queu.patch
@@ -9208,6 +9293,12 @@
patches.drivers/scsi-qla2xxx-Fix-system-crash-in-qlt_plogi_ack_unref.patch
patches.drivers/scsi-qla2xxx-Fix-memory-leak-in-dual-target-mode.patch
patches.drivers/scsi-qla2xxx-Update-driver-version-to-10.00.00.03-k.patch
+ patches.fixes/scsi-pmcraid-use-correct-size-unit-when-calling-find.patch
+ patches.fixes/scsi-devinfo-Apply-to-HP-rebranded-the-same-flags-as.patch
+ patches.fixes/scsi-devinfo-apply-to-HP-XP-the-same-flags-as-Hitach.patch
+ patches.fixes/scsi-dh-add-new-rdac-devices.patch
+ patches.fixes/scsi-devinfo-replace-Dell-PV-650F-with-EMC-CLARiiON.patch
+ patches.fixes/scsi-fnic-add-a-space-after-p-in-printf-format.patch
patches.drivers/scsi-qla2xxx-Suppress-gcc-7-fall-through-warnings.patch
patches.drivers/scsi-qla2xxx-remove-duplicate-includes.patch
patches.drivers/lpfc-Fix-random-heartbeat-timeouts-during-heavy.patch
@@ -9226,6 +9317,7 @@
patches.drivers/lpfc-don-t-dereference-localport-before-it-has-.patch
patches.drivers/lpfc-fix-a-couple-of-minor-indentation-issues.patch
patches.drivers/scsi-aacraid-Fix-hang-in-kdump.patch
+ patches.fixes/scsi-mpt3sas-Proper-handling-of-set-clear-of-ATA-com.patch
patches.drivers/scsi-qla2xxx-Fix-NULL-pointer-access-for-fcport-stru.patch
patches.drivers/scsi-qla2xxx-Use-IOCB-path-to-submit-Control-VP-MBX-.patch
patches.drivers/scsi-qla2xxx-Use-chip-reset-to-bring-down-laser-on-u.patch
@@ -9290,6 +9382,7 @@
patches.drivers/scsi-qla2xxx-Fix-queue-ID-for-async-abort-with-Multi.patch
patches.drivers/scsi-qla2xxx-Add-XCB-counters-to-debugfs.patch
patches.drivers/scsi-qla2xxx-Update-driver-version-to-10.00.00.05-k.patch
+ patches.fixes/scsi-qedf-Fix-error-return-code-in-__qedf_probe.patch
patches.drivers/scsi-megaraid_sas-NVMe-passthrough-command-support.patch
patches.fixes/scsi-qedi-drop-cqe-response-during-connection-recovery
patches.drivers/scsi-qla2xxx-Fix-logo-flag-for-qlt_free_session_done.patch
@@ -11230,17 +11323,12 @@
+dsterba patches.suse/btrfs-8063-delete-qgroup-items-in-drop_snapshot.patch
+jack patches.suse/xfs-warn-rt-volume.patch
+hare patches.fixes/edd-support-original-Phoenix-EDD-3.0-information.patch
-+hare patches.drivers/qla2xxx-0040-Add-module-parameter-for-interrupt-mode.patch
+hare patches.drivers/bfa-check-for-terminated-commands.patch
+hare patches.suse/aacraid-export-fixed-module-param
+hare patches.suse/scsi-always-retry-internal-target-error.patch
-+hare patches.fixes/scsi-do-not-retry-invalid-function-error.patch
+hare patches.fixes/scsi_scan-Send-TEST-UNIT-READY-to-LUN0-before-LUN-sc.patch
-+hare patches.fixes/scsi-Handle-power-on-reset-unit-attention.patch
+hare patches.fixes/sd-always-retry-READ-CAPACITY-for-ALUA-state-transit.patch
+hare patches.fixes/scsi-disable-VPD-page-check-on-error.patch
-+hare patches.fixes/scsi-Add-AIX-VDASD-to-blacklist.patch
-+hare patches.fixes/scsi-Modify-HITACHI-OPEN-V-blacklist.patch
+hare patches.fixes/sd-always-scan-VPD-pages-if-thin-provisioning-is-ena.patch
+hare patches.suse/scsi-do-not-print-reservation-conflict-for-TEST-UNIT.patch
+pjakobsson patches.drivers/0010-drm-hisilicon-hibmc-Add-drm_dev_set_unique-for-v4.4.patch