From patchwork Thu Jan 26 13:39:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cathy Avery X-Patchwork-Id: 9539273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9AA0A601D7 for ; Thu, 26 Jan 2017 13:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 899EB280F4 for ; Thu, 26 Jan 2017 13:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CBE128174; Thu, 26 Jan 2017 13:41:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3544F26E69 for ; Thu, 26 Jan 2017 13:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbdAZNkh (ORCPT ); Thu, 26 Jan 2017 08:40:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43178 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751707AbdAZNjE (ORCPT ); Thu, 26 Jan 2017 08:39:04 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E43DFC04BD24; Thu, 26 Jan 2017 13:39:04 +0000 (UTC) Received: from dhcp-17-98.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0QDd0sY012029; Thu, 26 Jan 2017 08:39:03 -0500 From: Cathy Avery To: kys@microsoft.com, hch@infradead.org, haiyangz@microsoft.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: dan.carpenter@oracle.com, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, famz@redhat.com Subject: [PATCH v2 2/2] scsi: storvsc: Add support for FC lightweight host. Date: Thu, 26 Jan 2017 08:39:00 -0500 Message-Id: <1485437940-18706-3-git-send-email-cavery@redhat.com> In-Reply-To: <1485437940-18706-1-git-send-email-cavery@redhat.com> References: <1485437940-18706-1-git-send-email-cavery@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Jan 2017 13:39:05 +0000 (UTC) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Included in the current storvsc driver for Hyper-V is the ability to access luns on an FC fabric via a virtualized fiber channel adapter exposed by the Hyper-V host. This was done to provide an interface for existing customer tools that was more consistent with a conventional FC device. The driver attaches to the FC transport to allow host and port names to be published under /sys/class/fc_host/hostX. A problem arose when attaching to the FC transport. The scsi_scan code attempts to call fc_user_scan which has basically become a no-op due to the virtualized nature of the FC host ( missing rports, vports, etc ). At this point you cannot refresh the scsi bus after mapping or unmapping luns on the SAN without a reboot. This patch consists of: 1) storvsc elects to use the new lightweight FC host option by enabling it in fc_function_template facilitating a fuctional scsi_scan. 2) Removes an original workaround dealing with replacing the eh_timed_out function. Patch 1 will not set the scsi_transport_template.eh_timed_out function directly during lightweight fc_attach_transport(). It instead relies on whatever was indicated as the scsi_host_template timeout handler during scsi_times_out() scsi_error.c. So the workaround is no longer necessary. Signed-off-by: Cathy Avery --- drivers/scsi/storvsc_drv.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 888e16e..d487e00 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1878,10 +1878,17 @@ static struct hv_driver storvsc_drv = { .remove = storvsc_remove, }; +/* + * The driver cannot functionally back all transport + * attributes so select only those pertinent including + * the lightweight model. + */ + #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) static struct fc_function_template fc_transport_functions = { .show_host_node_name = 1, .show_host_port_name = 1, + .lightweight_transport = 1, }; #endif @@ -1906,11 +1913,6 @@ static int __init storvsc_drv_init(void) fc_transport_template = fc_attach_transport(&fc_transport_functions); if (!fc_transport_template) return -ENODEV; - - /* - * Install Hyper-V specific timeout handler. - */ - fc_transport_template->eh_timed_out = storvsc_eh_timed_out; #endif ret = vmbus_driver_register(&storvsc_drv);