From 80f5f228e0870f8f93807aebffac067015bf5cb8 Mon Sep 17 00:00:00 2001 From: Rolf Neugebauer Date: Thu, 22 Mar 2018 20:00:20 +0000 Subject: [PATCH] kernel: Cherry-pick two Hyper-V SCSI driver patche These fix some issues around hot-unplugging devices which may be the cause of some LCOW issues we are seeing. Signed-off-by: Rolf Neugebauer --- ...ND_MIN_NAMESPACE_SIZE-from-4MB-to-4K.patch | 2 +- .../0002-hyper-v-trace-vmbus_on_msg_dpc.patch | 2 +- .../0003-hyper-v-trace-vmbus_on_message.patch | 2 +- .../0004-hyper-v-trace-vmbus_onoffer.patch | 2 +- ...-hyper-v-trace-vmbus_onoffer_rescind.patch | 2 +- ...06-hyper-v-trace-vmbus_onopen_result.patch | 2 +- ...-hyper-v-trace-vmbus_ongpadl_created.patch | 2 +- ...hyper-v-trace-vmbus_ongpadl_torndown.patch | 2 +- ...per-v-trace-vmbus_onversion_response.patch | 2 +- ...0-hyper-v-trace-vmbus_request_offers.patch | 2 +- .../0011-hyper-v-trace-vmbus_open.patch | 2 +- ...2-hyper-v-trace-vmbus_close_internal.patch | 2 +- ...-hyper-v-trace-vmbus_establish_gpadl.patch | 2 +- ...4-hyper-v-trace-vmbus_teardown_gpadl.patch | 2 +- ...yper-v-trace-vmbus_negotiate_version.patch | 2 +- ...16-hyper-v-trace-vmbus_release_relid.patch | 2 +- ...-trace-vmbus_send_tl_connect_request.patch | 2 +- .../0018-hyper-v-trace-channel-events.patch | 2 +- .../0019-serial-forbid-8250-on-s390.patch | 2 +- ...ow-only-one-remove-lun-work-item-to-.patch | 132 ++++++++++++++++++ ...id-excessive-host-scan-on-controller.patch | 110 +++++++++++++++ 21 files changed, 261 insertions(+), 19 deletions(-) create mode 100644 kernel/patches-4.14.x/0020-scsi-storvsc-Allow-only-one-remove-lun-work-item-to-.patch create mode 100644 kernel/patches-4.14.x/0021-scsi-storvsc-Avoid-excessive-host-scan-on-controller.patch diff --git a/kernel/patches-4.14.x/0001-NVDIMM-reducded-ND_MIN_NAMESPACE_SIZE-from-4MB-to-4K.patch b/kernel/patches-4.14.x/0001-NVDIMM-reducded-ND_MIN_NAMESPACE_SIZE-from-4MB-to-4K.patch index cda42bad3..3bc7a0fac 100644 --- a/kernel/patches-4.14.x/0001-NVDIMM-reducded-ND_MIN_NAMESPACE_SIZE-from-4MB-to-4K.patch +++ b/kernel/patches-4.14.x/0001-NVDIMM-reducded-ND_MIN_NAMESPACE_SIZE-from-4MB-to-4K.patch @@ -1,7 +1,7 @@ From f2dfc3322844833fff0e355605881c7057a6ff34 Mon Sep 17 00:00:00 2001 From: Cheng-mean Liu Date: Tue, 11 Jul 2017 16:58:26 -0700 -Subject: [PATCH 01/19] NVDIMM: reducded ND_MIN_NAMESPACE_SIZE from 4MB to 4KB +Subject: [PATCH 01/21] NVDIMM: reducded ND_MIN_NAMESPACE_SIZE from 4MB to 4KB (page size) Signed-off-by: Cheng-mean Liu diff --git a/kernel/patches-4.14.x/0002-hyper-v-trace-vmbus_on_msg_dpc.patch b/kernel/patches-4.14.x/0002-hyper-v-trace-vmbus_on_msg_dpc.patch index c303e55ce..14132e0a8 100644 --- a/kernel/patches-4.14.x/0002-hyper-v-trace-vmbus_on_msg_dpc.patch +++ b/kernel/patches-4.14.x/0002-hyper-v-trace-vmbus_on_msg_dpc.patch @@ -1,7 +1,7 @@ From 39acaefe663f3f9baf52bfe8353cdb185ec6e391 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:00 -0700 -Subject: [PATCH 02/19] hyper-v: trace vmbus_on_msg_dpc() +Subject: [PATCH 02/21] hyper-v: trace vmbus_on_msg_dpc() Add tracing subsystem to Hyper-V VMBus module and add tracepoint to vmbus_on_msg_dpc() which is called when we receive a message from host. diff --git a/kernel/patches-4.14.x/0003-hyper-v-trace-vmbus_on_message.patch b/kernel/patches-4.14.x/0003-hyper-v-trace-vmbus_on_message.patch index 6711420c2..524b32739 100644 --- a/kernel/patches-4.14.x/0003-hyper-v-trace-vmbus_on_message.patch +++ b/kernel/patches-4.14.x/0003-hyper-v-trace-vmbus_on_message.patch @@ -1,7 +1,7 @@ From 597a62a851affc0eb02402f5cfdd9d07f1e7ae87 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:01 -0700 -Subject: [PATCH 03/19] hyper-v: trace vmbus_on_message() +Subject: [PATCH 03/21] hyper-v: trace vmbus_on_message() Add tracepoint to vmbus_on_message() which is called when we start processing a blocking from work context. diff --git a/kernel/patches-4.14.x/0004-hyper-v-trace-vmbus_onoffer.patch b/kernel/patches-4.14.x/0004-hyper-v-trace-vmbus_onoffer.patch index 7d8f32f8f..c77cde98d 100644 --- a/kernel/patches-4.14.x/0004-hyper-v-trace-vmbus_onoffer.patch +++ b/kernel/patches-4.14.x/0004-hyper-v-trace-vmbus_onoffer.patch @@ -1,7 +1,7 @@ From 8db9f715df104300b0df6f6709e82ef4f9aa26a5 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:02 -0700 -Subject: [PATCH 04/19] hyper-v: trace vmbus_onoffer() +Subject: [PATCH 04/21] hyper-v: trace vmbus_onoffer() Add tracepoint to CHANNELMSG_OFFERCHANNEL handler. diff --git a/kernel/patches-4.14.x/0005-hyper-v-trace-vmbus_onoffer_rescind.patch b/kernel/patches-4.14.x/0005-hyper-v-trace-vmbus_onoffer_rescind.patch index b4caf6142..d04ec137b 100644 --- a/kernel/patches-4.14.x/0005-hyper-v-trace-vmbus_onoffer_rescind.patch +++ b/kernel/patches-4.14.x/0005-hyper-v-trace-vmbus_onoffer_rescind.patch @@ -1,7 +1,7 @@ From 0c6347ab475d34df2815cea98f0ebaa2fe5f6e3b Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:03 -0700 -Subject: [PATCH 05/19] hyper-v: trace vmbus_onoffer_rescind() +Subject: [PATCH 05/21] hyper-v: trace vmbus_onoffer_rescind() Add tracepoint to CHANNELMSG_RESCIND_CHANNELOFFER handler. diff --git a/kernel/patches-4.14.x/0006-hyper-v-trace-vmbus_onopen_result.patch b/kernel/patches-4.14.x/0006-hyper-v-trace-vmbus_onopen_result.patch index 06df977ba..df17924be 100644 --- a/kernel/patches-4.14.x/0006-hyper-v-trace-vmbus_onopen_result.patch +++ b/kernel/patches-4.14.x/0006-hyper-v-trace-vmbus_onopen_result.patch @@ -1,7 +1,7 @@ From 11ba0cc0131faac0d5e1e9ec30a5545156c2e636 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:04 -0700 -Subject: [PATCH 06/19] hyper-v: trace vmbus_onopen_result() +Subject: [PATCH 06/21] hyper-v: trace vmbus_onopen_result() Add tracepoint to CHANNELMSG_OPENCHANNEL_RESULT handler. diff --git a/kernel/patches-4.14.x/0007-hyper-v-trace-vmbus_ongpadl_created.patch b/kernel/patches-4.14.x/0007-hyper-v-trace-vmbus_ongpadl_created.patch index 8e92f7528..3d48bb121 100644 --- a/kernel/patches-4.14.x/0007-hyper-v-trace-vmbus_ongpadl_created.patch +++ b/kernel/patches-4.14.x/0007-hyper-v-trace-vmbus_ongpadl_created.patch @@ -1,7 +1,7 @@ From 46a7efc184320188f4b867c84777b5fcd564783c Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:05 -0700 -Subject: [PATCH 07/19] hyper-v: trace vmbus_ongpadl_created() +Subject: [PATCH 07/21] hyper-v: trace vmbus_ongpadl_created() Add tracepoint to CHANNELMSG_GPADL_CREATED handler. diff --git a/kernel/patches-4.14.x/0008-hyper-v-trace-vmbus_ongpadl_torndown.patch b/kernel/patches-4.14.x/0008-hyper-v-trace-vmbus_ongpadl_torndown.patch index 35ceadf7f..fa112a7d8 100644 --- a/kernel/patches-4.14.x/0008-hyper-v-trace-vmbus_ongpadl_torndown.patch +++ b/kernel/patches-4.14.x/0008-hyper-v-trace-vmbus_ongpadl_torndown.patch @@ -1,7 +1,7 @@ From 92412b339cf3f5aad7a2423349451db5fcfac9fd Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:06 -0700 -Subject: [PATCH 08/19] hyper-v: trace vmbus_ongpadl_torndown() +Subject: [PATCH 08/21] hyper-v: trace vmbus_ongpadl_torndown() Add tracepoint to CHANNELMSG_GPADL_TORNDOWN handler. diff --git a/kernel/patches-4.14.x/0009-hyper-v-trace-vmbus_onversion_response.patch b/kernel/patches-4.14.x/0009-hyper-v-trace-vmbus_onversion_response.patch index 6dbfe0143..cd3ef238c 100644 --- a/kernel/patches-4.14.x/0009-hyper-v-trace-vmbus_onversion_response.patch +++ b/kernel/patches-4.14.x/0009-hyper-v-trace-vmbus_onversion_response.patch @@ -1,7 +1,7 @@ From f887dce3b758deb4dece07f8e3ea2a00f80cdc31 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:07 -0700 -Subject: [PATCH 09/19] hyper-v: trace vmbus_onversion_response() +Subject: [PATCH 09/21] hyper-v: trace vmbus_onversion_response() Add tracepoint to CHANNELMSG_VERSION_RESPONSE handler. diff --git a/kernel/patches-4.14.x/0010-hyper-v-trace-vmbus_request_offers.patch b/kernel/patches-4.14.x/0010-hyper-v-trace-vmbus_request_offers.patch index 2eef7eb3e..c5aa0425c 100644 --- a/kernel/patches-4.14.x/0010-hyper-v-trace-vmbus_request_offers.patch +++ b/kernel/patches-4.14.x/0010-hyper-v-trace-vmbus_request_offers.patch @@ -1,7 +1,7 @@ From e44a4b4f6301dcdb3d790efe097e4bb23c68d9c0 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:08 -0700 -Subject: [PATCH 10/19] hyper-v: trace vmbus_request_offers() +Subject: [PATCH 10/21] hyper-v: trace vmbus_request_offers() Add tracepoint to CHANNELMSG_REQUESTOFFERS sender. diff --git a/kernel/patches-4.14.x/0011-hyper-v-trace-vmbus_open.patch b/kernel/patches-4.14.x/0011-hyper-v-trace-vmbus_open.patch index 87c1114a4..6f007a86e 100644 --- a/kernel/patches-4.14.x/0011-hyper-v-trace-vmbus_open.patch +++ b/kernel/patches-4.14.x/0011-hyper-v-trace-vmbus_open.patch @@ -1,7 +1,7 @@ From 2a62f25b008f45a8eb264146ae40d4658ee4d6d8 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:09 -0700 -Subject: [PATCH 11/19] hyper-v: trace vmbus_open() +Subject: [PATCH 11/21] hyper-v: trace vmbus_open() Add tracepoint to CHANNELMSG_OPENCHANNEL sender. diff --git a/kernel/patches-4.14.x/0012-hyper-v-trace-vmbus_close_internal.patch b/kernel/patches-4.14.x/0012-hyper-v-trace-vmbus_close_internal.patch index ef00ff138..c4f304ab4 100644 --- a/kernel/patches-4.14.x/0012-hyper-v-trace-vmbus_close_internal.patch +++ b/kernel/patches-4.14.x/0012-hyper-v-trace-vmbus_close_internal.patch @@ -1,7 +1,7 @@ From e69671031bc85350f16fcc0f73d162758fa9af6b Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:10 -0700 -Subject: [PATCH 12/19] hyper-v: trace vmbus_close_internal() +Subject: [PATCH 12/21] hyper-v: trace vmbus_close_internal() Add tracepoint to CHANNELMSG_CLOSECHANNEL sender. diff --git a/kernel/patches-4.14.x/0013-hyper-v-trace-vmbus_establish_gpadl.patch b/kernel/patches-4.14.x/0013-hyper-v-trace-vmbus_establish_gpadl.patch index c23772ec8..27a82bd2c 100644 --- a/kernel/patches-4.14.x/0013-hyper-v-trace-vmbus_establish_gpadl.patch +++ b/kernel/patches-4.14.x/0013-hyper-v-trace-vmbus_establish_gpadl.patch @@ -1,7 +1,7 @@ From 5023216570a427cf25fb782219054eae334346ed Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:11 -0700 -Subject: [PATCH 13/19] hyper-v: trace vmbus_establish_gpadl() +Subject: [PATCH 13/21] hyper-v: trace vmbus_establish_gpadl() Add tracepoint to CHANNELMSG_GPADL_HEADER/CHANNELMSG_GPADL_BODY sender. diff --git a/kernel/patches-4.14.x/0014-hyper-v-trace-vmbus_teardown_gpadl.patch b/kernel/patches-4.14.x/0014-hyper-v-trace-vmbus_teardown_gpadl.patch index fc5103d11..435e924be 100644 --- a/kernel/patches-4.14.x/0014-hyper-v-trace-vmbus_teardown_gpadl.patch +++ b/kernel/patches-4.14.x/0014-hyper-v-trace-vmbus_teardown_gpadl.patch @@ -1,7 +1,7 @@ From d00717f5e5c55048a95ba543e5e4f3ce6c57906f Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:12 -0700 -Subject: [PATCH 14/19] hyper-v: trace vmbus_teardown_gpadl() +Subject: [PATCH 14/21] hyper-v: trace vmbus_teardown_gpadl() Add tracepoint to CHANNELMSG_GPADL_TEARDOWN sender. diff --git a/kernel/patches-4.14.x/0015-hyper-v-trace-vmbus_negotiate_version.patch b/kernel/patches-4.14.x/0015-hyper-v-trace-vmbus_negotiate_version.patch index 6b74b41bb..6af22abf5 100644 --- a/kernel/patches-4.14.x/0015-hyper-v-trace-vmbus_negotiate_version.patch +++ b/kernel/patches-4.14.x/0015-hyper-v-trace-vmbus_negotiate_version.patch @@ -1,7 +1,7 @@ From d9d5329a9ecce6afa0fc25a0f560c473ae52de4a Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:13 -0700 -Subject: [PATCH 15/19] hyper-v: trace vmbus_negotiate_version() +Subject: [PATCH 15/21] hyper-v: trace vmbus_negotiate_version() Add tracepoint to CHANNELMSG_INITIATE_CONTACT sender. diff --git a/kernel/patches-4.14.x/0016-hyper-v-trace-vmbus_release_relid.patch b/kernel/patches-4.14.x/0016-hyper-v-trace-vmbus_release_relid.patch index 359acb77b..f9614c814 100644 --- a/kernel/patches-4.14.x/0016-hyper-v-trace-vmbus_release_relid.patch +++ b/kernel/patches-4.14.x/0016-hyper-v-trace-vmbus_release_relid.patch @@ -1,7 +1,7 @@ From 03890ec76a01397d8fba82ca606d77873e0504ce Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:14 -0700 -Subject: [PATCH 16/19] hyper-v: trace vmbus_release_relid() +Subject: [PATCH 16/21] hyper-v: trace vmbus_release_relid() Add tracepoint to CHANNELMSG_RELID_RELEASED sender. diff --git a/kernel/patches-4.14.x/0017-hyper-v-trace-vmbus_send_tl_connect_request.patch b/kernel/patches-4.14.x/0017-hyper-v-trace-vmbus_send_tl_connect_request.patch index 7a1d5de8b..791102cf2 100644 --- a/kernel/patches-4.14.x/0017-hyper-v-trace-vmbus_send_tl_connect_request.patch +++ b/kernel/patches-4.14.x/0017-hyper-v-trace-vmbus_send_tl_connect_request.patch @@ -1,7 +1,7 @@ From 540f25fed2376bfb7e4d2f144c7b453b9eb4660a Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:15 -0700 -Subject: [PATCH 17/19] hyper-v: trace vmbus_send_tl_connect_request() +Subject: [PATCH 17/21] hyper-v: trace vmbus_send_tl_connect_request() Add tracepoint to CHANNELMSG_TL_CONNECT_REQUEST sender. diff --git a/kernel/patches-4.14.x/0018-hyper-v-trace-channel-events.patch b/kernel/patches-4.14.x/0018-hyper-v-trace-channel-events.patch index 545bf72d1..fd2db8544 100644 --- a/kernel/patches-4.14.x/0018-hyper-v-trace-channel-events.patch +++ b/kernel/patches-4.14.x/0018-hyper-v-trace-channel-events.patch @@ -1,7 +1,7 @@ From b3776f6e8c1b0ab39c222cbe473ae42399a52783 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Sun, 29 Oct 2017 12:21:16 -0700 -Subject: [PATCH 18/19] hyper-v: trace channel events +Subject: [PATCH 18/21] hyper-v: trace channel events Added an additional set of trace points for when channel gets notified or signals host. diff --git a/kernel/patches-4.14.x/0019-serial-forbid-8250-on-s390.patch b/kernel/patches-4.14.x/0019-serial-forbid-8250-on-s390.patch index 58a2c226e..5ec580b8e 100644 --- a/kernel/patches-4.14.x/0019-serial-forbid-8250-on-s390.patch +++ b/kernel/patches-4.14.x/0019-serial-forbid-8250-on-s390.patch @@ -1,7 +1,7 @@ From 661a5c31d4ca7222b9576b43508fcb22df5adc2f Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Tue, 12 Dec 2017 09:08:35 +0100 -Subject: [PATCH 19/19] serial: forbid 8250 on s390 +Subject: [PATCH 19/21] serial: forbid 8250 on s390 Using "make kvmconfig" results in a potentially unusable linux image on s390. The reason is that both the (default on s390) sclp consoles diff --git a/kernel/patches-4.14.x/0020-scsi-storvsc-Allow-only-one-remove-lun-work-item-to-.patch b/kernel/patches-4.14.x/0020-scsi-storvsc-Allow-only-one-remove-lun-work-item-to-.patch new file mode 100644 index 000000000..efb8c79c2 --- /dev/null +++ b/kernel/patches-4.14.x/0020-scsi-storvsc-Allow-only-one-remove-lun-work-item-to-.patch @@ -0,0 +1,132 @@ +From 4ba99b3191f3fb7aebd9c2c3374828391ccb878c Mon Sep 17 00:00:00 2001 +From: Cathy Avery +Date: Tue, 31 Oct 2017 08:52:06 -0400 +Subject: [PATCH 20/21] scsi: storvsc: Allow only one remove lun work item to + be issued per lun + +When running multipath on a VM if all available paths go down the driver +can schedule large amounts of storvsc_remove_lun work items to the same +lun. In response to the failing paths typically storvsc responds by +taking host->scan_mutex and issuing a TUR per lun. If there has been +heavy IO to the failed device all the failed IOs are returned from the +host. A remove lun work item is issued per failed IO. If the outstanding +TURs have not been completed in a timely manner the scan_mutex is never +released or released too late. Consequently the many remove lun work +items are not completed as scsi_remove_device also tries to take +host->scan_mutex. This results in dragging the VM down and sometimes +completely. + +This patch only allows one remove lun to be issued to a particular lun +while it is an instantiated member of the scsi stack. + +Signed-off-by: Cathy Avery +Reviewed-by: Christoph Hellwig +Reviewed-by: Long Li +Signed-off-by: Martin K. Petersen +(cherry picked from commit 436ad941335386c5fc7faa915a8fbdfe8c908084) +--- + drivers/scsi/storvsc_drv.c | 27 ++++++++++++++++++++++----- + 1 file changed, 22 insertions(+), 5 deletions(-) + +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c +index a3e480e7a257..f0ce2193eff7 100644 +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -486,6 +486,7 @@ struct hv_host_device { + unsigned int port; + unsigned char path; + unsigned char target; ++ struct workqueue_struct *handle_error_wq; + }; + + struct storvsc_scan_work { +@@ -922,6 +923,7 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, + { + struct storvsc_scan_work *wrk; + void (*process_err_fn)(struct work_struct *work); ++ struct hv_host_device *host_dev = shost_priv(host); + bool do_work = false; + + switch (SRB_STATUS(vm_srb->srb_status)) { +@@ -989,7 +991,7 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, + wrk->lun = vm_srb->lun; + wrk->tgt_id = vm_srb->target_id; + INIT_WORK(&wrk->work, process_err_fn); +- schedule_work(&wrk->work); ++ queue_work(host_dev->handle_error_wq, &wrk->work); + } + + +@@ -1804,10 +1806,19 @@ static int storvsc_probe(struct hv_device *device, + if (stor_device->num_sc != 0) + host->nr_hw_queues = stor_device->num_sc + 1; + ++ /* ++ * Set the error handler work queue. ++ */ ++ host_dev->handle_error_wq = ++ alloc_ordered_workqueue("storvsc_error_wq_%d", ++ WQ_MEM_RECLAIM, ++ host->host_no); ++ if (!host_dev->handle_error_wq) ++ goto err_out2; + /* Register the HBA and start the scsi bus scan */ + ret = scsi_add_host(host, &device->device); + if (ret != 0) +- goto err_out2; ++ goto err_out3; + + if (!dev_is_ide) { + scsi_scan_host(host); +@@ -1816,7 +1827,7 @@ static int storvsc_probe(struct hv_device *device, + device->dev_instance.b[4]); + ret = scsi_add_device(host, 0, target, 0); + if (ret) +- goto err_out3; ++ goto err_out4; + } + #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) + if (host->transportt == fc_transport_template) { +@@ -1827,17 +1838,21 @@ static int storvsc_probe(struct hv_device *device, + fc_host_node_name(host) = stor_device->node_name; + fc_host_port_name(host) = stor_device->port_name; + stor_device->rport = fc_remote_port_add(host, 0, &ids); ++ + if (!stor_device->rport) { + ret = -ENOMEM; +- goto err_out3; ++ goto err_out4; + } + } + #endif + return 0; + +-err_out3: ++err_out4: + scsi_remove_host(host); + ++err_out3: ++ destroy_workqueue(host_dev->handle_error_wq); ++ + err_out2: + /* + * Once we have connected with the host, we would need to +@@ -1861,6 +1876,7 @@ static int storvsc_remove(struct hv_device *dev) + { + struct storvsc_device *stor_device = hv_get_drvdata(dev); + struct Scsi_Host *host = stor_device->host; ++ struct hv_host_device *host_dev = shost_priv(host); + + #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) + if (host->transportt == fc_transport_template) { +@@ -1868,6 +1884,7 @@ static int storvsc_remove(struct hv_device *dev) + fc_remove_host(host); + } + #endif ++ destroy_workqueue(host_dev->handle_error_wq); + scsi_remove_host(host); + storvsc_dev_remove(dev); + scsi_host_put(host); +-- +2.11.1 + diff --git a/kernel/patches-4.14.x/0021-scsi-storvsc-Avoid-excessive-host-scan-on-controller.patch b/kernel/patches-4.14.x/0021-scsi-storvsc-Avoid-excessive-host-scan-on-controller.patch new file mode 100644 index 000000000..804e2d37c --- /dev/null +++ b/kernel/patches-4.14.x/0021-scsi-storvsc-Avoid-excessive-host-scan-on-controller.patch @@ -0,0 +1,110 @@ +From 7586e0a49a7cc84f0b0ef766804837c81fe0cdd5 Mon Sep 17 00:00:00 2001 +From: Long Li +Date: Tue, 31 Oct 2017 14:58:08 -0700 +Subject: [PATCH 21/21] scsi: storvsc: Avoid excessive host scan on controller + change + +When there are multiple disks attached to the same SCSI controller, the +host may send several VSTOR_OPERATION_REMOVE_DEVICE or +VSTOR_OPERATION_ENUMERATE_BUS messages in a row, to indicate there is a +change on the SCSI controller. In response, storvsc rescans the SCSI +host. + +There is no need to do multiple scans on the same host. Fix the code to +do only one scan. + +[mkp: applied by hand] + +Signed-off-by: Long Li +Tested-by: Cathy Avery +Signed-off-by: Martin K. Petersen +(cherry picked from commit c58cc70fde299866bc261296166d26a87b4fa7ef) +--- + drivers/scsi/storvsc_drv.c | 26 +++++++++++--------------- + 1 file changed, 11 insertions(+), 15 deletions(-) + +diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c +index f0ce2193eff7..a892a5020c30 100644 +--- a/drivers/scsi/storvsc_drv.c ++++ b/drivers/scsi/storvsc_drv.c +@@ -487,6 +487,8 @@ struct hv_host_device { + unsigned char path; + unsigned char target; + struct workqueue_struct *handle_error_wq; ++ struct work_struct host_scan_work; ++ struct Scsi_Host *host; + }; + + struct storvsc_scan_work { +@@ -515,13 +517,12 @@ static void storvsc_device_scan(struct work_struct *work) + + static void storvsc_host_scan(struct work_struct *work) + { +- struct storvsc_scan_work *wrk; + struct Scsi_Host *host; + struct scsi_device *sdev; ++ struct hv_host_device *host_device = ++ container_of(work, struct hv_host_device, host_scan_work); + +- wrk = container_of(work, struct storvsc_scan_work, work); +- host = wrk->host; +- ++ host = host_device->host; + /* + * Before scanning the host, first check to see if any of the + * currrently known devices have been hot removed. We issue a +@@ -541,8 +542,6 @@ static void storvsc_host_scan(struct work_struct *work) + * Now scan the host to discover LUNs that may have been added. + */ + scsi_scan_host(host); +- +- kfree(wrk); + } + + static void storvsc_remove_lun(struct work_struct *work) +@@ -1119,8 +1118,7 @@ static void storvsc_on_receive(struct storvsc_device *stor_device, + struct vstor_packet *vstor_packet, + struct storvsc_cmd_request *request) + { +- struct storvsc_scan_work *work; +- ++ struct hv_host_device *host_dev; + switch (vstor_packet->operation) { + case VSTOR_OPERATION_COMPLETE_IO: + storvsc_on_io_completion(stor_device, vstor_packet, request); +@@ -1128,13 +1126,9 @@ static void storvsc_on_receive(struct storvsc_device *stor_device, + + case VSTOR_OPERATION_REMOVE_DEVICE: + case VSTOR_OPERATION_ENUMERATE_BUS: +- work = kmalloc(sizeof(struct storvsc_scan_work), GFP_ATOMIC); +- if (!work) +- return; +- +- INIT_WORK(&work->work, storvsc_host_scan); +- work->host = stor_device->host; +- schedule_work(&work->work); ++ host_dev = shost_priv(stor_device->host); ++ queue_work( ++ host_dev->handle_error_wq, &host_dev->host_scan_work); + break; + + case VSTOR_OPERATION_FCHBA_DATA: +@@ -1747,6 +1741,7 @@ static int storvsc_probe(struct hv_device *device, + + host_dev->port = host->host_no; + host_dev->dev = device; ++ host_dev->host = host; + + + stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL); +@@ -1815,6 +1810,7 @@ static int storvsc_probe(struct hv_device *device, + host->host_no); + if (!host_dev->handle_error_wq) + goto err_out2; ++ INIT_WORK(&host_dev->host_scan_work, storvsc_host_scan); + /* Register the HBA and start the scsi bus scan */ + ret = scsi_add_host(host, &device->device); + if (ret != 0) +-- +2.11.1 +