Hi Hieu,

This code will not work with CCB error strings related with PBE.
PBE can be running on a different node than the originating node.

Thanks,
Zoran

-----Original Message-----
From: Hieu Nguyen [mailto:[email protected]] 
Sent: den 21 april 2017 09:27
To: Zoran Milinkovic <[email protected]>; 
[email protected]; Hung Duc Nguyen <[email protected]>
Cc: [email protected]; Hieu Thanh Nguyen 
<[email protected]>
Subject: [PATCH 1/1] imm: Improve ccb error string handling [#2367]

---
 src/imm/immnd/ImmModel.cc | 61 +++++++----------------------------------------
 1 file changed, 9 insertions(+), 52 deletions(-)

diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc index 
35c8a31..e337231 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -10734,6 +10734,12 @@ void ImmModel::setCcbErrorString(CcbInfo* ccb, const 
char* errorString,
   va_list args;
   int isValidationErrString = 0;
 
+  // Only store error strings on originating node where OM client resides.
+  if ((ccb->mAugCcbParent && !ccb->mAugCcbParent->mOriginatingConn) ||
+      (!ccb->mOriginatingConn)) {
+    return;
+  }
+
   va_copy(args, vl);
   len = vsnprintf(fmtError, errLen, errorString, args);
   va_end(args);
@@ -11135,35 +11141,11 @@ void 
ImmModel::ccbObjDelContinuation(immsv_oi_ccb_upcall_rsp* rsp,
         // imm implementation has the right to veto any ccb at any time.
       }
 
-      if (rsp->errorString.size && ccb->mOriginatingConn) {
+      if (rsp->errorString.size) {
         /*Collect err strings, see: http://devel.opensaf.org/ticket/1904
           Only done at originating node since that is where the OM
           client resides. */
-        unsigned int ix = 0;
-        ImmsvAttrNameList* errStr = ccb->mErrorStrings;
-        ImmsvAttrNameList** errStrTail = &(ccb->mErrorStrings);
-        while (errStr) {
-          if (!strncmp(rsp->errorString.buf, errStr->name.buf,
-                       rsp->errorString.size)) {
-            TRACE_5("Discarding duplicate error string '%s' for ccb id %u",
-                    rsp->errorString.buf, ccbId);
-            return;
-          }
-          ++ix;
-          errStrTail = &(errStr->next);
-          errStr = errStr->next;
-        }
-
-        if (ix >= IMMSV_MAX_ATTRIBUTES) {
-          TRACE_5("Discarding error string '%s' for ccb id %u (too many)",
-                  rsp->errorString.buf, ccbId);
-        } else {
-          (*errStrTail) = 
(ImmsvAttrNameList*)malloc(sizeof(ImmsvAttrNameList));
-          (*errStrTail)->next = NULL;
-          (*errStrTail)->name.size = rsp->errorString.size;
-          (*errStrTail)->name.buf = rsp->errorString.buf;
-          rsp->errorString.buf = NULL; /* steal */
-        }
+        setCcbErrorString(ccb, rsp->errorString.buf);
       }
     }
   }
@@ -11299,32 +11281,7 @@ void 
ImmModel::ccbCompletedContinuation(immsv_oi_ccb_upcall_rsp* rsp,
       if (rsp->errorString.size) {
         TRACE("Error string received.");
         /*Collect err strings, see: http://devel.opensaf.org/ticket/1904 */
-        unsigned int ix = 0;
-        ImmsvAttrNameList* errStr = ccb->mErrorStrings;
-        ImmsvAttrNameList** errStrTail = &(ccb->mErrorStrings);
-        while (errStr) {
-          if (!strncmp(rsp->errorString.buf, errStr->name.buf,
-                       rsp->errorString.size)) {
-            TRACE_5("Discarding duplicate error string '%s' for ccb id %u",
-                    rsp->errorString.buf, ccbId);
-            return;
-          }
-          ++ix;
-          errStrTail = &(errStr->next);
-          errStr = errStr->next;
-        }
-
-        if (ix >= IMMSV_MAX_ATTRIBUTES) {
-          TRACE_5("Discarding error string '%s' for ccb id %u (too many)",
-                  rsp->errorString.buf, ccbId);
-        } else {
-          TRACE("Error string added.");
-          (*errStrTail) = 
(ImmsvAttrNameList*)malloc(sizeof(ImmsvAttrNameList));
-          (*errStrTail)->next = NULL;
-          (*errStrTail)->name.size = rsp->errorString.size;
-          (*errStrTail)->name.buf = rsp->errorString.buf;
-          rsp->errorString.buf = NULL; /* steal */
-        }
+        setCcbErrorString(ccb, rsp->errorString.buf);
       }
     }
   }
--
2.7.4


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