Re: [PATCH 5/6] eventfs: get rid of dentry pointers without refcounts

From: Linus Torvalds
Date: Wed Jan 31 2024 - 00:57:57 EST


On Tue, 30 Jan 2024 at 21:33, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> With even the last patch included, without the d_invalidate() I get errors
> with simply doing:
>
> # cd /sys/kernel/tracing
> # mkdir instances/foo
> # ls instances/foo/events
> # rmdir instances/foo
>
> As the rmdir calls tracefs_remove() that calls simple_recursive_removal()
> that then walks into the "events" directory. Without that d_invalidate, it
> walks beyond just the top directory and then splats on the dentries that
> are cached.

Ugh.

This is only an issue for that "events" dir, right? The one that has a
proper refcount on the dentry in 'ei->events_dir'?

Because yes, then doing d_invalidate() looks like the right thing.

Linus