From fa7876978ef424fb487e1fb05e183eb2134972a0 Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 17 Jul 2007 04:21:34 +0000 Subject: [PATCH] cosmetic rejoin cleanup git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1508 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/cephmds2/mds/MDCache.cc | 46 ++++++++++++++------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/branches/sage/cephmds2/mds/MDCache.cc b/branches/sage/cephmds2/mds/MDCache.cc index 0a8685a9df40d..028a7f7baa799 100644 --- a/branches/sage/cephmds2/mds/MDCache.cc +++ b/branches/sage/cephmds2/mds/MDCache.cc @@ -1842,19 +1842,30 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) // possible response(s) MMDSCacheRejoin *ack = 0; // if survivor MMDSCacheRejoin *purge = 0; // if i'm missing something, purge it from the (recovering) sender. - - // am i a survivor? - bool survivor = false; + bool survivor = false; // am i a survivor? + if (mds->is_active() || mds->is_stopping()) { survivor = true; - dout(10) << "i am surivivor; will ack immediately and remove stale replicas" << endl; + dout(10) << "i am a surivivor, and will ack immediately" << endl; ack = new MMDSCacheRejoin(MMDSCacheRejoin::OP_ACK); + + // check cap exports + for (map >::iterator p = weak->cap_exports.begin(); + p != weak->cap_exports.end(); + ++p) { + CInode *in = get_inode(p->first); + if (!in || !in->is_auth()) continue; + for (map::iterator q = p->second.begin(); + q != p->second.end(); + ++q) { + dout(10) << " claiming cap import " << p->first << " client" << q->first << " on " << *in << endl; + rejoin_import_cap(in, q->first, q->second, from); + } + } } else { assert(mds->is_rejoin()); - } - // check cap exports. - if (mds->is_rejoin()) { + // check cap exports. for (map >::iterator p = weak->cap_exports.begin(); p != weak->cap_exports.end(); ++p) { @@ -1875,20 +1886,6 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) cap_imports[p->first][q->first][from] = q->second; } } - } else { - // survivor. - for (map >::iterator p = weak->cap_exports.begin(); - p != weak->cap_exports.end(); - ++p) { - CInode *in = get_inode(p->first); - if (!in || !in->is_auth()) continue; - for (map::iterator q = p->second.begin(); - q != p->second.end(); - ++q) { - dout(10) << " claiming cap import " << p->first << " client" << q->first << " on " << *in << endl; - rejoin_import_cap(in, q->first, q->second, from); - } - } } // walk weak map @@ -1941,7 +1938,7 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) dout(10) << " have " << *in << endl; // scatter the dirlock, just in case? - if (!survivor) + if (!survivor && in->is_dir()) in->dirlock.set_state(LOCK_SCATTER); if (ack) { @@ -3051,6 +3048,11 @@ void MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map