Browse Source

rcutorture: Fix rcu_torture_cbflood() for callback-free RCU

The rcu_torture_cbflood() function correctly checks for flavors of
RCU that lack analogs to call_rcu() and rcu_barrier(), but in that
case it fails to terminate correctly.  In fact, it terminates so
incorrectly that segfaults can result.  This commit therefore causes
rcu_torture_cbflood() to do the proper wait-for-stop procedure.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Paul E. McKenney 10 years ago
parent
commit
3a0af33341
1 changed files with 2 additions and 3 deletions
  1. 2 3
      kernel/rcu/rcutorture.c

+ 2 - 3
kernel/rcu/rcutorture.c

@@ -823,9 +823,7 @@ rcu_torture_cbflood(void *arg)
 	}
 	}
 	if (err) {
 	if (err) {
 		VERBOSE_TOROUT_STRING("rcu_torture_cbflood disabled: Bad args or OOM");
 		VERBOSE_TOROUT_STRING("rcu_torture_cbflood disabled: Bad args or OOM");
-		while (!torture_must_stop())
-			schedule_timeout_interruptible(HZ);
-		return 0;
+		goto wait_for_stop;
 	}
 	}
 	VERBOSE_TOROUT_STRING("rcu_torture_cbflood task started");
 	VERBOSE_TOROUT_STRING("rcu_torture_cbflood task started");
 	do {
 	do {
@@ -844,6 +842,7 @@ rcu_torture_cbflood(void *arg)
 		stutter_wait("rcu_torture_cbflood");
 		stutter_wait("rcu_torture_cbflood");
 	} while (!torture_must_stop());
 	} while (!torture_must_stop());
 	vfree(rhp);
 	vfree(rhp);
+wait_for_stop:
 	torture_kthread_stopping("rcu_torture_cbflood");
 	torture_kthread_stopping("rcu_torture_cbflood");
 	return 0;
 	return 0;
 }
 }