Skip to content

Commit

Permalink
scsi: fnic: Avoid sending reset to firmware when another reset is in …
Browse files Browse the repository at this point in the history
…progress

This fix is to avoid calling fnic_fw_reset_handler through
fnic_host_reset when a finc reset is alreay in progress.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Sesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Satish Kharat authored and martinkpetersen committed Jan 6, 2017
1 parent 7961d53 commit 9698b6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/scsi/fnic/fnic.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ struct fnic {
struct completion *remove_wait; /* device remove thread blocks */

atomic_t in_flight; /* io counter */
bool internal_reset_inprogress;
u32 _reserved; /* fill hole */
unsigned long state_flags; /* protected by host lock */
enum fnic_state state;
Expand Down
16 changes: 16 additions & 0 deletions drivers/scsi/fnic/fnic_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2581,6 +2581,19 @@ int fnic_host_reset(struct scsi_cmnd *sc)
unsigned long wait_host_tmo;
struct Scsi_Host *shost = sc->device->host;
struct fc_lport *lp = shost_priv(shost);
struct fnic *fnic = lport_priv(lp);
unsigned long flags;

spin_lock_irqsave(&fnic->fnic_lock, flags);
if (fnic->internal_reset_inprogress == 0) {
fnic->internal_reset_inprogress = 1;
} else {
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
"host reset in progress skipping another host reset\n");
return SUCCESS;
}
spin_unlock_irqrestore(&fnic->fnic_lock, flags);

/*
* If fnic_reset is successful, wait for fabric login to complete
Expand All @@ -2601,6 +2614,9 @@ int fnic_host_reset(struct scsi_cmnd *sc)
}
}

spin_lock_irqsave(&fnic->fnic_lock, flags);
fnic->internal_reset_inprogress = 0;
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
return ret;
}

Expand Down

0 comments on commit 9698b6f

Please sign in to comment.