summaryrefslogtreecommitdiffstats
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorJackie Liu <liuyun01@kylinos.cn>2019-05-16 05:46:30 +0200
committerJens Axboe <axboe@kernel.dk>2019-05-16 16:10:25 +0200
commitdc6ce4bc2b355a47f225a0205046b3ebf29a7f72 (patch)
tree78492c45930982a9d1fae0ce6eed67c2a92597b1 /fs/io_uring.c
parentio_uring: fix infinite wait in khread_park() on io_finish_async() (diff)
downloadlinux-dc6ce4bc2b355a47f225a0205046b3ebf29a7f72.tar.xz
linux-dc6ce4bc2b355a47f225a0205046b3ebf29a7f72.zip
io_uring: adjust smp_rmb inside io_cqring_events
Whenever smp_rmb is required to use io_cqring_events, keep smp_rmb inside the function io_cqring_events. Signed-off-by: Jackie Liu <liuyun01@kylinos.cn> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 67d1aae349d7..9cc7a101ef2a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2167,6 +2167,8 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
static unsigned io_cqring_events(struct io_cq_ring *ring)
{
+ /* See comment at the top of this file */
+ smp_rmb();
return READ_ONCE(ring->r.tail) - READ_ONCE(ring->r.head);
}
@@ -2182,8 +2184,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
DEFINE_WAIT(wait);
int ret;
- /* See comment at the top of this file */
- smp_rmb();
if (io_cqring_events(ring) >= min_events)
return 0;
@@ -2205,8 +2205,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
prepare_to_wait(&ctx->wait, &wait, TASK_INTERRUPTIBLE);
ret = 0;
- /* See comment at the top of this file */
- smp_rmb();
if (io_cqring_events(ring) >= min_events)
break;