From 31fc9edb81938240cb6d837be6bb5c70e441f3c6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 12 Apr 2011 11:07:54 -0700 Subject: [PATCH] mds: fix create_mydir_hierarchy to save dir Mark the dentries dirty so they get saved to disk (they're not journaled!). This fixes rstat problems on startup, where populate_mydir was recreating the entries and munging rstats accordingly. Signed-off-by: Sage Weil --- src/mds/MDCache.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index cdbec21dc216a..61b9773660330 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -371,7 +371,8 @@ void MDCache::create_mydir_hierarchy(C_Gather *gather) CDir *straydir = stray->get_or_open_dirfrag(this, frag_t()); stringstream name; name << "stray" << i; - mydir->add_primary_dentry(name.str(), stray); + CDentry *sdn = mydir->add_primary_dentry(name.str(), stray); + sdn->_mark_dirty(mds->mdlog->get_current_segment()); stray->inode.dirstat = straydir->fnode.fragstat; @@ -385,7 +386,8 @@ void MDCache::create_mydir_hierarchy(C_Gather *gather) CInode *journal = create_system_inode(MDS_INO_LOG_OFFSET + mds->whoami, S_IFREG); string name = "journal"; - mydir->add_primary_dentry(name, journal); + CDentry *jdn = mydir->add_primary_dentry(name, journal); + jdn->_mark_dirty(mds->mdlog->get_current_segment()); mydir->fnode.fragstat.nfiles++; mydir->fnode.rstat.rfiles++; -- 2.39.5