Skip to content

Commit 60b8f71

Browse files
committed
tracing: Have the error of __tracing_resize_ring_buffer() passed to user
Currently if __tracing_resize_ring_buffer() returns an error, the tracing_resize_ringbuffer() returns -ENOMEM. But it may not be a memory issue that caused the function to fail. If the ring buffer is memory mapped, then the resizing of the ring buffer will be disabled. But if the user tries to resize the buffer, it will get an -ENOMEM returned, which is confusing because there is plenty of memory. The actual error returned was -EBUSY, which would make much more sense to the user. Cc: [email protected] Cc: Mathieu Desnoyers <[email protected]> Cc: Vincent Donnefort <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 117c392 ("ring-buffer: Introducing ring-buffer mapping functions") Signed-off-by: Steven Rostedt (Google) <[email protected]> Reviewed-by: Masami Hiramatsu (Google) <[email protected]>
1 parent 9ba0e17 commit 60b8f71

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

kernel/trace/trace.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5977,8 +5977,6 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr,
59775977
ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
59785978
unsigned long size, int cpu_id)
59795979
{
5980-
int ret;
5981-
59825980
guard(mutex)(&trace_types_lock);
59835981

59845982
if (cpu_id != RING_BUFFER_ALL_CPUS) {
@@ -5987,11 +5985,7 @@ ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
59875985
return -EINVAL;
59885986
}
59895987

5990-
ret = __tracing_resize_ring_buffer(tr, size, cpu_id);
5991-
if (ret < 0)
5992-
ret = -ENOMEM;
5993-
5994-
return ret;
5988+
return __tracing_resize_ring_buffer(tr, size, cpu_id);
59955989
}
59965990

59975991
static void update_last_data(struct trace_array *tr)

0 commit comments

Comments
 (0)