Skip to content

Commit

Permalink
mds: fix incorrect check for if dirfrag is being fragmented
Browse files Browse the repository at this point in the history
Fixes: https://tracker.ceph.com/issues/47201
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
  • Loading branch information
ukernel committed Aug 31, 2020
1 parent 912f6fa commit cb2cc22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mds/CDir.cc
Expand Up @@ -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())
Expand All @@ -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;
Expand All @@ -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);

/*
Expand Down
2 changes: 2 additions & 0 deletions src/mds/MDCache.cc
Expand Up @@ -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);
Expand Down

0 comments on commit cb2cc22

Please sign in to comment.