From: John Spray Date: Fri, 2 Oct 2015 10:13:52 +0000 (+0100) Subject: mds: add auth_name to session_info_t X-Git-Tag: v10.0.0~105^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4af1764667c70709da574ec6fcd36cddcc436101;p=ceph.git mds: add auth_name to session_info_t 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 --- diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index 37869be782c..9746559a9ec 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -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; diff --git a/src/mds/mdstypes.cc b/src/mds/mdstypes.cc index 3e3400ba7b3..77846c3cdae 100644 --- a/src/mds/mdstypes.cc +++ b/src/mds/mdstypes.cc @@ -671,19 +671,20 @@ void old_rstat_t::generate_test_instances(list& 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 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); } diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 929d3620723..33bd6714001 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -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 used_inos; // journaling use std::map client_metadata; std::set completed_flushes; + EntityName auth_name; client_t get_client() const { return client_t(inst.name.num()); }