diff mbox

[03/39] mds: fix MDCache::adjust_bounded_subtree_auth()

Message ID 1363531902-24909-4-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng March 17, 2013, 2:51 p.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

There are cases that need both create new bound and swallow intervening
subtree. For example: A MDS exports subtree A with bound B and imports
subtree B with bound C at the same time. The MDS crashes, exporting
subtree A fails, but importing subtree B succeed. During recovery, the
MDS may create new bound C and swallow subtree B.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 src/mds/MDCache.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Gregory Farnum March 20, 2013, 6:33 p.m. UTC | #1
Reviewed-by: Greg Farnum <greg@inktank.com>


Software Engineer #42 @ http://inktank.com | http://ceph.com


On Sunday, March 17, 2013 at 7:51 AM, Yan, Zheng wrote:

> From: "Yan, Zheng" <zheng.z.yan@intel.com (mailto:zheng.z.yan@intel.com)>
> 
> There are cases that need both create new bound and swallow intervening
> subtree. For example: A MDS exports subtree A with bound B and imports
> subtree B with bound C at the same time. The MDS crashes, exporting
> subtree A fails, but importing subtree B succeed. During recovery, the
> MDS may create new bound C and swallow subtree B.
> 
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com (mailto:zheng.z.yan@intel.com)>
> ---
> src/mds/MDCache.cc (http://MDCache.cc) | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mds/MDCache.cc (http://MDCache.cc) b/src/mds/MDCache.cc (http://MDCache.cc)
> index 684e70b..19dc60b 100644
> --- a/src/mds/MDCache.cc (http://MDCache.cc)
> +++ b/src/mds/MDCache.cc (http://MDCache.cc)
> @@ -980,15 +980,21 @@ void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
> }
> else {
> dout(10) << " want bound " << *bound << dendl;
> + CDir *t = get_subtree_root(bound->get_parent_dir());
> + if (subtrees[t].count(bound) == 0) {
> + assert(t != dir);
> + dout(10) << " new bound " << *bound << dendl;
> + adjust_subtree_auth(bound, t->authority());
> + }
> // make sure it's nested beneath ambiguous subtree(s)
> while (1) {
> - CDir *t = get_subtree_root(bound->get_parent_dir());
> - if (t == dir) break;
> while (subtrees[dir].count(t) == 0)
> t = get_subtree_root(t->get_parent_dir());
> dout(10) << " swallowing intervening subtree at " << *t << dendl;
> adjust_subtree_auth(t, auth);
> try_subtree_merge_at(t);
> + t = get_subtree_root(bound->get_parent_dir());
> + if (t == dir) break;
> }
> }
> }
> -- 
> 1.7.11.7



--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc
index 684e70b..19dc60b 100644
--- a/src/mds/MDCache.cc
+++ b/src/mds/MDCache.cc
@@ -980,15 +980,21 @@  void MDCache::adjust_bounded_subtree_auth(CDir *dir, set<CDir*>& bounds, pair<in
       }
       else {
 	dout(10) << "  want bound " << *bound << dendl;
+	CDir *t = get_subtree_root(bound->get_parent_dir());
+	if (subtrees[t].count(bound) == 0) {
+	  assert(t != dir);
+	  dout(10) << "  new bound " << *bound << dendl;
+	  adjust_subtree_auth(bound, t->authority());
+	}
 	// make sure it's nested beneath ambiguous subtree(s)
 	while (1) {
-	  CDir *t = get_subtree_root(bound->get_parent_dir());
-	  if (t == dir) break;
 	  while (subtrees[dir].count(t) == 0)
 	    t = get_subtree_root(t->get_parent_dir());
 	  dout(10) << "  swallowing intervening subtree at " << *t << dendl;
 	  adjust_subtree_auth(t, auth);
 	  try_subtree_merge_at(t);
+	  t = get_subtree_root(bound->get_parent_dir());
+	  if (t == dir) break;
 	}
       }
     }