From: Yan, Zheng Date: Mon, 31 Aug 2020 09:11:09 +0000 (+0800) Subject: mds: fix incorrect check for if dirfrag is being fragmented X-Git-Tag: v15.2.9~122^2~52^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F37034%2Fhead;p=ceph.git mds: fix incorrect check for if dirfrag is being fragmented Fixes: https://tracker.ceph.com/issues/47201 Signed-off-by: "Yan, Zheng" (cherry picked from commit cb2cc228dadf3e5d5cd75835365b91a43c941453) Conflicts: src/mds/CDir.cc - op.stat() takes different kind of null arguments in octopus, but this is not relevant to the backport - newline was missing at the very end of the file: added it --- diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 6c8a0a125fd..62234fb3814 100755 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -2212,7 +2212,7 @@ void CDir::_omap_commit(int op_prio) op.priority = op_prio; // don't create new dirfrag blindly - if (!is_new() && !state_test(CDir::STATE_FRAGMENTING)) + if (!is_new()) op.stat(NULL, (ceph::real_time*) NULL, NULL); if (!to_set.empty()) @@ -2230,7 +2230,7 @@ void CDir::_omap_commit(int op_prio) } }; - if (state_test(CDir::STATE_FRAGMENTING)) { + if (state_test(CDir::STATE_FRAGMENTING) && is_new()) { assert(committed_version == 0); for (auto p = items.begin(); p != items.end(); ) { CDentry *dn = p->second; @@ -2251,7 +2251,7 @@ void CDir::_omap_commit(int op_prio) op.priority = op_prio; // don't create new dirfrag blindly - if (!is_new() && !state_test(CDir::STATE_FRAGMENTING)) + if (!is_new()) op.stat(NULL, (ceph::real_time*)NULL, NULL); /* @@ -3549,4 +3549,4 @@ bool CDir::should_split_fast() const } MEMPOOL_DEFINE_OBJECT_FACTORY(CDir, co_dir, mds_co); -MEMPOOL_DEFINE_OBJECT_FACTORY(CDir::scrub_info_t, scrub_info_t, mds_co) \ No newline at end of file +MEMPOOL_DEFINE_OBJECT_FACTORY(CDir::scrub_info_t, scrub_info_t, mds_co) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 88eece19f00..eacb3ec10ae 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -11995,6 +11995,8 @@ void MDCache::_fragment_logged(MDRequestRef& mdr) for (const auto& dir : info.resultfrags) { dout(10) << " storing result frag " << *dir << dendl; + dir->mark_new(mdr->ls); + // freeze and store them too dir->auth_pin(this); dir->state_set(CDir::STATE_FRAGMENTING);