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: v14.2.12~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=235d54ae355b370c3e3f92eb0a813af8d63380b2;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 nautilus, but this is not relevant to the backport --- diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 4112fdd836f..e657654243d 100755 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -2198,7 +2198,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()) @@ -2216,7 +2216,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; @@ -2237,7 +2237,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); /* diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index f771ca54556..e18f33635f9 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -11676,6 +11676,8 @@ void MDCache::_fragment_logged(MDRequestRef& mdr) CDir *dir = *p; 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);