From: Yan, Zheng Date: Tue, 14 Jan 2014 01:07:16 +0000 (+0800) Subject: mds: fix MDCache::get_force_dirfrag_bound_set() X-Git-Tag: v0.78~165^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e0e25658d679cc79beefc7ab4b09d8c7715baaf0;p=ceph.git mds: fix MDCache::get_force_dirfrag_bound_set() don't force dir fragments according to the subtree bounds in resolve message. The resolve message was not sent by the auth MDS of these subtree bounds dirfrags. Signed-off-by: Yan, Zheng --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 4716c3099f61..c819f211f794 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -1064,24 +1064,40 @@ void MDCache::get_force_dirfrag_bound_set(vector& dfs, set& bo if (!diri) continue; dout(10) << " checking fragset " << p->second.get() << " on " << *diri << dendl; + + fragtree_t tmpdft; + for (set::iterator q = p->second.begin(); q != p->second.end(); ++q) + tmpdft.force_to_leaf(g_ceph_context, *q); + for (set::iterator q = p->second.begin(); q != p->second.end(); ++q) { frag_t fg = *q; - list u; - diri->get_dirfrags_under(fg, u); - dout(10) << " frag " << fg << " contains " << u << dendl; - if (!u.empty()) - bounds.insert(u.begin(), u.end()); - frag_t t = fg; - while (t != frag_t()) { - t = t.parent(); - CDir *dir = diri->get_dirfrag(t); - if (dir) { - // ugh, we found a containing parent - dout(10) << " ugh, splitting parent frag " << t << " " << *dir << dendl; - force_dir_fragment(diri, fg); - break; + list fgls; + diri->dirfragtree.get_leaves_under(fg, fgls); + if (fgls.empty()) { + bool all = true; + frag_t approx_fg = diri->dirfragtree[fg.value()]; + list ls; + tmpdft.get_leaves_under(approx_fg, ls); + for (list::iterator r = ls.begin(); r != ls.end(); ++r) { + if (p->second.get().count(*r) == 0) { + // not bound, so the resolve message is from auth MDS of the dirfrag + force_dir_fragment(diri, *r); + all = false; + } + } + if (all) { + fgls.push_back(approx_fg); + } else { + diri->dirfragtree.get_leaves_under(fg, fgls); + assert(!fgls.empty()); } } + dout(10) << " frag " << fg << " contains " << fgls << dendl; + for (list::iterator r = fgls.begin(); r != fgls.end(); ++r) { + CDir *dir = diri->get_dirfrag(*r); + if (dir) + bounds.insert(dir); + } } } }