src/imm/immnd/immnd_evt.c | 33 ++++++++++++++++++++++++++++++---
src/imm/immnd/immnd_proc.c | 22 ++--------------------
2 files changed, 32 insertions(+), 23 deletions(-)
When SC comes back too fast, it will fail to change to SEVER_READY state
because immnd_proc_server() is not executed.
This patch basically reverts the changes in immnd_proc_server() made by #1692
and moves them to immnd_evt_proc_mds_evt().
Also, this patch hanldes the case when D2ND_SYNC_START is received but sync
process isn't forked yet.
That case was not handled in the patch for #1692.
diff --git a/src/imm/immnd/immnd_evt.c b/src/imm/immnd/immnd_evt.c
--- a/src/imm/immnd/immnd_evt.c
+++ b/src/imm/immnd/immnd_evt.c
@@ -10386,15 +10386,28 @@ static uint32_t immnd_evt_proc_mds_evt(I
cb->mSyncRequested = false;
} else if (cb->mState == IMM_SERVER_SYNC_SERVER
&& cb->mPendSync) {
- /* Sent out sync-start msg but sync
didn't start yet, revert the state to IMM_SERVER_READY */
+ /* Sent out ND2D_SYNC_START msg but
sync didn't start yet, revert the state to IMM_SERVER_READY */
cb->mPendSync = false;
cb->mState = IMM_SERVER_READY;
LOG_NO("SERVER STATE:
IMM_SERVER_SYNC_SERVER --> IMM_SERVER_READY");
+ } else if (cb->mState == IMM_SERVER_SYNC_SERVER
&& (cb->syncPid <= 0)) {
+ /* Received D2ND_SYNC_START msg but
sync process wasn't forked yet, revert the state to IMM_SERVER_READY */
+ cb->mState = IMM_SERVER_READY;
+ LOG_NO("SERVER STATE:
IMM_SERVER_SYNC_SERVER --> IMM_SERVER_READY");
+ immnd_abortSync(cb);
+
} else if (cb->mState == IMM_SERVER_SYNC_SERVER
&& (cb->syncPid > 0)) {
- /* Sync started, kill sync process to
trigger sync abort in immnd_proc_server() */
+ /* Sync started, force kill sync
process */
osafassert(!cb->mPendSync);
- kill(cb->syncPid, SIGTERM);
+
+ LOG_NO("Force kill sync process and
abort sync");
+ kill(cb->syncPid, SIGKILL);
+ cb->syncPid = 0;
+
+ cb->mState = IMM_SERVER_READY;
+ LOG_NO("SERVER STATE:
IMM_SERVER_SYNC_SERVER --> IMM_SERVER_READY");
+ immnd_abortSync(cb);
}
} else if(cb->mState <= IMM_SERVER_LOADING_PENDING) {
@@ -10430,6 +10443,20 @@ static uint32_t immnd_evt_proc_mds_evt(I
LOG_ER("FAILURE IN REGISTERING IMMND WITH MDS -
exiting");
exit(1);
}
+
+ if(cb->pbePid > 0) {
+ /* Check if pbe process is terminated.
+ * Will send SIGKILL if it's not terminated. */
+ int status = 0;
+ if (waitpid(cb->pbePid, &status, WNOHANG) > 0) {
+ LOG_NO("PBE has terminated due to SC absence");
+ } else {
+ LOG_WA("SC were absent and PBE appears hung,
sending SIGKILL");
+ kill(cb->pbePid, SIGKILL);
+ }
+ cb->pbePid = 0;
+ }
+
} else if ((evt->info.mds_info.change == NCSMDS_UP) &&
(evt->info.mds_info.svc_id == NCSMDS_SVC_ID_IMMD)) {
LOG_NO("IMMD service is UP ... ScAbsenseAllowed?:%u
introduced?:%u",
cb->mScAbsenceAllowed, cb->mIntroduced);
diff --git a/src/imm/immnd/immnd_proc.c b/src/imm/immnd/immnd_proc.c
--- a/src/imm/immnd/immnd_proc.c
+++ b/src/imm/immnd/immnd_proc.c
@@ -2014,14 +2014,9 @@ uint32_t immnd_proc_server(uint32_t *tim
/*Phase 2 */
if (cb->syncPid <= 0) {
/*Fork sync-agent */
- /* When SC are absent, we don't fork to trigger
abortSync */
- if (cb->mIntroduced != 2) {
- cb->syncPid = immnd_forkSync(cb);
- }
+ cb->syncPid = immnd_forkSync(cb);
if (cb->syncPid <= 0) {
- if (cb->mIntroduced != 2) {
- LOG_ER("Failed to fork sync
process");
- }
+ LOG_ER("Failed to fork sync process");
cb->syncPid = 0;
cb->mStep = 0;
cb->mJobStart = now;
@@ -2083,19 +2078,6 @@ uint32_t immnd_proc_server(uint32_t *tim
if(cb->mIntroduced == 2) {
immnd_introduceMe(cb);
- if(cb->pbePid > 0) {
- /* Check if pbe process is terminated.
- * Will send SIGKILL if it's not terminated. */
- int status = 0;
- if (waitpid(cb->pbePid, &status, WNOHANG) > 0) {
- cb->pbePid = 0;
- LOG_NO("PBE has terminated due to SC
absence");
- } else {
- LOG_WA("SC were absent and PBE appears
hung, sending SIGKILL");
- kill(cb->pbePid, SIGKILL);
- cb->pbePid = 0;
- }
- }
break;
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel