@@ -480,10 +480,21 @@ int
480480snic_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