@@ -923,34 +923,14 @@ static bool blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,
923
923
unsigned long * next = priv ;
924
924
925
925
/*
926
- * Just do a quick check if it is expired before locking the request in
927
- * so we're not unnecessarilly synchronizing across CPUs.
928
- */
929
- if (!blk_mq_req_expired (rq , next ))
930
- return true;
931
-
932
- /*
933
- * We have reason to believe the request may be expired. Take a
934
- * reference on the request to lock this request lifetime into its
935
- * currently allocated context to prevent it from being reallocated in
936
- * the event the completion by-passes this timeout handler.
937
- *
938
- * If the reference was already released, then the driver beat the
939
- * timeout handler to posting a natural completion.
940
- */
941
- if (!refcount_inc_not_zero (& rq -> ref ))
942
- return true;
943
-
944
- /*
945
- * The request is now locked and cannot be reallocated underneath the
946
- * timeout handler's processing. Re-verify this exact request is truly
947
- * expired; if it is not expired, then the request was completed and
948
- * reallocated as a new request.
926
+ * blk_mq_queue_tag_busy_iter() has locked the request, so it cannot
927
+ * be reallocated underneath the timeout handler's processing, then
928
+ * the expire check is reliable. If the request is not expired, then
929
+ * it was completed and reallocated as a new request after returning
930
+ * from blk_mq_check_expired().
949
931
*/
950
932
if (blk_mq_req_expired (rq , next ))
951
933
blk_mq_rq_timed_out (rq , reserved );
952
-
953
- blk_mq_put_rq_ref (rq );
954
934
return true;
955
935
}
956
936
0 commit comments