summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-09-30 14:44:17 -0700
committerSage Weil <sage@inktank.com>2013-09-30 14:44:17 -0700
commit2126d7e7827cbd9c2cd7be006e8ebcdcf45276c1 (patch)
treec87c1b7dea39bc47ca1c1bc5ce5742e9c36cc253
parent67f5ef15d11a8d6ea5287e33ac7af00739ea0379 (diff)
downloadceph-wip-client-kick.tar.gz
client: remove requests from closed MetaSessionwip-client-kick
If we get a CLOSED message on a session, remove/kick any requests on that session before tearing it down. Otherwise, we get a crash like 2013-09-26 03:51:44.704446 7f4d35a46700 10 client.4111 kick_requests for mds.0 2013-09-26 03:51:45.014156 7f4d35a46700 -1 ./include/xlist.h: In function 'xlist<T>::~xlist() [with T = MetaRequest*]' thread 7f4d35a46700 time 2013-09-26 03:51:44.751908 ./include/xlist.h: 69: FAILED assert(_size == 0) ceph version 0.61.5 (8ee10dc4bb73bdd918873f29c70eedc3c7ef1979) 1: (MetaSession::~MetaSession()+0x425) [0x4e0105] 2: (Client::_closed_mds_session(MetaSession*)+0x116) [0x48a696] 3: (Client::handle_client_session(MClientSession*)+0x2bb) [0x48bf5b] 4: (Client::ms_dispatch(Message*)+0x56b) [0x4bfa0b] 5: (DispatchQueue::entry()+0x3f1) [0x621b31] 6: (DispatchQueue::DispatchThread::entry()+0xd) [0x6191bd] 7: (()+0x7851) [0x7f4d3c168851] 8: (clone()+0x6d) [0x7f4d3b09d90d] Note that this can happen if we fail to reconnect do an MDS during its reconnect interval. If that happens, we probably have inodes in our cache with no caps and things are generally not going to work very well. This is but one step in improving the situation. Separate out the two methods since they share little/no behavior. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/client/Client.cc40
-rw-r--r--src/client/Client.h3
2 files changed, 27 insertions, 16 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 77fd2084cf1..55ad80eb8c8 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -1532,7 +1532,7 @@ void Client::_closed_mds_session(MetaSession *s)
signal_context_list(s->waiting_for_open);
mount_cond.Signal();
remove_session_caps(s);
- kick_requests(s, true);
+ kick_requests_closed(s);
mds_sessions.erase(s->mds_num);
delete s;
}
@@ -1905,7 +1905,7 @@ void Client::handle_mds_map(MMDSMap* m)
if (newstate >= MDSMap::STATE_ACTIVE) {
if (oldstate < MDSMap::STATE_ACTIVE) {
- kick_requests(p->second, false);
+ kick_requests(p->second);
kick_flushing_caps(p->second);
signal_context_list(p->second->waiting_for_open);
kick_maxsize_requests(p->second);
@@ -1989,25 +1989,16 @@ void Client::send_reconnect(MetaSession *session)
}
-void Client::kick_requests(MetaSession *session, bool signal)
+void Client::kick_requests(MetaSession *session)
{
ldout(cct, 10) << "kick_requests for mds." << session->mds_num << dendl;
-
for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
p != mds_requests.end();
- ++p)
+ ++p) {
if (p->second->mds == session->mds_num) {
- if (signal) {
- // only signal caller if there is a caller
- // otherwise, let resend_unsafe handle it
- if (p->second->caller_cond) {
- p->second->kick = true;
- p->second->caller_cond->Signal();
- }
- } else {
- send_request(p->second, session);
- }
+ send_request(p->second, session);
}
+ }
}
void Client::resend_unsafe_requests(MetaSession *session)
@@ -2018,6 +2009,25 @@ void Client::resend_unsafe_requests(MetaSession *session)
send_request(*iter, session);
}
+void Client::kick_requests_closed(MetaSession *session)
+{
+ ldout(cct, 10) << "kick_requests_closed for mds." << session->mds_num << dendl;
+ for (map<tid_t, MetaRequest*>::iterator p = mds_requests.begin();
+ p != mds_requests.end();
+ ++p) {
+ if (p->second->mds == session->mds_num) {
+ if (p->second->caller_cond) {
+ p->second->kick = true;
+ p->second->caller_cond->Signal();
+ }
+ p->second->item.remove_myself();
+ p->second->unsafe_item.remove_myself();
+ }
+ }
+ assert(session->requests.empty());
+ assert(session->unsafe_requests.empty());
+}
+
diff --git a/src/client/Client.h b/src/client/Client.h
index c7c9cef0e0c..d1906a661a0 100644
--- a/src/client/Client.h
+++ b/src/client/Client.h
@@ -270,7 +270,8 @@ public:
void connect_mds_targets(int mds);
void send_request(MetaRequest *request, MetaSession *session);
MClientRequest *build_client_request(MetaRequest *request);
- void kick_requests(MetaSession *session, bool signal);
+ void kick_requests(MetaSession *session);
+ void kick_requests_closed(MetaSession *session);
void handle_client_request_forward(MClientRequestForward *reply);
void handle_client_reply(MClientReply *reply);