Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fnic: Using rport->dd_data to check rport online instead of rport_lookup.

When issuing I/O we check if rport is online through libfc
rport_lookup() function which needs to be protected by mutex lock that
cannot acquired in I/O context. The change is to use midlayer remote
port s dd_data which is preserved until its devloss timeout and no
protection is required. The the scsi_cmnd error code is expected to be
in the left 16 bits of the result field. Changed to correct this. Fnic
driver version changed from 1.6.0.20 to 1.6.0.21

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Satish Kharat and committed by
Martin K. Petersen
1b6ac5e3 a36f5dd0

+12 -10
+1 -1
drivers/scsi/fnic/fnic.h
··· 39 39 40 40 #define DRV_NAME "fnic" 41 41 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" 42 - #define DRV_VERSION "1.6.0.20" 42 + #define DRV_VERSION "1.6.0.21" 43 43 #define PFX DRV_NAME ": " 44 44 #define DFX DRV_NAME "%d: " 45 45
+11 -9
drivers/scsi/fnic/fnic_scsi.c
··· 439 439 int sg_count = 0; 440 440 unsigned long flags = 0; 441 441 unsigned long ptr; 442 - struct fc_rport_priv *rdata; 443 442 spinlock_t *io_lock = NULL; 444 443 int io_lock_acquired = 0; 445 444 ··· 454 455 return 0; 455 456 } 456 457 457 - rdata = lp->tt.rport_lookup(lp, rport->port_id); 458 - if (!rdata || (rdata->rp_state == RPORT_ST_DELETE)) { 459 - FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, 460 - "returning IO as rport is removed\n"); 461 - atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); 462 - sc->result = DID_NO_CONNECT; 463 - done(sc); 464 - return 0; 458 + if (rport) { 459 + struct fc_rport_libfc_priv *rp = rport->dd_data; 460 + 461 + if (!rp || rp->rp_state != RPORT_ST_READY) { 462 + FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, 463 + "returning DID_NO_CONNECT for IO as rport is removed\n"); 464 + atomic64_inc(&fnic_stats->misc_stats.rport_not_ready); 465 + sc->result = DID_NO_CONNECT<<16; 466 + done(sc); 467 + return 0; 468 + } 465 469 } 466 470 467 471 if (lp->state != LPORT_ST_READY || !(lp->link_up))