On Wed, 7 Jan 2026 11:41:33 -0500
Steven Rostedt <[email protected]> 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) <[email protected]>

Reply via email to