From: Steven Rostedt <steven@rostedt.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
Anubhav Shelat <ashelat@redhat.com>,
Shivank Garg <shivankg@amd.com>,
Ackerley Tng <ackerleytng@google.com>,
Fuad Tabba <tabba@google.com>,
Christian Brauner <brauner@kernel.org>,
Sean Christopherson <seanjc@google.com>
Subject: Re: [PATCH v3] tracefs: Add read-only eventfs filesystem at /sys/kernel/events
Date: Mon, 10 Aug 2026 21:36:11 -0400 [thread overview]
Message-ID: <20260810213611.5e6f3d13@robin> (raw)
In-Reply-To: <20260811102818.1f2f51a6c9277d2f1c054e7a@kernel.org>
On Tue, 11 Aug 2026 10:28:18 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> Hi Steve,
>
> I have some comments on this.
>
> On Mon, 10 Aug 2026 16:07:08 -0400
> Steven Rostedt <steven@rostedt.org> wrote:
>
> > @@ -551,20 +643,40 @@ static struct dentry *eventfs_root_lookup(struct inode *dir,
> > if (strcmp(name, entry->name) != 0)
> > continue;
> >
> > + if (ro && !entry->read_only)
> > + return NULL;
> > +
> > data = ei->data;
> > if (entry->callback(name, &mode, &data, &fops) <= 0)
> > return NULL;
> >
> > + if (ro)
> > + mode |= 0444;
>
> Don't we need to clear writable bits? e.g.
>
> mode = (mode & ~0222) | 0444;
Sure.
>
> [...]
> > @@ -812,6 +937,52 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
> > return ERR_PTR(-ENOMEM);
> > }
> >
> > +/**
> > + * eventfs_create_events_dir_ro - create a read-only events directory
> > + * @name: The name of the top level directory to create.
> > + * @entries: A list of entries that represent the files under this directory
> > + * @size: The number of @entries
> > + * @data: The default data to pass to the files (an entry may override it).
>
> This document need to be updated too. It should be "eventfs_create_events_ro_copy"
> and only takes @name and @ei.
Bah, I thought I fixed that. I may have but lost the changes in a rebase.
>
> > + *
> > + * This function configures the eventfs filesystem root as a read-only
> > + * trace event directory using the existing eventfs_inode lazy-lookup
> > + * infrastructure.
> > + *
> > + * See eventfs_create_dir() for use of @entries.
> > + */
> > +int eventfs_create_events_ro_copy(const char *name, struct eventfs_inode *ei)
> > +{
> > + static struct dentry *dentry;
> > + struct tracefs_inode *ti;
> > + struct inode *inode;
> > +
> > + /* Can only be called once. */
> > + if (dentry)
> > + return -EBUSY;
> > +
> > + /* Reference acquired but never freed */
> > + dentry = eventfs_ro_get_root();
> > + if (IS_ERR(dentry))
> > + return PTR_ERR(dentry);
> > +
> > + inode = d_inode(dentry);
> > +
> > + INIT_LIST_HEAD(&ei->children);
> > + INIT_LIST_HEAD(&ei->list);
>
> Nit: This seems redundant because those lists are initialized in
> event_create_events_dir() already, and here we initialize again.
> Currently, there is no chance to add anything on these lists.
> (But if we add something on these lists, re-initializing will
> make the items orphaned silently.)
Nice catch. I'll fix it.
I also found some other issues with the superblock setup. This isn't
going to go into the next merge window as it's too late.
Thanks for looking at it,
-- Steve
>
> > +
> > + ti = get_tracefs(inode);
> > + ti->flags |= TRACEFS_EVENT_INODE;
> > + ti->private = ei;
> > +
> > + inode->i_op = &eventfs_ro_dir_inode_operations;
> > + inode->i_fop = &eventfs_ro_file_operations;
> > +
> > + /* This is never freed */
> > + dentry->d_fsdata = get_ei(ei);
> > +
> > + return 0;
> > +}
>
> Thanks,
>
next prev parent reply other threads:[~2026-08-11 1:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 20:07 [PATCH v3] tracefs: Add read-only eventfs filesystem at /sys/kernel/events Steven Rostedt
2026-08-10 21:39 ` Steven Rostedt
2026-08-11 1:28 ` Masami Hiramatsu
2026-08-11 1:36 ` Steven Rostedt [this message]
2026-08-20 5:32 ` kernel test robot
2026-08-20 11:25 ` kernel test robot
2026-08-20 16:31 ` Li, Philip
2026-08-20 11:25 ` kernel test robot
2026-08-20 16:32 ` Li, Philip
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=20260810213611.5e6f3d13@robin \
--to=steven@rostedt.org \
--cc=ackerleytng@google.com \
--cc=ashelat@redhat.com \
--cc=brauner@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=seanjc@google.com \
--cc=shivankg@amd.com \
--cc=tabba@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.