From ddfb2d760e4ae9ec78b1782f421b6a32fcb4603e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 19 May 2009 09:58:15 -0700 Subject: [PATCH] mon: send mount error to client on EPERM or protocol version mismatch --- src/mon/ClientMonitor.cc | 5 +++++ src/mon/Monitor.cc | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/mon/ClientMonitor.cc b/src/mon/ClientMonitor.cc index 7393f7d7e0618..0983a4b52d2d5 100644 --- a/src/mon/ClientMonitor.cc +++ b/src/mon/ClientMonitor.cc @@ -138,6 +138,11 @@ bool ClientMonitor::check_mount(MClientMount *m) dout(0) << "client is not authorized to mount" << dendl; ss << "client " << addr << " is not authorized to mount"; mon->get_logclient()->log(LOG_SEC, ss); + + string s; + getline(ss, s); + mon->messenger->send_message(new MClientMountAck(-EPERM, s.c_str()), + m->get_orig_source_inst()); return true; } if (client_map.addr_client.count(addr)) { diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index dadded02c05e3..930a8084222ed 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -33,6 +33,8 @@ #include "messages/MMonPaxos.h" +#include "messages/MClientMountAck.h" + #include "common/Timer.h" #include "common/Clock.h" @@ -344,6 +346,16 @@ bool Monitor::dispatch_impl(Message *m) if (m->get_header().monc_protocol != CEPH_MONC_PROTOCOL) { dout(0) << "monc protocol v " << (int)m->get_header().monc_protocol << " != my " << CEPH_MONC_PROTOCOL << " from " << m->get_orig_source_inst() << " " << *m << dendl; + + if (m->get_type() == CEPH_MSG_CLIENT_MOUNT) { + stringstream ss; + ss << "client protocol v " << (int)m->get_header().monc_protocol << " != server v " << CEPH_MONC_PROTOCOL; + string s; + getline(ss, s); + messenger->send_message(new MClientMountAck(-EINVAL, s.c_str()), + m->get_orig_source_inst()); + } + delete m; return true; } -- 2.39.5