mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-11 08:18:47 +00:00
scsi: hpsa: limit outstanding rescans
Avoid rescan storms. No need to queue another if one is pending. Reviewed-by: Scott Benesh <scott.benesh@microsemi.com> Reviewed-by: Scott Teel <scott.teel@microsemi.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Don Brace <don.brace@microsemi.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
85b29008d8
commit
87b9e6aa87
@ -5555,7 +5555,7 @@ static void hpsa_scan_complete(struct ctlr_info *h)
|
|||||||
|
|
||||||
spin_lock_irqsave(&h->scan_lock, flags);
|
spin_lock_irqsave(&h->scan_lock, flags);
|
||||||
h->scan_finished = 1;
|
h->scan_finished = 1;
|
||||||
wake_up_all(&h->scan_wait_queue);
|
wake_up(&h->scan_wait_queue);
|
||||||
spin_unlock_irqrestore(&h->scan_lock, flags);
|
spin_unlock_irqrestore(&h->scan_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5573,11 +5573,23 @@ static void hpsa_scan_start(struct Scsi_Host *sh)
|
|||||||
if (unlikely(lockup_detected(h)))
|
if (unlikely(lockup_detected(h)))
|
||||||
return hpsa_scan_complete(h);
|
return hpsa_scan_complete(h);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a scan is already waiting to run, no need to add another
|
||||||
|
*/
|
||||||
|
spin_lock_irqsave(&h->scan_lock, flags);
|
||||||
|
if (h->scan_waiting) {
|
||||||
|
spin_unlock_irqrestore(&h->scan_lock, flags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&h->scan_lock, flags);
|
||||||
|
|
||||||
/* wait until any scan already in progress is finished. */
|
/* wait until any scan already in progress is finished. */
|
||||||
while (1) {
|
while (1) {
|
||||||
spin_lock_irqsave(&h->scan_lock, flags);
|
spin_lock_irqsave(&h->scan_lock, flags);
|
||||||
if (h->scan_finished)
|
if (h->scan_finished)
|
||||||
break;
|
break;
|
||||||
|
h->scan_waiting = 1;
|
||||||
spin_unlock_irqrestore(&h->scan_lock, flags);
|
spin_unlock_irqrestore(&h->scan_lock, flags);
|
||||||
wait_event(h->scan_wait_queue, h->scan_finished);
|
wait_event(h->scan_wait_queue, h->scan_finished);
|
||||||
/* Note: We don't need to worry about a race between this
|
/* Note: We don't need to worry about a race between this
|
||||||
@ -5587,6 +5599,7 @@ static void hpsa_scan_start(struct Scsi_Host *sh)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
h->scan_finished = 0; /* mark scan as in progress */
|
h->scan_finished = 0; /* mark scan as in progress */
|
||||||
|
h->scan_waiting = 0;
|
||||||
spin_unlock_irqrestore(&h->scan_lock, flags);
|
spin_unlock_irqrestore(&h->scan_lock, flags);
|
||||||
|
|
||||||
if (unlikely(lockup_detected(h)))
|
if (unlikely(lockup_detected(h)))
|
||||||
@ -8789,6 +8802,7 @@ reinit_after_soft_reset:
|
|||||||
init_waitqueue_head(&h->event_sync_wait_queue);
|
init_waitqueue_head(&h->event_sync_wait_queue);
|
||||||
mutex_init(&h->reset_mutex);
|
mutex_init(&h->reset_mutex);
|
||||||
h->scan_finished = 1; /* no scan currently in progress */
|
h->scan_finished = 1; /* no scan currently in progress */
|
||||||
|
h->scan_waiting = 0;
|
||||||
|
|
||||||
pci_set_drvdata(pdev, h);
|
pci_set_drvdata(pdev, h);
|
||||||
h->ndevices = 0;
|
h->ndevices = 0;
|
||||||
|
@ -201,6 +201,7 @@ struct ctlr_info {
|
|||||||
dma_addr_t errinfo_pool_dhandle;
|
dma_addr_t errinfo_pool_dhandle;
|
||||||
unsigned long *cmd_pool_bits;
|
unsigned long *cmd_pool_bits;
|
||||||
int scan_finished;
|
int scan_finished;
|
||||||
|
u8 scan_waiting : 1;
|
||||||
spinlock_t scan_lock;
|
spinlock_t scan_lock;
|
||||||
wait_queue_head_t scan_wait_queue;
|
wait_queue_head_t scan_wait_queue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user