Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1608298

[PATCH 2/2] fs/aio.c: use READ_ONCE instead of ACCESS_ONCE for kiocb->ki_cancel

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Emilio Cobos Álvarez <emilio@crisal.io>
Newsgroups linux.kernel
Subject [PATCH 2/2] fs/aio.c: use READ_ONCE instead of ACCESS_ONCE for kiocb->ki_cancel
Date Fri, 24 Mar 2017 11:30:02 +0100
Message-ID <touDM-64-21@gated-at.bofh.it> (permalink)
References <touDM-64-19@gated-at.bofh.it>
X-Original-To linux-kernel@vger.kernel.org, Benjamin LaHaise <bcrl@kvack.org>, linux-aio@kvack.org
Authentication-Results mail.emiliocobos.net; dmarc=none header.from=crisal.io
X-Mailer git-send-email 2.12.1
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 26
Organization linux.* mail to news gateway
X-Original-Cc Emilio Cobos Álvarez <emilio@crisal.io>
X-Original-Date Fri, 24 Mar 2017 11:14:52 +0100
X-Original-Message-ID <20170324101452.19832-2-emilio@crisal.io>
X-Original-References <20170324101452.19832-1-emilio@crisal.io>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1608298

Show key headers only | View raw


This is suggested by checkpath, but thought that wasn't as trivial as the
previous patch and deserved a bit more thought.

AIUI, this should prevent the compiler reordering the assignment in the same
way, so let's just use it.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
---
 fs/aio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index be0ca6d9a6b3..dce62ed78c5c 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -578,7 +578,7 @@ static int kiocb_cancel(struct aio_kiocb *kiocb)
 	 * actually has a cancel function, hence the cmpxchg()
 	 */
 
-	cancel = ACCESS_ONCE(kiocb->ki_cancel);
+	cancel = READ_ONCE(kiocb->ki_cancel);
 	do {
 		if (!cancel || cancel == KIOCB_CANCELLED)
 			return -EINVAL;
-- 
2.12.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 2/2] fs/aio.c: use READ_ONCE instead of ACCESS_ONCE for kiocb->ki_cancel Emilio Cobos Álvarez <emilio@crisal.io> - 2017-03-24 11:30 +0100

csiph-web