From 6c8f648a4ac0c8daca63f240935f679953ecb028 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 6 Aug 2018 14:51:09 +0800 Subject: [PATCH] client: fix choose_target_mds for requests that do name lookup There are two cases that a dirfrag is not recorded in CInode::fragmap. One is that the dirfrag is not subtree root, another is that client does not know which mds is dirfrag's auth mds. For the both cases, requests that do name lookup are better to sent to dir inode's auth mds. Fixes: http://tracker.ceph.com/issues/26860 Signed-off-by: "Yan, Zheng" (cherry picked from commit 436d1741e623748bc0dfd4e305d4c07cc602a093) --- src/client/Client.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/Client.cc b/src/client/Client.cc index 13258bce90e..e8c2fcf7156 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1461,6 +1461,10 @@ mds_rank_t Client::choose_target_mds(MetaRequest *req, Inode** phash_diri) mds = in->fragmap[fg]; if (phash_diri) *phash_diri = in; + } else if (in->auth_cap) { + mds = in->auth_cap->session->mds_num; + } + if (mds >= 0) { ldout(cct, 10) << __func__ << " from dirfragtree hash" << dendl; goto out; } -- 2.47.3