From: Sage Weil Date: Fri, 19 Jun 2009 18:40:09 +0000 (-0700) Subject: uclient: close mds session close race X-Git-Tag: v0.9~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3e0c3e29d971c70a4b2f458919cd8a3270d5193d;p=ceph.git uclient: close mds session close race If we get a mds push msg while closing the session, resend the close request. --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 3c4ff5a20e03..25cfacccf671 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1219,6 +1219,17 @@ void Client::kick_requests(int mds) * leases */ +void Client::got_mds_push(int mds) +{ + MDSSession& s = mds_sessions[mds]; + + s.seq++; + dout(10) << " mds" << mds << " seq now " << s.seq << dendl; + if (s.closing) + messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_CLOSE, s.seq), + s.inst); +} + void Client::handle_lease(MClientLease *m) { dout(10) << "handle_lease " << *m << dendl; @@ -1226,7 +1237,7 @@ void Client::handle_lease(MClientLease *m) assert(m->get_action() == CEPH_MDS_LEASE_REVOKE); int mds = m->get_source().num(); - mds_sessions[mds].seq++; + got_mds_push(mds); ceph_seq_t seq = m->get_seq(); @@ -1922,8 +1933,7 @@ void Client::handle_snap(MClientSnap *m) { dout(10) << "handle_snap " << *m << dendl; int mds = m->get_source().num(); - - mds_sessions[mds].seq++; + got_mds_push(mds); list to_move; SnapRealm *realm = 0; @@ -1996,11 +2006,7 @@ void Client::handle_caps(MClientCaps *m) m->clear_payload(); // for if/when we send back to MDS - // note push seq increment - if (mds_sessions.count(mds) == 0) - dout(0) << "got file_caps without session from mds" << mds << " msg " << *m << dendl; - //assert(mds_sessions.count(mds)); // HACK FIXME SOON - mds_sessions[mds].seq++; + got_mds_push(mds); Inode *in = 0; vinodeno_t vino(m->get_ino(), CEPH_NOSNAP); @@ -2417,6 +2423,7 @@ int Client::unmount() ++p) { dout(2) << "sending client_session close to mds" << p->first << " seq " << p->second.seq << dendl; + p->second.closing = true; messenger->send_message(new MClientSession(CEPH_SESSION_REQUEST_CLOSE, p->second.seq), mdsmap->get_inst(p->first)); } diff --git a/src/client/Client.h b/src/client/Client.h index 8aebfb2caf2e..f7ee455d8ad1 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -577,15 +577,17 @@ public: utime_t cap_ttl, last_cap_renew_request; int num_caps; entity_inst_t inst; + bool closing; MClientCapRelease *release; - MDSSession() : seq(0), cap_gen(0), num_caps(0), release(NULL) {} + MDSSession() : seq(0), cap_gen(0), num_caps(0), closing(false), release(NULL) {} }; map mds_sessions; // mds -> push seq map > waiting_for_session; list waiting_for_mdsmap; + void got_mds_push(int mds); void handle_client_session(MClientSession *m); void send_reconnect(int mds);