]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/PaxosService: handle non-zero return values
authorSage Weil <sage@inktank.com>
Tue, 19 Mar 2013 06:09:51 +0000 (23:09 -0700)
committerSage Weil <sage@inktank.com>
Tue, 19 Mar 2013 06:09:51 +0000 (23:09 -0700)
If 7aec13f749035b9bef5e398c1ac3d56ceec8eb81 we started passing non-zero
return values to these completions; now we have to deal with them
accordingly.

RetryMessage behaves just like the Monitor variant.

Propose and Committed update state but otherwise ignore non-zero
return values.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/PaxosService.h

index 30a7b6dfe51e581771f31e8814f4f0af4670e3f5..cc403574df8684639d054cb6ca3c92c91483cd4d 100644 (file)
@@ -105,11 +105,12 @@ protected:
   public:
     C_RetryMessage(PaxosService *s, PaxosServiceMessage *m_) : svc(s), m(m_) {}
     void finish(int r) {
-      if (r == -ECANCELED) {
+      if (r == -EAGAIN || r >= 0)
+       svc->dispatch(m);
+      else if (r == -ECANCELED)
        m->put();
-       return;
-      }
-      svc->dispatch(m);
+      else
+       assert(0 == "bad C_RetryMessage return value");
     }
   };
 
@@ -140,10 +141,13 @@ protected:
   public:
     C_Propose(PaxosService *p) : ps(p) { }
     void finish(int r) {
-      if (r == -ECANCELED)
-       return;
       ps->proposal_timer = 0;
-      ps->propose_pending(); 
+      if (r >= 0)
+       ps->propose_pending();
+      else if (r == -ECANCELED || r == -EAGAIN)
+       return;
+      else
+       assert(0 == "bad return value for C_Propose");
     }
   };
 
@@ -163,7 +167,12 @@ protected:
     C_Committed(PaxosService *p) : ps(p) { }
     void finish(int r) {
       ps->proposing.set(0);
-      ps->_active();
+      if (r >= 0)
+       ps->_active();
+      else if (r == -ECANCELED || r == -EAGAIN)
+       return;
+      else
+       assert(0 == "bad return value for C_Committed");
     }
   };
   /**