From: Yan, Zheng Date: Mon, 20 Feb 2017 03:27:09 +0000 (+0800) Subject: mds: properly set default dir_hash for directory inodes X-Git-Tag: v12.0.1~266^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9eea8395a500d6c94b7e6e2c7b925f2aa314ccb4;p=ceph.git mds: properly set default dir_hash for directory inodes MDCache::handle_cache_rejoin_strong(). may add new inodes (race with cache expire). Updating these inodes is at the very end of the function. Before these inodes get updated, MDCache::handle_cache_rejoin_strong() may add dentries to these inodes. So dir_hash type of these inodes should be set to the default value. Signed-off-by: "Yan, Zheng" --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index adc77de693348..84bba81b64ea8 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -4900,6 +4900,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack) diri = new CInode(this, false); diri->inode.ino = p->first.ino; diri->inode.mode = S_IFDIR; + diri->inode.dir_layout.dl_dir_hash = g_conf->mds_default_dir_hash; add_inode(diri); if (MDS_INO_MDSDIR(from) == p->first.ino) { diri->inode_auth = mds_authority_t(from, CDIR_AUTH_UNKNOWN); @@ -4971,6 +4972,7 @@ void MDCache::handle_cache_rejoin_ack(MMDSCacheRejoin *ack) in = new CInode(this, false, q->second.first, q->first.snapid); in->inode.ino = q->second.ino; in->inode.mode = S_IFDIR; + in->inode.dir_layout.dl_dir_hash = g_conf->mds_default_dir_hash; add_inode(in); dout(10) << " add inode " << *in << dendl; } else if (in->get_parent_dn()) {