From 027fa300a8f1070f20ba155a9497731f23438b82 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 17 Nov 2008 20:37:05 -0800 Subject: [PATCH] mds: add new directory to new_dirfrags list This ensures the directory gets committed before the mkdir event is trimmed from the journal. Fixes the failed assertion in CDir::_fetched seen on mds recovery (due to a missing directory object). --- src/mds/CDir.cc | 5 +++++ src/mds/CDir.h | 2 ++ src/mds/Server.cc | 1 + 3 files changed, 8 insertions(+) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 60bb9c3865fe3..94a4f884757f5 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -952,6 +952,11 @@ void CDir::_mark_dirty(LogSegment *ls) } } +void CDir::mark_new(LogSegment *ls) +{ + ls->new_dirfrags.push_back(&xlist_new); +} + void CDir::mark_clean() { dout(10) << "mark_clean " << *this << " version " << get_version() << dendl; diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 58d66e083d6df..1bb1549d425fa 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -191,6 +191,8 @@ public: void log_mark_dirty(); void mark_clean(); + void mark_new(LogSegment *ls); + public: //typedef hash_map map_t; // there is a bug somewhere, valgrind me. //typedef map map_t; diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 0c9734743185a..5afcac63fd444 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -2116,6 +2116,7 @@ public: CDir *dir = newi->get_dirfrag(frag_t()); assert(dir); dir->mark_dirty(1, mdr->ls); + dir->mark_new(mdr->ls); } mdr->apply(); -- 2.39.5