summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Wang <jinpu.wang@profitbricks.com>2015-11-05 14:32:29 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2015-11-10 03:36:04 +0300
commit4927f1fcf9afc0043a4a88c98cb7cb6caec11ff1 (patch)
tree3265ba6665220c4bb791e898f39f888bc31d79e6
parentce664fb5d4628632a6eceb8e69cbf015b7fb232a (diff)
downloadlinux-4927f1fcf9afc0043a4a88c98cb7cb6caec11ff1.tar.xz
isci: remove SCSI host before detaching from SAS transport
commit cff549e4860f ("scsi: proper state checking and module refcount handling in scsi_device_get") , the reference count of scsi device was changed, which could lead to when rmmod with at least on drive attached, SCSI error handle will run into infinite loop, and lockup the system. Fix it by remove scsi host first, this way scsi core will not send commands down after detaching SAS transport. This is a follow up fix for Benjamin's fix for pm80xx. See also: http://www.spinics.net/lists/linux-scsi/msg90088.html Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/isci/init.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
index 0dfcabe3ca7c..9e0d069f987b 100644
--- a/drivers/scsi/isci/init.c
+++ b/drivers/scsi/isci/init.c
@@ -272,11 +272,11 @@ static void isci_unregister(struct isci_host *isci_host)
if (!isci_host)
return;
+ shost = to_shost(isci_host);
+ scsi_remove_host(shost);
sas_unregister_ha(&isci_host->sas_ha);
- shost = to_shost(isci_host);
sas_remove_host(shost);
- scsi_remove_host(shost);
scsi_host_put(shost);
}