Hi Hung,

Reviewed the code.
Ack from me.

Thanks,
Zoran

-----Original Message-----
From: Hung Nguyen [mailto:[email protected]] 
Sent: den 19 januari 2017 12:20
To: Zoran Milinkovic <[email protected]>; 
[email protected]
Cc: [email protected]
Subject: [PATCH 1 of 1] imm: Fix the mismatch when resetting 
sLastContinuationId [#2272]

 src/imm/immnd/ImmModel.cc |  58 +++++++++++++++++++++++++---------------------
 1 files changed, 32 insertions(+), 26 deletions(-)


The mismatch only happens in ::ccbObjectCreate(), ::ccbObjectModify(), 
::deleteObject().
The changes in other functions are to make sure that we handle 
sLastContinuationId the same way in the whole IMM Model code.
sLastContinuationId will be increased (and reset if needed) before we use it.

diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -3014,9 +3014,10 @@ ImmModel::adjustEpoch(int suggestedEpoch
            immnd_abortSync().
         */
 
-        *continuationIdPtr = ++sLastContinuationId;
-        if(sLastContinuationId >= 0xfffffffe)
-        {sLastContinuationId = 1;}
+        if (++sLastContinuationId >= 0xfffffffe) {
+            sLastContinuationId = 1;
+        }
+        *continuationIdPtr = sLastContinuationId;
         TRACE("continuation generated: %u", *continuationIdPtr);
 
         if(getPbeOi(pbeConnPtr, pbeNodeIdPtr)) { @@ -3801,8 +3802,7 @@ 
ImmModel::classCreate(const ImmsvOmClass
             LOG_ER("Pbe is not available, can not happen here");
             abort();
         }
-        ++sLastContinuationId;
-        if(sLastContinuationId >= 0xfffffffe) {
+        if (++sLastContinuationId >= 0xfffffffe) {
             sLastContinuationId = 1;
         }
         (*continuationIdPtr) = sLastContinuationId; @@ -4747,9 +4747,8 @@ 
ImmModel::classDelete(const ImmsvOmClass
                     LOG_ER("Pbe is not available, can not happen here");
                     abort();
                 }
-                ++sLastContinuationId;
-                if(sLastContinuationId >= 0xfffffffe) {
-                        sLastContinuationId = 1;
+                if (++sLastContinuationId >= 0xfffffffe) {
+                    sLastContinuationId = 1;
                 }
                 (*continuationIdPtr) = sLastContinuationId;
 
@@ -5736,8 +5735,7 @@ ImmModel::ccbApply(SaUint32T ccbId,
                 ImplementerCcbAssociation* implAssoc = isi->second;
                 ImplementerInfo* impInfo = implAssoc->mImplementer;
                 osafassert(impInfo);
-                ++sLastContinuationId; 
-                if(sLastContinuationId >= 0xfffffffe) {
+                if (++sLastContinuationId >= 0xfffffffe) {
                     sLastContinuationId = 1;
                 }
                 /* incremented sLastContinuationId unconditionally before @@ 
-8530,9 +8528,10 @@ SaAisErrorT ImmModel::ccbObjectCreate(Im
                 oMut->mWaitForImplAck = true;
                 
                 //Increment even if we dont invoke locally
-                oMut->mContinuationId = (++sLastContinuationId);
-                if(sLastContinuationId >= 0xfffffffe) 
-                {sLastContinuationId = 1;}
+                if (++sLastContinuationId >= 0xfffffffe) {
+                    sLastContinuationId = 1;
+                }
+                oMut->mContinuationId = sLastContinuationId;
 
                 if(*implConn) {
                     if(object->mImplementer->mDying) { @@ -9838,8 +9837,10 @@ 
ImmModel::ccbObjectModify(const ImmsvOmC
             oMut->mWaitForImplAck = true;
             
             //Increment even if we dont invoke locally
-            oMut->mContinuationId = (++sLastContinuationId);
-            if(sLastContinuationId >= 0xfffffffe) {sLastContinuationId = 1;}
+            if (++sLastContinuationId >= 0xfffffffe) {
+                sLastContinuationId = 1;
+            }
+            oMut->mContinuationId = sLastContinuationId;
 
             if(*implConn) {
                 if(object->mImplementer->mDying) { @@ -10460,8 +10461,10 @@ 
ImmModel::deleteObject(ObjectMap::iterat
             
             oMut->mWaitForImplAck = true; //Wait for an ack from implementer
             //Increment even if we dont invoke locally
-            oMut->mContinuationId = (++sLastContinuationId);
-            if(sLastContinuationId >= 0xfffffffe) {sLastContinuationId = 1;}
+            if (++sLastContinuationId >= 0xfffffffe) {
+                sLastContinuationId = 1;
+            }
+            oMut->mContinuationId = sLastContinuationId;
 
             if(ccb->mAugCcbParent) {
                 oMut->mIsAugDelete = true; @@ -16307,9 +16310,10 @@ 
ImmModel::rtObjectCreate(struct ImmsvOmC
                 object->mObjFlags |= IMM_CREATE_LOCK;
                 /* Dont overwrite IMM_DN_INTERNAL_REP*/
 
-                *continuationId = ++sLastContinuationId;
-                if(sLastContinuationId >= 0xfffffffe)
-                {sLastContinuationId = 1;}
+                if (++sLastContinuationId >= 0xfffffffe) {
+                    sLastContinuationId = 1;
+                }
+                *continuationId = sLastContinuationId;
 
                 ObjectMutation* oMut = new ObjectMutation(IMM_CREATE);
                 oMut->mContinuationId = (*continuationId); @@ -17161,9 
+17165,10 @@ ImmModel::rtObjectUpdate(const ImmsvOmCc
             /* If 2PBE then not both PBEs on same processor. */
             osafassert(!((*pbeConnPtr) && (*pbe2BConnPtr)));
 
-            *continuationIdPtr = ++sLastContinuationId;
-            if(sLastContinuationId >= 0xfffffffe)
-            {sLastContinuationId = 1;}
+            if (++sLastContinuationId >= 0xfffffffe) {
+                sLastContinuationId = 1;
+            }
+            *continuationIdPtr = sLastContinuationId;
             TRACE("continuation generated: %u", *continuationIdPtr);
 
             if(conn) {
@@ -17728,9 +17733,10 @@ ImmModel::rtObjectDelete(const ImmsvOmCc
             /* If the subtree to delete includes PRTOs then we use a 
continuationId
                as a common pseudo ccbId for all the RTOs in the subtree.
             */
-            *continuationIdPtr = ++sLastContinuationId;
-            if(sLastContinuationId >= 0xfffffffe)
-            {sLastContinuationId = 1;}
+            if (++sLastContinuationId >= 0xfffffffe) {
+                sLastContinuationId = 1;
+            }
+            *continuationIdPtr = sLastContinuationId;
             TRACE("continuation generated: %u", *continuationIdPtr);
 
             if(reqConn) {

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