From: "Joel Fernandes (Google)" <j...@joelfernandes.org>

rcutorture currently increments both successes and error counters for
the rcu_barrier test incase of errors. It should only increment the
error counter incase of errors so make it do so.

Test: Introduced rcu_barrier errors by returning from the barrier
callback without incrementing the callback counter.

Signed-off-by: Joel Fernandes (Google) <j...@joelfernandes.org>
---
 kernel/rcu/rcutorture.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index f2cde4dd432d..3faaabc99b60 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1722,8 +1722,9 @@ static int rcu_torture_barrier(void *arg)
                               atomic_read(&barrier_cbs_invoked),
                               n_barrier_cbs);
                        WARN_ON_ONCE(1);
+               } else {
+                       n_barrier_successes++;
                }
-               n_barrier_successes++;
                schedule_timeout_interruptible(HZ / 10);
        } while (!torture_must_stop());
        torture_kthread_stopping("rcu_torture_barrier");
-- 
2.18.0.rc1.244.gcf134e6275-goog

Reply via email to