From cb2cc228dadf3e5d5cd75835365b91a43c941453 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Mon, 31 Aug 2020 17:11:09 +0800 Subject: [PATCH] mds: fix incorrect check for if dirfrag is being fragmented Fixes: https://tracker.ceph.com/issues/47201 Signed-off-by: "Yan, Zheng" --- src/mds/CDir.cc | 6 +++--- src/mds/MDCache.cc | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 21a4c8e63a7dd..7061de14442e9 100755 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -2240,7 +2240,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(nullptr, nullptr, nullptr); if (!to_set.empty()) @@ -2258,7 +2258,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; @@ -2279,7 +2279,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(nullptr, nullptr, nullptr); /* diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 51d0db0c7cae9..678d80d8556fd 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -11998,6 +11998,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); -- 2.39.5