Skip to content

Commit 58fcf92

Browse files
Narsimhulu Musinimartinkpetersen
authored andcommitted
snic: target cleanup in driver unload path
Fix deletes the snic targets synchronously prior to deletion of host. Signed-off-by: Narsimhulu Musini <[email protected]> Signed-off-by: Sesidhar Baddela <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6e0ae74 commit 58fcf92

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

drivers/scsi/snic/snic_disc.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,10 +480,21 @@ int
480480
snic_disc_start(struct snic *snic)
481481
{
482482
struct snic_disc *disc = &snic->disc;
483+
unsigned long flags;
483484
int ret = 0;
484485

485486
SNIC_SCSI_DBG(snic->shost, "Discovery Start.\n");
486487

488+
spin_lock_irqsave(&snic->snic_lock, flags);
489+
if (snic->in_remove) {
490+
spin_unlock_irqrestore(&snic->snic_lock, flags);
491+
SNIC_ERR("snic driver removal in progress ...\n");
492+
ret = 0;
493+
494+
return ret;
495+
}
496+
spin_unlock_irqrestore(&snic->snic_lock, flags);
497+
487498
mutex_lock(&disc->mutex);
488499
if (disc->state == SNIC_DISC_PENDING) {
489500
disc->req_cnt++;
@@ -533,6 +544,8 @@ snic_tgt_del_all(struct snic *snic)
533544
struct list_head *cur, *nxt;
534545
unsigned long flags;
535546

547+
scsi_flush_work(snic->shost);
548+
536549
mutex_lock(&snic->disc.mutex);
537550
spin_lock_irqsave(snic->shost->host_lock, flags);
538551

@@ -545,7 +558,7 @@ snic_tgt_del_all(struct snic *snic)
545558
tgt = NULL;
546559
}
547560
spin_unlock_irqrestore(snic->shost->host_lock, flags);
548-
549-
scsi_flush_work(snic->shost);
550561
mutex_unlock(&snic->disc.mutex);
562+
563+
flush_workqueue(snic_glob->event_q);
551564
} /* end of snic_tgt_del_all */

0 commit comments

Comments
 (0)