diff --git a/src/sbd-cluster.c b/src/sbd-cluster.c index b6c5512..48c6071 100644 --- a/src/sbd-cluster.c +++ b/src/sbd-cluster.c @@ -146,7 +146,7 @@ sbd_cpg_membership_health_update() set_servant_health(pcmk_health_noquorum, LOG_WARNING, "Connected to %s but quorum using qdevice is distrusted " "for SBD as qdevice-sync_timeout (%ds) > watchdog-timeout " - "(%lus).", + "(%us).", name_for_cluster_type(get_cluster_type()), qdevice_sync_timeout, timeout_watchdog ); @@ -154,7 +154,7 @@ sbd_cpg_membership_health_update() } #endif set_servant_health(pcmk_health_online, LOG_INFO, - "Connected to %s (%u members)%s", + "Connected to %s (%d members)%s", name_for_cluster_type(get_cluster_type()), cpg_membership_entries, #if CHECK_QDEVICE_SYNC_TIMEOUT @@ -710,9 +710,9 @@ find_pacemaker_remote(void) } /* entry_name is truncated to 16 characters including the nul terminator */ - cl_log(LOG_DEBUG, "Found %s at %u", entry_name, pid); + cl_log(LOG_DEBUG, "Found %s at %d", entry_name, pid); if (strncmp(entry_name, PACEMAKER_REMOTE_BINARY, 15) == 0) { - cl_log(LOG_NOTICE, "Found Pacemaker Remote at PID %u", pid); + cl_log(LOG_NOTICE, "Found Pacemaker Remote at PID %d", pid); remoted_pid = pid; remote_node = true; break; diff --git a/src/sbd-common.c b/src/sbd-common.c index 249899d..18148c6 100644 --- a/src/sbd-common.c +++ b/src/sbd-common.c @@ -35,10 +35,10 @@ #endif /* Tunable defaults: */ -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_watchdog = SBD_WATCHDOG_TIMEOUT_DEFAULT; +int timeout_msgwait = 2 * SBD_WATCHDOG_TIMEOUT_DEFAULT; +int 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; @@ -46,7 +46,7 @@ int timeout_startup = 120; int watchdog_use = 1; int watchdog_set_timeout = 1; -unsigned long timeout_watchdog_crashdump = 0; +int timeout_watchdog_crashdump = 0; int skip_rt = 0; int debug = 0; int debug_mode = 0; @@ -179,7 +179,7 @@ watchdog_init_interval_fd(int wdfd, int timeout) { if (ioctl(wdfd, WDIOC_SETTIMEOUT, &timeout) < 0) { cl_perror( "WDIOC_SETTIMEOUT" - ": Failed to set watchdog timer to %u seconds.", + ": Failed to set watchdog timer to %d seconds.", timeout); cl_log(LOG_CRIT, "Please validate your watchdog configuration!"); cl_log(LOG_CRIT, "Choose a different watchdog driver or specify -T to skip this if you are completely sure."); @@ -203,7 +203,7 @@ watchdog_init_interval(void) if (watchdog_init_interval_fd(watchdogfd, timeout_watchdog) < 0) { return -1; } - cl_log(LOG_INFO, "Set watchdog timeout to %u seconds.", (int) timeout_watchdog); + cl_log(LOG_INFO, "Set watchdog timeout to %d seconds.", timeout_watchdog); return 0; } @@ -266,7 +266,7 @@ watchdog_init(void) if (watchdogfd >= 0) { cl_log(LOG_NOTICE, "Using watchdog device '%s'", watchdogdev); if (watchdog_set_timeout) { - cl_log(LOG_INFO, "Set watchdog timeout to %u seconds.", (int) timeout_watchdog); + cl_log(LOG_INFO, "Set watchdog timeout to %d seconds.", timeout_watchdog); } } else { return -1; @@ -651,7 +651,7 @@ int watchdog_test(void) printf("\n"); printf("NOTICE: The watchdog device is expected to reset the system\n" " in %d seconds. If system remains active beyond that time,\n" - " watchdog may not be functional.\n\n", (int) timeout_watchdog); + " watchdog may not be functional.\n\n", timeout_watchdog); for (i=timeout_watchdog; i>1; i--) { printf("Reset countdown ... %d seconds\n", i); sleep(1); diff --git a/src/sbd-inquisitor.c b/src/sbd-inquisitor.c index 051801b..6edda1b 100644 --- a/src/sbd-inquisitor.c +++ b/src/sbd-inquisitor.c @@ -489,7 +489,7 @@ void inquisitor_child(void) int decoupled = 0; int cluster_appeared = 0; int pcmk_override = 0; - time_t latency; + int latency; struct timespec t_last_tickle, t_now; struct servants_list_item* s; @@ -725,8 +725,8 @@ void inquisitor_child(void) /* Note that this can actually be negative, since we set * last_tickle after we set now. */ - latency = t_now.tv_sec - t_last_tickle.tv_sec; - if (timeout_watchdog && (latency > (int)timeout_watchdog)) { + latency = (int) (t_now.tv_sec - t_last_tickle.tv_sec); + if (timeout_watchdog && (latency > timeout_watchdog)) { if (!decoupled) { /* We're still being watched by our * parent. We don't fence, but exit. */ @@ -745,10 +745,10 @@ void inquisitor_child(void) } } - if (timeout_watchdog_warn && (latency > (int)timeout_watchdog_warn)) { + if (timeout_watchdog_warn && (latency > timeout_watchdog_warn)) { cl_log(LOG_WARNING, "Latency: No liveness for %ds exceeds watchdog warning timeout of %ds (healthy servants: %d)", - (int)latency, (int)timeout_watchdog_warn, good_servants); + latency, timeout_watchdog_warn, good_servants); if (debug_mode && watchdog_use) { /* In debug mode, trigger a reset before the watchdog can panic the machine */ @@ -1110,7 +1110,7 @@ int main(int argc, char **argv, char **envp) case 'C': timeout_watchdog_crashdump = sanitized_num_optarg; cl_log(LOG_INFO, "Setting crashdump watchdog timeout to %d", - (int)timeout_watchdog_crashdump); + timeout_watchdog_crashdump); break; case '1': timeout_watchdog = sanitized_num_optarg; @@ -1128,7 +1128,7 @@ int main(int argc, char **argv, char **envp) timeout_watchdog_warn = sanitized_num_optarg; do_calculate_timeout_watchdog_warn = false; cl_log(LOG_INFO, "Setting latency warning to %d", - (int)timeout_watchdog_warn); + timeout_watchdog_warn); break; case 't': servant_restart_interval = sanitized_num_optarg; diff --git a/src/sbd-md.c b/src/sbd-md.c index 38624ff..df6a1bc 100644 --- a/src/sbd-md.c +++ b/src/sbd-md.c @@ -1049,7 +1049,7 @@ static int servant_check_timeout_inconsistent(struct sector_header_s *hdr) { if (timeout_watchdog != hdr->timeout_watchdog) { cl_log(LOG_WARNING, "watchdog timeout: %d versus %d on this device", - (int)timeout_watchdog, (int)hdr->timeout_watchdog); + timeout_watchdog, (int)hdr->timeout_watchdog); return -1; } if (timeout_allocate != hdr->timeout_allocate) { @@ -1077,7 +1077,8 @@ int servant_md(const char *diskname, int mode, const void* argp) struct sector_header_s *s_header = NULL; int mbox; int rc = 0; - time_t t0, t1, latency; + time_t t0, t1; + int latency; sigset_t servant_masks; struct sbd_context *st; pid_t ppid; @@ -1264,14 +1265,14 @@ int servant_md(const char *diskname, int mode, const void* argp) sigqueue_zero(ppid, SIG_LIVENESS); t1 = time(NULL); - latency = t1 - t0; + latency = (int) (t1 - t0); if (timeout_watchdog_warn && (latency > timeout_watchdog_warn)) { cl_log(LOG_WARNING, "Latency: %ds exceeded watchdog warning timeout %ds on disk %s", - (int)latency, (int)timeout_watchdog_warn, + latency, timeout_watchdog_warn, diskname); } else if (debug) { - DBGLOG(LOG_DEBUG, "Latency: %ds on disk %s", (int)latency, + DBGLOG(LOG_DEBUG, "Latency: %ds on disk %s", latency, diskname); } } diff --git a/src/sbd.h b/src/sbd.h index 7874e8d..d75430d 100644 --- a/src/sbd.h +++ b/src/sbd.h @@ -143,10 +143,10 @@ int sigqueue_zero(pid_t pid, int sig); 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_watchdog; +extern int timeout_watchdog_warn; +extern bool do_calculate_timeout_watchdog_warn; +extern int timeout_watchdog_crashdump; extern int timeout_allocate; extern int timeout_loop; extern int timeout_msgwait; @@ -216,5 +216,5 @@ bool sbd_is_cluster(struct servants_list_item *servant); #define calculate_timeout_watchdog_warn(timeout) \ (timeout < 5 ? 2 : \ - (timeout < (ULONG_MAX / 3) ? \ - (((unsigned long) timeout) * 3 / 5) : (((unsigned long) timeout) / 5 * 3))) + (timeout < (INT_MAX / 3) ? \ + (((int) timeout) * 3 / 5) : (((int) timeout) / 5 * 3)))