mirror of https://gitee.com/openkylin/linux.git
rcu: Fixes to rcutorture error handling and cleanup
The rcutorture initialization code ignored the error returns from rcu_torture_onoff_init() and rcu_torture_stall_init(). The rcutorture cleanup code failed to NULL out a number of pointers. These bugs will normally have no effect, but this commit fixes them nevertheless. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
66f75a5d02
commit
37e377d282
|
@ -1337,6 +1337,7 @@ static void rcutorture_booster_cleanup(int cpu)
|
||||||
|
|
||||||
/* This must be outside of the mutex, otherwise deadlock! */
|
/* This must be outside of the mutex, otherwise deadlock! */
|
||||||
kthread_stop(t);
|
kthread_stop(t);
|
||||||
|
boost_tasks[cpu] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rcutorture_booster_init(int cpu)
|
static int rcutorture_booster_init(int cpu)
|
||||||
|
@ -1484,13 +1485,15 @@ static void rcu_torture_onoff_cleanup(void)
|
||||||
return;
|
return;
|
||||||
VERBOSE_PRINTK_STRING("Stopping rcu_torture_onoff task");
|
VERBOSE_PRINTK_STRING("Stopping rcu_torture_onoff task");
|
||||||
kthread_stop(onoff_task);
|
kthread_stop(onoff_task);
|
||||||
|
onoff_task = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* #ifdef CONFIG_HOTPLUG_CPU */
|
#else /* #ifdef CONFIG_HOTPLUG_CPU */
|
||||||
|
|
||||||
static void
|
static int
|
||||||
rcu_torture_onoff_init(void)
|
rcu_torture_onoff_init(void)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rcu_torture_onoff_cleanup(void)
|
static void rcu_torture_onoff_cleanup(void)
|
||||||
|
@ -1554,6 +1557,7 @@ static void rcu_torture_stall_cleanup(void)
|
||||||
return;
|
return;
|
||||||
VERBOSE_PRINTK_STRING("Stopping rcu_torture_stall_task.");
|
VERBOSE_PRINTK_STRING("Stopping rcu_torture_stall_task.");
|
||||||
kthread_stop(stall_task);
|
kthread_stop(stall_task);
|
||||||
|
stall_task = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rcutorture_cpu_notify(struct notifier_block *self,
|
static int rcutorture_cpu_notify(struct notifier_block *self,
|
||||||
|
@ -1665,6 +1669,7 @@ rcu_torture_cleanup(void)
|
||||||
VERBOSE_PRINTK_STRING("Stopping rcu_torture_shutdown task");
|
VERBOSE_PRINTK_STRING("Stopping rcu_torture_shutdown task");
|
||||||
kthread_stop(shutdown_task);
|
kthread_stop(shutdown_task);
|
||||||
}
|
}
|
||||||
|
shutdown_task = NULL;
|
||||||
rcu_torture_onoff_cleanup();
|
rcu_torture_onoff_cleanup();
|
||||||
|
|
||||||
/* Wait for all RCU callbacks to fire. */
|
/* Wait for all RCU callbacks to fire. */
|
||||||
|
@ -1897,9 +1902,17 @@ rcu_torture_init(void)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rcu_torture_onoff_init();
|
i = rcu_torture_onoff_init();
|
||||||
|
if (i != 0) {
|
||||||
|
firsterr = i;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
register_reboot_notifier(&rcutorture_shutdown_nb);
|
register_reboot_notifier(&rcutorture_shutdown_nb);
|
||||||
rcu_torture_stall_init();
|
i = rcu_torture_stall_init();
|
||||||
|
if (i != 0) {
|
||||||
|
firsterr = i;
|
||||||
|
goto unwind;
|
||||||
|
}
|
||||||
rcutorture_record_test_transition();
|
rcutorture_record_test_transition();
|
||||||
mutex_unlock(&fullstop_mutex);
|
mutex_unlock(&fullstop_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue