From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <oliver.sang@intel.com>,
oe-lkp@lists.linux.dev, lkp@intel.com,
linux-kernel@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Ajay Kaher <ajay.kaher@broadcom.com>,
linux-trace-kernel@vger.kernel.org
Subject: Re: [linus:master] [eventfs] 852e46e239: BUG:unable_to_handle_page_fault_for_address
Date: Tue, 30 Jan 2024 12:06:34 -0500 [thread overview]
Message-ID: <20240130120634.2f0ecd0a@gandalf.local.home> (raw)
In-Reply-To: <CAHk-=wiNY3W1QKveFnH=dJtRNW7kA1Nbn6Ua49EbM6AC+Rx8wg@mail.gmail.com>
On Tue, 30 Jan 2024 08:55:51 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Tue, 30 Jan 2024 at 08:49, Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> > - On removal, I got rid of the SRCU callback and the work queue.
> > Instead, I find the dentry of the current eventfs_inode that is being
> > deleted by walking the ei->parent until I find the events inode that has
> > a dentry. I then use that to do a lookup walking back down to the
> > eventfs_inode I want to delete. This gives me the dentry that I can call
> > d_invalidate() on.
>
> Yes, that works.
>
> However, I have a patch that is *much* smaller and simpler, and
> doesn't need that walk.
>
> The VFS layer already has a good interface for "should I still use
> this dentry", which is needed for various network filesystems etc that
> want to time out caches (or check explicitly whether the file still
> exists etc): it's the dentry d_revalidate() check.
>
> Let me just reboot into it to test that I got all the cases.
>
> It makes the code even more obvious, and avoids all the complexity.
I actually had this before, but it wasn't working (likely to something else
that wasn't working or I did it wrong) so I reverted it.
-- Steve
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 49d4630d5d70..9867b39ae24c 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -451,6 +451,13 @@ lookup_file_dentry(struct dentry *dentry,
return dentry;
}
+int eventfs_revalidate(struct dentry *dentry, unsigned int flags)
+{
+ struct eventfs_inode *ei = dentry->d_fsdata;
+
+ return ei && !ei->is_freed;
+}
+
/**
* eventfs_root_lookup - lookup routine to create file/dir
* @dir: in which a lookup is being done
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index e1b172c0e091..0395459d919e 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -392,8 +392,24 @@ static void tracefs_dentry_iput(struct dentry *dentry, struct inode *inode)
iput(inode);
}
+static int tracefs_revalidate(struct dentry *dentry, unsigned int flags)
+{
+ struct inode *inode = dentry->d_inode;
+ struct tracefs_inode *ti;
+
+ if (!dentry || !inode)
+ return 0;
+
+ ti = get_tracefs(inode);
+ if (!ti || !(ti->flags & TRACEFS_EVENT_INODE))
+ return 1;
+
+ return eventfs_revalidate(dentry, flags);
+}
+
static const struct dentry_operations tracefs_dentry_operations = {
- .d_iput = tracefs_dentry_iput,
+ .d_iput = tracefs_dentry_iput,
+ .d_revalidate = tracefs_revalidate,
};
static int trace_fill_super(struct super_block *sb, void *data, int silent)
diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
index 2af78fd95c93..a1024202c4e5 100644
--- a/fs/tracefs/internal.h
+++ b/fs/tracefs/internal.h
@@ -80,5 +80,6 @@ struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
struct dentry *eventfs_failed_creating(struct dentry *dentry);
struct dentry *eventfs_end_creating(struct dentry *dentry);
void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry);
+int eventfs_revalidate(struct dentry *dentry, unsigned int flags);
#endif /* _TRACEFS_INTERNAL_H */
next prev parent reply other threads:[~2024-01-30 17:06 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 2:58 [linus:master] [eventfs] 852e46e239: BUG:unable_to_handle_page_fault_for_address kernel test robot
2024-01-29 4:36 ` Linus Torvalds
2024-01-29 17:01 ` Steven Rostedt
2024-01-29 17:40 ` Linus Torvalds
2024-01-29 17:44 ` Steven Rostedt
2024-01-29 17:45 ` Steven Rostedt
2024-01-29 17:56 ` Linus Torvalds
2024-01-29 17:55 ` Linus Torvalds
2024-01-29 19:24 ` Linus Torvalds
2024-01-29 19:51 ` Linus Torvalds
2024-01-29 20:26 ` Steven Rostedt
2024-01-29 20:51 ` Linus Torvalds
2024-01-29 21:45 ` Steven Rostedt
2024-01-29 22:19 ` Linus Torvalds
2024-01-29 21:55 ` Steven Rostedt
2024-01-29 22:22 ` Steven Rostedt
2024-01-29 22:35 ` Linus Torvalds
2024-01-29 22:42 ` Linus Torvalds
2024-01-29 22:49 ` Steven Rostedt
2024-01-30 0:01 ` Linus Torvalds
2024-01-30 0:35 ` Steven Rostedt
2024-01-30 1:50 ` Linus Torvalds
2024-01-30 3:56 ` Linus Torvalds
2024-01-30 8:43 ` Linus Torvalds
2024-01-30 9:12 ` Linus Torvalds
2024-01-30 14:39 ` Steven Rostedt
2024-01-30 16:49 ` Steven Rostedt
2024-01-30 16:55 ` Linus Torvalds
2024-01-30 17:06 ` Steven Rostedt [this message]
2024-01-30 17:09 ` Linus Torvalds
2024-01-30 16:51 ` Linus Torvalds
2024-01-30 18:23 ` Steven Rostedt
2024-01-30 19:19 ` Linus Torvalds
2024-01-30 19:37 ` Steven Rostedt
2024-01-30 19:54 ` Linus Torvalds
2024-01-30 20:04 ` Steven Rostedt
2024-01-31 15:58 ` Steven Rostedt
2024-01-31 16:13 ` Steven Rostedt
2024-01-31 17:28 ` Steven Rostedt
2024-01-31 17:26 ` Steven Rostedt
2024-01-31 19:35 ` Linus Torvalds
2024-01-31 19:42 ` Steven Rostedt
2024-01-30 18:36 ` Steven Rostedt
2024-01-29 22:47 ` Steven Rostedt
2024-01-29 23:15 ` Steven Rostedt
2024-01-30 2:08 ` Al Viro
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=20240130120634.2f0ecd0a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=ajay.kaher@broadcom.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=torvalds@linux-foundation.org \
--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;
as well as URLs for NNTP newsgroup(s).