]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix LOOKUPHASH to avoid creating bogus replica CDir
authorSage Weil <sage@newdream.net>
Tue, 7 Dec 2010 00:31:56 +0000 (16:31 -0800)
committerSage Weil <sage@newdream.net>
Wed, 8 Dec 2010 00:44:18 +0000 (16:44 -0800)
We can't create the CDir if we are non-auth.

Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/Server.cc

index 0e04b0cdce0ee6901b4aff2b9c211d7a3ce5f2ae..1db1936cd67b1ba48e461306f639ba443f020374 100644 (file)
@@ -2058,7 +2058,20 @@ void Server::handle_client_lookup_hash(MDRequest *mdr)
     }
     unsigned hash = atoi(req->get_filepath2()[0].c_str());
     frag_t fg = diri->dirfragtree[hash];
-    CDir *dir = diri->get_or_open_dirfrag(mdcache, fg);
+    CDir *dir = diri->get_dirfrag(fg);
+    if (!dir) {
+      if (!diri->is_auth()) {
+       if (diri->is_ambiguous_auth()) {
+         // wait
+         dout(7) << " waiting for single auth in " << *diri << dendl;
+         diri->add_waiter(CInode::WAIT_SINGLEAUTH, new C_MDS_RetryRequest(mdcache, mdr));
+         return;
+       } 
+       mdcache->request_forward(mdr, diri->authority().first);
+       return;
+      }
+      dir = diri->get_or_open_dirfrag(mdcache, fg);
+    }
     assert(dir);
     if (!dir->is_auth()) {
       if (dir->is_ambiguous_auth()) {