aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Moyer <jmoyer@redhat.com>2014-09-02 13:17:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-05 13:40:52 -0700
commite7ac34bf5e041dbeb7596d5db91fd7e4c300da96 (patch)
tree8e2095a359d46bdd64bd8069c779d4814e1c8ccc /fs
parentb1fd18c3caf2439f18c7fd35421371f2e983f3b8 (diff)
aio: add missing smp_rmb() in read_events_ring
commit 2ff396be602f10b5eab8e73b24f20348fa2de159 upstream. 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: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 65c96caeb52..ce0818223dc 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1134,6 +1134,12 @@ static long aio_read_events_ring(struct kioctx *ctx,
tail = ring->tail;
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);
if (head == tail)