From: Joao Eduardo Luis Date: Wed, 16 Jul 2014 17:08:51 +0000 (+0100) Subject: common: LogClient: delegate message reference release to caller X-Git-Tag: v0.86~167^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=15e9fc45bee10fae1657a7449e72c6ee41e9daac;p=ceph.git common: LogClient: delegate message reference release to caller 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 --- diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index 4c845965ab30..77effcf58762 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -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; } diff --git a/src/common/LogClient.h b/src/common/LogClient.h index 5e736550652c..c803604f04ef 100644 --- a/src/common/LogClient.h +++ b/src/common/LogClient.h @@ -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); diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 46ffa5c8508b..df1d38e260cd 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -292,6 +292,7 @@ bool MonClient::ms_dispatch(Message *m) case MSG_LOGACK: if (log_client) { log_client->handle_log_ack(static_cast(m)); + m->put(); if (more_log_pending) { send_log(); } diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 959541776073..ac68700b5eea 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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