Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933560AbdCUSK2 (ORCPT ); Tue, 21 Mar 2017 14:10:28 -0400 Received: from mail-sn1nam02on0105.outbound.protection.outlook.com ([104.47.36.105]:29453 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757975AbdCUSKZ (ORCPT ); Tue, 21 Mar 2017 14:10:25 -0400 From: KY Srinivasan To: Cathy Avery , "hch@infradead.org" , Haiyang Zhang , "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" CC: "stephen@networkplumber.org" , "dan.carpenter@oracle.com" , "devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , "linux-scsi@vger.kernel.org" Subject: RE: [PATCH v2] scsi: storvsc: Add support for FC rport. Thread-Topic: [PATCH v2] scsi: storvsc: Add support for FC rport. Thread-Index: AQHSnzGimcFVJqQ/7E+baU2s1cHay6GfnbHQ Date: Tue, 21 Mar 2017 18:10:21 +0000 Message-ID: References: <1489763861-18384-1-git-send-email-cavery@redhat.com> In-Reply-To: <1489763861-18384-1-git-send-email-cavery@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:6::66f] x-microsoft-exchange-diagnostics: 1;BLUPR03MB1409;7:lQ68oNmmEvcqOz1vxdvF3obItOCaZV+av+aOtmalIEBZNQCrE9QDus33oZFBsAINoqf8B/GOfVgYChNMztJWgvU+osTq9gw+ehItYAmLqh09kmuVfrnUMVjI1ZQVeFTaQz58LGu4X9pUgrWGZGFAfX7UylJiyzgsIyGDkzRP77H1DU5dPU+dnjuevxFpkgs/F82uwffRPt8I8NFR96rkk/5qkE7RiuO0OABUmysdfy6tjuUgfakKAgsMo3Oj4L3UBc6onALDs6LfOwiNssvF2tBWSS3XEYzsk1HR4KFTIoL52fWRagdctJJ4UiMkpZtkQi31xk8obyr5lM8lC04/gHmH1Awse4Jzj8CWZdB7MN0= x-ms-office365-filtering-correlation-id: 99a6200c-41bd-4ec7-3a42-08d470858a45 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081);SRVR:BLUPR03MB1409; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(104084551191319)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123560025)(20161123562025)(20161123558025)(20161123564025)(20161123555025)(6072148);SRVR:BLUPR03MB1409;BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB1409; x-forefront-prvs: 02530BD3AA x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(39840400002)(39450400003)(39410400002)(39850400002)(377454003)(13464003)(189998001)(53936002)(2501003)(55016002)(5890100001)(54906002)(9686003)(74316002)(99286003)(122556002)(2201001)(38730400002)(8990500004)(6246003)(53546009)(6506006)(6436002)(229853002)(77096006)(6116002)(2950100002)(102836003)(33656002)(86612001)(10290500002)(54356999)(86362001)(7736002)(1511001)(2900100001)(3660700001)(50986999)(81166006)(76176999)(3280700002)(8676002)(4326008)(8936002)(5660300001)(10090500001)(2906002)(305945005)(25786009)(7696004)(5005710100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR03MB1409;H:DM5PR03MB2490.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2017 18:10:21.7355 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1409 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2LIAUF3002171 Content-Length: 3496 Lines: 104 > -----Original Message----- > From: Cathy Avery [mailto:cavery@redhat.com] > Sent: Friday, March 17, 2017 8:18 AM > To: KY Srinivasan ; hch@infradead.org; Haiyang Zhang > ; jejb@linux.vnet.ibm.com; > martin.petersen@oracle.com > Cc: stephen@networkplumber.org; dan.carpenter@oracle.com; > devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; linux- > scsi@vger.kernel.org > Subject: [PATCH v2] scsi: storvsc: Add support for FC rport. > > 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. The driver also attaches to > the FC transport to allow host and port names to be published under > /sys/class/fc_host/hostX. Current customer tools running on the VM > require that these names be available in the well known standard > location under 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 fact that the virtualized FC device does not expose rports. > At this point you cannot refresh the scsi bus after mapping or unmapping > luns on the SAN without a reboot of the VM. > > This patch stubs in an rport per fc_host in storvsc so that the > requirement of a defined rport is now met within the fc_transport and > echo "- - -" > /sys/class/scsi_host/hostX/scan now works. > > Signed-off-by: Cathy Avery Acked-by: K. Y. Srinivasan > --- > Changes since v1: > - Fix fc_rport_identifiers init [Stephen Hemminger] > - Better error checking > --- > drivers/scsi/storvsc_drv.c | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c > index 638e5f4..37646d1 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -478,6 +478,9 @@ struct storvsc_device { > */ > u64 node_name; > u64 port_name; > +#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) > + struct fc_rport *rport; > +#endif > }; > > struct hv_host_device { > @@ -1816,19 +1819,27 @@ static int storvsc_probe(struct hv_device > *device, > target = (device->dev_instance.b[5] << 8 | > device->dev_instance.b[4]); > ret = scsi_add_device(host, 0, target, 0); > - if (ret) { > - scsi_remove_host(host); > - goto err_out2; > - } > + if (ret) > + goto err_out3; > } > #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) > if (host->transportt == fc_transport_template) { > + struct fc_rport_identifiers ids = { > + .roles = FC_PORT_ROLE_FCP_TARGET, > + }; > + > 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) > + goto err_out3; > } > #endif > return 0; > > +err_out3: > + scsi_remove_host(host); > + > err_out2: > /* > * Once we have connected with the host, we would need to > @@ -1854,8 +1865,10 @@ static int storvsc_remove(struct hv_device *dev) > struct Scsi_Host *host = stor_device->host; > > #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) > - if (host->transportt == fc_transport_template) > + if (host->transportt == fc_transport_template) { > + fc_remote_port_delete(stor_device->rport); > fc_remove_host(host); > + } > #endif > scsi_remove_host(host); > storvsc_dev_remove(dev); > -- > 2.5.0