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.
Unified · Split
| @@ -1022,23 +1022,23 @@ static int __init lock_torture_init(void) · 1021 unmodified lines | |||
| 1022 | if (onoff_interval > 0) { | 1022 | if (onoff_interval > 0) { |
| 1023 | firsterr = torture_onoff_init(onoff_holdoff * HZ, | 1023 | firsterr = torture_onoff_init(onoff_holdoff * HZ, |
| 1024 | onoff_interval * HZ, NULL); | 1024 | onoff_interval * HZ, NULL); |
| 1025 | if (firsterr) | 1025 | if (torture_init_error(firsterr)) |
| 1026 | goto unwind; | 1026 | goto unwind; |
| 1027 | } | 1027 | } |
| 1028 | if (shuffle_interval > 0) { | 1028 | if (shuffle_interval > 0) { |
| 1029 | firsterr = torture_shuffle_init(shuffle_interval); | 1029 | firsterr = torture_shuffle_init(shuffle_interval); |
| 1030 | if (firsterr) | 1030 | if (torture_init_error(firsterr)) |
| 1031 | goto unwind; | 1031 | goto unwind; |
| 1032 | } | 1032 | } |
| 1033 | if (shutdown_secs > 0) { | 1033 | if (shutdown_secs > 0) { |
| 1034 | firsterr = torture_shutdown_init(shutdown_secs, | 1034 | firsterr = torture_shutdown_init(shutdown_secs, |
| 1035 | lock_torture_cleanup); | 1035 | lock_torture_cleanup); |
| 1036 | if (firsterr) | 1036 | if (torture_init_error(firsterr)) |
| 1037 | goto unwind; | 1037 | goto unwind; |
| 1038 | } | 1038 | } |
| 1039 | if (stutter > 0) { | 1039 | if (stutter > 0) { |
| 1040 | firsterr = torture_stutter_init(stutter, stutter); | 1040 | firsterr = torture_stutter_init(stutter, stutter); |
| 1041 | if (firsterr) | 1041 | if (torture_init_error(firsterr)) |
| 1042 | goto unwind; | 1042 | goto unwind; |
| 1043 | } | 1043 | } |
| 1044 | 1044 | ||
| @@ -1082,7 +1082,7 @@ static int __init lock_torture_init(void) · 37 unmodified lines | |||
| 1082 | /* Create writer. */ | 1082 | /* Create writer. */ |
| 1083 | firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i], | 1083 | firsterr = torture_create_kthread(lock_torture_writer, &cxt.lwsa[i], |
| 1084 | writer_tasks[i]); | 1084 | writer_tasks[i]); |
| 1085 | if (firsterr) | 1085 | if (torture_init_error(firsterr)) |
| 1086 | goto unwind; | 1086 | goto unwind; |
| 1087 | 1087 | ||
| 1088 | create_reader: | 1088 | create_reader: |
| @@ -1091,13 +1091,13 @@ static int __init lock_torture_init(void) · 2 unmodified lines | |||
| 1091 | /* Create reader. */ | 1091 | /* Create reader. */ |
| 1092 | firsterr = torture_create_kthread(lock_torture_reader, &cxt.lrsa[j], | 1092 | firsterr = torture_create_kthread(lock_torture_reader, &cxt.lrsa[j], |
| 1093 | reader_tasks[j]); | 1093 | reader_tasks[j]); |
| 1094 | if (firsterr) | 1094 | if (torture_init_error(firsterr)) |
| 1095 | goto unwind; | 1095 | goto unwind; |
| 1096 | } | 1096 | } |
| 1097 | if (stat_interval > 0) { | 1097 | if (stat_interval > 0) { |
| 1098 | firsterr = torture_create_kthread(lock_torture_stats, NULL, | 1098 | firsterr = torture_create_kthread(lock_torture_stats, NULL, |
| 1099 | stats_task); | 1099 | stats_task); |
| 1100 | if (firsterr) | 1100 | if (torture_init_error(firsterr)) |
| 1101 | goto unwind; | 1101 | goto unwind; |
| 1102 | } | 1102 | } |
| 1103 | torture_init_end(); | 1103 | torture_init_end(); |