Re: [PATCH 1/2] tracing: Make the backup instance readonly
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date: 2026-01-08 03:07:42
Also in:
lkml
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Date: 2026-01-08 03:07:42
Also in:
lkml
On Wed, 7 Jan 2026 11:41:33 -0500 Steven Rostedt [off-list ref] wrote:
quoted
@@ -4888,6 +4888,9 @@ static int tracing_open(struct inode *inode, struct file *file) int cpu = tracing_get_cpu(inode); struct array_buffer *trace_buf = &tr->array_buffer; + if (trace_array_is_readonly(tr)) + return -EPERM;So this fails if someone opens a file in RDONLY mode? Why?
This is for `trace` file and this block is to erase the buffer.
-----
/* If this file was open for write, then erase contents */
if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
int cpu = tracing_get_cpu(inode);
struct array_buffer *trace_buf = &tr->array_buffer;
if (trace_array_is_readonly(tr))
return -EPERM;
-----
Thus, if user opens it RDONLY mode to read the buffer, we don't care
because it is readonly (readable).
Thank you,
--
Masami Hiramatsu (Google) [off-list ref]