Commit bd70dc15 authored by Satish Kharat's avatar Satish Kharat Committed by Sasha Levin

scsi: fnic: Avoid sending reset to firmware when another reset is in progress

[ Upstream commit 9698b6f4 ]

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: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarSesidhar Baddela <sebaddel@cisco.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent d50c49d3
......@@ -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;
......
......@@ -2517,6 +2517,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
......@@ -2537,6 +2550,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment