Skip to content

Commit a031980

Browse files
committed
Merge branch 'io_uring-6.16' into for-next
* io_uring-6.16: Revert "io_uring: gate REQ_F_ISREG on !S_ANON_INODE as well" io_uring/msg_ring: ensure io_kiocb freeing is deferred for RCU
2 parents f3d9f10 + 9dff55e commit a031980

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

include/linux/io_uring_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ struct io_kiocb {
703703
struct hlist_node hash_node;
704704
/* For IOPOLL setup queues, with hybrid polling */
705705
u64 iopoll_start;
706+
/* for private io_kiocb freeing */
707+
struct rcu_head rcu_head;
706708
};
707709
/* internal polling, see IORING_FEAT_FAST_POLL */
708710
struct async_poll *apoll;

io_uring/io_uring.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,12 +1706,11 @@ static void io_iopoll_req_issued(struct io_kiocb *req, unsigned int issue_flags)
17061706

17071707
io_req_flags_t io_file_get_flags(struct file *file)
17081708
{
1709-
struct inode *inode = file_inode(file);
17101709
io_req_flags_t res = 0;
17111710

17121711
BUILD_BUG_ON(REQ_F_ISREG_BIT != REQ_F_SUPPORT_NOWAIT_BIT + 1);
17131712

1714-
if (S_ISREG(inode->i_mode) && !(inode->i_flags & S_ANON_INODE))
1713+
if (S_ISREG(file_inode(file)->i_mode))
17151714
res |= REQ_F_ISREG;
17161715
if ((file->f_flags & O_NONBLOCK) || (file->f_mode & FMODE_NOWAIT))
17171716
res |= REQ_F_SUPPORT_NOWAIT;

io_uring/msg_ring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ static void io_msg_tw_complete(struct io_kiocb *req, io_tw_token_t tw)
8282
spin_unlock(&ctx->msg_lock);
8383
}
8484
if (req)
85-
kmem_cache_free(req_cachep, req);
85+
kfree_rcu(req, rcu_head);
8686
percpu_ref_put(&ctx->refs);
8787
}
8888

8989
static int io_msg_remote_post(struct io_ring_ctx *ctx, struct io_kiocb *req,
9090
int res, u32 cflags, u64 user_data)
9191
{
9292
if (!READ_ONCE(ctx->submitter_task)) {
93-
kmem_cache_free(req_cachep, req);
93+
kfree_rcu(req, rcu_head);
9494
return -EOWNERDEAD;
9595
}
9696
req->opcode = IORING_OP_NOP;

0 commit comments

Comments
 (0)