diff options
author | Satish Kharat <satishkh@cisco.com> | 2016-12-14 16:20:41 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-01-05 20:41:31 -0500 |
commit | 9698b6f473555a722bf81a3371998427d5d27bde (patch) | |
tree | 6d84cbc49d767fcc058459a815fb0b0003d9aa38 | |
parent | 7961d53d22375bb9e8ae8063533b9059102ed39d (diff) |
scsi: fnic: Avoid sending reset to firmware when another reset is in 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>
-rw-r--r-- | drivers/scsi/fnic/fnic.h | 1 | ||||
-rw-r--r-- | drivers/scsi/fnic/fnic_scsi.c | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index 9ddc9200e0a4..9e4b7709043e 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
@@ -248,6 +248,7 @@ struct fnic { | |||
248 | struct completion *remove_wait; /* device remove thread blocks */ | 248 | struct completion *remove_wait; /* device remove thread blocks */ |
249 | 249 | ||
250 | atomic_t in_flight; /* io counter */ | 250 | atomic_t in_flight; /* io counter */ |
251 | bool internal_reset_inprogress; | ||
251 | u32 _reserved; /* fill hole */ | 252 | u32 _reserved; /* fill hole */ |
252 | unsigned long state_flags; /* protected by host lock */ | 253 | unsigned long state_flags; /* protected by host lock */ |
253 | enum fnic_state state; | 254 | enum fnic_state state; |
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 2544a37ece0a..adb3d5871e74 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c | |||
@@ -2581,6 +2581,19 @@ int fnic_host_reset(struct scsi_cmnd *sc) | |||
2581 | unsigned long wait_host_tmo; | 2581 | unsigned long wait_host_tmo; |
2582 | struct Scsi_Host *shost = sc->device->host; | 2582 | struct Scsi_Host *shost = sc->device->host; |
2583 | struct fc_lport *lp = shost_priv(shost); | 2583 | struct fc_lport *lp = shost_priv(shost); |
2584 | struct fnic *fnic = lport_priv(lp); | ||
2585 | unsigned long flags; | ||
2586 | |||
2587 | spin_lock_irqsave(&fnic->fnic_lock, flags); | ||
2588 | if (fnic->internal_reset_inprogress == 0) { | ||
2589 | fnic->internal_reset_inprogress = 1; | ||
2590 | } else { | ||
2591 | spin_unlock_irqrestore(&fnic->fnic_lock, flags); | ||
2592 | FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, | ||
2593 | "host reset in progress skipping another host reset\n"); | ||
2594 | return SUCCESS; | ||
2595 | } | ||
2596 | spin_unlock_irqrestore(&fnic->fnic_lock, flags); | ||
2584 | 2597 | ||
2585 | /* | 2598 | /* |
2586 | * If fnic_reset is successful, wait for fabric login to complete | 2599 | * If fnic_reset is successful, wait for fabric login to complete |
@@ -2601,6 +2614,9 @@ int fnic_host_reset(struct scsi_cmnd *sc) | |||
2601 | } | 2614 | } |
2602 | } | 2615 | } |
2603 | 2616 | ||
2617 | spin_lock_irqsave(&fnic->fnic_lock, flags); | ||
2618 | fnic->internal_reset_inprogress = 0; | ||
2619 | spin_unlock_irqrestore(&fnic->fnic_lock, flags); | ||
2604 | return ret; | 2620 | return ret; |
2605 | } | 2621 | } |
2606 | 2622 | ||