Patchwork [libsas,v10,6/9] libsas: use ->lldd_I_T_nexus_reset for ->eh_bus_reset_handler

login
register
mail settings
Submitter Dan Williams
Date March 11, 2012, 4:39 a.m.
Message ID <20120311043927.27797.43676.stgit@dwillia2-linux.jf.intel.com>
Download mbox | patch
Permalink /patch/145937/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Dan Williams - March 11, 2012, 4:39 a.m.
sas_eh_bus_reset_handler() amounts to sas_phy_reset() without
notification of the reset to the lldd.  If this is triggered from
eh-cmnd recovery there may be sas_tasks for the lldd to terminate, so
->lldd_I_T_nexus_reset is warranted.

Cc: Xiangliang Yu <yuxiangl@marvell.com>
Cc: Luben Tuikov <ltuikov@yahoo.com>
Cc: Jack Wang <jack_wang@usish.com>
Reviewed-by: Jacek Danecki <jacek.danecki@intel.com>
[jacek: modify pm8001_I_T_nexus_reset to return -ENODEV]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/scsi/libsas/sas_scsi_host.c |   19 ++++++++-----------
 drivers/scsi/pm8001/pm8001_sas.c    |    3 ++-
 2 files changed, 10 insertions(+), 12 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jack Wang - March 11, 2012, 5:37 a.m.
TG9va3MgT0sgdG8gbWUuDQpUaGFua3MuDQpBY2tlZC1ieTogSmFjayBXYW5nIDxqYWNrX3dhbmdA
dXNpc2guY29tPg0KDQoNCi0tLS0tLS0tLS0tLS0tDQpqYWNrX3dhbmcNCj5zYXNfZWhfYnVzX3Jl
c2V0X2hhbmRsZXIoKSBhbW91bnRzIHRvIHNhc19waHlfcmVzZXQoKSB3aXRob3V0DQo+bm90aWZp
Y2F0aW9uIG9mIHRoZSByZXNldCB0byB0aGUgbGxkZC4gIElmIHRoaXMgaXMgdHJpZ2dlcmVkIGZy
b20NCj5laC1jbW5kIHJlY292ZXJ5IHRoZXJlIG1heSBiZSBzYXNf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gPSBkZXYtPmxsZGRfZGV2Ow0KPiAJcG04MDAxX2hhID0gcG04MDAxX2ZpbmRfaGFfYnlf
ZGV2KGRldik7DQo+DQo+LS0NCj5UbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2VuZCB0
aGUgbGluZSAidW5zdWJzY3JpYmUgbGludXgtc2NzaSIgaW4NCj50aGUgYm9keSBvZiBhIG1lc3Nh
Z2UgdG8gbWFqb3Jkb21vQHZnZXIua2VybmVsLm9yZw0KPk1vcmUgbWFqb3Jkb21vIGluZm8gYXQg
IGh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRtbA0KPg0KPl9fX19fX19f
X18gSW5mb3JtYXRpb24gZnJvbSBFU0VUIE5PRDMyIEFudGl2aXJ1cywgdmVyc2lvbiBvZiB2aXJ1
cyBzaWduYXR1cmUgZGF0YWJhc2UgNTY1OSAoMjAxMDExMjkpIF9fX19fX19fX18NCj4NCj5UaGUg
bWVzc2FnZSB3YXMgY2hlY2tlZCBieSBFU0VUIE5PRDMyIEFudGl2aXJ1cy4NCj4NCj5odHRwOi8v
d3d3LmVzZXQuY29tDQo+DQo+DQo+

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index dec992b..a5c4ce4 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -576,25 +576,22 @@  int sas_eh_device_reset_handler(struct scsi_cmnd *cmd)
 	return FAILED;
 }
 
-/* Attempt to send a phy (bus) reset */
 int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd)
 {
-	struct domain_device *dev = cmd_to_domain_dev(cmd);
-	struct sas_phy *phy = sas_get_local_phy(dev);
-	struct Scsi_Host *host = cmd->device->host;
 	int res;
+	struct Scsi_Host *host = cmd->device->host;
+	struct domain_device *dev = cmd_to_domain_dev(cmd);
+	struct sas_internal *i = to_sas_internal(host->transportt);
 
 	if (current != host->ehandler)
 		return sas_queue_reset(dev, SAS_DEV_RESET, 0, 0);
 
-	res = sas_phy_reset(phy, 1);
-	if (res)
-		SAS_DPRINTK("Bus reset of %s failed 0x%x\n",
-			    kobject_name(&phy->dev.kobj),
-			    res);
-	sas_put_local_phy(phy);
+	if (!i->dft->lldd_I_T_nexus_reset)
+		return FAILED;
 
-	if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE)
+	res = i->dft->lldd_I_T_nexus_reset(dev);
+	if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE ||
+	    res == -ENODEV)
 		return SUCCESS;
 
 	return FAILED;
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index b111018..3a03b40 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -868,8 +868,9 @@  int pm8001_I_T_nexus_reset(struct domain_device *dev)
 	struct pm8001_device *pm8001_dev;
 	struct pm8001_hba_info *pm8001_ha;
 	struct sas_phy *phy;
+
 	if (!dev || !dev->lldd_dev)
-		return -1;
+		return -ENODEV;
 
 	pm8001_dev = dev->lldd_dev;
 	pm8001_ha = pm8001_find_ha_by_dev(dev);