提交 58fcf920 编写于 作者: N Narsimhulu Musini 提交者: Martin K. Petersen

snic: target cleanup in driver unload path

Fix deletes the snic targets synchronously prior to deletion of host.
Signed-off-by: NNarsimhulu Musini <nmusini@cisco.com>
Signed-off-by: NSesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 6e0ae74b
...@@ -480,10 +480,21 @@ int ...@@ -480,10 +480,21 @@ int
snic_disc_start(struct snic *snic) snic_disc_start(struct snic *snic)
{ {
struct snic_disc *disc = &snic->disc; struct snic_disc *disc = &snic->disc;
unsigned long flags;
int ret = 0; int ret = 0;
SNIC_SCSI_DBG(snic->shost, "Discovery Start.\n"); SNIC_SCSI_DBG(snic->shost, "Discovery Start.\n");
spin_lock_irqsave(&snic->snic_lock, flags);
if (snic->in_remove) {
spin_unlock_irqrestore(&snic->snic_lock, flags);
SNIC_ERR("snic driver removal in progress ...\n");
ret = 0;
return ret;
}
spin_unlock_irqrestore(&snic->snic_lock, flags);
mutex_lock(&disc->mutex); mutex_lock(&disc->mutex);
if (disc->state == SNIC_DISC_PENDING) { if (disc->state == SNIC_DISC_PENDING) {
disc->req_cnt++; disc->req_cnt++;
...@@ -533,6 +544,8 @@ snic_tgt_del_all(struct snic *snic) ...@@ -533,6 +544,8 @@ snic_tgt_del_all(struct snic *snic)
struct list_head *cur, *nxt; struct list_head *cur, *nxt;
unsigned long flags; unsigned long flags;
scsi_flush_work(snic->shost);
mutex_lock(&snic->disc.mutex); mutex_lock(&snic->disc.mutex);
spin_lock_irqsave(snic->shost->host_lock, flags); spin_lock_irqsave(snic->shost->host_lock, flags);
...@@ -545,7 +558,7 @@ snic_tgt_del_all(struct snic *snic) ...@@ -545,7 +558,7 @@ snic_tgt_del_all(struct snic *snic)
tgt = NULL; tgt = NULL;
} }
spin_unlock_irqrestore(snic->shost->host_lock, flags); spin_unlock_irqrestore(snic->shost->host_lock, flags);
scsi_flush_work(snic->shost);
mutex_unlock(&snic->disc.mutex); mutex_unlock(&snic->disc.mutex);
flush_workqueue(snic_glob->event_q);
} /* end of snic_tgt_del_all */ } /* end of snic_tgt_del_all */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册