}
};
+void MDCache::open_root_inode(Context *c)
+{
+ assert(!root);
+ if (mds->whoami == mds->mdsmap->get_root()) {
+ create_root_inode(); // initially inaccurate!
+ root->fetch(c);
+ } else {
+ discover_base_ino(MDS_INO_ROOT, c, mds->mdsmap->get_root());
+ }
+}
+
void MDCache::open_root()
{
- dout(10) << "open_root root=" << root << dendl;
+ dout(10) << "open_root" << dendl;
+
+ if (!root) {
+ open_root_inode(new C_MDS_RetryOpenRoot(this));
+ return;
+ }
if (mds->whoami == mds->mdsmap->get_root()) {
- if (!root) {
- create_root_inode(); // initially inaccurate!
- root->fetch(new C_MDS_RetryOpenRoot(this));
- return;
- }
assert(root->is_auth());
CDir *rootdir = root->get_or_open_dirfrag(this, frag_t());
assert(mydir);
} else {
- if (!root) {
- discover_base_ino(MDS_INO_ROOT, new C_MDS_RetryOpenRoot(this), mds->mdsmap->get_root());
- return;
- }
assert(!root->is_auth());
CDir *rootdir = root->get_dirfrag(frag_t());
break;
case 2:
+ dout(2) << "boot_start " << step << ": loading root inode" << dendl;
+ mdcache->open_root_inode(new C_MDS_BootStart(this, 3));
+ break;
+
+ case 3:
if (is_replay() || is_standby_replay()) {
dout(2) << "boot_start " << step << ": replaying mds log" << dendl;
- mdlog->replay(new C_MDS_BootStart(this, 3));
+ mdlog->replay(new C_MDS_BootStart(this, 4));
break;
} else {
dout(2) << "boot_start " << step << ": positioning at end of old mds log" << dendl;
step++;
}
- case 3:
+ case 4:
if (is_replay() || is_standby_replay()) {
replay_done();
break;
{
dout(10) << "EMetaBlob.replay " << lump_map.size() << " dirlumps" << dendl;
- //if (!logseg) logseg = _segment;
assert(logseg);
+ if (root) {
+ CInode *in = mds->mdcache->get_inode(root->inode.ino);
+ bool isnew = in ? false:true;
+ if (!in)
+ in = new CInode(mds->mdcache, true);
+ in->inode = root->inode;
+ in->xattrs = root->xattrs;
+ if (in->inode.is_dir()) {
+ in->dirfragtree = root->dirfragtree;
+ /*
+ * we can do this before linking hte inode bc the split_at would
+ * be a no-op.. we have no children (namely open snaprealms) to
+ * divy up
+ */
+ in->decode_snap_blob(root->snapbl);
+ }
+ if (in->inode.is_symlink()) in->symlink = root->symlink;
+ if (isnew)
+ mds->mdcache->add_inode(in);
+ if (root->dirty) in->_mark_dirty(logseg);
+ dout(10) << "EMetaBlob.replay " << (isnew ? " added root ":" updated root ") << *in << dendl;
+ }
+
// walk through my dirs (in order!)
for (list<dirfrag_t>::iterator lp = lump_order.begin();
lp != lump_order.end();
// hmm. do i have the inode?
CInode *diri = mds->mdcache->get_inode((*lp).ino);
if (!diri) {
- if ((*lp).ino == MDS_INO_ROOT) {
+ /*if ((*lp).ino == MDS_INO_ROOT) {
diri = mds->mdcache->create_root_inode();
dout(10) << "EMetaBlob.replay created root " << *diri << dendl;
- }/* else if (MDS_INO_IS_STRAY((*lp).ino)) {
+ } else if (MDS_INO_IS_STRAY((*lp).ino)) {
int whose = (*lp).ino - MDS_INO_STRAY_OFFSET;
diri = mds->mdcache->create_stray_inode(whose);
dout(10) << "EMetaBlob.replay created stray " << *diri << dendl;
- } */ else {
+ } else */
+ {
dout(0) << "EMetaBlob.replay missing dir ino " << (*lp).ino << dendl;
assert(0);
}