osaf/services/saf/immsv/immnd/immnd_cb.h   |   1 +
 osaf/services/saf/immsv/immnd/immnd_proc.c |  30 +++++++++++++++++++++++-------
 2 files changed, 24 insertions(+), 7 deletions(-)


diff --git a/osaf/services/saf/immsv/immnd/immnd_cb.h 
b/osaf/services/saf/immsv/immnd/immnd_cb.h
--- a/osaf/services/saf/immsv/immnd/immnd_cb.h
+++ b/osaf/services/saf/immsv/immnd/immnd_cb.h
@@ -128,6 +128,7 @@ typedef struct immnd_cb_tag {
        uint8_t mLostNodes;       //Detached & not syncreq => delay sync start
        uint8_t mBlockPbeEnable;  //Current PBE has not completed shutdown yet.
        uint8_t mPbeKills;        //If != 0 then immnd has tried to kill Pbe.
+       uint8_t mPbeCritical;    //if != 0 then pbe is disabled, but critical 
ccbs are still present.
        uint8_t m2Pbe;            //If!=0 => 2PBE, 2 => fetch PBE file info.
        bool mIsOtherScUp; //If set & this is an SC then other SC is up(2pbe).
                   //False=> *allow* 1safe 2pbe. May err conservatively (true) 
diff --git a/osaf/services/saf/immsv/immnd/immnd_proc.c 
b/osaf/services/saf/immsv/immnd/immnd_proc.c
--- a/osaf/services/saf/immsv/immnd/immnd_proc.c
+++ b/osaf/services/saf/immsv/immnd/immnd_proc.c
@@ -1631,6 +1631,7 @@ static int immnd_forkPbe(IMMND_CB *cb)
        }
        TRACE_5("Parent %s, successfully forked %s, pid:%d", base, dbFilePath, 
pid);
        cb->mPbeKills = 0; /* Rest kill count when we just created a new PBE. */
+       cb->mPbeCritical = 0;
        if(cb->mIsCoord && cb->mPbeVeteran) {
                cb->mPbeVeteran = SA_FALSE;
                /* If pbe crashes again before succeeding to attach as PBE 
implementer
@@ -2004,6 +2005,7 @@ uint32_t immnd_proc_server(uint32_t *tim
                                        }
                                        cb->pbePid = 0;
                                        cb->mPbeKills = 0;
+                                       cb->mPbeCritical = 0;
                                        if(!immModel_pbeIsInSync(cb, false)) {
                                                TRACE_5("Sync-server/coord 
invoking "
                                                        
"immnd_pbePrtoPurgeMutations");
@@ -2112,6 +2114,7 @@ uint32_t immnd_proc_server(uint32_t *tim
                                }
                                cb->pbePid = 0;
                                cb->mPbeKills = 0;
+                               cb->mPbeCritical = 0;
                                osafassert(coord);
                                if(!immModel_pbeIsInSync(cb, false)) {
                                        TRACE_5("Server-ready/coord invoking "
@@ -2211,13 +2214,26 @@ uint32_t immnd_proc_server(uint32_t *tim
                                } else { /* Pbe is running. */
                                        osafassert(cb->pbePid > 0);
                                        if (cb->mRim == SA_IMM_INIT_FROM_FILE 
|| cb->mBlockPbeEnable) {
-                                               /* Pbe should NOT run.*/
-                                               if((cb->mPbeKills++)==0) { /* 
Send SIGTERM only once.*/
-                                                       LOG_NO("STOPPING PBE 
process.");
-                                                       kill(cb->pbePid, 
SIGTERM);
-                                               } else if(cb->mPbeKills > 20) {
-                                                       LOG_WA("PBE process 
appears hung, sending SIGKILL");
-                                                       kill(cb->pbePid, 
SIGKILL);
+                                               /* If the PBE is terminated 
without checking critical CCBs, then 
+                                               the PBE is not turned on, then 
new/restared IMMND can not be synced.
+                                               In the case of Upgrade the 
campaign will fail. Max of 20 seconds 
+                                               will be waited, for critical 
ccbs to send Ack, After that the PBE will be 
+                                               terminated. This check is 
required for 1PBE. */ 
+                                               if(immModel_pbeIsInSync(cb, 
true)|| (cb->mPbeCritical > 20)|| cb->m2Pbe ){
+                                                       if(cb->mPbeCritical)
+                                                               
cb->mPbeCritical = 0;
+                                                       /* Pbe should NOT run.*/
+                                                       
if((cb->mPbeKills++)==0) { /* Send SIGTERM only once.*/
+                                                               
LOG_NO("STOPPING PBE process.");
+                                                               
kill(cb->pbePid, SIGTERM);
+                                                       } else if(cb->mPbeKills 
> 20) {
+                                                               LOG_WA("PBE 
process appears hung, sending SIGKILL");
+                                                               
kill(cb->pbePid, SIGKILL);
+                                                       }
+                                               } else {
+                                                       LOG_WA("PBE has 
critical CCBs, waiting for the PBE to send response to critical ccbs"
+                                                                       "Before 
stopping the PBE");
+                                                       cb->mPbeCritical++;
                                                }
                                        }
                                }

------------------------------------------------------------------------------
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

Reply via email to