Skip to content

Commit

Permalink
cfq-iosched: fix race in cfq_set_request()
Browse files Browse the repository at this point in the history
We need to hold the queue lock over the reference increment,
it's not atomic anymore.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
  • Loading branch information
Jens Axboe committed Mar 7, 2011
1 parent da52777 commit 93803e0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3675,12 +3675,11 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask)

cfqq->allocated[rw]++;

spin_unlock_irqrestore(q->queue_lock, flags);

cfqq->ref++;
rq->elevator_private[0] = cic;
rq->elevator_private[1] = cfqq;
rq->elevator_private[2] = cfq_ref_get_cfqg(cfqq->cfqg);
spin_unlock_irqrestore(q->queue_lock, flags);
return 0;

queue_fail:
Expand Down

0 comments on commit 93803e0

Please sign in to comment.