Linux filesystem development
 help / color / mirror / Atom feed
From: Ian Kent <raven@themaw.net>
To: Miklos Szeredi <miklos@szeredi.hu>,
	Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Amir Goldstein <amir73il@gmail.com>, Jan Kara <jack@suse.cz>
Subject: Re: bad things when too many negative dentries in a directory
Date: Mon, 14 Apr 2025 14:28:42 +0800	[thread overview]
Message-ID: <3c38cf85-d31d-4c46-b9f8-e801a39ca3ff@themaw.net> (raw)
In-Reply-To: <CAJfpegvaoreOeAMeK=Q_E8+3WHra5G4s_BoZDCN1yCwdzkdyJw@mail.gmail.com>

On 11/4/25 23:40, Miklos Szeredi wrote:
> On Fri, 11 Apr 2025 at 16:47, Christian Brauner <brauner@kernel.org> wrote:
>
>> Note that we have a new sysctl:
>>
>> /proc/sys/fs/dentry-negative
>>
>> that can be used to control the negative dentry policy because any
>> generic change that we tried to make has always resulted in unacceptable
>> regressions for someone's workload. Currently we only allow it to be set
>> to 1 (default 0). If set to 1 it will not create negative dentries
>> during unlink. If that's sufficient than recommend this to users that
>> suffer from this problem if not consider adding another sensitive
>> policy.
> Okay, I'll forward that info.
>
> However, hundreds of millions of negative dentries can be created
> rather efficiently without unlink, though this one probably doesn't
> happen under normal circumstances.  Allowing this to starve the
> scheduler for an arbitrary long time is not a good idea in any case,
> so the fsnotify problem needs some other solution, and I suspect that
> it's not to disable negative caching completely, as that would be a
> major bummer.

I know that the most recent case we have seen of this would probably

be resolved by the sysctl but this was not the first recent case we had.

Unfortunately I can't remember the details, all I remember is it was

similar but not quite the same.


In any case it's quite possible that many files can be processed, opened

and then closed, not unlinked.


So I think it's worth considering this as well.

>
> But the idea of leaving negative dentries off d_children is
> independent of caching policy.  The lookup cache would work fine
> without d_sib being chained, it only needs careful thought in
>
> 1) putting the dentry on d_children when it's turned into positive
> 2) getting the dentry off d_children when it's turned into negative.

That shouldn't be too difficult to do ... sounds like a good idea to me.


Ian


  parent reply	other threads:[~2025-04-14  6:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11  9:40 bad things when too many negative dentries in a directory Miklos Szeredi
2025-04-11 14:47 ` Christian Brauner
2025-04-11 15:40   ` Miklos Szeredi
2025-04-11 16:01     ` Matthew Wilcox
2025-04-14 14:07       ` James Bottomley
2025-04-14 14:30         ` Matthew Wilcox
2025-04-14 15:40           ` James Bottomley
2025-04-14 16:14             ` Matthew Wilcox
2025-04-14 17:58               ` James Bottomley
2025-04-15 17:22                 ` Andreas Dilger
2025-04-16 15:18                   ` Miklos Szeredi
2025-04-16 15:37                     ` Matthew Wilcox
2025-04-16 21:41                     ` Dave Chinner
2025-04-16 15:26                   ` James Bottomley
2025-04-22  6:57                     ` Andreas Dilger
2025-04-14  6:28     ` Ian Kent [this message]
2025-04-14  7:17       ` Miklos Szeredi
2025-04-12  1:48   ` Ian Kent
2025-04-12  1:56     ` Ian Kent
2025-04-12  6:31     ` Ian Kent
2025-04-11 21:02 ` Mateusz Guzik
2025-04-20  4:49 ` Al Viro
2025-05-08 15:45   ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c38cf85-d31d-4c46-b9f8-e801a39ca3ff@themaw.net \
    --to=raven@themaw.net \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox