]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix up root/base inode special cases
authorSage Weil <sage@newdream.net>
Wed, 17 Mar 2010 18:08:21 +0000 (11:08 -0700)
committerSage Weil <sage@newdream.net>
Wed, 17 Mar 2010 18:08:21 +0000 (11:08 -0700)
src/mds/AnchorServer.cc
src/mds/MDCache.cc

index 4ed27235055be0a7d723f7554a680d21153b7852..b0a4ca762ace1ad8e265426ad30ecdc85ace6ec8 100644 (file)
@@ -52,7 +52,7 @@ bool AnchorServer::add(inodeno_t ino, inodeno_t dirino, __u32 dn_hash)
   //dout(17) << "add " << ino << " dirfrag " << dirfrag << dendl;
   
   // parent should be there
-  assert(dirino == MDS_INO_ROOT ||     // base case,
+  assert(MDS_INO_IS_BASE(dirino) ||     // base case,
          anchor_map.count(dirino));   // or have it
   
   if (anchor_map.count(ino) == 0) {
@@ -242,7 +242,7 @@ void AnchorServer::handle_query(MMDSTableRequest *req)
     dout(10) << "handle_lookup  adding " << anchor << dendl;
     trace.insert(trace.begin(), anchor);  // lame FIXME
     
-    if (anchor.dirino == MDS_INO_ROOT)
+    if (MDS_INO_IS_BASE(anchor.dirino))
       break;
     curino = anchor.dirino;
   }
index 0c97da16773fe11e91a4910cb19f4edea43d0baf..6c48752542dc7c7920e49c36396422a67bf38305 100644 (file)
@@ -730,7 +730,7 @@ void MDCache::try_subtree_merge_at(CDir *dir)
 
   // merge with parent?
   CDir *parent = dir;  
-  if (dir->ino() != MDS_INO_ROOT)
+  if (!dir->inode->is_base())
     parent = get_subtree_root(dir->get_parent_dir());
   
   if (parent != dir &&                              // we have a parent,
@@ -7365,15 +7365,15 @@ void MDCache::handle_discover(MDiscover *dis)
 
     cur = root;
   }
-  else if (dis->get_base_ino() == MDS_INO_STRAY(whoami)) {
+  else if (dis->get_base_ino() == MDS_INO_MDSDIR(whoami)) {
     // wants root
     dout(7) << "handle_discover from mds" << from
-           << " wants stray + " << dis->get_want().get_path()
+           << " wants mdsdir + " << dis->get_want().get_path()
            << " snap " << snapid
            << dendl;
     reply->starts_with = MDiscoverReply::INODE;
-    replicate_inode(stray, from, reply->trace);
-    dout(10) << "added stray " << *stray << dendl;
+    replicate_inode(myin, from, reply->trace);
+    dout(10) << "added mdsdir " << *myin << dendl;
 
     cur = stray;
   }
@@ -7424,7 +7424,7 @@ void MDCache::handle_discover(MDiscover *dis)
     } else {
       // requester explicity specified the frag
       fg = dis->get_base_dir_frag();
-      assert(dis->wants_base_dir() || dis->get_want_ino() || dis->get_base_ino() == MDS_INO_ROOT);
+      assert(dis->wants_base_dir() || dis->get_want_ino() || MDS_INO_IS_BASE(dis->get_base_ino()));
     }
     CDir *curdir = cur->get_dirfrag(fg);
 
@@ -7880,6 +7880,8 @@ CInode *MDCache::add_replica_inode(bufferlist::iterator& p, CDentry *dn, list<Co
     add_inode(in);
     if (in->ino() == MDS_INO_ROOT)
       in->inode_auth.first = 0;
+    else if (in->is_mdsdir())
+      in->inode_auth.first = in->ino() - MDS_INO_MDSDIR_OFFSET;
     dout(10) << "add_replica_inode added " << *in << dendl;
     if (dn) {
       assert(dn->get_linkage()->is_null());
@@ -8720,6 +8722,8 @@ void MDCache::show_subtrees(int dbl)
 
     if (dir->ino() == MDS_INO_ROOT)
       assert(dir->inode == root);
+    if (dir->ino() == MDS_INO_MDSDIR(mds->get_nodeid()))
+      assert(dir->inode == myin);
     if (dir->ino() == MDS_INO_STRAY(mds->get_nodeid()))
       assert(dir->inode == stray);