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