[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <0fbdd4f77c9051e4f23b943aa8d373d151679f0d.1411724724.git.jslaby@suse.cz>
Date: Fri, 26 Sep 2014 11:45:52 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Jeff Moyer <jmoyer@...hat.com>,
Benjamin LaHaise <bcrl@...ck.org>, Jiri Slaby <jslaby@...e.cz>
Subject: [PATCH 3.12 141/142] aio: add missing smp_rmb() in read_events_ring
From: Jeff Moyer <jmoyer@...hat.com>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
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@...hat.com>
Signed-off-by: Benjamin LaHaise <bcrl@...ck.org>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
fs/aio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/aio.c b/fs/aio.c
index 6d68e01dc7ca..b732a9c32042 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1065,6 +1065,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)
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists