Re: [PATCH RFC/RFT v2 00/18] Fix easy bits of the negative dentry problem

NeilBrown <[email protected]>
Newsgroups org.kernel.vger.ceph-devel,org.kernel.vger.autofs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs
Message-ID <[email protected]>
On Sat, 15 Aug 2026, Al Viro wrote:
> On Sat, Aug 15, 2026 at 02:21:17PM +1000, NeilBrown wrote:
> 
> > Most of d_walk() already schedules as needed, but I
> >  think there is still room for improvement, but that can come later.
> 
> How the hell could it possibly schedule, when it might very well have
> grabbed rename_lock?  Confused...

I should have said:
  Most d_walk() instances abort when there is a need to schedule()
  so the caller can do that and retry.

That really only applies to shrink_dcache_tree() which it is a bit of
stretch to call "most", but apart from path_has_submounts() the others
are all called only after shrink_dcache_tree() has done its work, so
there won't be many (any?) negative dentries any more, so they won't need
to schedule().

I think path_has_submounts() could be changed to search mounts for
descendants, rather than searching descendant for mounts.
Maybe something like:

int path_has_submounts(const struct path *parent)
{
	struct mount *m;

	guard(mount_locked_reader)();
	list_for_each_entry(m, &real_mount(parent->mnt)->mnt_mounts, mnt_child)
		if (is_subdir(m->mnt_mountpoint, parent->dentry))
			return 1;

	return 0;
}

As it is only used by autofs which could have lots of mounts that might
be slower in the common case.  But it isn't clear there is problem here
that needs fixing.  autofs certainly *could* collect lots of negative
dentries, but does it?

> 
> Al, getting through the piles of mail at the moment (sick for a month)...
> 

My condolences.  Thanks for having a look at this series.

NeilBrown
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.