Skip to content

Commit 02ff177

Browse files
rostedtmehmetb0
authored andcommitted
tracing: Have the error of __tracing_resize_ring_buffer() passed to user
BugLink: https://bugs.launchpad.net/bugs/2106494 [ Upstream commit 60b8f71 ] 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]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent c23fcaa commit 02ff177

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
@@ -5911,8 +5911,6 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr,
59115911
ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
59125912
unsigned long size, int cpu_id)
59135913
{
5914-
int ret;
5915-
59165914
guard(mutex)(&trace_types_lock);
59175915

59185916
if (cpu_id != RING_BUFFER_ALL_CPUS) {
@@ -5921,11 +5919,7 @@ ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
59215919
return -EINVAL;
59225920
}
59235921

5924-
ret = __tracing_resize_ring_buffer(tr, size, cpu_id);
5925-
if (ret < 0)
5926-
ret = -ENOMEM;
5927-
5928-
return ret;
5922+
return __tracing_resize_ring_buffer(tr, size, cpu_id);
59295923
}
59305924

59315925

0 commit comments

Comments
 (0)