[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1520363106-4687-3-git-send-email-will.deacon@arm.com>
Date: Tue, 6 Mar 2018 19:05:06 +0000
From: Will Deacon <will.deacon@....com>
To: linux-fsdevel@...r.kernel.org, viro@...iv.linux.org.uk,
torvalds@...ux-foundation.org
Cc: peterz@...radead.org, willy@...radead.org,
linux-kernel@...r.kernel.org, Will Deacon <will.deacon@....com>
Subject: [RESEND PATCHv2 2/2] fs: dcache: Use READ_ONCE when accessing i_dir_seq
i_dir_seq is subject to concurrent modification by a cmpxchg or
store-release operation, so ensure that the relaxed access in
d_alloc_parallel uses READ_ONCE.
Reported-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Will Deacon <will.deacon@....com>
---
fs/dcache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dcache.c b/fs/dcache.c
index b243deec298c..5716ab04e1db 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2502,7 +2502,7 @@ struct dentry *d_alloc_parallel(struct dentry *parent,
}
hlist_bl_lock(b);
- if (unlikely(parent->d_inode->i_dir_seq != seq)) {
+ if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) {
hlist_bl_unlock(b);
rcu_read_unlock();
goto retry;
--
2.1.4
Powered by blists - more mailing lists