X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=block%2Fblk-timeout.c;h=1ec0d503cacdc95bf296776ca2dc2d1e9ac4b108;hb=c572ae4efd1b0a5cc76c5e6aae05c1b182b6a69c;hp=a09535377a94c0b84a59118533f5e4ddeaa1076d;hpb=70ed28b92a786f44750ab64117b03d126dd14656;p=safe%2Fjmp%2Flinux-2.6 diff --git a/block/blk-timeout.c b/block/blk-timeout.c index a095353..1ec0d50 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c @@ -209,14 +209,34 @@ void blk_abort_queue(struct request_queue *q) { unsigned long flags; struct request *rq, *tmp; + LIST_HEAD(list); + + /* + * Not a request based block device, nothing to abort + */ + if (!q->request_fn) + return; spin_lock_irqsave(q->queue_lock, flags); elv_abort_queue(q); - list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list) + /* + * Splice entries to local list, to avoid deadlocking if entries + * get readded to the timeout list by error handling + */ + list_splice_init(&q->timeout_list, &list); + + list_for_each_entry_safe(rq, tmp, &list, timeout_list) blk_abort_request(rq); + /* + * Occasionally, blk_abort_request() will return without + * deleting the element from the list. Make sure we add those back + * instead of leaving them on the local stack list. + */ + list_splice(&list, &q->timeout_list); + spin_unlock_irqrestore(q->queue_lock, flags); }