@@ -170,17 +170,14 @@ __fnic_set_state_flags(struct fnic *fnic, unsigned long st_flags,
170
170
unsigned long clearbits )
171
171
{
172
172
unsigned long flags = 0 ;
173
- unsigned long host_lock_flags = 0 ;
174
173
175
174
spin_lock_irqsave (& fnic -> fnic_lock , flags );
176
- spin_lock_irqsave (fnic -> lport -> host -> host_lock , host_lock_flags );
177
175
178
176
if (clearbits )
179
177
fnic -> state_flags &= ~st_flags ;
180
178
else
181
179
fnic -> state_flags |= st_flags ;
182
180
183
- spin_unlock_irqrestore (fnic -> lport -> host -> host_lock , host_lock_flags );
184
181
spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
185
182
186
183
return ;
@@ -427,14 +424,27 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
427
424
int io_lock_acquired = 0 ;
428
425
struct fc_rport_libfc_priv * rp ;
429
426
430
- if (unlikely (fnic_chk_state_flags_locked (fnic , FNIC_FLAGS_IO_BLOCKED )))
427
+ spin_lock_irqsave (& fnic -> fnic_lock , flags );
428
+
429
+ if (unlikely (fnic_chk_state_flags_locked (fnic , FNIC_FLAGS_IO_BLOCKED ))) {
430
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
431
+ FNIC_SCSI_DBG (KERN_ERR , fnic -> lport -> host ,
432
+ "fnic<%d>: %s: %d: fnic IO blocked flags: 0x%lx. Returning SCSI_MLQUEUE_HOST_BUSY\n" ,
433
+ fnic -> fnic_num , __func__ , __LINE__ , fnic -> state_flags );
431
434
return SCSI_MLQUEUE_HOST_BUSY ;
435
+ }
432
436
433
- if (unlikely (fnic_chk_state_flags_locked (fnic , FNIC_FLAGS_FWRESET )))
437
+ if (unlikely (fnic_chk_state_flags_locked (fnic , FNIC_FLAGS_FWRESET ))) {
438
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
439
+ FNIC_SCSI_DBG (KERN_ERR , fnic -> lport -> host ,
440
+ "fnic<%d>: %s: %d: fnic flags: 0x%lx. Returning SCSI_MLQUEUE_HOST_BUSY\n" ,
441
+ fnic -> fnic_num , __func__ , __LINE__ , fnic -> state_flags );
434
442
return SCSI_MLQUEUE_HOST_BUSY ;
443
+ }
435
444
436
445
rport = starget_to_rport (scsi_target (sc -> device ));
437
446
if (!rport ) {
447
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
438
448
FNIC_SCSI_DBG (KERN_DEBUG , fnic -> lport -> host ,
439
449
"returning DID_NO_CONNECT for IO as rport is NULL\n" );
440
450
sc -> result = DID_NO_CONNECT << 16 ;
@@ -444,6 +454,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
444
454
445
455
ret = fc_remote_port_chkready (rport );
446
456
if (ret ) {
457
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
447
458
FNIC_SCSI_DBG (KERN_DEBUG , fnic -> lport -> host ,
448
459
"rport is not ready\n" );
449
460
atomic64_inc (& fnic_stats -> misc_stats .rport_not_ready );
@@ -454,6 +465,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
454
465
455
466
rp = rport -> dd_data ;
456
467
if (!rp || rp -> rp_state == RPORT_ST_DELETE ) {
468
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
457
469
FNIC_SCSI_DBG (KERN_DEBUG , fnic -> lport -> host ,
458
470
"rport 0x%x removed, returning DID_NO_CONNECT\n" ,
459
471
rport -> port_id );
@@ -465,6 +477,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
465
477
}
466
478
467
479
if (rp -> rp_state != RPORT_ST_READY ) {
480
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
468
481
FNIC_SCSI_DBG (KERN_DEBUG , fnic -> lport -> host ,
469
482
"rport 0x%x in state 0x%x, returning DID_IMM_RETRY\n" ,
470
483
rport -> port_id , rp -> rp_state );
@@ -474,17 +487,17 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
474
487
return 0 ;
475
488
}
476
489
477
- if (lp -> state != LPORT_ST_READY || !(lp -> link_up ))
490
+ if (lp -> state != LPORT_ST_READY || !(lp -> link_up )) {
491
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
492
+ FNIC_SCSI_DBG (KERN_ERR , fnic -> lport -> host ,
493
+ "fnic<%d>: %s: %d: state not ready: %d/link not up: %d Returning HOST_BUSY\n" ,
494
+ fnic -> fnic_num , __func__ , __LINE__ , lp -> state , lp -> link_up );
478
495
return SCSI_MLQUEUE_HOST_BUSY ;
496
+ }
479
497
480
498
atomic_inc (& fnic -> in_flight );
481
499
482
- /*
483
- * Release host lock, use driver resource specific locks from here.
484
- * Don't re-enable interrupts in case they were disabled prior to the
485
- * caller disabling them.
486
- */
487
- spin_unlock (lp -> host -> host_lock );
500
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
488
501
fnic_priv (sc )-> state = FNIC_IOREQ_NOT_INITED ;
489
502
fnic_priv (sc )-> flags = FNIC_NO_FLAGS ;
490
503
@@ -569,8 +582,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
569
582
mempool_free (io_req , fnic -> io_req_pool );
570
583
}
571
584
atomic_dec (& fnic -> in_flight );
572
- /* acquire host lock before returning to SCSI */
573
- spin_lock (lp -> host -> host_lock );
574
585
return ret ;
575
586
} else {
576
587
atomic64_inc (& fnic_stats -> io_stats .active_ios );
@@ -598,8 +609,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
598
609
spin_unlock_irqrestore (io_lock , flags );
599
610
600
611
atomic_dec (& fnic -> in_flight );
601
- /* acquire host lock before returning to SCSI */
602
- spin_lock (lp -> host -> host_lock );
603
612
return ret ;
604
613
}
605
614
@@ -1493,18 +1502,17 @@ static inline int fnic_queue_abort_io_req(struct fnic *fnic, int tag,
1493
1502
struct fnic_io_req * io_req )
1494
1503
{
1495
1504
struct vnic_wq_copy * wq = & fnic -> hw_copy_wq [0 ];
1496
- struct Scsi_Host * host = fnic -> lport -> host ;
1497
1505
struct misc_stats * misc_stats = & fnic -> fnic_stats .misc_stats ;
1498
1506
unsigned long flags ;
1499
1507
1500
- spin_lock_irqsave (host -> host_lock , flags );
1508
+ spin_lock_irqsave (& fnic -> fnic_lock , flags );
1501
1509
if (unlikely (fnic_chk_state_flags_locked (fnic ,
1502
1510
FNIC_FLAGS_IO_BLOCKED ))) {
1503
- spin_unlock_irqrestore (host -> host_lock , flags );
1511
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
1504
1512
return 1 ;
1505
1513
} else
1506
1514
atomic_inc (& fnic -> in_flight );
1507
- spin_unlock_irqrestore (host -> host_lock , flags );
1515
+ spin_unlock_irqrestore (& fnic -> fnic_lock , flags );
1508
1516
1509
1517
spin_lock_irqsave (& fnic -> wq_copy_lock [0 ], flags );
1510
1518
@@ -1939,7 +1947,6 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic,
1939
1947
struct fnic_io_req * io_req )
1940
1948
{
1941
1949
struct vnic_wq_copy * wq = & fnic -> hw_copy_wq [0 ];
1942
- struct Scsi_Host * host = fnic -> lport -> host ;
1943
1950
struct misc_stats * misc_stats = & fnic -> fnic_stats .misc_stats ;
1944
1951
struct scsi_lun fc_lun ;
1945
1952
int ret = 0 ;
@@ -1949,14 +1956,14 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic,
1949
1956
if (tag == SCSI_NO_TAG )
1950
1957
tag = io_req -> tag ;
1951
1958
1952
- spin_lock_irqsave (host -> host_lock , intr_flags );
1959
+ spin_lock_irqsave (& fnic -> fnic_lock , intr_flags );
1953
1960
if (unlikely (fnic_chk_state_flags_locked (fnic ,
1954
1961
FNIC_FLAGS_IO_BLOCKED ))) {
1955
- spin_unlock_irqrestore (host -> host_lock , intr_flags );
1962
+ spin_unlock_irqrestore (& fnic -> fnic_lock , intr_flags );
1956
1963
return FAILED ;
1957
1964
} else
1958
1965
atomic_inc (& fnic -> in_flight );
1959
- spin_unlock_irqrestore (host -> host_lock , intr_flags );
1966
+ spin_unlock_irqrestore (& fnic -> fnic_lock , intr_flags );
1960
1967
1961
1968
spin_lock_irqsave (& fnic -> wq_copy_lock [0 ], intr_flags );
1962
1969
0 commit comments