aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_base.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-08-20 03:52:00 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 10:34:49 -0400
commit155dd4c763694222c125e65438d823f58ea653bc (patch)
tree0db7b5b8d41c165222357ac8dee45482f1425faa /drivers/scsi/mpt2sas/mpt2sas_base.c
parentcd4e12e8ad246ec5bc23ab04d0da0e6985025620 (diff)
[SCSI] mpt2sas: Prevent sending command to FW while Host Reset
This patch renames the flag for indicating host reset from ioc_reset_in_progress to shost_recovery. It also removes the spin locks surrounding the setting of this flag, which are unnecessary. Sanity checks on the shost_recovery flag were added thru out the code so as to prevent sending firmware commands during host reset. Also, the setting of the shost state to SHOST_RECOVERY was removed to prevent deadlocks, this is actually better handled by the shost_recovery flag. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Reviewed-by: Eric Moore <Eric.moore@lsi.com> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_base.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index cc5a8dae4ae1..1cfb503125b6 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -94,7 +94,7 @@ _base_fault_reset_work(struct work_struct *work)
94 int rc; 94 int rc;
95 95
96 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); 96 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
97 if (ioc->ioc_reset_in_progress) 97 if (ioc->shost_recovery)
98 goto rearm_timer; 98 goto rearm_timer;
99 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 99 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
100 100
@@ -3501,20 +3501,13 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
3501 __func__)); 3501 __func__));
3502 3502
3503 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); 3503 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
3504 if (ioc->ioc_reset_in_progress) { 3504 if (ioc->shost_recovery) {
3505 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 3505 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
3506 printk(MPT2SAS_ERR_FMT "%s: busy\n", 3506 printk(MPT2SAS_ERR_FMT "%s: busy\n",
3507 ioc->name, __func__); 3507 ioc->name, __func__);
3508 return -EBUSY; 3508 return -EBUSY;
3509 } 3509 }
3510 ioc->ioc_reset_in_progress = 1;
3511 ioc->shost_recovery = 1; 3510 ioc->shost_recovery = 1;
3512 if (ioc->shost->shost_state == SHOST_RUNNING) {
3513 /* set back to SHOST_RUNNING in mpt2sas_scsih.c */
3514 scsi_host_set_state(ioc->shost, SHOST_RECOVERY);
3515 printk(MPT2SAS_INFO_FMT "putting controller into "
3516 "SHOST_RECOVERY\n", ioc->name);
3517 }
3518 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 3511 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
3519 3512
3520 _base_reset_handler(ioc, MPT2_IOC_PRE_RESET); 3513 _base_reset_handler(ioc, MPT2_IOC_PRE_RESET);
@@ -3534,7 +3527,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
3534 ioc->name, __func__, ((r == 0) ? "SUCCESS" : "FAILED"))); 3527 ioc->name, __func__, ((r == 0) ? "SUCCESS" : "FAILED")));
3535 3528
3536 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags); 3529 spin_lock_irqsave(&ioc->ioc_reset_in_progress_lock, flags);
3537 ioc->ioc_reset_in_progress = 0; 3530 ioc->shost_recovery = 0;
3538 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags); 3531 spin_unlock_irqrestore(&ioc->ioc_reset_in_progress_lock, flags);
3539 3532
3540 if (!r) 3533 if (!r)