[PATCH] elevator: move clearing of unplug flag earlier

A flag was recently added to the elevator code to avoid
performing an unplug when reuests are being re-queued.
The goal of this flag was to avoid a deep recursion that
can occur when re-queueing requests after a SCSI device/host
reset. See http://lkml.org/lkml/2006/5/17/254

However, that fix added the flag near the bottom of a case
statement, where an earlier break (in an if statement) could
transport one out of the case, without setting the flag.
This patch sets the flag earlier in the case statement.

I re-discovered the deep recursion recently during testing;
I was told that it was a known problem, and the fix to it was
in the kernel I was testing. Indeed it was ... but it didn't
fix the bug. With the patch below, I no longer see the bug.

Signed-off by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
Cc: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Linas Vepstas and committed by Linus Torvalds 95543179 3a712292

+6 -5
+6 -5
block/elevator.c
··· 590 590 */ 591 591 rq->cmd_flags |= REQ_SOFTBARRIER; 592 592 593 + /* 594 + * Most requeues happen because of a busy condition, 595 + * don't force unplug of the queue for that case. 596 + */ 597 + unplug_it = 0; 598 + 593 599 if (q->ordseq == 0) { 594 600 list_add(&rq->queuelist, &q->queue_head); 595 601 break; ··· 610 604 } 611 605 612 606 list_add_tail(&rq->queuelist, pos); 613 - /* 614 - * most requeues happen because of a busy condition, don't 615 - * force unplug of the queue for that case. 616 - */ 617 - unplug_it = 0; 618 607 break; 619 608 620 609 default: