* [PATCH] vfs, freeze: use ACCESS_ONCE() to guard access to ->mnt_flags
@ 2012-11-16 9:23 Miao Xie
2012-11-16 13:25 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: Miao Xie @ 2012-11-16 9:23 UTC (permalink / raw)
To: Linux Fsdevel; +Cc: Jan Kara, Al Viro
The compiler may optimize the while loop and make the check just be done once,
so we should use ACCESS_ONCE() to guard access to ->mnt_flags
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 7bdf790..6eca68e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -311,7 +311,7 @@ int __mnt_want_write(struct vfsmount *m)
* incremented count after it has set MNT_WRITE_HOLD.
*/
smp_mb();
- while (mnt->mnt.mnt_flags & MNT_WRITE_HOLD)
+ while (ACCESS_ONCE(mnt->mnt.mnt_flags) & MNT_WRITE_HOLD)
cpu_relax();
/*
* After the slowpath clears MNT_WRITE_HOLD, mnt_is_readonly will
--
1.7.11.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vfs, freeze: use ACCESS_ONCE() to guard access to ->mnt_flags
2012-11-16 9:23 [PATCH] vfs, freeze: use ACCESS_ONCE() to guard access to ->mnt_flags Miao Xie
@ 2012-11-16 13:25 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2012-11-16 13:25 UTC (permalink / raw)
To: Miao Xie; +Cc: Linux Fsdevel, Jan Kara
On Fri, Nov 16, 2012 at 05:23:50PM +0800, Miao Xie wrote:
> The compiler may optimize the while loop and make the check just be done once,
> so we should use ACCESS_ONCE() to guard access to ->mnt_flags
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-16 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 9:23 [PATCH] vfs, freeze: use ACCESS_ONCE() to guard access to ->mnt_flags Miao Xie
2012-11-16 13:25 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).