diff options
author | Jeff Moyer <jmoyer@redhat.com> | 2014-09-02 19:17:00 +0200 |
---|---|---|
committer | Benjamin LaHaise <bcrl@kvack.org> | 2014-09-02 21:20:03 +0200 |
commit | 2ff396be602f10b5eab8e73b24f20348fa2de159 (patch) | |
tree | bdc814b8e0a170f1c852553230b32d888cf7fa5a /fs/aio.c | |
parent | Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/ker... (diff) | |
download | linux-2ff396be602f10b5eab8e73b24f20348fa2de159.tar.xz linux-2ff396be602f10b5eab8e73b24f20348fa2de159.zip |
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: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Cc: stable@vger.kernel.org
Diffstat (limited to '')
-rw-r--r-- | fs/aio.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1111,6 +1111,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) |