From d1276f0ac46ebc06a9e62bb622e8521ab61cd7e6 Mon Sep 17 00:00:00 2001 From: sageweil Date: Wed, 10 Oct 2007 00:42:54 +0000 Subject: [PATCH] parallel_fetch fixup, client mdsmap fix, freeze tweak, rejoin tweak git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1906 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/mds/client/Client.cc | 9 ++++-- branches/sage/mds/mds/CDir.cc | 6 ++-- branches/sage/mds/mds/CDir.h | 6 ++-- branches/sage/mds/mds/CInode.cc | 2 +- branches/sage/mds/mds/MDCache.cc | 48 ++++++++++++++++-------------- branches/sage/mds/mds/MDCache.h | 3 +- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/branches/sage/mds/client/Client.cc b/branches/sage/mds/client/Client.cc index 0aa111e3f52db..aac84c5491b3e 100644 --- a/branches/sage/mds/client/Client.cc +++ b/branches/sage/mds/client/Client.cc @@ -978,10 +978,15 @@ void Client::handle_mds_map(MMDSMap* m) mount_cond.Signal(); // mount might be waiting for this. } + if (m->get_epoch() < mdsmap->get_epoch()) { + dout(1) << "handle_mds_map epoch " << m->get_epoch() << " is older than our " + << mdsmap->get_epoch() << dendl; + delete m; + return; + } + dout(1) << "handle_mds_map epoch " << m->get_epoch() << dendl; - epoch_t was = mdsmap->get_epoch(); mdsmap->decode(m->get_encoded()); - assert(mdsmap->get_epoch() >= was); // send reconnect? if (frommds >= 0 && diff --git a/branches/sage/mds/mds/CDir.cc b/branches/sage/mds/mds/CDir.cc index 93f753aaa5087..201f3ffeeebeb 100644 --- a/branches/sage/mds/mds/CDir.cc +++ b/branches/sage/mds/mds/CDir.cc @@ -739,8 +739,10 @@ void CDir::finish_waiting(int mask, int result) list finished; take_waiting(mask, finished); - //finish_contexts(finished, result); - cache->mds->queue_waiters(finished); + if (result < 0) + finish_contexts(finished, result); + else + cache->mds->queue_waiters(finished); } diff --git a/branches/sage/mds/mds/CDir.h b/branches/sage/mds/mds/CDir.h index 120a1290fc2ce..0552cbb144024 100644 --- a/branches/sage/mds/mds/CDir.h +++ b/branches/sage/mds/mds/CDir.h @@ -160,8 +160,8 @@ class CDir : public MDSCacheObject { //int hack_num_accessed; public: - typedef hash_map map_t; // there is a bug somewhere, valgrind me. - //typedef map map_t; + //typedef hash_map map_t; // there is a bug somewhere, valgrind me. + typedef map map_t; protected: // contents map_t items; // non-null AND null @@ -424,12 +424,10 @@ public: // -- freezing -- bool freeze_tree(); void _freeze_tree(); - void freeze_tree_finish(); void unfreeze_tree(); bool freeze_dir(); void _freeze_dir(); - void freeze_dir_finish(); void unfreeze_dir(); void maybe_finish_freeze() { diff --git a/branches/sage/mds/mds/CInode.cc b/branches/sage/mds/mds/CInode.cc index 5b604e6acb4f5..4cb1159fafbe2 100644 --- a/branches/sage/mds/mds/CInode.cc +++ b/branches/sage/mds/mds/CInode.cc @@ -404,7 +404,7 @@ void CInode::_mark_dirty(LogSegment *ls) if (!state_test(STATE_DIRTY)) { state_set(STATE_DIRTY); get(PIN_DIRTY); - //assert(ls); // not true for wonky srci import on rename. + assert(ls); } // move myself to this segment's dirty list diff --git a/branches/sage/mds/mds/MDCache.cc b/branches/sage/mds/mds/MDCache.cc index 03fa6d9b0d195..1609139af11c3 100644 --- a/branches/sage/mds/mds/MDCache.cc +++ b/branches/sage/mds/mds/MDCache.cc @@ -1996,6 +1996,18 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) } } + // full inodes? + // dirty scatterlock content! + for (list::iterator p = weak->full_inodes.begin(); + p != weak->full_inodes.end(); + ++p) { + CInode *in = get_inode(p->inode.ino); + if (!in) continue; + if (p->inode.mtime > in->inode.mtime) in->inode.mtime = p->inode.mtime; + dout(10) << " got dirty inode scatterlock content " << *in << dendl; + in->dirlock.set_updated(); + } + // walk weak map for (map >::iterator p = weak->weak.begin(); p != weak->weak.end(); @@ -2074,17 +2086,6 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) in->dirlock.get_replica_state()); } - // full inodes? - // dirty scatterlock content! - for (list::iterator p = weak->full_inodes.begin(); - p != weak->full_inodes.end(); - ++p) { - CInode *in = get_inode(p->inode.ino); - if (!in) continue; - if (p->inode.mtime > in->inode.mtime) in->inode.mtime = p->inode.mtime; - dout(10) << " got dirty inode scatterlock content " << *in << dendl; - } - if (survivor) { // survivor. do everything now. rejoin_scour_survivor_replicas(from, ack); @@ -2107,11 +2108,11 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak) * * @pathmap - map of inodeno to full pathnames. we remove items from this map * as we discover we have them. - * @retry - non-completion callback context. called when a pass of fetches - * completes. deleted if we are done (i.e. pathmap is empty). + * + * returns a C_Gather* is there is work to do. caller is responsible for setting + * the C_Gather completer. */ -bool MDCache::parallel_fetch(map& pathmap, - Context *retry) +C_Gather *MDCache::parallel_fetch(map& pathmap) { dout(10) << "parallel_fetch on " << pathmap.size() << " paths" << dendl; @@ -2138,12 +2139,11 @@ bool MDCache::parallel_fetch(map& pathmap, if (pathmap.empty()) { dout(10) << "parallel_fetch done" << dendl; assert(fetch_queue.empty()); - delete retry; - return true; + return false; } // do a parallel fetch - C_Gather *gather = new C_Gather(retry); + C_Gather *gather = new C_Gather; for (set::iterator p = fetch_queue.begin(); p != fetch_queue.end(); ++p) { @@ -2151,7 +2151,7 @@ bool MDCache::parallel_fetch(map& pathmap, (*p)->fetch(gather->new_sub()); } - return false; + return gather; } @@ -2629,9 +2629,13 @@ void MDCache::rejoin_gather_finish() // fetch paths? // do this before ack, since some inodes we may have already gotten // from surviving MDSs. - if (!cap_import_paths.empty() && - !parallel_fetch(cap_import_paths, new C_MDC_RejoinGatherFinish(this))) - return; + if (!cap_import_paths.empty()) { + C_Gather *gather = parallel_fetch(cap_import_paths); + if (gather) { + gather->set_finisher(new C_MDC_RejoinGatherFinish(this)); + return; + } + } // process cap imports // ino -> client -> frommds -> capex diff --git a/branches/sage/mds/mds/MDCache.h b/branches/sage/mds/mds/MDCache.h index d67d5a4cdf32b..a56dcbc9d55ce 100644 --- a/branches/sage/mds/mds/MDCache.h +++ b/branches/sage/mds/mds/MDCache.h @@ -567,8 +567,7 @@ public: vector& anchortrace, Context *onfinish); - bool parallel_fetch(map& pathmap, - Context *c); + C_Gather *parallel_fetch(map& pathmap); void make_trace(vector& trace, CInode *in); -- 2.39.5