[PATCH] ublk: remove "can't touch 'ublk_io' any more" comments

Caleb Sander Mateos posted 1 patch 1 week ago
drivers/block/ublk_drv.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] ublk: remove "can't touch 'ublk_io' any more" comments
Posted by Caleb Sander Mateos 1 week ago
The struct ublk_io is in fact accessed in __ublk_complete_rq() after the
comment. But it's not racy to access the ublk_io between clearing its
UBLK_IO_FLAG_OWNED_BY_SRV flag and completing the request, as no other
thread can use the ublk_io in the meantime.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 drivers/block/ublk_drv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 5efaf53261ce..1c8699ea7abd 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -3336,11 +3336,10 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
 		ret = ublk_config_io_buf(ub, io, cmd, addr, &buf_idx);
 		if (buf_idx != UBLK_INVALID_BUF_IDX)
 			io_buffer_unregister_bvec(cmd, buf_idx, issue_flags);
 		compl = ublk_need_complete_req(ub, io);
 
-		/* can't touch 'ublk_io' any more */
 		if (req_op(req) == REQ_OP_ZONE_APPEND)
 			req->__sector = addr;
 		if (compl)
 			__ublk_complete_rq(req, io, ublk_dev_need_map_io(ub), NULL);
 
@@ -3668,11 +3667,10 @@ static int ublk_batch_commit_io(struct ublk_queue *ubq,
 			__func__, data->ub->dev_info.dev_id, ubq->q_id,
 			elem->tag, ret);
 		return ret;
 	}
 
-	/* can't touch 'ublk_io' any more */
 	if (buf_idx != UBLK_INVALID_BUF_IDX)
 		io_buffer_unregister_bvec(data->cmd, buf_idx, data->issue_flags);
 	if (req_op(req) == REQ_OP_ZONE_APPEND)
 		req->__sector = ublk_batch_zone_lba(uc, elem);
 	if (compl)
-- 
2.45.2
Re: [PATCH] ublk: remove "can't touch 'ublk_io' any more" comments
Posted by Jens Axboe 6 days, 22 hours ago
On Fri, 30 Jan 2026 08:25:30 -0700, Caleb Sander Mateos wrote:
> The struct ublk_io is in fact accessed in __ublk_complete_rq() after the
> comment. But it's not racy to access the ublk_io between clearing its
> UBLK_IO_FLAG_OWNED_BY_SRV flag and completing the request, as no other
> thread can use the ublk_io in the meantime.
> 
> 

Applied, thanks!

[1/1] ublk: remove "can't touch 'ublk_io' any more" comments
      commit: 491af20b3c6d5baedb96357d4b12232ae490cbe7

Best regards,
-- 
Jens Axboe
Re: [PATCH] ublk: remove "can't touch 'ublk_io' any more" comments
Posted by Ming Lei 1 week ago
On Fri, Jan 30, 2026 at 11:25 PM Caleb Sander Mateos
<csander@purestorage.com> wrote:
>
> The struct ublk_io is in fact accessed in __ublk_complete_rq() after the
> comment. But it's not racy to access the ublk_io between clearing its
> UBLK_IO_FLAG_OWNED_BY_SRV flag and completing the request, as no other
> thread can use the ublk_io in the meantime.
>
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,