Commit 3f395dc4 authored by Patrick Mansfield's avatar Patrick Mansfield Committed by James Bottomley

[PATCH] 3/5 scsi-locking-2.5 prevent looping when processing

Ensure that we cannot loop forever (however unlikely) when processing the
starved queues.
parent 48811377
...@@ -470,6 +470,13 @@ void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd) ...@@ -470,6 +470,13 @@ void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd)
spin_unlock_irqrestore(sdev2->request_queue->queue_lock, flags); spin_unlock_irqrestore(sdev2->request_queue->queue_lock, flags);
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
if (unlikely(!list_empty(&sdev->starved_entry)))
/*
* sdev lost a race, and was put back on the
* starved list. This is unlikely but without this
* in theory we could loop forever.
*/
break;
} }
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment