From 3f66a1a9c9368dd823cf03b764eb17a4c4b62be0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 14 Nov 2008 16:54:32 -0800 Subject: [PATCH] mds: be more forgiving on EPurgeFinish Inode may not be in cache because of purge_stray() avoiding journaling it's intent to purge. If that changes down the line, add the assertion back. --- src/mds/MDCache.cc | 4 ++++ src/mds/journal.cc | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 68cccd7d46439..e1440ff484432 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6387,6 +6387,10 @@ void MDCache::purge_stray(CDentry *dn) // CHEAT. there's no real need to journal our intent to purge, since // that is implicit in the dentry's presence and non-use in the stray // dir. on recovery, we'll need to re-eval all strays anyway. + // + // as a result, we adjust EPurgeFinish::replay to forgive us if hte + // inode isn't in the cache. If we later decide to journal our + // intent here, add that assertion back. purge_inode(in, 0, in->inode.size, mds->mdlog->get_current_segment()); waiting_for_purge[in][0].push_back(new C_MDC_PurgeStrayPurged(this, dn)); diff --git a/src/mds/journal.cc b/src/mds/journal.cc index eccb6d4d0fd79..06cf6de402e6a 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -864,6 +864,12 @@ void EPurgeFinish::replay(MDS *mds) { dout(10) << "EPurgeFinish.replay " << ino << " " << oldsize << " -> " << newsize << dendl; CInode *in = mds->mdcache->get_inode(ino); + + // if we don't have *in at this point, it's because purge_stray is lazy and + // doesn't jouranl it's intent to purge. no worries, if *in isn't in the cache, + // it's not in the purge table either. we'll eval_stray when we finish + // recovery. + //assert(in); if (in) mds->mdcache->remove_recovered_purge(in, newsize, oldsize); } -- 2.39.5