summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2025-07-13 22:33:58 +0800
committerJens Axboe <axboe@kernel.dk>2025-07-15 08:04:16 -0600
commit7074feeca41d09713d70e619a34d9e7b4e219f8c (patch)
tree4623678072bcb572823a56de16589b7fdd9d35b5
parentdd7a8507319e22141fa2e107d81cba18a4007d92 (diff)
ublk: move fake timeout logic into __ublk_complete_rq()
Almost every block driver deals with fake timeout logic around real request completion code. Also the existing way may cause request reference count leak, so move the logic into __ublk_complete_rq(), then we can skip the completion in the last step like other drivers. Reviewed-by: Caleb Sander Mateos <csander@purestorage.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250713143415.2857561-4-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/ublk_drv.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 7d1d8bd979c5..73c6c8d3b117 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1155,7 +1155,7 @@ static inline void __ublk_complete_rq(struct request *req)
if (blk_update_request(req, BLK_STS_OK, io->res))
blk_mq_requeue_request(req, true);
- else
+ else if (likely(!blk_should_fake_timeout(req->q)))
__blk_mq_end_request(req, BLK_STS_OK);
return;
@@ -2237,9 +2237,6 @@ static int ublk_commit_and_fetch(const struct ublk_queue *ubq,
if (req_op(req) == REQ_OP_ZONE_APPEND)
req->__sector = ub_cmd->zone_append_lba;
- if (unlikely(blk_should_fake_timeout(req->q)))
- return 0;
-
if (ublk_need_req_ref(ubq))
ublk_sub_req_ref(io, req);
else