]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: add auth_name to session_info_t
authorJohn Spray <john.spray@redhat.com>
Fri, 2 Oct 2015 10:13:52 +0000 (11:13 +0100)
committerJohn Spray <john.spray@redhat.com>
Tue, 6 Oct 2015 13:27:39 +0000 (14:27 +0100)
Record the name of the entity who's authorisation
credentials were used during connection.  This
allows us to refer to it later when listing or
evicting sessions, for the user's benefit.

Signed-off-by: John Spray <john.spray@redhat.com>
src/mds/MDSDaemon.cc
src/mds/mdstypes.cc
src/mds/mdstypes.h

index 37869be782c10ac7bc4652a66164f4ef974a7ae7..9746559a9ecd33d2ef1c818a39c879d9d9bf9796 100644 (file)
@@ -1255,6 +1255,7 @@ bool MDSDaemon::ms_verify_authorizer(Connection *con, int peer_type,
     // request to open a session (initial state of Session is `closed`)
     if (!s) {
       s = new Session;
+      s->info.auth_name = name;
       s->info.inst.addr = con->get_peer_addr();
       s->info.inst.name = n;
       dout(10) << " new session " << s << " for " << s->info.inst << " con " << con << dendl;
index 3e3400ba7b339cf8fe5f6f78fcbe64b4659ea3f6..77846c3cdae517d5e2328d5b65eb9802b8a4b6dc 100644 (file)
@@ -671,19 +671,20 @@ void old_rstat_t::generate_test_instances(list<old_rstat_t*>& ls)
  */
 void session_info_t::encode(bufferlist& bl) const
 {
-  ENCODE_START(5, 3, bl);
+  ENCODE_START(6, 3, bl);
   ::encode(inst, bl);
   ::encode(completed_requests, bl);
   ::encode(prealloc_inos, bl);   // hacky, see below.
   ::encode(used_inos, bl);
   ::encode(client_metadata, bl);
   ::encode(completed_flushes, bl);
+  ::encode(auth_name, bl);
   ENCODE_FINISH(bl);
 }
 
 void session_info_t::decode(bufferlist::iterator& p)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, p);
+  DECODE_START_LEGACY_COMPAT_LEN(6, 2, 2, p);
   ::decode(inst, p);
   if (struct_v <= 2) {
     set<ceph_tid_t> s;
@@ -705,6 +706,9 @@ void session_info_t::decode(bufferlist::iterator& p)
   if (struct_v >= 5) {
     ::decode(completed_flushes, p);
   }
+  if (struct_v >= 6) {
+    ::decode(auth_name, p);
+  }
   DECODE_FINISH(p);
 }
 
index 929d36207238bea1c893c8c1325982e50d75a120..33bd671400103e90a732a5ec7297e6f70f675cd5 100644 (file)
@@ -13,6 +13,7 @@
 #include "common/config.h"
 #include "common/Clock.h"
 #include "common/DecayCounter.h"
+#include "common/entity_name.h"
 #include "MDSContext.h"
 
 #include "include/frag.h"
@@ -645,6 +646,7 @@ struct session_info_t {
   interval_set<inodeno_t> used_inos;       // journaling use
   std::map<std::string, std::string> client_metadata;
   std::set<ceph_tid_t> completed_flushes;
+  EntityName auth_name;
 
   client_t get_client() const { return client_t(inst.name.num()); }