From: Sage Weil Date: Tue, 19 May 2009 16:58:15 +0000 (-0700) Subject: mon: send mount error to client on EPERM or protocol version mismatch X-Git-Tag: v0.8~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ddfb2d760e4ae9ec78b1782f421b6a32fcb4603e;p=ceph.git mon: send mount error to client on EPERM or protocol version mismatch --- diff --git a/src/mon/ClientMonitor.cc b/src/mon/ClientMonitor.cc index 7393f7d7e06..0983a4b52d2 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 dadded02c05..930a8084222 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; }