Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Reset last_boot_info if ring buffer is reset

Commit 32dc0042528d ("tracing: Reset last-boot buffers when reading
out all cpu buffers") resets the last_boot_info when user read out
all data via trace_pipe* files. But it is not reset when user
resets the buffer from other files. (e.g. write `trace` file)

Reset it when the corresponding ring buffer is reset too.

Cc: stable@vger.kernel.org
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/177071302364.2293046.17895165659153977720.stgit@mhiramat.tok.corp.google.com
Fixes: 32dc0042528d ("tracing: Reset last-boot buffers when reading out all cpu buffers")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Masami Hiramatsu (Google) and committed by
Steven Rostedt (Google)
804c4a22 f844282d

+6
+6
kernel/trace/trace.c
··· 4127 4127 return single_release(inode, file); 4128 4128 } 4129 4129 4130 + static bool update_last_data_if_empty(struct trace_array *tr); 4131 + 4130 4132 static int tracing_open(struct inode *inode, struct file *file) 4131 4133 { 4132 4134 struct trace_array *tr = inode->i_private; ··· 4153 4151 tracing_reset_online_cpus(trace_buf); 4154 4152 else 4155 4153 tracing_reset_cpu(trace_buf, cpu); 4154 + 4155 + update_last_data_if_empty(tr); 4156 4156 } 4157 4157 4158 4158 if (file->f_mode & FMODE_READ) { ··· 5219 5215 int tracer_init(struct tracer *t, struct trace_array *tr) 5220 5216 { 5221 5217 tracing_reset_online_cpus(&tr->array_buffer); 5218 + update_last_data_if_empty(tr); 5222 5219 return t->init(tr); 5223 5220 } 5224 5221 ··· 7033 7028 ring_buffer_set_clock(tr->snapshot_buffer.buffer, trace_clocks[i].func); 7034 7029 tracing_reset_online_cpus(&tr->snapshot_buffer); 7035 7030 #endif 7031 + update_last_data_if_empty(tr); 7036 7032 7037 7033 if (tr->scratch && !(tr->flags & TRACE_ARRAY_FL_LAST_BOOT)) { 7038 7034 struct trace_scratch *tscratch = tr->scratch;