client/Dentry.cc \
client/MetaRequest.cc \
client/SnapRealm.cc \
+ client/MetaSession.cc \
client/Trace.cc
libclient_la_LIBADD = libosdc.la $(LIBEDIT_LIBS)
noinst_LTLIBRARIES += libclient.la
m_client->client_lock.Lock();
if (command == "mds_requests")
m_client->dump_mds_requests(&formatter);
+ else if (command == "mds_sessions")
+ m_client->dump_mds_sessions(&formatter);
else if (command == "dump_cache")
m_client->dump_cache(&formatter);
else
lderr(cct) << "error registering admin socket command: "
<< cpp_strerror(-ret) << dendl;
}
+ ret = admin_socket->register_command("mds_sessions",
+ &m_command_hook,
+ "show mds session state");
+ if (ret < 0) {
+ lderr(cct) << "error registering admin socket command: "
+ << cpp_strerror(-ret) << dendl;
+ }
ret = admin_socket->register_command("dump_cache",
&m_command_hook,
"show in-memory metadata cache contents");
}
}
+void Client::dump_mds_sessions(Formatter *f)
+{
+ f->open_array_section("open_sessions");
+ for (map<int,MetaSession*>::const_iterator p = mds_sessions.begin(); p != mds_sessions.end(); ++p) {
+ f->open_object_section("session");
+ p->second->dump(f);
+ f->close_section();
+ }
+ f->close_section();
+ f->open_array_section("opening_sessions");
+ for (map<int,list<Cond*> >::const_iterator p = waiting_for_session.begin(); p != waiting_for_session.end(); ++p) {
+ f->dump_int("mds", p->first);
+ }
+ f->close_section();
+ f->dump_int("mdsmap_epoch", mdsmap->get_epoch());
+}
void Client::dump_mds_requests(Formatter *f)
{
for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
set<int> failed_mds;
void dump_mds_requests(Formatter *f);
+ void dump_mds_sessions(Formatter *f);
int make_request(MetaRequest *req, int uid, int gid,
//MClientRequest *req, int uid, int gid,
--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "include/types.h"
+
+#include "MetaSession.h"
+
+#include "common/Formatter.h"
+
+void MetaSession::dump(Formatter *f) const
+{
+ f->dump_int("mds", mds_num);
+ f->dump_stream("addr") << inst.addr;
+ f->dump_unsigned("seq", seq);
+ f->dump_unsigned("cap_gen", cap_gen);
+ f->dump_stream("cap_ttl") << cap_ttl;
+ f->dump_stream("last_cap_renew_request") << last_cap_renew_request;
+ f->dump_unsigned("cap_renew_seq", cap_renew_seq);
+ f->dump_int("num_caps", num_caps);
+ f->dump_int("closing", (int)closing);
+ f->dump_int("was_stale", (int)was_stale);
+}
+
+MetaSession::~MetaSession()
+{
+ if (release)
+ release->put();
+}
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
#ifndef CEPH_CLIENT_METASESSION_H
#define CEPH_CLIENT_METASESSION_H
MetaSession() : mds_num(-1), seq(0), cap_gen(0), cap_renew_seq(0), num_caps(0),
closing(false), was_stale(false), release(NULL) {}
- ~MetaSession() {
- if (release)
- release->put();
- }
+ ~MetaSession();
+
+ void dump(Formatter *f) const;
};
#endif