On Thu, Mar 16, 2017 at 12:22:01AM +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 03:36:31PM +0000, Bart Van Assche wrote: > > OK, this race should only exist in case that the requeue happens after dispatch > busy, because COMPLETE flag isn't set. And if the requeue is from io completion, > no such race because COMPLETE flag is set. > > One solution I thought of is to call blk_mark_rq_complete() before requeuing > when dispatch busy happened, but that looks a bit silly. Another way is to > set STARTED flag just after .queue_rq returns BLK_MQ_RQ_QUEUE_OK, which looks > reasonable too. Any comments on the 2nd solution? Actually it isn't possible to happen because rq->deadline is just set in blk_mq_start_request() called from .queue_rq, and it won't trigger timeout handling even STARTED is observed as true in blk_mq_check_expired() because timeout period is often set as big enough. So it is still safe, isn't it? But this situation should have been commented. Thanks, Ming