]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: unqueue recovery on purging inodes
authorSage Weil <sage@newdream.net>
Tue, 18 Nov 2008 00:46:38 +0000 (16:46 -0800)
committerSage Weil <sage@newdream.net>
Tue, 18 Nov 2008 00:46:38 +0000 (16:46 -0800)
If an inode is queued for file size recovery when it is purged,
unqueue it.  This catches the log replay case where client
reconnect queues up the inode.

Also, in eval_stray, skip inodes that are queued.  This should
avoid a recovery running concurrently with the purge (which could
be problematic, as it would carry a pointer to *in).

src/mds/MDCache.cc
src/mds/MDCache.h

index e1440ff4844320ec692fd11d87978b725982397c..1967d1de3b2eb4bfed70cd19e6e5adf6d5f4a9d2 100644 (file)
@@ -3925,6 +3925,14 @@ void MDCache::_queue_file_recover(CInode *in)
   file_recover_queue.insert(in);
 }
 
+void MDCache::unqueue_file_recover(CInode *in)
+{
+  dout(15) << "unqueue_file_recover " << *in << dendl;
+  in->state_clear(CInode::STATE_RECOVERING);
+  in->auth_unpin(this);
+  file_recover_queue.erase(in);
+}
+
 /*
  * called after recovery to recover file sizes for previously opened (for write)
  * files.  that is, those where max_size > size.
@@ -6331,6 +6339,8 @@ void MDCache::eval_stray(CDentry *dn)
     if (dn->is_replicated() || in->is_any_caps()) return;  // wait
     if (!in->dirfrags.empty()) return;  // wait for dirs to close/trim
     if (dn->state_test(CDentry::STATE_PURGING)) return;  // already purging
+    if (in->state_test(CInode::STATE_NEEDSRECOVER) ||
+       in->state_test(CInode::STATE_RECOVERING)) return;  // don't mess with file size probing
     purge_stray(dn);
   }
   else if (in->inode.nlink == 1) {
@@ -6437,6 +6447,8 @@ void MDCache::_purge_stray_logged(CDentry *dn, version_t pdv, LogSegment *ls)
   CInode *in = dn->inode;
   if (in->is_dirty())
     in->mark_clean();
+  if (in->state_test(CInode::STATE_RECOVERING))
+    unqueue_file_recover(in);
   if (dn->is_dirty())
     dn->mark_clean();
   remove_inode(in);
index 17bd319ea6a5a0c581844b030e716d69fc1f289d..c29b9906fd0f732c33040004f00ba63ea195b67b 100644 (file)
@@ -696,6 +696,7 @@ public:
   set<CInode*> file_recovering;
 
   void queue_file_recover(CInode *in);
+  void unqueue_file_recover(CInode *in);
   void _queued_file_recover_cow(CInode *in, Mutation *mut);
   void _queue_file_recover(CInode *in);
   void identify_files_to_recover();