diff options
author | He Kuang <hekuang@huawei.com> | 2016-03-26 05:12:10 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-06-30 23:30:35 -0400 |
commit | ae0a843c740b4e63684eefae96097cf62d9b7a14 (patch) | |
tree | 9969977bb9c255981b82501e9678cee997914161 | |
parent | c074cefcc0f75152bc74a1c4f2e7b662f09403d4 (diff) |
dentry_cmp(): use lockless_dereference() instead of smp_read_barrier_depends()
lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends().
Signed-off-by: He Kuang <hekuang@huawei.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/dcache.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index e5c8ba76d426..dc37c0238b46 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -226,10 +226,9 @@ static inline int dentry_string_cmp(const unsigned char *cs, const unsigned char | |||
226 | 226 | ||
227 | static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount) | 227 | static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *ct, unsigned tcount) |
228 | { | 228 | { |
229 | const unsigned char *cs; | ||
230 | /* | 229 | /* |
231 | * Be careful about RCU walk racing with rename: | 230 | * Be careful about RCU walk racing with rename: |
232 | * use ACCESS_ONCE to fetch the name pointer. | 231 | * use 'lockless_dereference' to fetch the name pointer. |
233 | * | 232 | * |
234 | * NOTE! Even if a rename will mean that the length | 233 | * NOTE! Even if a rename will mean that the length |
235 | * was not loaded atomically, we don't care. The | 234 | * was not loaded atomically, we don't care. The |
@@ -243,8 +242,8 @@ static inline int dentry_cmp(const struct dentry *dentry, const unsigned char *c | |||
243 | * early because the data cannot match (there can | 242 | * early because the data cannot match (there can |
244 | * be no NUL in the ct/tcount data) | 243 | * be no NUL in the ct/tcount data) |
245 | */ | 244 | */ |
246 | cs = ACCESS_ONCE(dentry->d_name.name); | 245 | const unsigned char *cs = lockless_dereference(dentry->d_name.name); |
247 | smp_read_barrier_depends(); | 246 | |
248 | return dentry_string_cmp(cs, ct, tcount); | 247 | return dentry_string_cmp(cs, ct, tcount); |
249 | } | 248 | } |
250 | 249 | ||