--- zzzz-none-000/linux-2.6.39.4/block/elevator.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-arm-6490-729/linux-2.6.39.4/block/elevator.c 2021-11-10 13:23:10.000000000 +0000 @@ -483,6 +483,11 @@ struct request *__rq; int ret; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return ELEVATOR_NO_MERGE; + } + /* * Levels of merges: * nomerges: No merges at all attempted @@ -559,6 +564,11 @@ { struct elevator_queue *e = q->elevator; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return; + } + if (e->ops->elevator_merged_fn) e->ops->elevator_merged_fn(q, rq, type); @@ -598,6 +608,11 @@ void elv_requeue_request(struct request_queue *q, struct request *rq) { + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return; + } + /* * it already went through dequeue, we need to decrement the * in_flight count again @@ -616,6 +631,12 @@ void elv_drain_elevator(struct request_queue *q) { static int printed; + + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return; + } + while (q->elevator->ops->elevator_dispatch_fn(q, 1)) ; if (q->nr_sorted == 0) @@ -657,6 +678,11 @@ void __elv_add_request(struct request_queue *q, struct request *rq, int where) { + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return; + } + trace_block_rq_insert(q, rq); rq->q = q; @@ -752,6 +778,12 @@ { struct elevator_queue *e = q->elevator; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return NULL; + } + + if (e->ops->elevator_latter_req_fn) return e->ops->elevator_latter_req_fn(q, rq); return NULL; @@ -761,6 +793,11 @@ { struct elevator_queue *e = q->elevator; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return NULL; + } + if (e->ops->elevator_former_req_fn) return e->ops->elevator_former_req_fn(q, rq); return NULL; @@ -781,6 +818,11 @@ { struct elevator_queue *e = q->elevator; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return; + } + if (e->ops->elevator_put_req_fn) e->ops->elevator_put_req_fn(rq); } @@ -789,6 +831,11 @@ { struct elevator_queue *e = q->elevator; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return ELV_MQUEUE_NO; + } + if (e->ops->elevator_may_queue_fn) return e->ops->elevator_may_queue_fn(q, rw); @@ -819,6 +866,11 @@ { struct elevator_queue *e = q->elevator; + /*= AVM/WKR 20161123: Crash fix, don't access elevator of dead queue =*/ + if (unlikely(test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))) { + return; + } + /* * request is released from the driver, io must be done */