From 3f395dc477c28291a2e274e41cb3833265176f7c Mon Sep 17 00:00:00 2001 From: Patrick Mansfield Date: Sat, 12 Apr 2003 00:05:25 -0500 Subject: [PATCH] [PATCH] 3/5 scsi-locking-2.5 prevent looping when processing Ensure that we cannot loop forever (however unlikely) when processing the starved queues. --- drivers/scsi/scsi_lib.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 6bfe03727be31..4b00953ba4dda 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -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_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); -- 2.53.0