]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
shmem: no dentry retention past the refcount reaching zero
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 24 Feb 2025 01:50:42 +0000 (20:50 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Jun 2025 17:40:01 +0000 (13:40 -0400)
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 <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
mm/shmem.c

index 3583508800fc06deaac1075049fc4d7e8c69e084..94b2b4264607c787086a6881b8ee2813a70a4c58 100644 (file)
@@ -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;