Skip to content

Commit b3b3cc6

Browse files
committed
locktorture: Warn on individual lock_torture_init() error conditions
When running locktorture as a module, any lock_torture_init() issues will be reflected in the error code from modprobe or insmod, as the case may be. However, these error codes are not available when running locktorture built-in, for example, when using the kvm.sh script. This commit therefore adds WARN_ON_ONCE() to allow distinguishing lock_torture_init() errors when running locktorture built-in. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent efeff6b commit b3b3cc6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

kernel/locking/locktorture.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,23 +1022,23 @@ static int __init lock_torture_init(void)
10221022
if (onoff_interval > 0) {
10231023
firsterr = torture_onoff_init(onoff_holdoff * HZ,
10241024
onoff_interval * HZ, NULL);
1025-
if (firsterr)
1025+
if (torture_init_error(firsterr))
10261026
goto unwind;
10271027
}
10281028
if (shuffle_interval > 0) {
10291029
firsterr = torture_shuffle_init(shuffle_interval);
1030-
if (firsterr)
1030+
if (torture_init_error(firsterr))
10311031
goto unwind;
10321032
}
10331033
if (shutdown_secs > 0) {
10341034
firsterr = torture_shutdown_init(shutdown_secs,
10351035
lock_torture_cleanup);
1036-
if (firsterr)
1036+
if (torture_init_error(firsterr))
10371037
goto unwind;
10381038
}
10391039
if (stutter > 0) {
10401040
firsterr = torture_stutter_init(stutter, stutter);
1041-
if (firsterr)
1041+
if (torture_init_error(firsterr))
10421042
goto unwind;
10431043
}
10441044

@@ -1082,7 +1082,7 @@ static int __init lock_torture_init(void)
10821082
/* Create writer. */
10831083
firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i],
10841084
writer_tasks[i]);
1085-
if (firsterr)
1085+
if (torture_init_error(firsterr))
10861086
goto unwind;
10871087

10881088
create_reader:
@@ -1091,13 +1091,13 @@ static int __init lock_torture_init(void)
10911091
/* Create reader. */
10921092
firsterr = torture_create_kthread(lock_torture_reader, &cxt.lrsa[j],
10931093
reader_tasks[j]);
1094-
if (firsterr)
1094+
if (torture_init_error(firsterr))
10951095
goto unwind;
10961096
}
10971097
if (stat_interval > 0) {
10981098
firsterr = torture_create_kthread(lock_torture_stats, NULL,
10991099
stats_task);
1100-
if (firsterr)
1100+
if (torture_init_error(firsterr))
11011101
goto unwind;
11021102
}
11031103
torture_init_end();

0 commit comments

Comments
 (0)