aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2023-10-30 01:06:06 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2023-11-25 02:34:12 -0500
commitc2e5e29f3fdaff6f57795be068ce525c60954fd0 (patch)
treee2b9208f66a15d5ed727d127e26444a1d7d2fb5d /fs/dcache.c
parent5e7a5c8d17d94216aed205cb0f20cd32adfd4487 (diff)
downloadlinux-c2e5e29f3fdaff6f57795be068ce525c60954fd0.tar.gz
to_shrink_list(): call only if refcount is 0
The only thing it does if refcount is not zero is d_lru_del(); no point, IMO, seeing that plain dput() does nothing of that sort... Note that 2 of 3 current callers are guaranteed that refcount is 0. Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 5284b02747cd9..704676bf06fd5 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -915,8 +915,7 @@ __must_hold(&dentry->d_lock)
if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
if (dentry->d_flags & DCACHE_LRU_LIST)
d_lru_del(dentry);
- if (!dentry->d_lockref.count)
- d_shrink_add(dentry, list);
+ d_shrink_add(dentry, list);
}
}
@@ -1115,10 +1114,8 @@ EXPORT_SYMBOL(d_prune_aliases);
static inline void shrink_kill(struct dentry *victim, struct list_head *list)
{
struct dentry *parent = victim->d_parent;
- if (parent != victim) {
- --parent->d_lockref.count;
+ if (parent != victim && !--parent->d_lockref.count)
to_shrink_list(parent, list);
- }
__dentry_kill(victim);
}