Use list_splice for blk_abort_queue
Subsystems (2)
PATCH 1/1 Use list_splice for blk_abort_queue
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.
--- block/blk-timeout.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
block/blk-timeout.c +4 -1
@@ -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);
Signature · 1 line
1.5.3.2
Quoted 41 lines · Hannes Reinecke
blk_abort_queuetakes thequeue_lockwithspinlock_irqsaveand walks thetimer_listwithlist_for_each_entry_safe. Since a path to a SCSI device just failed, the rport state isFC_PORTSTATE_BLOCKED. This rport state triggersblk_add_timer(), which in turn callslist_add_tail()to move the request to the end oftimer_list. Thus, thelist_for_each_XXXloop never reaches the end of thetimer_list. By usinglist_splice_init()we're breaking the loop and process only the requests present on thetimeout_listwhenblk_abort_queue()is called.Signed-off-by Hannes Reinecke <[email protected]>Tested-by Christof Schmitt <[email protected]>--- block/blk-timeout.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)block/blk-timeout.c +4
-1@@ -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);Signature · 1 line
1.5.3.2
Hannes, this fix has been in mainline for about 10 days.
Signature · 1 line
Jens Axboe
Hi Jens,
Quoted 37 lines · Jens Axboe
Quoted 36 lines · Hannes Reinecke
blk_abort_queuetakes thequeue_lockwithspinlock_irqsaveand walks thetimer_listwithlist_for_each_entry_safe. Since a path to a SCSI device just failed, the rport state isFC_PORTSTATE_BLOCKED. This rport state triggersblk_add_timer(), which in turn callslist_add_tail()to move the request to the end oftimer_list. Thus, thelist_for_each_XXXloop never reaches the end of thetimer_list. By usinglist_splice_init()we're breaking the loop and process only the requests present on thetimeout_listwhenblk_abort_queue()is called.Signed-off-by Hannes Reinecke <[email protected]>Tested-by Christof Schmitt <[email protected]>--- block/blk-timeout.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)block/blk-timeout.c +4
-1@@ -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);
Quoted 7 lines
Quoted 4 lines
block/blk-timeout.c +0
-0spin_unlock_irqrestore (q->queue_lock, flags);Signature · 1 line
1.5.3.2Hannes, 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
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 47 lines · Hannes Reinecke
Hi Jens,
Quoted 37 lines · Jens Axboe
Quoted 36 lines · Hannes Reinecke
blk_abort_queuetakes thequeue_lockwithspinlock_irqsaveand walks thetimer_listwithlist_for_each_entry_safe. Since a path to a SCSI device just failed, the rport state isFC_PORTSTATE_BLOCKED. This rport state triggersblk_add_timer(), which in turn callslist_add_tail()to move the request to the end oftimer_list. Thus, thelist_for_each_XXXloop never reaches the end of thetimer_list. By usinglist_splice_init()we're breaking the loop and process only the requests present on thetimeout_listwhenblk_abort_queue()is called.Signed-off-by Hannes Reinecke <[email protected]>Tested-by Christof Schmitt <[email protected]>--- block/blk-timeout.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)block/blk-timeout.c +4
-1@@ -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);Quoted 7 lines
Quoted 4 lines
block/blk-timeout.c +0
-1spin_unlock_irqrestore (q->queue_lock, flags); --1.5.3.2
Hannes, this fix has been in mainline for about 10 days.
Quoted 4 lines
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.
Signature · 1 line
Jens Axboe
Quoted 4 lines · Jens Axboe
Quoted 3 lines · Hannes Reinecke
Hi Jens,
Jens Axboe wrote:
[ .. ]
Quoted 11 lines
Quoted 6 lines
Quoted 2 lines
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
Signature · 8 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html