]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: mark new root inode dirty 21922/head
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 1 May 2018 22:25:04 +0000 (15:25 -0700)
committerPrashant D <pdhange@redhat.com>
Thu, 10 May 2018 00:04:44 +0000 (20:04 -0400)
Fixes: http://tracker.ceph.com/issues/23960
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit d75842f8f1f5e382b2e4770b75baf8aafa48b62c)

src/mds/CInode.cc
src/mds/CInode.h
src/mds/MDCache.cc
src/mds/Server.cc
src/mds/journal.cc

index 929e3252e48a1722110d46b558d3e07cc900f581..23f6879e35cdfc66a2f6f64a5c1e8bb23a794cfd 100644 (file)
@@ -423,7 +423,7 @@ void CInode::pop_and_dirty_projected_inode(LogSegment *ls)
   inode = front.inode;
 
   if (inode.is_backtrace_updated())
-    _mark_dirty_parent(ls, old_pool != inode.layout.pool_id);
+    mark_dirty_parent(ls, old_pool != inode.layout.pool_id);
 
   if (front.xattrs) {
     --num_projected_xattrs;
@@ -1236,7 +1236,7 @@ void CInode::fetch_backtrace(Context *fin, bufferlist *backtrace)
   mdcache->fetch_backtrace(inode.ino, get_backtrace_pool(), *backtrace, fin);
 }
 
-void CInode::_mark_dirty_parent(LogSegment *ls, bool dirty_pool)
+void CInode::mark_dirty_parent(LogSegment *ls, bool dirty_pool)
 {
   if (!state_test(STATE_DIRTYPARENT)) {
     dout(10) << "mark_dirty_parent" << dendl;
@@ -1283,7 +1283,7 @@ void CInode::verify_diri_backtrace(bufferlist &bl, int err)
     mds->clog->error() << "bad backtrace on directory inode " << ino();
     assert(!"bad backtrace" == (g_conf->mds_verify_backtrace > 1));
 
-    _mark_dirty_parent(mds->mdlog->get_current_segment(), false);
+    mark_dirty_parent(mds->mdlog->get_current_segment(), false);
     mds->mdlog->flush();
   }
 }
@@ -3681,7 +3681,7 @@ void CInode::decode_import(bufferlist::iterator& p,
   }
   if (is_dirty_parent()) {
     get(PIN_DIRTYPARENT);
-    _mark_dirty_parent(ls);
+    mark_dirty_parent(ls);
   }
 
   ::decode(pop, ceph_clock_now(), p);
@@ -3925,7 +3925,7 @@ next:
         in->make_path_string(path);
         in->mdcache->mds->clog->warn() << "bad backtrace on inode " << in->ino()
                                        << "(" << path << "), rewriting it";
-        in->_mark_dirty_parent(in->mdcache->mds->mdlog->get_current_segment(),
+        in->mark_dirty_parent(in->mdcache->mds->mdlog->get_current_segment(),
                            false);
         // Flag that we repaired this BT so that it won't go into damagetable
         results->backtrace.repaired = true;
index c735f43a2f011ea489c300002a190540462392cc..0f1fce80b2e6a109e088ce33d6ca9899577fdb81 100644 (file)
@@ -762,7 +762,7 @@ protected:
    */
   int64_t get_backtrace_pool() const;
 public:
-  void _mark_dirty_parent(LogSegment *ls, bool dirty_pool=false);
+  void mark_dirty_parent(LogSegment *ls, bool dirty_pool=false);
   void clear_dirty_parent();
   void verify_diri_backtrace(bufferlist &bl, int err);
   bool is_dirty_parent() { return state_test(STATE_DIRTYPARENT); }
index c10cc2fe4f8d5d786b0e9b7247c03a9a82376d92..c06bbe3a1ca91edfc0d803377dd0694ef6a223db 100644 (file)
@@ -434,7 +434,10 @@ void MDCache::create_empty_hierarchy(MDSGather *gather)
   rootdir->mark_dirty(rootdir->pre_dirty(), mds->mdlog->get_current_segment());
   rootdir->commit(0, gather->new_sub());
 
-  root->store(gather->new_sub());
+  root->mark_clean();
+  root->mark_dirty(root->pre_dirty(), mds->mdlog->get_current_segment());
+  root->mark_dirty_parent(mds->mdlog->get_current_segment(), true);
+  root->flush(gather->new_sub());
 }
 
 void MDCache::create_mydir_hierarchy(MDSGather *gather)
@@ -464,7 +467,7 @@ void MDCache::create_mydir_hierarchy(MDSGather *gather)
     straydir->mark_complete();
     straydir->mark_dirty(straydir->pre_dirty(), ls);
     straydir->commit(0, gather->new_sub());
-    stray->_mark_dirty_parent(ls, true);
+    stray->mark_dirty_parent(ls, true);
     stray->store_backtrace(gather->new_sub());
   }
 
index 5132ece9e57cd433facaeb8f95e0104d3bd6c8b3..fcfa3a22db801519fc88a6bdb7a41d83d3d53245 100644 (file)
@@ -3397,7 +3397,7 @@ public:
     // dirty inode, dn, dir
     newi->inode.version--;   // a bit hacky, see C_MDS_mknod_finish
     newi->mark_dirty(newi->inode.version+1, mdr->ls);
-    newi->_mark_dirty_parent(mdr->ls, true);
+    newi->mark_dirty_parent(mdr->ls, true);
 
     mdr->apply();
 
@@ -4981,7 +4981,7 @@ public:
     // a new version of hte inode since it's just been created)
     newi->inode.version--; 
     newi->mark_dirty(newi->inode.version + 1, mdr->ls);
-    newi->_mark_dirty_parent(mdr->ls, true);
+    newi->mark_dirty_parent(mdr->ls, true);
 
     // mkdir?
     if (newi->inode.is_dir()) { 
index f46dc991468fcb10986c2f2398e481f706423d76..f86d0c2586a33f7dd30d0d4835e9b665358d7ea3 100644 (file)
@@ -1349,7 +1349,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
       if (p->is_dirty())
        in->_mark_dirty(logseg);
       if (p->is_dirty_parent())
-       in->_mark_dirty_parent(logseg, p->is_dirty_pool());
+       in->mark_dirty_parent(logseg, p->is_dirty_pool());
       if (p->need_snapflush())
        logseg->open_files.push_back(&in->item_open_file);
       if (dn->is_auth())