]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: LogClient: delegate message reference release to caller
authorJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 16 Jul 2014 17:08:51 +0000 (18:08 +0100)
committerJoao Eduardo Luis <joao.luis@inktank.com>
Wed, 27 Aug 2014 17:21:47 +0000 (18:21 +0100)
Caller decides whether to release the message's reference.  It may want
to use the same message on another LogClient, if we decide not to handle
it.

Currently we always handle the message and thus always return true.  This
will not be as such later in the patch series.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/common/LogClient.cc
src/common/LogClient.h
src/mon/MonClient.cc
src/mon/Monitor.cc

index 4c845965ab30c5041cd05f422bf6273b2e64cf9f..77effcf58762257496a630942fcd8c682cd63fae 100644 (file)
@@ -169,7 +169,7 @@ Message *LogClient::_get_mon_log_message()
   return log;
 }
 
-void LogClient::handle_log_ack(MLogAck *m)
+bool LogClient::handle_log_ack(MLogAck *m)
 {
   Mutex::Locker l(log_lock);
   ldout(cct,10) << "handle_log_ack " << *m << dendl;
@@ -184,6 +184,6 @@ void LogClient::handle_log_ack(MLogAck *m)
     ldout(cct,10) << " logged " << entry << dendl;
     q = log_queue.erase(q);
   }
-  m->put();
+  return true;
 }
 
index 5e736550652cabbcd58468de17b3de61b340bc7a..c803604f04efa86745e1a2a60523124d03260054 100644 (file)
@@ -59,7 +59,7 @@ public:
   LogClient(CephContext *cct, Messenger *m, MonMap *mm,
            enum logclient_flag_t flags);
 
-  void handle_log_ack(MLogAck *m);
+  bool handle_log_ack(MLogAck *m);
 
   LogClientTemp debug() {
     return LogClientTemp(CLOG_DEBUG, *this);
index 46ffa5c8508be473abf84b0c77289c884f67e01b..df1d38e260cd9b7e6b61ce41f6197c286fadb8e0 100644 (file)
@@ -292,6 +292,7 @@ bool MonClient::ms_dispatch(Message *m)
   case MSG_LOGACK:
     if (log_client) {
       log_client->handle_log_ack(static_cast<MLogAck*>(m));
+      m->put();
       if (more_log_pending) {
        send_log();
       }
index 9595417760735ebf8dcf2e57fe841ca9df64110e..ac68700b5eea95353dc3eb568b2b591a64ce7246 100644 (file)
@@ -3095,6 +3095,7 @@ void Monitor::dispatch(MonSession *s, Message *m, const bool src_is_mon)
 
     case MSG_LOGACK:
       clog.handle_log_ack((MLogAck*)m);
+      m->put();
       break;
 
     // monmap