@@ -4860,10 +4860,10 @@ void
48604860lpfc_nlp_set_state (struct lpfc_vport * vport , struct lpfc_nodelist * ndlp ,
48614861 int state )
48624862{
4863- struct Scsi_Host * shost = lpfc_shost_from_vport (vport );
48644863 int old_state = ndlp -> nlp_state ;
48654864 int node_dropped = ndlp -> nlp_flag & NLP_DROPPED ;
48664865 char name1 [16 ], name2 [16 ];
4866+ unsigned long iflags ;
48674867
48684868 lpfc_printf_vlog (vport , KERN_INFO , LOG_NODE ,
48694869 "0904 NPort state transition x%06x, %s -> %s\n" ,
@@ -4890,9 +4890,9 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
48904890 }
48914891
48924892 if (list_empty (& ndlp -> nlp_listp )) {
4893- spin_lock_irq ( shost -> host_lock );
4893+ spin_lock_irqsave ( & vport -> fc_nodes_list_lock , iflags );
48944894 list_add_tail (& ndlp -> nlp_listp , & vport -> fc_nodes );
4895- spin_unlock_irq ( shost -> host_lock );
4895+ spin_unlock_irqrestore ( & vport -> fc_nodes_list_lock , iflags );
48964896 } else if (old_state )
48974897 lpfc_nlp_counters (vport , old_state , -1 );
48984898
@@ -4904,26 +4904,26 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
49044904void
49054905lpfc_enqueue_node (struct lpfc_vport * vport , struct lpfc_nodelist * ndlp )
49064906{
4907- struct Scsi_Host * shost = lpfc_shost_from_vport ( vport ) ;
4907+ unsigned long iflags ;
49084908
49094909 if (list_empty (& ndlp -> nlp_listp )) {
4910- spin_lock_irq ( shost -> host_lock );
4910+ spin_lock_irqsave ( & vport -> fc_nodes_list_lock , iflags );
49114911 list_add_tail (& ndlp -> nlp_listp , & vport -> fc_nodes );
4912- spin_unlock_irq ( shost -> host_lock );
4912+ spin_unlock_irqrestore ( & vport -> fc_nodes_list_lock , iflags );
49134913 }
49144914}
49154915
49164916void
49174917lpfc_dequeue_node (struct lpfc_vport * vport , struct lpfc_nodelist * ndlp )
49184918{
4919- struct Scsi_Host * shost = lpfc_shost_from_vport ( vport ) ;
4919+ unsigned long iflags ;
49204920
49214921 lpfc_cancel_retry_delay_tmo (vport , ndlp );
49224922 if (ndlp -> nlp_state && !list_empty (& ndlp -> nlp_listp ))
49234923 lpfc_nlp_counters (vport , ndlp -> nlp_state , -1 );
4924- spin_lock_irq ( shost -> host_lock );
4924+ spin_lock_irqsave ( & vport -> fc_nodes_list_lock , iflags );
49254925 list_del_init (& ndlp -> nlp_listp );
4926- spin_unlock_irq ( shost -> host_lock );
4926+ spin_unlock_irqrestore ( & vport -> fc_nodes_list_lock , iflags );
49274927 lpfc_nlp_state_cleanup (vport , ndlp , ndlp -> nlp_state ,
49284928 NLP_STE_UNUSED_NODE );
49294929}
@@ -5421,8 +5421,8 @@ lpfc_unreg_hba_rpis(struct lpfc_hba *phba)
54215421{
54225422 struct lpfc_vport * * vports ;
54235423 struct lpfc_nodelist * ndlp ;
5424- struct Scsi_Host * shost ;
54255424 int i ;
5425+ unsigned long iflags ;
54265426
54275427 vports = lpfc_create_vport_work_array (phba );
54285428 if (!vports ) {
@@ -5431,17 +5431,18 @@ lpfc_unreg_hba_rpis(struct lpfc_hba *phba)
54315431 return ;
54325432 }
54335433 for (i = 0 ; i <= phba -> max_vports && vports [i ] != NULL ; i ++ ) {
5434- shost = lpfc_shost_from_vport (vports [i ]);
5435- spin_lock_irq (shost -> host_lock );
5434+ spin_lock_irqsave (& vports [i ]-> fc_nodes_list_lock , iflags );
54365435 list_for_each_entry (ndlp , & vports [i ]-> fc_nodes , nlp_listp ) {
54375436 if (ndlp -> nlp_flag & NLP_RPI_REGISTERED ) {
54385437 /* The mempool_alloc might sleep */
5439- spin_unlock_irq (shost -> host_lock );
5438+ spin_unlock_irqrestore (& vports [i ]-> fc_nodes_list_lock ,
5439+ iflags );
54405440 lpfc_unreg_rpi (vports [i ], ndlp );
5441- spin_lock_irq (shost -> host_lock );
5441+ spin_lock_irqsave (& vports [i ]-> fc_nodes_list_lock ,
5442+ iflags );
54425443 }
54435444 }
5444- spin_unlock_irq ( shost -> host_lock );
5445+ spin_unlock_irqrestore ( & vports [ i ] -> fc_nodes_list_lock , iflags );
54455446 }
54465447 lpfc_destroy_vport_work_array (phba , vports );
54475448}
@@ -5683,12 +5684,11 @@ lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
56835684struct lpfc_nodelist *
56845685lpfc_findnode_mapped (struct lpfc_vport * vport )
56855686{
5686- struct Scsi_Host * shost = lpfc_shost_from_vport (vport );
56875687 struct lpfc_nodelist * ndlp ;
56885688 uint32_t data1 ;
56895689 unsigned long iflags ;
56905690
5691- spin_lock_irqsave (shost -> host_lock , iflags );
5691+ spin_lock_irqsave (& vport -> fc_nodes_list_lock , iflags );
56925692
56935693 list_for_each_entry (ndlp , & vport -> fc_nodes , nlp_listp ) {
56945694 if (ndlp -> nlp_state == NLP_STE_UNMAPPED_NODE ||
@@ -5697,7 +5697,8 @@ lpfc_findnode_mapped(struct lpfc_vport *vport)
56975697 ((uint32_t )ndlp -> nlp_xri << 16 ) |
56985698 ((uint32_t )ndlp -> nlp_type << 8 ) |
56995699 ((uint32_t )ndlp -> nlp_rpi & 0xff ));
5700- spin_unlock_irqrestore (shost -> host_lock , iflags );
5700+ spin_unlock_irqrestore (& vport -> fc_nodes_list_lock ,
5701+ iflags );
57015702 lpfc_printf_vlog (vport , KERN_INFO , LOG_NODE_VERBOSE ,
57025703 "2025 FIND node DID MAPPED "
57035704 "Data: x%px x%x x%x x%x x%px\n" ,
@@ -5707,7 +5708,7 @@ lpfc_findnode_mapped(struct lpfc_vport *vport)
57075708 return ndlp ;
57085709 }
57095710 }
5710- spin_unlock_irqrestore (shost -> host_lock , iflags );
5711+ spin_unlock_irqrestore (& vport -> fc_nodes_list_lock , iflags );
57115712
57125713 /* FIND node did <did> NOT FOUND */
57135714 lpfc_printf_vlog (vport , KERN_INFO , LOG_NODE ,
@@ -6742,7 +6743,7 @@ lpfc_fcf_inuse(struct lpfc_hba *phba)
67426743 struct lpfc_vport * * vports ;
67436744 int i , ret = 0 ;
67446745 struct lpfc_nodelist * ndlp ;
6745- struct Scsi_Host * shost ;
6746+ unsigned long iflags ;
67466747
67476748 vports = lpfc_create_vport_work_array (phba );
67486749
@@ -6751,24 +6752,23 @@ lpfc_fcf_inuse(struct lpfc_hba *phba)
67516752 return 1 ;
67526753
67536754 for (i = 0 ; i <= phba -> max_vports && vports [i ] != NULL ; i ++ ) {
6754- shost = lpfc_shost_from_vport (vports [i ]);
6755- spin_lock_irq (shost -> host_lock );
67566755 /*
67576756 * IF the CVL_RCVD bit is not set then we have sent the
67586757 * flogi.
67596758 * If dev_loss fires while we are waiting we do not want to
67606759 * unreg the fcf.
67616760 */
67626761 if (!(vports [i ]-> fc_flag & FC_VPORT_CVL_RCVD )) {
6763- spin_unlock_irq (shost -> host_lock );
67646762 ret = 1 ;
67656763 goto out ;
67666764 }
6765+ spin_lock_irqsave (& vports [i ]-> fc_nodes_list_lock , iflags );
67676766 list_for_each_entry (ndlp , & vports [i ]-> fc_nodes , nlp_listp ) {
67686767 if (ndlp -> rport &&
67696768 (ndlp -> rport -> roles & FC_RPORT_ROLE_FCP_TARGET )) {
67706769 ret = 1 ;
6771- spin_unlock_irq (shost -> host_lock );
6770+ spin_unlock_irqrestore (& vports [i ]-> fc_nodes_list_lock ,
6771+ iflags );
67726772 goto out ;
67736773 } else if (ndlp -> nlp_flag & NLP_RPI_REGISTERED ) {
67746774 ret = 1 ;
@@ -6780,7 +6780,7 @@ lpfc_fcf_inuse(struct lpfc_hba *phba)
67806780 ndlp -> nlp_flag );
67816781 }
67826782 }
6783- spin_unlock_irq ( shost -> host_lock );
6783+ spin_unlock_irqrestore ( & vports [ i ] -> fc_nodes_list_lock , iflags );
67846784 }
67856785out :
67866786 lpfc_destroy_vport_work_array (phba , vports );
0 commit comments