From: hare@suse.de (Hannes Reinecke)
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: jens.axboe@oracle.com, linux-scsi@vger.kernel.org
Subject: [PATCH] Use list_splice for blk_abort_queue
Date: Fri, 27 Feb 2009 12:37:05 +0100 [thread overview]
Message-ID: <20090227113706.3005518C786@pentland.suse.de> (raw)
blk_abort_queue takes the queue_lock with spinlock_irqsave and walks
the timer_list with list_for_each_entry_safe. Since a path to a SCSI
device just failed, the rport state is FC_PORTSTATE_BLOCKED. This
rport state triggers blk_add_timer(), which in turn calls
list_add_tail() to move the request to the end of timer_list. Thus,
the list_for_each_XXX loop never reaches the end of the timer_list.
By using list_splice_init() we're breaking the loop and process only
the requests present on the timeout_list when blk_abort_queue() is
called.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Tested-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---
block/blk-timeout.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index a095353..67bcc3f 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -209,12 +209,15 @@ void blk_abort_queue(struct request_queue *q)
{
unsigned long flags;
struct request *rq, *tmp;
+ LIST_HEAD(list);
spin_lock_irqsave(q->queue_lock, flags);
elv_abort_queue(q);
- list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list)
+ list_splice_init(&q->timeout_list, &list);
+
+ list_for_each_entry_safe(rq, tmp, &list, timeout_list)
blk_abort_request(rq);
spin_unlock_irqrestore(q->queue_lock, flags);
--
1.5.3.2
next reply other threads:[~2009-02-27 11:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-27 11:37 Hannes Reinecke [this message]
2009-02-27 11:40 ` [PATCH] Use list_splice for blk_abort_queue Jens Axboe
2009-02-27 11:48 ` Hannes Reinecke
2009-02-27 11:56 ` Jens Axboe
2009-02-27 12:04 ` Hannes Reinecke
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=20090227113706.3005518C786@pentland.suse.de \
--to=hare@suse.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jens.axboe@oracle.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