aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libsas/sas_ata.c5
-rw-r--r--drivers/scsi/libsas/sas_discover.c5
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c3
3 files changed, 10 insertions, 3 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 37a9e73870d4..26a943eb153a 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -661,8 +661,13 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie)
661 struct ata_port *ap = dev->sata_dev.ap; 661 struct ata_port *ap = dev->sata_dev.ap;
662 struct sas_ha_struct *ha = dev->port->ha; 662 struct sas_ha_struct *ha = dev->port->ha;
663 663
664 /* hold a reference over eh since we may be racing with final
665 * remove once all commands are completed
666 */
667 kref_get(&dev->kref);
664 ata_port_printk(ap, KERN_DEBUG, "sas eh calling libata port error handler"); 668 ata_port_printk(ap, KERN_DEBUG, "sas eh calling libata port error handler");
665 ata_scsi_port_error_handler(ha->core.shost, ap); 669 ata_scsi_port_error_handler(ha->core.shost, ap);
670 sas_put_device(dev);
666} 671}
667 672
668void sas_ata_strategy_handler(struct Scsi_Host *shost) 673void sas_ata_strategy_handler(struct Scsi_Host *shost)
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index b91866a8233b..4be5ddad7be7 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -242,6 +242,11 @@ void sas_free_device(struct kref *kref)
242 if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV) 242 if (dev->dev_type == EDGE_DEV || dev->dev_type == FANOUT_DEV)
243 kfree(dev->ex_dev.ex_phy); 243 kfree(dev->ex_dev.ex_phy);
244 244
245 if (dev_is_sata(dev) && dev->sata_dev.ap) {
246 ata_sas_port_destroy(dev->sata_dev.ap);
247 dev->sata_dev.ap = NULL;
248 }
249
245 kfree(dev); 250 kfree(dev);
246} 251}
247 252
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 731c89250639..b563ff27626b 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1028,9 +1028,6 @@ void sas_target_destroy(struct scsi_target *starget)
1028 if (!found_dev) 1028 if (!found_dev)
1029 return; 1029 return;
1030 1030
1031 if (dev_is_sata(found_dev))
1032 ata_sas_port_destroy(found_dev->sata_dev.ap);
1033
1034 starget->hostdata = NULL; 1031 starget->hostdata = NULL;
1035 sas_put_device(found_dev); 1032 sas_put_device(found_dev);
1036} 1033}