Skip to content

Commit 27eb77b

Browse files
Satish Kharatgregkh
authored andcommitted
scsi: fnic: Avoid sending reset to firmware when another reset is in progress
[ Upstream commit 9698b6f473555a722bf81a3371998427d5d27bde ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0866aed commit 27eb77b

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/scsi/fnic/fnic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ struct fnic {
248248
struct completion *remove_wait; /* device remove thread blocks */
249249

250250
atomic_t in_flight; /* io counter */
251+
bool internal_reset_inprogress;
251252
u32 _reserved; /* fill hole */
252253
unsigned long state_flags; /* protected by host lock */
253254
enum fnic_state state;

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,19 @@ int fnic_host_reset(struct scsi_cmnd *sc)
25332533
unsigned long wait_host_tmo;
25342534
struct Scsi_Host *shost = sc->device->host;
25352535
struct fc_lport *lp = shost_priv(shost);
2536+
struct fnic *fnic = lport_priv(lp);
2537+
unsigned long flags;
2538+
2539+
spin_lock_irqsave(&fnic->fnic_lock, flags);
2540+
if (fnic->internal_reset_inprogress == 0) {
2541+
fnic->internal_reset_inprogress = 1;
2542+
} else {
2543+
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
2544+
FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
2545+
"host reset in progress skipping another host reset\n");
2546+
return SUCCESS;
2547+
}
2548+
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
25362549

25372550
/*
25382551
* If fnic_reset is successful, wait for fabric login to complete
@@ -2553,6 +2566,9 @@ int fnic_host_reset(struct scsi_cmnd *sc)
25532566
}
25542567
}
25552568

2569+
spin_lock_irqsave(&fnic->fnic_lock, flags);
2570+
fnic->internal_reset_inprogress = 0;
2571+
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
25562572
return ret;
25572573
}
25582574

0 commit comments

Comments
 (0)