]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make _create_system_file dirty dentries properly
authorSage Weil <sage.weil@dreamhost.com>
Tue, 12 Apr 2011 18:08:39 +0000 (11:08 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 12 Apr 2011 19:39:34 +0000 (12:39 -0700)
Properly dirty the new dentries so they get written to the directory
objects later on.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mds/MDCache.cc
src/mds/MDCache.h

index 14b0b45217cf450423b31960be8e9e5f3111c808..15b913f3f6662d655c81386d4fe0df53dce9cea6 100644 (file)
@@ -406,10 +406,12 @@ struct C_MDC_CreateSystemFile : public Context {
   MDCache *cache;
   Mutation *mut;
   CDentry *dn;
+  version_t dpv;
   Context *fin;
-  C_MDC_CreateSystemFile(MDCache *c, Mutation *mu, CDentry *d, Context *f) : cache(c), mut(mu), dn(d), fin(f) {}
+  C_MDC_CreateSystemFile(MDCache *c, Mutation *mu, CDentry *d, version_t v, Context *f) :
+    cache(c), mut(mu), dn(d), dpv(v), fin(f) {}
   void finish(int r) {
-    cache->_create_system_file_finish(mut, dn, fin);
+    cache->_create_system_file_finish(mut, dn, dpv, fin);
   }
 };
 
@@ -419,7 +421,8 @@ void MDCache::_create_system_file(CDir *dir, const char *name, CInode *in, Conte
   CDentry *dn = dir->add_null_dentry(name);
 
   dn->push_projected_linkage(in);
-
+  version_t dpv = dn->pre_dirty();
+  
   CDir *mdir = 0;
   if (in->inode.is_dir()) {
     in->inode.rstat.rsubdirs = 1;
@@ -458,15 +461,16 @@ void MDCache::_create_system_file(CDir *dir, const char *name, CInode *in, Conte
     le->metablob.add_dir(mdir, true, true, true); // dirty AND complete AND new
 
   mds->mdlog->submit_entry(le);
-  mds->mdlog->wait_for_safe(new C_MDC_CreateSystemFile(this, mut, dn, fin));
+  mds->mdlog->wait_for_safe(new C_MDC_CreateSystemFile(this, mut, dn, dpv, fin));
   mds->mdlog->flush();
 }
 
-void MDCache::_create_system_file_finish(Mutation *mut, CDentry *dn, Context *fin)
+void MDCache::_create_system_file_finish(Mutation *mut, CDentry *dn, version_t dpv, Context *fin)
 {
   dout(10) << "_create_system_file_finish " << *dn << dendl;
   
   dn->pop_projected_linkage();
+  dn->mark_dirty(dpv, mut->ls);
 
   CInode *in = dn->get_linkage()->get_inode();
   in->inode.version--;
index 2c198bc2ec2b713eafb7e8c701bf89a0524d70de..081d3814a31a4ed9c3545c35dc499cd0d6bb59a8 100644 (file)
@@ -978,7 +978,7 @@ public:
   void populate_mydir();
 
   void _create_system_file(CDir *dir, const char *name, CInode *in, Context *fin);
-  void _create_system_file_finish(Mutation *mut, CDentry *dn, Context *fin);
+  void _create_system_file_finish(Mutation *mut, CDentry *dn, version_t dpv, Context *fin);
 
   void open_foreign_mdsdir(inodeno_t ino, Context *c);
   CDentry *get_or_create_stray_dentry(CInode *in);