diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-01-30 17:21:11 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2014-02-23 12:01:08 -0500 |
commit | cc47ae0830264f07442070b36fe0d0a4d4e3c313 (patch) | |
tree | 6fb3b6b73a8f47085475d57a966940728a869895 /kernel/torture.c | |
parent | b5daa8f3b3b2b0133ad40e13d4f722070119ce36 (diff) |
rcutorture: Abstract torture-test cleanup
This commit creates a torture_cleanup() that handles the generic
cleanup actions local to kernel/torture.c.
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.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/kernel/torture.c b/kernel/torture.c index 828d0b1a49b8..41ae5cc3c4c3 100644 --- a/kernel/torture.c +++ b/kernel/torture.c | |||
@@ -199,7 +199,7 @@ EXPORT_SYMBOL_GPL(torture_onoff_init); | |||
199 | /* | 199 | /* |
200 | * Clean up after online/offline testing. | 200 | * Clean up after online/offline testing. |
201 | */ | 201 | */ |
202 | void torture_onoff_cleanup(void) | 202 | static void torture_onoff_cleanup(void) |
203 | { | 203 | { |
204 | #ifdef CONFIG_HOTPLUG_CPU | 204 | #ifdef CONFIG_HOTPLUG_CPU |
205 | if (onoff_task == NULL) | 205 | if (onoff_task == NULL) |
@@ -403,7 +403,7 @@ EXPORT_SYMBOL_GPL(torture_shuffle_init); | |||
403 | /* | 403 | /* |
404 | * Stop the shuffling. | 404 | * Stop the shuffling. |
405 | */ | 405 | */ |
406 | void torture_shuffle_cleanup(void) | 406 | static void torture_shuffle_cleanup(void) |
407 | { | 407 | { |
408 | torture_shuffle_task_unregister_all(); | 408 | torture_shuffle_task_unregister_all(); |
409 | if (shuffler_task) { | 409 | if (shuffler_task) { |
@@ -453,3 +453,29 @@ void __init torture_init_end(void) | |||
453 | mutex_unlock(&fullstop_mutex); | 453 | mutex_unlock(&fullstop_mutex); |
454 | } | 454 | } |
455 | EXPORT_SYMBOL_GPL(torture_init_end); | 455 | EXPORT_SYMBOL_GPL(torture_init_end); |
456 | |||
457 | /* | ||
458 | * Clean up torture module. Please note that this is -not- invoked via | ||
459 | * the usual module_exit() mechanism, but rather by an explicit call from | ||
460 | * the client torture module. Returns true if a race with system shutdown | ||
461 | * is detected. | ||
462 | * | ||
463 | * This must be called before the caller starts shutting down its own | ||
464 | * kthreads. | ||
465 | */ | ||
466 | bool torture_cleanup(void) | ||
467 | { | ||
468 | mutex_lock(&fullstop_mutex); | ||
469 | if (fullstop == FULLSTOP_SHUTDOWN) { | ||
470 | pr_warn("Concurrent rmmod and shutdown illegal!\n"); | ||
471 | mutex_unlock(&fullstop_mutex); | ||
472 | schedule_timeout_uninterruptible(10); | ||
473 | return true; | ||
474 | } | ||
475 | fullstop = FULLSTOP_RMMOD; | ||
476 | mutex_unlock(&fullstop_mutex); | ||
477 | torture_shuffle_cleanup(); | ||
478 | torture_onoff_cleanup(); | ||
479 | return false; | ||
480 | } | ||
481 | EXPORT_SYMBOL_GPL(torture_cleanup); | ||