]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: send mount error to client on EPERM or protocol version mismatch
authorSage Weil <sage@newdream.net>
Tue, 19 May 2009 16:58:15 +0000 (09:58 -0700)
committerSage Weil <sage@newdream.net>
Tue, 19 May 2009 16:58:15 +0000 (09:58 -0700)
src/mon/ClientMonitor.cc
src/mon/Monitor.cc

index 7393f7d7e06188fd10d900879dd1c640297ccce1..0983a4b52d2d54e8b065eee27e7c18ca156ec25c 100644 (file)
@@ -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)) {
index dadded02c05e3a3467e7866d8c85b8cc170ef42b..930a8084222ed274727d0dc9928763a10e5d7c3a 100644 (file)
@@ -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;
   }