* [PATCH] Use list_splice for blk_abort_queue
@ 2009-02-27 11:37 Hannes Reinecke
2009-02-27 11:40 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Hannes Reinecke @ 2009-02-27 11:37 UTC (permalink / raw)
To: James Bottomley; +Cc: jens.axboe, linux-scsi
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Use list_splice for blk_abort_queue
2009-02-27 11:37 [PATCH] Use list_splice for blk_abort_queue Hannes Reinecke
@ 2009-02-27 11:40 ` Jens Axboe
2009-02-27 11:48 ` Hannes Reinecke
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2009-02-27 11:40 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: James Bottomley, linux-scsi
On Fri, Feb 27 2009, Hannes Reinecke wrote:
>
> 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
>
Hannes, this fix has been in mainline for about 10 days.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Use list_splice for blk_abort_queue
2009-02-27 11:40 ` Jens Axboe
@ 2009-02-27 11:48 ` Hannes Reinecke
2009-02-27 11:56 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Hannes Reinecke @ 2009-02-27 11:48 UTC (permalink / raw)
To: Jens Axboe; +Cc: James Bottomley, linux-scsi
Hi Jens,
Jens Axboe wrote:
> On Fri, Feb 27 2009, Hannes Reinecke wrote:
>> 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
>>
>
> Hannes, this fix has been in mainline for about 10 days.
>
Ah, sorry. Missed that one.
I'm just about to catch up with unread mails, and you said something
about 'the original author should resend the patch'.
Which I did.
Oh well, sorry for the noise.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Use list_splice for blk_abort_queue
2009-02-27 11:48 ` Hannes Reinecke
@ 2009-02-27 11:56 ` Jens Axboe
2009-02-27 12:04 ` Hannes Reinecke
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2009-02-27 11:56 UTC (permalink / raw)
To: Hannes Reinecke; +Cc: James Bottomley, linux-scsi
On Fri, Feb 27 2009, Hannes Reinecke wrote:
> Hi Jens,
>
> Jens Axboe wrote:
>> On Fri, Feb 27 2009, Hannes Reinecke wrote:
>>> 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
>>>
>>
>> Hannes, this fix has been in mainline for about 10 days.
>>
> Ah, sorry. Missed that one.
> I'm just about to catch up with unread mails, and you said something
> about 'the original author should resend the patch'.
> Which I did.
Yep, I did say that. But after a few days I figured you were probably
away or something, so I hacked up a changelog myself and put it in
there. It was already tested good and it makes sense.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Use list_splice for blk_abort_queue
2009-02-27 11:56 ` Jens Axboe
@ 2009-02-27 12:04 ` Hannes Reinecke
0 siblings, 0 replies; 5+ messages in thread
From: Hannes Reinecke @ 2009-02-27 12:04 UTC (permalink / raw)
To: Jens Axboe; +Cc: James Bottomley, linux-scsi
Jens Axboe wrote:
> On Fri, Feb 27 2009, Hannes Reinecke wrote:
>> Hi Jens,
>>
>> Jens Axboe wrote:
[ .. ]
>>> Hannes, this fix has been in mainline for about 10 days.
>>>
>> Ah, sorry. Missed that one.
>> I'm just about to catch up with unread mails, and you said something
>> about 'the original author should resend the patch'.
>> Which I did.
>
> Yep, I did say that. But after a few days I figured you were probably
> away or something, so I hacked up a changelog myself and put it in
> there. It was already tested good and it makes sense.
>
Yes, indeed 'something'. Thanks.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-27 12:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-27 11:37 [PATCH] Use list_splice for blk_abort_queue Hannes Reinecke
2009-02-27 11:40 ` Jens Axboe
2009-02-27 11:48 ` Hannes Reinecke
2009-02-27 11:56 ` Jens Axboe
2009-02-27 12:04 ` Hannes Reinecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox