From 5e5416e605757855dde7aa69b1d575ca3439dbd5 Mon Sep 17 00:00:00 2001 From: sageweil Date: Fri, 12 Oct 2007 22:18:50 +0000 Subject: [PATCH] fixed discovery of base inodes git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1933 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/mds/TODO | 21 ------------------- branches/sage/mds/mds/MDCache.cc | 36 ++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/branches/sage/mds/TODO b/branches/sage/mds/TODO index c4f9b16383dc9..ed581ab0b350b 100644 --- a/branches/sage/mds/TODO +++ b/branches/sage/mds/TODO @@ -52,27 +52,6 @@ mdsmon - per-mds, shared standby queues -fix rename -if (0) { -- who cares if dir items are dirtied out of order? - - continue to delay _apply - - need to make sure slave_prepare isn't trimmed before the commit commits - - put xlist_item in MDRequest, add to LogSegment for duration of delay before change is applied to - the cache - - dirtying has to be attached to teh _original_ logsegment.. mdr->ls -} else { -- witnesses -/ - rename_apply immediately after _prepare (preserve journal pipelining) -/ - srci auth do versionlock on inode to avoid mention in journal prior to commit|rollback -/ - this is to avoid some event between the prepare and rollback with incorrect linkage - - add in-memory rollback in the _commit (on failure) -/ - do separate get_srci_replicas slave op first, then wrap inode export into actual prepare last, so that srci auth can apply immediately. -} -/- srci auth needs to freeze inode before exporting it -/ *** hrm, what about misdirected lock requests.. singleauth won't capture a rename export! -/ -> inode ambiguous_auth bit+waiter; set on prepare, clear on mdr finish. - - mds bugs - open file rejournaling vs capped log... diff --git a/branches/sage/mds/mds/MDCache.cc b/branches/sage/mds/mds/MDCache.cc index 6eb443dc11b46..32201986d9f40 100644 --- a/branches/sage/mds/mds/MDCache.cc +++ b/branches/sage/mds/mds/MDCache.cc @@ -167,8 +167,13 @@ void MDCache::add_inode(CInode *in) assert(inode_map.count(in->ino()) == 0); // should be no dup inos! inode_map[ in->ino() ] = in; - if (in->ino() < MDS_INO_BASE) + if (in->ino() < MDS_INO_BASE) { base_inodes.insert(in); + if (in->ino() == MDS_INO_ROOT) + set_root(in); + if (in->ino() == MDS_INO_STRAY(mds->get_nodeid())) + stray = in; + } } void MDCache::remove_inode(CInode *o) @@ -216,7 +221,6 @@ CInode *MDCache::create_root_inode() root->force_auth = pair(0, CDIR_AUTH_UNKNOWN); - set_root( root ); add_inode( root ); return root; @@ -252,22 +256,23 @@ void MDCache::open_root(Context *c) CInode *MDCache::create_stray_inode(int whose) { if (whose < 0) whose = mds->get_nodeid(); - stray = new CInode(this, whose == mds->get_nodeid()); - memset(&stray->inode, 0, sizeof(inode_t)); - stray->inode.ino = MDS_INO_STRAY(whose); + + CInode *in = new CInode(this, whose == mds->get_nodeid()); + memset(&in->inode, 0, sizeof(inode_t)); + in->inode.ino = MDS_INO_STRAY(whose); // make it up (FIXME) - stray->inode.mode = 0755 | INODE_MODE_DIR; - stray->inode.size = 0; - stray->inode.ctime = - stray->inode.mtime = g_clock.now(); + in->inode.mode = 0755 | INODE_MODE_DIR; + in->inode.size = 0; + in->inode.ctime = + in->inode.mtime = g_clock.now(); - stray->inode.nlink = 1; - stray->inode.layout = g_OSD_MDDirLayout; + in->inode.nlink = 1; + in->inode.layout = g_OSD_MDDirLayout; - add_inode( stray ); + add_inode( in ); - return stray; + return in; } void MDCache::open_local_stray() @@ -5203,7 +5208,8 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) // starting point CInode *cur = get_inode(m->get_base_ino()); - if (!cur) { + + if (m->has_base_inode()) { assert(m->get_base_ino() < MDS_INO_BASE); assert(!m->has_base_dentry()); assert(!m->has_base_dir()); @@ -5211,8 +5217,6 @@ void MDCache::handle_discover_reply(MDiscoverReply *m) // add base inode cur = add_replica_inode(m->get_inode(0), NULL, finished); cur->force_auth = pair(m->get_source().num(), CDIR_AUTH_UNKNOWN); - if (cur->ino() == MDS_INO_ROOT) - set_root(cur); dout(7) << "discover_reply got base inode " << *cur << dendl; -- 2.39.5