Linux filesystem development
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Christian Brauner <brauner@kernel.org>,
	 linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Amir Goldstein <amir73il@gmail.com>, Jan Kara <jack@suse.cz>,
	Ian Kent <raven@themaw.net>
Subject: Re: bad things when too many negative dentries in a directory
Date: Mon, 14 Apr 2025 13:58:56 -0400	[thread overview]
Message-ID: <e01314df537bced144509a8f5e5d4fa7b6b39057.camel@HansenPartnership.com> (raw)
In-Reply-To: <Z_00ahyvcMpbKXoj@casper.infradead.org>

On Mon, 2025-04-14 at 17:14 +0100, Matthew Wilcox wrote:
[...]
> > I got that's what it's doing, and why the negative dentries are
> > useless since the file name is app specific, I'm just curious why
> > an app that knows it's the only consumer of a file places it in the
> > last place it looks rather than the first ... it seems to be
> > suboptimal and difficult for us to detect heuristically.
> 
> The first two are read only.  One is where the package could have an
> override, the second is where the local sysadmin could have an
> override. The third is writable.  It's not entirely insane.
> 
> Another way to solve this would be to notice "hey, this directory
> only has three entries and umpteen negative entries, let's do the
> thing that ramfs does to tell the dcache that it knows about all
> positive entries in this directory and delete all the negative
> ones".  I forget what flag that is.

It's not a flag, it's the dentry operations for pseudo filesystems
(simple_lookup sets simple_dentry_operations which provides a d_delete
that always says don't retain).  However, that's really because all
pseudo filesystems have a complete dentry cache (all visible files have
dentries), so there's no benefit caching negative lookups (and the
d_delete trick only affects negative dentries because positive ones
have a non zero refcount).

There is a DCACHE_DONTCACHE flag that dumps a dentry (regardless of
positive or negative) on final dput  I suppose that could be set in
lookup_open() on negative under some circumstances (open flag, sysctl,
etc.).

Regards,

James


  reply	other threads:[~2025-04-14 17:58 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 [this message]
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
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=e01314df537bced144509a8f5e5d4fa7b6b39057.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=raven@themaw.net \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /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