From cd1bb642a5c0c790c9b89cd13c7f2946e9feb2ab Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 21 Aug 2007 23:48:53 +0000 Subject: [PATCH] fixed re-broken cdir complete flag bug (which resulted in lost dentries) git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1649 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/mds/mds/MDCache.cc | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/branches/sage/mds/mds/MDCache.cc b/branches/sage/mds/mds/MDCache.cc index 4575345ee7026..dc8521f46de10 100644 --- a/branches/sage/mds/mds/MDCache.cc +++ b/branches/sage/mds/mds/MDCache.cc @@ -1539,11 +1539,11 @@ void MDCache::disambiguate_imports() if (dir->authority().first == CDIR_AUTH_UNKNOWN || // if i am resolving dir->is_ambiguous_auth()) { // if i am a surviving bystander - dout(10) << "mds" << who << " did import " << *dir << endl; + dout(10) << " mds" << who << " did import " << *dir << endl; adjust_bounded_subtree_auth(dir, q->second, who); try_subtree_merge(dir); } else { - dout(10) << "mds" << who << " did not import " << *dir << endl; + dout(10) << " mds" << who << " did not import " << *dir << endl; } } } @@ -2949,6 +2949,13 @@ void MDCache::trim_dentry(CDentry *dn, map& expiremap) expiremap[a]->add_dentry(con->dirfrag(), dir->dirfrag(), dn->get_name(), dn->get_replica_nonce()); } } + + // adjust the dir state + // NOTE: we can safely remove a clean, null dentry without effecting + // directory completeness. + // (do this _before_ we unlink the inode, below!) + if (!(dn->is_null() && dn->is_clean())) + dir->state_clear(CDir::STATE_COMPLETE); // unlink the dentry if (dn->is_remote()) { @@ -2964,21 +2971,15 @@ void MDCache::trim_dentry(CDentry *dn, map& expiremap) else { assert(dn->is_null()); } - - // adjust the dir state - // NOTE: we can safely remove a clean, null dentry without effecting - // directory completeness. - if (!(dn->is_null() && dn->is_clean())) - dir->state_clear(CDir::STATE_COMPLETE); - - // remove dentry - dir->remove_dentry(dn); - - // reexport? - if (dir->get_size() == 0 && dir->is_subtree_root()) - migrator->export_empty_import(dir); - if (mds->logger) mds->logger->inc("cex"); + // remove dentry + dir->remove_dentry(dn); + + // reexport? + if (dir->get_size() == 0 && dir->is_subtree_root()) + migrator->export_empty_import(dir); + + if (mds->logger) mds->logger->inc("cex"); } -- 2.39.5