On Wed, 18 Jan 2023 17:37:13 +0800, Kemeng Shi wrote: > Commit 1f5bd336b9150 ("blk-mq: add blk_mq_alloc_request_hctx") add > blk_mq_alloc_request_hctx to send commands to a specific queue. If > BLK_MQ_REQ_NOWAIT is not set in tag allocation, we may change to different > hctx after sleep and get tag from unexpected hctx. So BLK_MQ_REQ_NOWAIT > must be set in flags for blk_mq_alloc_request_hctx. > After commit 600c3b0cea784 ("blk-mq: open code __blk_mq_alloc_request in > blk_mq_alloc_request_hctx"), blk_mq_alloc_request_hctx return -EINVAL > if both BLK_MQ_REQ_NOWAIT and BLK_MQ_REQ_RESERVED are not set instead of > if BLK_MQ_REQ_NOWAIT is not set. So if BLK_MQ_REQ_NOWAIT is not set and > BLK_MQ_REQ_RESERVED is set, blk_mq_alloc_request_hctx could alloc tag > from unexpected hctx. I guess what we need here is that return -EINVAL > if either BLK_MQ_REQ_NOWAIT or BLK_MQ_REQ_RESERVED is not set. > > [...] Applied, thanks! [01/14] blk-mq: avoid sleep in blk_mq_alloc_request_hctx commit: 6ee858a3d3270a68902d66bb47c151a83622535c [02/14] blk-mq: remove stale comment for blk_mq_sched_mark_restart_hctx commit: c31e76bcc379182fe67a82c618493b7b8868c672 [03/14] blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait commit: 98b99e9412d0cde8c7b442bf5efb09528a2ede8b [04/14] blk-mq: Fix potential io hung for shared sbitmap per tagset commit: 47df9ce95cd568d3f84218c4f65e9fbd4dfeda55 [05/14] blk-mq: remove unnecessary list_empty check in blk_mq_try_issue_list_directly commit: 08e3599e7401a7eae5e68f5e2601cc4a4e53951b [06/14] blk-mq: remove unncessary from_schedule parameter in blk_mq_plug_issue_direct commit: 3e368fb023ffab83404f628d02789550d79eca9c [07/14] blk-mq: make blk_mq_commit_rqs a general function for all commits commit: 34c9f547402f11c0241a44800574ec4fa38cccb8 [08/14] blk-mq: remove unncessary error count and commit in blk_mq_plug_issue_direct commit: 0d617a83e8d4d3149d76cc074d9779a3b0ee7baf [09/14] blk-mq: use blk_mq_commit_rqs helper in blk_mq_try_issue_list_directly commit: 984ce0a7d75b577fd84f2cc7a83e6e2d2503f90e [10/14] blk-mq: simplify flush check in blk_mq_dispatch_rq_list commit: e4ef2e05e0020db0d61b2cf451ef38a2bba33910 [11/14] blk-mq: remove unnecessary error count and check in blk_mq_dispatch_rq_list commit: 4ea58fe456c21bb259a7cbf8498946f86e9b84aa [12/14] blk-mq: remove set of bd->last when get driver tag for next request fails commit: f1ce99f7098d9e7a322caf48eb8af05be7999827 [13/14] blk-mq: use switch/case to improve readability in blk_mq_try_issue_list_directly commit: 27e8b2bb149aff7b7b673b46c7206f4f37c30093 [14/14] blk-mq: correct stale comment of .get_budget commit: 01542f651a9f58a9b176c3d3dc3eefbacee53b78 Best regards, -- Jens Axboe