]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix create_mydir_hierarchy to save dir
authorSage Weil <sage.weil@dreamhost.com>
Tue, 12 Apr 2011 18:07:54 +0000 (11:07 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 12 Apr 2011 19:39:30 +0000 (12:39 -0700)
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 <sage.weil@dreamhost.com>
src/mds/MDCache.cc

index eecc39a53c73a3117f434f74f4cdf68844e52cdd..14b0b45217cf450423b31960be8e9e5f3111c808 100644 (file)
@@ -367,7 +367,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;
 
@@ -381,7 +382,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++;