]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: release import caps we don't have
authorSage Weil <sage@inktank.com>
Wed, 17 Oct 2012 22:44:09 +0000 (15:44 -0700)
committerSage Weil <sage@inktank.com>
Sun, 21 Oct 2012 16:26:09 +0000 (09:26 -0700)
If we don't have the inode, release the caps.  There is no point in adding
it to our cache, and that is problematic anyway because it ends up with a
ref count of zero and no dentry that will get trimmed by trim_cache(),
leaving it stuck there on shutdown.

This also aligns us with the kernel client behavior.

Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Client.cc

index 6eac729ca1edc4498706b45d42db7b3deb229b74..b83bfeb4c9ede1a99331547b619b55e620e3c882 100644 (file)
@@ -2999,20 +2999,24 @@ void Client::handle_caps(MClientCaps *m)
     in = inode_map[vino];
   if (!in) {
     if (m->get_op() == CEPH_CAP_OP_IMPORT) {
-      ldout(cct, 5) << "handle_caps adding ino " << vino << " on IMPORT" << dendl;
-      in = new Inode(cct, vino, &m->get_layout());
-      inode_map[vino] = in;
-      in->ino = vino.ino;
-      in->snapid = vino.snapid;
-      in->mode = m->head.mode;
+      ldout(cct, 5) << "handle_caps don't have vino " << vino << " on IMPORT, immediately releasing" << dendl;
+      MetaSession *session = mds_sessions[mds];
+      if (!session->release)
+       session->release = new MClientCapRelease;
+      ceph_mds_cap_item i;
+      i.ino = m->get_ino();
+      i.cap_id = m->get_cap_id();
+      i.seq = m->get_seq();
+      i.migrate_seq = m->get_mseq();
+      session->release->caps.push_back(i);
     } else {
       ldout(cct, 5) << "handle_caps don't have vino " << vino << ", dropping" << dendl;
-      m->put();
-
-      // in case the mds is waiting on e.g. a revocation
-      flush_cap_releases();
-      return;
     }
+    m->put();
+
+    // in case the mds is waiting on e.g. a revocation
+    flush_cap_releases();
+    return;
   }
 
   switch (m->get_op()) {