Thread (14 messages) 14 messages, 2 authors, 2024-02-01

Re: [PATCH v2 4/7] tracefs: dentry lookup crapectomy

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2024-02-01 03:02:11
Also in: linux-fsdevel, lkml, stable

On Wed, Jan 31, 2024 at 09:26:42PM -0500, Steven Rostedt wrote:
quoted
Huh?  Just return NULL and be done with that - you'll get an
unhashed negative dentry and let the caller turn that into
-ENOENT...
We had a problem here with just returning NULL. It leaves the negative
dentry around and doesn't get refreshed.
Why would that dentry stick around?  And how would anyone find
it, anyway, when it's not hashed?
I did this:

 # cd /sys/kernel/tracing
 # ls events/kprobes/sched/
ls: cannot access 'events/kprobes/sched/': No such file or directory
 # echo 'p:sched schedule' >> kprobe_events
 # ls events/kprobes/sched/
ls: cannot access 'events/kprobes/sched/': No such file or directory

When it should have been:

 # ls events/kprobes/sched/
enable  filter  format  hist  hist_debug  id  inject  trigger

Leaving the negative dentry there will have it fail when the directory
exists the next time.
Then you have something very deeply fucked up.  NULL or ERR_PTR(-ENOENT)
from ->lookup() in the last component of open() would do exactly the
same thing: dput() whatever had been passed to ->lookup() and fail
open(2) with -ENOENT.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help