diff options
-rw-r--r-- | kernel/trace/ring_buffer.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 79d6012bb1f1..2878bd43a59c 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -3519,16 +3519,23 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, | |||
3519 | atomic_inc(&cpu_buffer_a->record_disabled); | 3519 | atomic_inc(&cpu_buffer_a->record_disabled); |
3520 | atomic_inc(&cpu_buffer_b->record_disabled); | 3520 | atomic_inc(&cpu_buffer_b->record_disabled); |
3521 | 3521 | ||
3522 | ret = -EBUSY; | ||
3523 | if (local_read(&cpu_buffer_a->committing)) | ||
3524 | goto out_dec; | ||
3525 | if (local_read(&cpu_buffer_b->committing)) | ||
3526 | goto out_dec; | ||
3527 | |||
3522 | buffer_a->buffers[cpu] = cpu_buffer_b; | 3528 | buffer_a->buffers[cpu] = cpu_buffer_b; |
3523 | buffer_b->buffers[cpu] = cpu_buffer_a; | 3529 | buffer_b->buffers[cpu] = cpu_buffer_a; |
3524 | 3530 | ||
3525 | cpu_buffer_b->buffer = buffer_a; | 3531 | cpu_buffer_b->buffer = buffer_a; |
3526 | cpu_buffer_a->buffer = buffer_b; | 3532 | cpu_buffer_a->buffer = buffer_b; |
3527 | 3533 | ||
3534 | ret = 0; | ||
3535 | |||
3536 | out_dec: | ||
3528 | atomic_dec(&cpu_buffer_a->record_disabled); | 3537 | atomic_dec(&cpu_buffer_a->record_disabled); |
3529 | atomic_dec(&cpu_buffer_b->record_disabled); | 3538 | atomic_dec(&cpu_buffer_b->record_disabled); |
3530 | |||
3531 | ret = 0; | ||
3532 | out: | 3539 | out: |
3533 | return ret; | 3540 | return ret; |
3534 | } | 3541 | } |