From: Sage Weil Date: Tue, 7 Dec 2010 00:31:56 +0000 (-0800) Subject: mds: fix LOOKUPHASH to avoid creating bogus replica CDir X-Git-Tag: v0.24~45 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f97660ff40969f0bdbe071dc4b807c5ac5b1810d;p=ceph.git mds: fix LOOKUPHASH to avoid creating bogus replica CDir We can't create the CDir if we are non-auth. Signed-off-by: Sage Weil --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 0e04b0cdce0e..1db1936cd67b 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -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()) {