Re: [PATCH 1/2] tracing: Make the backup instance readonly

From: Google

Date: Wed Jan 07 2026 - 22:07:42 EST


On Wed, 7 Jan 2026 11:41:33 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> > @@ -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) <mhiramat@xxxxxxxxxx>