提交 2ff396be 编写于 作者: J Jeff Moyer 提交者: Benjamin LaHaise

aio: add missing smp_rmb() in read_events_ring

We ran into a case on ppc64 running mariadb where io_getevents would
return zeroed out I/O events.  After adding instrumentation, it became
clear that there was some missing synchronization between reading the
tail pointer and the events themselves.  This small patch fixes the
problem in testing.

Thanks to Zach for helping to look into this, and suggesting the fix.
Signed-off-by: NJeff Moyer <jmoyer@redhat.com>
Signed-off-by: NBenjamin LaHaise <bcrl@kvack.org>
Cc: stable@vger.kernel.org
上级 7be141d0
...@@ -1111,6 +1111,12 @@ static long aio_read_events_ring(struct kioctx *ctx, ...@@ -1111,6 +1111,12 @@ static long aio_read_events_ring(struct kioctx *ctx,
tail = ring->tail; tail = ring->tail;
kunmap_atomic(ring); kunmap_atomic(ring);
/*
* Ensure that once we've read the current tail pointer, that
* we also see the events that were stored up to the tail.
*/
smp_rmb();
pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events);
if (head == tail) if (head == tail)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册