public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mansfield <patmans@us.ibm.com>
To: James Bottomley <James.Bottomley@steeleye.com>,
	linux-scsi@vger.kernel.org
Subject: [patch] 3/5 scsi-locking-2.5 prevent looping when processing starved queues
Date: Wed, 9 Apr 2003 16:47:33 -0700	[thread overview]
Message-ID: <20030409164733.C23701@beaverton.ibm.com> (raw)
In-Reply-To: <20030409164701.B23701@beaverton.ibm.com>; from patmans@us.ibm.com on Wed, Apr 09, 2003 at 04:47:01PM -0700

Ensure that we cannot loop forever (however unlikely) when processing the
starved queues.

diff -purN -X /home/patman/dontdiff 02_no_hier/drivers/scsi/scsi_lib.c 03_no_loop/drivers/scsi/scsi_lib.c
--- 02_no_hier/drivers/scsi/scsi_lib.c	Wed Apr  9 12:39:20 2003
+++ 03_no_loop/drivers/scsi/scsi_lib.c	Wed Apr  9 12:39:22 2003
@@ -470,6 +470,13 @@ void scsi_queue_next_request(request_que
 		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);
 

  reply	other threads:[~2003-04-09 23:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-09 23:46 [patch] 1/5 scsi-locking-2.5 single_lun store scsi_device pointer Patrick Mansfield
2003-04-09 23:47 ` [patch] 2/5 scsi-locking-2.5 remove lock hierarchy Patrick Mansfield
2003-04-09 23:47   ` Patrick Mansfield [this message]
2003-04-09 23:47     ` [patch] 4/5 scsi-locking-2.5 list_del starved_entry plus use GFP_ATOMIC Patrick Mansfield
2003-04-09 23:48       ` [patch] 5/5 scsi-locking-2.5 remove extra sdev2, remove extra logging Patrick Mansfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030409164733.C23701@beaverton.ibm.com \
    --to=patmans@us.ibm.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox