Hi Hung,

Reviewed the code.
Ack from me with a minor comment.

The comment in the code "// Note: interference only possible fore release." is 
not valid anymore since now both release and set are handled in "if (!doIt && 
ccbIdOfObj)"
You can only remove the line when you push the code.

Thanks,
Zoran

-----Original Message-----
From: Hung Nguyen [mailto:hung.d.ngu...@dektech.com.au] 
Sent: den 14 september 2017 06:42
To: Zoran Milinkovic <zoran.milinko...@ericsson.com>
Cc: opensaf-devel@lists.sourceforge.net; Hung Duc Nguyen 
<hung.d.ngu...@dektech.com.au>
Subject: [PATCH 1/1] imm: Don't allow setting new admo name when object is in a 
critical CCB [#2576]

When object is in a critical CCB and has no admo,
ERR_TRY_AGAIN will be returned if setting a new admo name to the object.

If setting a different admo name, ERR_EXIST will be returned as stated in IMM 
specification.
---
 src/imm/immnd/ImmModel.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index 2a53ed4..275883b 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -5164,7 +5164,7 @@ SaAisErrorT ImmModel::adminOwnerChange(const struct 
immsv_a2nd_admown_set* req,
           CcbVector::iterator i2;
           ObjectInfo* objectInfo = i1->second;
           ccbIdOfObj = objectInfo->mCcbId;
-          if (!doIt && ccbIdOfObj && release) {
+          if (!doIt && ccbIdOfObj) {
             // check for ccb interference
             // Note: interference only possible fore release.
             // For set the adminowner is either same == noop;
@@ -5177,7 +5177,13 @@ SaAisErrorT ImmModel::adminOwnerChange(const struct 
immsv_a2nd_admown_set* req,
               if (!release && (adm->mAdminOwnerName == oldOwner)) {
                 TRACE("Idempotent adminOwner set for %s on %s",
                       oldOwner.c_str(), objectName.c_str());
-              } else {
+              } else if (!release && oldOwner.empty()
+                  && (*i2)->mState == IMM_CCB_CRITICAL) {
+                TRACE_7("ERR_TRY_AGAIN: Object '%s' is in a critical CCB (%d)",
+                        objectName.c_str(), (*i2)->mId);
+                TRACE_LEAVE();
+                return SA_AIS_ERR_TRY_AGAIN;
+              } else if (release) {
                 LOG_IN("ERR_BUSY: ccb id %u active on object %s", ccbIdOfObj,
                        objectName.c_str());
                 TRACE_LEAVE();
-- 
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to