summaryrefslogtreecommitdiffstats
path: root/kernel/torture.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-04-07 09:14:11 -0700
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2014-05-14 09:46:29 -0700
commit5228084eed8d54c426c7abde3be66daf8e1b0e57 (patch)
tree5c53c30d2f6f7627f857d6ebe002eb3eae2a48d8 /kernel/torture.c
parentd065eacfdb9d47010f120e9310d7fc8ef2eba272 (diff)
downloadlinux-5228084eed8d54c426c7abde3be66daf8e1b0e57.tar.gz
linux-5228084eed8d54c426c7abde3be66daf8e1b0e57.tar.bz2
linux-5228084eed8d54c426c7abde3be66daf8e1b0e57.zip
torture: Check for multiple concurrent torture tests
The torture tests are designed to run in isolation, but do not enforce this isolation. This commit therefore checks for concurrent torture tests, and refuses to start new tests while old tests are running. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Diffstat (limited to 'kernel/torture.c')
-rw-r--r--kernel/torture.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/torture.c b/kernel/torture.c
index ae1723a4c751..0ed0b49d2ce1 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -599,14 +599,20 @@ static void torture_stutter_cleanup(void)
* The runnable parameter points to a flag that controls whether or not
* the test is currently runnable. If there is no such flag, pass in NULL.
*/
-void __init torture_init_begin(char *ttype, bool v, int *runnable)
+bool __init torture_init_begin(char *ttype, bool v, int *runnable)
{
mutex_lock(&fullstop_mutex);
+ if (torture_type != NULL) {
+ pr_alert("torture_init_begin: refusing %s init: %s running",
+ ttype, torture_type);
+ mutex_unlock(&fullstop_mutex);
+ return false;
+ }
torture_type = ttype;
verbose = v;
torture_runnable = runnable;
fullstop = FULLSTOP_DONTSTOP;
-
+ return true;
}
EXPORT_SYMBOL_GPL(torture_init_begin);
@@ -645,6 +651,9 @@ bool torture_cleanup(void)
torture_shuffle_cleanup();
torture_stutter_cleanup();
torture_onoff_cleanup();
+ mutex_lock(&fullstop_mutex);
+ torture_type = NULL;
+ mutex_unlock(&fullstop_mutex);
return false;
}
EXPORT_SYMBOL_GPL(torture_cleanup);