diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-09-17 23:31:27 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-09-17 23:31:27 -0400 |
commit | 850d71acd52cd331474116fbd60cf8b3f3ded93e (patch) | |
tree | a4e4412794927eb053a440769510c453d046c43d /fs/autofs/expire.c | |
parent | c3aed16680cd0c0e5abf1bfc0dc1338e6a41b29f (diff) | |
download | linux-850d71acd52cd331474116fbd60cf8b3f3ded93e.tar.bz2 |
autofs: don't bother with atomics for ino->count
All writers are serialized on inode->i_rwsem. So are the readers
outside of expire.c. And the readers in expire.c are in the
code that really doesn't care about narrow races - it's looking
for expiry candidates and its callers have to cope with the
possibility of a good candidate becoming busy right under them.
No point bothering with atomic operations - just use int and
mark the non-serialized readers with READ_ONCE().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs/expire.c')
-rw-r--r-- | fs/autofs/expire.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/autofs/expire.c b/fs/autofs/expire.c index 2866fabf497f..31d616aa6fc9 100644 --- a/fs/autofs/expire.c +++ b/fs/autofs/expire.c @@ -211,7 +211,7 @@ static int autofs_tree_busy(struct vfsmount *mnt, } } else { struct autofs_info *ino = autofs_dentry_ino(p); - unsigned int ino_count = atomic_read(&ino->count); + unsigned int ino_count = READ_ONCE(ino->count); /* allow for dget above and top is already dgot */ if (p == top) @@ -379,7 +379,7 @@ static struct dentry *should_expire(struct dentry *dentry, /* Not a forced expire? */ if (!(how & AUTOFS_EXP_FORCED)) { /* ref-walk currently on this dentry? */ - ino_count = atomic_read(&ino->count) + 1; + ino_count = READ_ONCE(ino->count) + 1; if (d_count(dentry) > ino_count) return NULL; } @@ -396,7 +396,7 @@ static struct dentry *should_expire(struct dentry *dentry, /* Not a forced expire? */ if (!(how & AUTOFS_EXP_FORCED)) { /* ref-walk currently on this dentry? */ - ino_count = atomic_read(&ino->count) + 1; + ino_count = READ_ONCE(ino->count) + 1; if (d_count(dentry) > ino_count) return NULL; } |