Skip to content

Commit

Permalink
blk-mq: Fix timeout and state order
Browse files Browse the repository at this point in the history
The block layer had been setting the state to in-flight prior to updating
the timer. This is the wrong order since the timeout handler could observe
the in-flight state with the older timeout, believing the request had
expired when in fact it is just getting started.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Keith Busch authored and Jens Axboe committed May 29, 2018
1 parent 01fc27d commit ad103e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ void blk_mq_start_request(struct request *rq)
preempt_disable();
write_seqcount_begin(&rq->gstate_seq);

blk_mq_rq_update_state(rq, MQ_RQ_IN_FLIGHT);
blk_add_timer(rq);
blk_mq_rq_update_state(rq, MQ_RQ_IN_FLIGHT);

write_seqcount_end(&rq->gstate_seq);
preempt_enable();
Expand Down

0 comments on commit ad103e7

Please sign in to comment.