Skip to content

Commit

Permalink
Fix: sbd-inquisitor: ensure the timeout for watchdog warning specifie…
Browse files Browse the repository at this point in the history
…d with `-5` option is respected

Previously if `-5` option was specified prior to a `-1` option, it
would be ignored.
  • Loading branch information
gao-yan committed Mar 3, 2021
1 parent f0ab654 commit f39f2a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/sbd-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
unsigned long timeout_watchdog = SBD_WATCHDOG_TIMEOUT_DEFAULT;
int timeout_msgwait = 2 * SBD_WATCHDOG_TIMEOUT_DEFAULT;
unsigned long timeout_watchdog_warn = calculate_timeout_watchdog_warn(SBD_WATCHDOG_TIMEOUT_DEFAULT);
bool do_calculate_timeout_watchdog_warn = true;
int timeout_allocate = 2;
int timeout_loop = 1;
int timeout_io = 3;
Expand Down
5 changes: 3 additions & 2 deletions src/sbd-inquisitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ int main(int argc, char **argv, char **envp)
value = getenv("SBD_WATCHDOG_TIMEOUT");
if(value) {
timeout_watchdog = crm_get_msec(value) / 1000;
if(timeout_watchdog > 5) {
if (do_calculate_timeout_watchdog_warn && timeout_watchdog > 5) {
timeout_watchdog_warn = (int)timeout_watchdog / 5 * 3;
}
}
Expand Down Expand Up @@ -1058,7 +1058,7 @@ int main(int argc, char **argv, char **envp)
break;
case '1':
timeout_watchdog = atoi(optarg);
if(timeout_watchdog > 5) {
if (do_calculate_timeout_watchdog_warn && timeout_watchdog > 5) {
timeout_watchdog_warn = (int)timeout_watchdog / 5 * 3;
}
break;
Expand All @@ -1073,6 +1073,7 @@ int main(int argc, char **argv, char **envp)
break;
case '5':
timeout_watchdog_warn = atoi(optarg);
do_calculate_timeout_watchdog_warn = false;
cl_log(LOG_INFO, "Setting latency warning to %d",
(int)timeout_watchdog_warn);
break;
Expand Down
1 change: 1 addition & 0 deletions src/sbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void notify_parent(void);
/* Tunable defaults: */
extern unsigned long timeout_watchdog;
extern unsigned long timeout_watchdog_warn;
extern bool do_calculate_timeout_watchdog_warn;
extern unsigned long timeout_watchdog_crashdump;
extern int timeout_allocate;
extern int timeout_loop;
Expand Down

0 comments on commit f39f2a0

Please sign in to comment.