diff options
| author | Jens Axboe <axboe@kernel.dk> | 2025-04-16 13:25:03 -0600 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-04-21 05:06:58 -0600 |
| commit | 8a2dacd49f1d19f4e3a4ebc99d11622cafd1659e (patch) | |
| tree | ff0b54219dbc6ca2a331631c8f41ae24aee543d0 /io_uring/rsrc.c | |
| parent | 53db8a71ecb42c2ec5e9c6925269a750255f9af5 (diff) | |
io_uring/rsrc: remove node assignment helpers
There are two helpers here, one assigns and increments the node ref
count, and the other is simply a wrapper around that for the buffer node
handling.
The buffer node assignment benefits from checking and setting
REQ_F_BUF_NODE together, otherwise stalls have been observed on setting
that flag later in the process. Hence re-do it so that it's set when
checked, and cleared in case of (unlikely) failure. With that, the
buffer node helper can go, and then drop the generic
io_req_assign_rsrc_node() helper as well as there's only a single user
of it left at that point.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/rsrc.c')
| -rw-r--r-- | io_uring/rsrc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index f80a77c4973f..107064c9c6fc 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1110,13 +1110,19 @@ inline struct io_rsrc_node *io_find_buf_node(struct io_kiocb *req, if (req->flags & REQ_F_BUF_NODE) return req->buf_node; + req->flags |= REQ_F_BUF_NODE; io_ring_submit_lock(ctx, issue_flags); node = io_rsrc_node_lookup(&ctx->buf_table, req->buf_index); - if (node) - io_req_assign_buf_node(req, node); + if (node) { + node->refs++; + req->buf_node = node; + io_ring_submit_unlock(ctx, issue_flags); + return node; + } + req->flags &= ~REQ_F_BUF_NODE; io_ring_submit_unlock(ctx, issue_flags); - return node; + return NULL; } int io_import_reg_buf(struct io_kiocb *req, struct iov_iter *iter, |
