Skip to contentSkip to conversation

block: fix a possible oops on elv_abort_queue()

PATCH Applied Kiyoshi Ueda 2 participants 2 messages Jun 1, 2009 – Jun 2, 2009 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: fix a possible oops on elv_abort_queue()

Hi Jens,

I found one more mis-conversion to the 'request is always dequeued when completing' model in elv_abort_queue() during code inspection. Although I haven't hit any problem caused by this mis-conversion yet and just done compile/boot test, please apply if you have no problem.

Request must be dequeued when it completes.
However, elv_abort_queue() completes requests without dequeueing. This will cause oops in the __blk_end_request_all(). This patch fixes the oops.

---
 block/elevator.c |    5 +++++
 1 file changed, 5 insertions(+)
block/elevator.c +5 -0
Index: linux-2.6-block/block/elevator.c
===================================================================
@@ -813,6 +813,11 @@ void elv_abort_queue(struct request_queu
 		rq = list_entry_rq(q->queue_head.next);
 		rq->cmd_flags |= REQ_QUIET;
 		trace_block_rq_abort(q, rq);
+		/*
+		 * Mark this request as started so we don't trigger
+		 * any debug logic in the end I/O path.
+		 */
+		blk_start_request(rq);
 		__blk_end_request_all(rq, -EIO);
 	}
 }
Applied
#1 lore raw
Quoted 8 lines · Kiyoshi Ueda

Hi Jens,

I found one more mis-conversion to the 'request is always dequeued when completing' model in elv_abort_queue() during code inspection. Although I haven't hit any problem caused by this mis-conversion yet and just done compile/boot test, please apply if you have no problem.

Quoted 4 lines

Request must be dequeued when it completes.
However, elv_abort_queue() completes requests without dequeueing. This will cause oops in the __blk_end_request_all(). This patch fixes the oops.

Thanks, applied!

Quoted 23 lines
---
 block/elevator.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-2.6-block/block/elevator.c
===================================================================

block/elevator.c +5 -0
@@ -813,6 +813,11 @@ void elv_abort_queue(struct request_queu
 		rq = list_entry_rq(q->queue_head.next);
 		rq->cmd_flags |= REQ_QUIET;
 		trace_block_rq_abort(q, rq);
+		/*
+		 * Mark this request as started so we don't trigger
+		 * any debug logic in the end I/O path.
+		 */
+		blk_start_request(rq);
 		__blk_end_request_all(rq, -EIO);
 	}
 }
Signature · 1 line
Jens Axboe