From: Al Viro Date: Mon, 24 Feb 2025 01:50:42 +0000 (-0500) Subject: shmem: no dentry retention past the refcount reaching zero X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3542920b91831974e3b9b3ce4bc083657a4f43d6;p=thirdparty%2Fkernel%2Fstable.git shmem: no dentry retention past the refcount reaching zero Just set DCACHE_DONTCACHE in ->s_d_flags and be done with that. Dentries there live for as long as they are pinned; once the refcount hits zero, that's it. The same, of course, goes for other tree-in-dcache filesystems - more in the next commits... Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- diff --git a/mm/shmem.c b/mm/shmem.c index 3583508800fc0..94b2b4264607c 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4980,7 +4980,6 @@ static void shmem_put_super(struct super_block *sb) static const struct dentry_operations shmem_ci_dentry_ops = { .d_hash = generic_ci_d_hash, .d_compare = generic_ci_d_compare, - .d_delete = always_delete_dentry, }; #endif @@ -5037,6 +5036,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc) #else sb->s_flags |= SB_NOUSER; #endif /* CONFIG_TMPFS */ + sb->s_d_flags |= DCACHE_DONTCACHE; sbinfo->max_blocks = ctx->blocks; sbinfo->max_inodes = ctx->inodes; sbinfo->free_ispace = sbinfo->max_inodes * BOGO_INODE_SIZE;