diff options
author | Brian King <brking@linux.vnet.ibm.com> | 2007-04-26 17:00:06 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-06 10:33:17 -0400 |
commit | 970ea2941199f9c5f3b4faffd68e7e9a4505de8e (patch) | |
tree | c4080dfaef7cda2cc06b00d05ae524aab24c72e3 /drivers/scsi | |
parent | d7a54e30d324b6f3b29a6cf2ff24c95b135013f5 (diff) |
[SCSI] ipr: Prevent overlapped adapter resets
This patch fixes some scenarios where an ipr adapter
could get reset overlapped, which could cause very
long timeouts to occur, or PCI bus errors.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ipr.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 2c7b77e833f9..f7af86f73d6b 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2635,8 +2635,13 @@ static ssize_t ipr_store_diagnostics(struct class_device *class_dev, | |||
2635 | if (!capable(CAP_SYS_ADMIN)) | 2635 | if (!capable(CAP_SYS_ADMIN)) |
2636 | return -EACCES; | 2636 | return -EACCES; |
2637 | 2637 | ||
2638 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
2639 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 2638 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
2639 | while(ioa_cfg->in_reset_reload) { | ||
2640 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
2641 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
2642 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
2643 | } | ||
2644 | |||
2640 | ioa_cfg->errors_logged = 0; | 2645 | ioa_cfg->errors_logged = 0; |
2641 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL); | 2646 | ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NORMAL); |
2642 | 2647 | ||
@@ -2958,6 +2963,11 @@ static int ipr_update_ioa_ucode(struct ipr_ioa_cfg *ioa_cfg, | |||
2958 | unsigned long lock_flags; | 2963 | unsigned long lock_flags; |
2959 | 2964 | ||
2960 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 2965 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
2966 | while(ioa_cfg->in_reset_reload) { | ||
2967 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
2968 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
2969 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
2970 | } | ||
2961 | 2971 | ||
2962 | if (ioa_cfg->ucode_sglist) { | 2972 | if (ioa_cfg->ucode_sglist) { |
2963 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 2973 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
@@ -7428,6 +7438,12 @@ static void __ipr_remove(struct pci_dev *pdev) | |||
7428 | ENTER; | 7438 | ENTER; |
7429 | 7439 | ||
7430 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | 7440 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); |
7441 | while(ioa_cfg->in_reset_reload) { | ||
7442 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); | ||
7443 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
7444 | spin_lock_irqsave(ioa_cfg->host->host_lock, host_lock_flags); | ||
7445 | } | ||
7446 | |||
7431 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); | 7447 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); |
7432 | 7448 | ||
7433 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); | 7449 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, host_lock_flags); |
@@ -7551,6 +7567,12 @@ static void ipr_shutdown(struct pci_dev *pdev) | |||
7551 | unsigned long lock_flags = 0; | 7567 | unsigned long lock_flags = 0; |
7552 | 7568 | ||
7553 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | 7569 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); |
7570 | while(ioa_cfg->in_reset_reload) { | ||
7571 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | ||
7572 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | ||
7573 | spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); | ||
7574 | } | ||
7575 | |||
7554 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); | 7576 | ipr_initiate_ioa_bringdown(ioa_cfg, IPR_SHUTDOWN_NORMAL); |
7555 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 7577 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
7556 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); | 7578 | wait_event(ioa_cfg->reset_wait_q, !ioa_cfg->in_reset_reload); |