]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: handle cap msg on missing inode
authorSage Weil <sage@newdream.net>
Sun, 27 Apr 2008 20:38:11 +0000 (13:38 -0700)
committerSage Weil <sage@newdream.net>
Sun, 27 Apr 2008 20:38:34 +0000 (13:38 -0700)
src/TODO
src/client/Client.cc

index c6f9f2d63728e7c14d60ee4b5509f606710a05b0..79bd0f9a8f6ff353cc65bbb2e5203a40bb6be6cb 100644 (file)
--- a/src/TODO
+++ b/src/TODO
@@ -18,6 +18,7 @@ userspace client
 - reference count lease validations on path lookup?
 
 kernel client
+- flush all WRITE caps on session close
 - flush caps on sync, fsync, etc.
   - hmm, should these go in a per-session "check" list, instead of independently scheduling delayed_work for each inode?
 - fsync should flush cap file size to mds.  not sure how to block on that, however.. maybe a want_reply flag in the cap msg?
index ef359818537769ec028abde335898713044ea3d2..2de80733e7c98a25acb8188c0c2eb0ebd54551a7 100644 (file)
@@ -1294,8 +1294,6 @@ public:
 void Client::handle_file_caps(MClientFileCaps *m)
 {
   int mds = m->get_source().num();
-  Inode *in = 0;
-  if (inode_map.count(m->get_ino())) in = inode_map[ m->get_ino() ];
 
   m->clear_payload();  // for if/when we send back to MDS
 
@@ -1305,6 +1303,18 @@ void Client::handle_file_caps(MClientFileCaps *m)
   //assert(mds_sessions.count(mds));   // HACK FIXME SOON
   mds_sessions[mds]++;
 
+  Inode *in = 0;
+  if (inode_map.count(m->get_ino())) in = inode_map[ m->get_ino() ];
+  if (!in) {
+    /*
+     * this can happen if we release caps, and then trim the inode from our cache,
+     * but are racing with, e.g., an mds callback.
+     */
+    dout(5) << "handle_file_caps don't have ino " << m->get_ino() << dendl;
+    delete m;
+    return;
+  }
+  
   // reap?
   if (m->get_op() == CEPH_CAP_OP_IMPORT) {
     int other = m->get_migrate_mds();
@@ -1344,8 +1354,6 @@ void Client::handle_file_caps(MClientFileCaps *m)
     }
   }
 
-  assert(in);
-  
   // stale?
   if (m->get_op() == CEPH_CAP_OP_EXPORT) {
     dout(5) << "handle_file_caps on ino " << m->get_ino() << " seq " << m->get_seq() << " from mds" << mds << " now exported/stale" << dendl;