From 486d696723374e40469e98b6e0c0b615f508f339 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 9 Nov 2009 21:31:51 -0800 Subject: [PATCH] mon: ignore MAuth message when connection has no session This happens if hte message is delayed, and the session meanwhile is closed. We need similar checks any time we take a Session from the message->get_connection().... --- src/mon/AuthMonitor.cc | 5 +++++ src/mon/MonClient.cc | 2 +- src/mon/Monitor.cc | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index cb28aed5946b8..3b01b837a52a2 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -359,6 +359,11 @@ bool AuthMonitor::prep_auth(MAuth *m, bool paxos_writable) MAuthReply *reply; Session *s = (Session *)m->get_connection()->get_priv(); + if (!s) { + dout(10) << "no session, dropping" << dendl; + delete m; + return true; + } bufferlist response_bl; bufferlist::iterator indata = m->auth_payload.begin(); diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 7a99f4d702f62..c463eefd68e80 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -295,7 +295,7 @@ void MonClient::handle_auth(MAuthReply *m) ::decode(global_id, p); clientid = global_id; auth->set_global_id(global_id); - dout(1) << "my global_id is " << global_id << dendl; + dout(10) << "my global_id is " << global_id << dendl; } catch (buffer::error *err) { delete m; return; diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 688ecae22705d..93c98d0972a32 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -683,6 +683,11 @@ void Monitor::handle_subscribe(MMonSubscribe *m) bool reply = false; Session *s = (Session *)m->get_connection()->get_priv(); + if (!s) { + dout(10) << " no session, dropping" << dendl; + delete m; + return; + } s->until = g_clock.now(); s->until += g_conf.mon_subscribe_interval; -- 2.39.5