From 67c4f1b148db886f1d0b9710814613628551b6a8 Mon Sep 17 00:00:00 2001 From: Eric MacDonald Date: Wed, 4 Jan 2023 14:53:51 -0500 Subject: [PATCH] Avoid logging in fork_sysreq_reboot failsafe thread Continuing to log in the fork_sysreq_reboot failsafe thread is seen to cause mtcAgent and mtcClient log file corruption with binary data. As an avoidance measure this update changes the offending information logs to normally disabled debug logs. Test Plan: PASS: Verify build, install and provision system with debian iso - AIO SX (hw), Standard 2+1 (vbox) PASS: Verify mtcAgent and mtcClient log files do not get binary data (corruption) injected over a self reboot. PASS: Verify lock and unlock of AIO SX host PASS: Verify lock and unlock of system node from active controller PASS: Verify host reboot command PASS: Verify critical process failure reboot handling Closes-Bug: 2001719 Signed-off-by: Eric MacDonald Change-Id: Ib49ee427d2a6363ce21ec7488b1f739986828219 --- mtce-common/src/common/nodeUtil.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mtce-common/src/common/nodeUtil.cpp b/mtce-common/src/common/nodeUtil.cpp index 169b0fe8..566a99dd 100755 --- a/mtce-common/src/common/nodeUtil.cpp +++ b/mtce-common/src/common/nodeUtil.cpp @@ -1021,16 +1021,16 @@ void fork_sysreq_reboot ( int delay_in_secs ) { elog ("failed to fork fail-safe (backup) sysreq reboot\n"); return ; - } + } else if( 0 == parent ) /* we're the child */ { int sysrq_handler_fd; int sysrq_tigger_fd ; size_t temp ; - - setup_child ( false ) ; - ilog ("*** Failsafe Reset Thread ***\n"); + setup_child ( false ) ; + + dlog ("*** Failsafe Reset Thread ***\n"); /* Commented this out because blocking SIGTERM in systemd environment * causes any processes that spawn this sysreq will stall shutdown @@ -1046,7 +1046,7 @@ void fork_sysreq_reboot ( int delay_in_secs ) sysrq_handler_fd = open( "/proc/sys/kernel/sysrq", O_RDWR | O_CLOEXEC ); if( 0 > sysrq_handler_fd ) { - ilog ( "failed sysrq_handler open\n"); + elog ( "failed sysrq_handler open\n"); return ; } @@ -1059,7 +1059,7 @@ void fork_sysreq_reboot ( int delay_in_secs ) { if ( 0 == (i % 5) ) { - ilog ( "sysrq reset in %d seconds\n", i ); + dlog ( "sysrq reset in %d seconds\n", i ); } } } @@ -1068,19 +1068,19 @@ void fork_sysreq_reboot ( int delay_in_secs ) sysrq_tigger_fd = open( "/proc/sysrq-trigger", O_RDWR | O_CLOEXEC ); if( 0 > sysrq_tigger_fd ) { - ilog ( "failed sysrq_trigger open\n"); + elog ( "failed sysrq_trigger open\n"); return ; } - temp = write( sysrq_tigger_fd, "b", 1 ); + temp = write( sysrq_tigger_fd, "b", 1 ); close( sysrq_tigger_fd ); - - ilog ( "sysreq rc:%ld\n", temp ); + + dlog ( "sysreq rc:%ld\n", temp ); UNUSED(temp); - sleep (10); - + sleep (10); + // Shouldn't get this far, else there was an error. exit(-1); }