From: Yan, Zheng Date: Fri, 26 May 2017 03:41:48 +0000 (+0800) Subject: mds: properly create aux subtrees for pinned directory X-Git-Tag: ses5-milestone6~9^2~36^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e901d7fe971892ddca1281065895634f7a92dbe7;p=ceph.git mds: properly create aux subtrees for pinned directory Fixes: http://tracker.ceph.com/issues/20083 Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index bd7a37971c39..567668a12433 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -4429,10 +4429,12 @@ void CInode::maybe_export_pin(bool update) continue; if (export_pin != MDS_RANK_NONE) { if (dir->is_subtree_root()) { - // export subtrees ? - queue = (export_pin != dir->get_dir_auth().first); + // set auxsubtree bit or export it + if (!dir->state_test(CDir::STATE_AUXSUBTREE) || + export_pin != dir->get_dir_auth().first) + queue = true; } else { - // create aux subtrees + // create aux subtree or export it queue = true; } } else { diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 17a055154aa2..cda09c922637 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -107,16 +107,19 @@ void MDBalancer::handle_export_pins(void) mds->mdcache->try_subtree_merge(dir); } } else if (export_pin == mds->get_nodeid()) { + if (dir->state_test(CDir::STATE_CREATING) || + dir->is_frozen() || dir->is_freezing()) { + // try again later + remove = false; + continue; + } if (!dir->is_subtree_root()) { - if (dir->state_test(CDir::STATE_CREATING) || - dir->is_frozen() || dir->is_freezing()) { - // try again later - remove = false; - continue; - } dir->state_set(CDir::STATE_AUXSUBTREE); mds->mdcache->adjust_subtree_auth(dir, mds->get_nodeid()); dout(10) << " create aux subtree on " << *dir << dendl; + } else if (!dir->state_test(CDir::STATE_AUXSUBTREE)) { + dout(10) << " set auxsubtree bit on " << *dir << dendl; + dir->state_set(CDir::STATE_AUXSUBTREE); } } else { mds->mdcache->migrator->export_dir(dir, export_pin);