On Thu, 2018-07-19 at 09:56 -0600, Keith Busch wrote: > Even some scsi drivers are susceptible to losing their requests with the > reverted behavior: take virtio-scsi for example, which returns RESET_TIMER > from it's timeout handler. With the behavior everyone seems to want, > a natural completion at or around the same time is lost forever because > it was blocked from completion with no way to recover.
The patch I had posted handles a completion that occurs while a timeout is being handled properly. From https://www.mail-archive.com/[email protected]/msg22196.html: void blk_mq_complete_request(struct request *rq) [ ... ] + if (blk_mq_change_rq_state(rq, MQ_RQ_IN_FLIGHT, + MQ_RQ_COMPLETE)) { + __blk_mq_complete_request(rq); + break; + } + if (blk_mq_change_rq_state(rq, MQ_RQ_TIMED_OUT, MQ_RQ_COMPLETE)) + break; [ ... ] @@ -838,25 +838,42 @@ static void blk_mq_rq_timed_out(struct request *req, bool reserved) [ ... ] case BLK_EH_RESET_TIMER: [ ... ] + if (blk_mq_rq_state(req) == MQ_RQ_COMPLETE) { + __blk_mq_complete_request(req); + break; + } Bart.
