]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix ino release on session close
authorSage Weil <sage@inktank.com>
Sat, 22 Sep 2012 05:20:09 +0000 (22:20 -0700)
committerSage Weil <sage@inktank.com>
Wed, 26 Sep 2012 15:24:25 +0000 (08:24 -0700)
If we project an inode release, we need to follow through, even if for
some reason we decide to keep the session active.  Clear out the session
interval_sets in case that happens.

Fixes: #1677
Signed-off-by: Sage Weil <sage@inktank.com>
src/mds/Server.cc

index dcdc75add0da74c863a8033efab7574b3562e4fd..c87f4a847f617eca0f73759f1d96f0f84546ca33 100644 (file)
@@ -255,6 +255,11 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
   dout(10) << "_session_logged " << session->inst << " state_seq " << state_seq << " " << (open ? "open":"close")
           << " " << pv << dendl;
 
+  if (piv) {
+    mds->inotable->apply_release_ids(inos);
+    assert(mds->inotable->get_version() == piv);
+  }
+
   // apply
   if (session->get_state_seq() != state_seq) {
     dout(10) << " journaled state_seq " << state_seq << " != current " << session->get_state_seq()
@@ -280,11 +285,6 @@ void Server::_session_logged(Session *session, uint64_t state_seq, bool open, ve
       dn->remove_client_lease(r, mds->locker);
     }
     
-    if (piv) {
-      mds->inotable->apply_release_ids(inos);
-      assert(mds->inotable->get_version() == piv);
-    }
-
     if (session->is_closing()) {
       // reset session
       mds->send_message_client(new MClientSession(CEPH_SESSION_CLOSE), session);
@@ -473,8 +473,12 @@ void Server::journal_close_session(Session *session, int state)
   version_t pv = ++mds->sessionmap.projected;
   version_t piv = 0;
 
-  interval_set<inodeno_t> both = session->prealloc_inos;
+  // release alloc and pending-alloc inos for this session
+  // and wipe out session state, in case the session close aborts for some reason
+  interval_set<inodeno_t> both;
+  both.swap(session->prealloc_inos);
   both.insert(session->pending_prealloc_inos);
+  session->pending_prealloc_inos.clear();
   if (both.size()) {
     mds->inotable->project_release_ids(both);
     piv = mds->inotable->get_projected_version();