Commit f3fa7f02 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'io_uring-6.3-2023-03-30' of git://git.kernel.dk/linux

Pull io_uring fixes from Jens Axboe:

 - Fix a regression with the poll retry, introduced in this merge window
   (me)

 - Fix a regression with the alloc cache not decrementing the member
   count on removal. Also a regression from this merge window (Pavel)

 - Fix race around rsrc node grabbing (Pavel)

* tag 'io_uring-6.3-2023-03-30' of git://git.kernel.dk/linux:
  io_uring: fix poll/netmsg alloc caches
  io_uring/rsrc: fix rogue rsrc node grabbing
  io_uring/poll: clear single/double poll flags on poll arming
parents 2bac7dc1 fd30d1cd
...@@ -27,6 +27,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c ...@@ -27,6 +27,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c
struct hlist_node *node = cache->list.first; struct hlist_node *node = cache->list.first;
hlist_del(node); hlist_del(node);
cache->nr_cached--;
return container_of(node, struct io_cache_entry, node); return container_of(node, struct io_cache_entry, node);
} }
......
...@@ -726,6 +726,7 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags) ...@@ -726,6 +726,7 @@ int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags)
apoll = io_req_alloc_apoll(req, issue_flags); apoll = io_req_alloc_apoll(req, issue_flags);
if (!apoll) if (!apoll)
return IO_APOLL_ABORTED; return IO_APOLL_ABORTED;
req->flags &= ~(REQ_F_SINGLE_POLL | REQ_F_DOUBLE_POLL);
req->flags |= REQ_F_POLLED; req->flags |= REQ_F_POLLED;
ipt.pt._qproc = io_async_queue_proc; ipt.pt._qproc = io_async_queue_proc;
......
...@@ -144,15 +144,13 @@ static inline void io_req_set_rsrc_node(struct io_kiocb *req, ...@@ -144,15 +144,13 @@ static inline void io_req_set_rsrc_node(struct io_kiocb *req,
unsigned int issue_flags) unsigned int issue_flags)
{ {
if (!req->rsrc_node) { if (!req->rsrc_node) {
req->rsrc_node = ctx->rsrc_node; io_ring_submit_lock(ctx, issue_flags);
if (!(issue_flags & IO_URING_F_UNLOCKED)) { lockdep_assert_held(&ctx->uring_lock);
lockdep_assert_held(&ctx->uring_lock);
io_charge_rsrc_node(ctx); req->rsrc_node = ctx->rsrc_node;
} else { io_charge_rsrc_node(ctx);
percpu_ref_get(&req->rsrc_node->refs); io_ring_submit_unlock(ctx, issue_flags);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment