summaryrefslogtreecommitdiffstats
path: root/io_uring/io_uring.h
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2022-11-23 12:33:41 +0100
committerJens Axboe <axboe@kernel.dk>2022-11-23 18:45:31 +0100
commit1bec951c3809051f64a6957fe86d1b4786cc0313 (patch)
tree7964364c1c55aea528254617dc80a3c6e6fd14ad /io_uring/io_uring.h
parentio_uring: inline __io_req_complete_put() (diff)
downloadlinux-1bec951c3809051f64a6957fe86d1b4786cc0313.tar.xz
linux-1bec951c3809051f64a6957fe86d1b4786cc0313.zip
io_uring: iopoll protect complete_post
io_req_complete_post() may be used by iopoll enabled rings, grab locks in this case. That requires to pass issue_flags to propagate the locking state. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/cc6d854065c57c838ca8e8806f707a226b70fd2d.1669203009.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/io_uring.h')
-rw-r--r--io_uring/io_uring.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 222af88df10f..b5b80bf03385 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -31,14 +31,20 @@ int io_run_task_work_sig(struct io_ring_ctx *ctx);
int __io_run_local_work(struct io_ring_ctx *ctx, bool *locked);
int io_run_local_work(struct io_ring_ctx *ctx);
void io_req_complete_failed(struct io_kiocb *req, s32 res);
-void __io_req_complete(struct io_kiocb *req, unsigned issue_flags);
-void io_req_complete_post(struct io_kiocb *req);
+void io_req_complete_post(struct io_kiocb *req, unsigned issue_flags);
bool io_post_aux_cqe(struct io_ring_ctx *ctx, u64 user_data, s32 res, u32 cflags,
bool allow_overflow);
bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, s32 res, u32 cflags,
bool allow_overflow);
void __io_commit_cqring_flush(struct io_ring_ctx *ctx);
+static inline void io_req_complete_post_tw(struct io_kiocb *req, bool *locked)
+{
+ unsigned flags = *locked ? 0 : IO_URING_F_UNLOCKED;
+
+ io_req_complete_post(req, flags);
+}
+
struct page **io_pin_pages(unsigned long ubuf, unsigned long len, int *npages);
struct file *io_file_get_normal(struct io_kiocb *req, int fd);