diff mbox series

[12/21] shmem: no dentry retention past the refcount reaching zero

Message ID 20250224212051.1756517-12-viro@zeniv.linux.org.uk (mailing list archive)
State New
Headers show
Series [01/21] procfs: kill ->proc_dops | expand

Commit Message

Al Viro Feb. 24, 2025, 9:20 p.m. UTC
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...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 mm/shmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Brauner Feb. 26, 2025, 8:38 a.m. UTC | #1
On Mon, Feb 24, 2025 at 09:20:42PM +0000, Al Viro wrote:
> 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...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---

Reviewed-by: Christian Brauner <brauner@kernel.org>

>  mm/shmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 0ecb49113bb2..dd84b1c554a8 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -4971,7 +4971,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
>  
> @@ -5028,6 +5027,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;
> -- 
> 2.39.5
>
diff mbox series

Patch

diff --git a/mm/shmem.c b/mm/shmem.c
index 0ecb49113bb2..dd84b1c554a8 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4971,7 +4971,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
 
@@ -5028,6 +5027,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;