From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] tracing: Make the backup instance readonly
Date: Tue, 13 Jan 2026 09:31:00 +0900 [thread overview]
Message-ID: <20260113093100.e91c5be8b8fa5f1e64899ba4@kernel.org> (raw)
In-Reply-To: <176788218294.1398317.13118277798168167277.stgit@mhiramat.tok.corp.google.com>
On Thu, 8 Jan 2026 23:23:03 +0900
"Masami Hiramatsu (Google)" <mhiramat@kernel.org> wrote:
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 9b07ad9eb284..741b16b54d90 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -1379,6 +1379,9 @@ static int __ftrace_set_clr_event(struct trace_array *tr, const char *match,
> {
> int ret;
>
> + if (trace_array_is_readonly(tr))
> + return -EPERM;
> +
> mutex_lock(&event_mutex);
> ret = __ftrace_set_clr_event_nolock(tr, match, sub, event, set, mod);
> mutex_unlock(&event_mutex);
> @@ -2817,8 +2820,8 @@ event_subsystem_dir(struct trace_array *tr, const char *name,
> } else
> __get_system(system);
>
> - /* ftrace only has directories no files */
> - if (strcmp(name, "ftrace") == 0)
> + /* ftrace only has directories no files, readonly instance too. */
> + if (strcmp(name, "ftrace") == 0 || trace_array_is_readonly(tr))
> nr_entries = 0;
> else
> nr_entries = ARRAY_SIZE(system_entries);
> @@ -2979,7 +2982,6 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
> struct eventfs_inode *e_events;
> struct eventfs_inode *ei;
> const char *name;
> - int nr_entries;
> int ret;
> static struct eventfs_entry event_entries[] = {
> {
> @@ -3024,6 +3026,18 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
> },
> #endif
> };
> + static struct eventfs_entry event_ro_entries[] = {
> + {
> + .name = "format",
> + .callback = event_callback,
> + },
> +#ifdef CONFIG_PERF_EVENTS
> + {
> + .name = "id",
> + .callback = event_callback,
> + },
> +#endif
> + };
Thinking about this hack again, it would be easier to maintain if I add
a readonly flag to each eventfs_entry and specify readonly when creating
the eventfs top directory.
Let me update it.
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next prev parent reply other threads:[~2026-01-13 0:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 14:22 [PATCH v2 0/2] tracing: Remove backup instance after read all Masami Hiramatsu (Google)
2026-01-08 14:23 ` [PATCH v2 1/2] tracing: Make the backup instance readonly Masami Hiramatsu (Google)
2026-01-13 0:31 ` Masami Hiramatsu [this message]
2026-01-13 0:45 ` Steven Rostedt
2026-01-13 0:47 ` Steven Rostedt
2026-01-13 6:04 ` Masami Hiramatsu
2026-01-08 14:23 ` [PATCH v2 2/2] tracing: Add autoremove feature to the backup instance Masami Hiramatsu (Google)
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=20260113093100.e91c5be8b8fa5f1e64899ba4@kernel.org \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
/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.