aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ring_buffer.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-01-21 15:24:56 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-22 04:27:16 -0500
commit97b17efe4537e11bf6669106cfe4ee2c5331b267 (patch)
tree46310b25ea38628fc631d4c4c248ebe66426036f /kernel/trace/ring_buffer.c
parent5bc4564b224c3d9fe6dddafa25f56059bd978231 (diff)
ring-buffer: do not swap if recording is disabled
If the ring buffer recording has been disabled. Do not let swapping of ring buffers occur. Simply return -EAGAIN. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r--kernel/trace/ring_buffer.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0b9de5a3d699..890020e28a35 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2266,9 +2266,24 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a,
2266 if (buffer_a->pages != buffer_b->pages) 2266 if (buffer_a->pages != buffer_b->pages)
2267 return -EINVAL; 2267 return -EINVAL;
2268 2268
2269 if (ring_buffer_flags != RB_BUFFERS_ON)
2270 return -EAGAIN;
2271
2272 if (atomic_read(&buffer_a->record_disabled))
2273 return -EAGAIN;
2274
2275 if (atomic_read(&buffer_b->record_disabled))
2276 return -EAGAIN;
2277
2269 cpu_buffer_a = buffer_a->buffers[cpu]; 2278 cpu_buffer_a = buffer_a->buffers[cpu];
2270 cpu_buffer_b = buffer_b->buffers[cpu]; 2279 cpu_buffer_b = buffer_b->buffers[cpu];
2271 2280
2281 if (atomic_read(&cpu_buffer_a->record_disabled))
2282 return -EAGAIN;
2283
2284 if (atomic_read(&cpu_buffer_b->record_disabled))
2285 return -EAGAIN;
2286
2272 /* 2287 /*
2273 * We can't do a synchronize_sched here because this 2288 * We can't do a synchronize_sched here because this
2274 * function can be called in atomic context. 2289 * function can be called in atomic context.