summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-04-01 15:43:57 +0100
committerJens Axboe <axboe@kernel.dk>2021-04-11 19:30:34 -0600
commite07785b0029165fdb1c72ac12fe42801ba5f9f61 (patch)
treee0e0d0d23881bb82243046af172b6ebe1ed4a34a /fs/io_uring.c
parent47e90392c8ad982c25f58125e9be3fc4d476b9ed (diff)
downloadlwn-e07785b0029165fdb1c72ac12fe42801ba5f9f61.tar.gz
lwn-e07785b0029165fdb1c72ac12fe42801ba5f9f61.zip
io_uring: lock annotate timeouts and poll
Add timeout and poll ->comletion_lock annotations for Sparse, makes life easier while looking at the functions. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/2345325643093d41543383ba985a735aeb899eac.1617287883.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 913929d9d05a..7c5c3d46c6b7 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4885,6 +4885,7 @@ static struct io_poll_iocb *io_poll_get_single(struct io_kiocb *req)
}
static void io_poll_remove_double(struct io_kiocb *req)
+ __must_hold(&req->ctx->completion_lock)
{
struct io_poll_iocb *poll = io_poll_get_double(req);
@@ -4903,6 +4904,7 @@ static void io_poll_remove_double(struct io_kiocb *req)
}
static bool io_poll_complete(struct io_kiocb *req, __poll_t mask, int error)
+ __must_hold(&req->ctx->completion_lock)
{
struct io_ring_ctx *ctx = req->ctx;
unsigned flags = IORING_CQE_F_MORE;
@@ -5208,6 +5210,7 @@ static bool io_arm_poll_handler(struct io_kiocb *req)
static bool __io_poll_remove_one(struct io_kiocb *req,
struct io_poll_iocb *poll, bool do_cancel)
+ __must_hold(&req->ctx->completion_lock)
{
bool do_complete = false;
@@ -5226,6 +5229,7 @@ static bool __io_poll_remove_one(struct io_kiocb *req,
}
static bool io_poll_remove_waitqs(struct io_kiocb *req)
+ __must_hold(&req->ctx->completion_lock)
{
bool do_complete;
@@ -5249,6 +5253,7 @@ static bool io_poll_remove_waitqs(struct io_kiocb *req)
}
static bool io_poll_remove_one(struct io_kiocb *req)
+ __must_hold(&req->ctx->completion_lock)
{
bool do_complete;
@@ -5292,6 +5297,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
}
static struct io_kiocb *io_poll_find(struct io_ring_ctx *ctx, __u64 sqe_addr)
+ __must_hold(&ctx->completion_lock)
{
struct hlist_head *list;
struct io_kiocb *req;
@@ -5307,6 +5313,7 @@ static struct io_kiocb *io_poll_find(struct io_ring_ctx *ctx, __u64 sqe_addr)
}
static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr)
+ __must_hold(&ctx->completion_lock)
{
struct io_kiocb *req;
@@ -5513,6 +5520,7 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer)
static struct io_kiocb *io_timeout_extract(struct io_ring_ctx *ctx,
__u64 user_data)
+ __must_hold(&ctx->completion_lock)
{
struct io_timeout_data *io;
struct io_kiocb *req;
@@ -5537,6 +5545,7 @@ static struct io_kiocb *io_timeout_extract(struct io_ring_ctx *ctx,
}
static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data)
+ __must_hold(&ctx->completion_lock)
{
struct io_kiocb *req = io_timeout_extract(ctx, user_data);
@@ -5551,6 +5560,7 @@ static int io_timeout_cancel(struct io_ring_ctx *ctx, __u64 user_data)
static int io_timeout_update(struct io_ring_ctx *ctx, __u64 user_data,
struct timespec64 *ts, enum hrtimer_mode mode)
+ __must_hold(&ctx->completion_lock)
{
struct io_kiocb *req = io_timeout_extract(ctx, user_data);
struct io_timeout_data *data;