diff options
Diffstat (limited to 'src/mds/CDir.cc')
-rw-r--r-- | src/mds/CDir.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 89e2e5e4be9..7d28e039d9c 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1319,7 +1319,7 @@ void CDir::take_dentry_waiting(std::string_view dname, snapid_t first, snapid_t << it->first.snapid << " on " << *this << dendl; std::copy(it->second.begin(), it->second.end(), std::back_inserter(ls)); - waiting_on_dentry.erase(it++); + it = waiting_on_dentry.erase(it); } if (waiting_on_dentry.empty()) @@ -2494,6 +2494,10 @@ void CDir::_omap_commit_ops(int r, int op_prio, int64_t metapool, version_t vers mdcache->mds->heartbeat_reset(); } + // the last omap commit includes the omap header, so account for + // that size early on so that when we reach `commit_one(true)`, + // there is enough space for the header. + write_size += sizeof(fnode_t); using ceph::encode; for (auto &item : to_set) { bufferlist bl; @@ -2823,8 +2827,6 @@ void CDir::_committed(int r, version_t v) auto it = waiting_for_commit.begin(); while (it != waiting_for_commit.end()) { - auto _it = it; - ++_it; if (it->first > committed_version) { dout(10) << " there are waiters for " << it->first << ", committing again" << dendl; _commit(it->first, -1); @@ -2834,8 +2836,7 @@ void CDir::_committed(int r, version_t v) for (const auto &waiter : it->second) t.push_back(waiter); mdcache->mds->queue_waiters(t); - waiting_for_commit.erase(it); - it = _it; + it = waiting_for_commit.erase(it); if (!(++count % mdcache->mds->heartbeat_reset_grace())) mdcache->mds->heartbeat_reset(); @@ -3461,16 +3462,23 @@ bool CDir::can_auth_pin(int *err_ret) const { int err; if (!is_auth()) { + dout(20) << __func__ << ": error - no auth" << dendl; err = ERR_NOT_AUTH; } else if (is_freezing_dir() || is_frozen_dir()) { + dout(20) << __func__ << ": error - fragmenting dir (" + << (is_freezing_dir() ? "freezing" : "frozen") + << ")" << dendl; err = ERR_FRAGMENTING_DIR; } else { auto p = is_freezing_or_frozen_tree(); if (p.first) { + dout(20) << __func__ << ": error - exporting tree" << dendl; err = ERR_EXPORTING_TREE; } else if (p.second) { + dout(20) << __func__ << ": error - exporting tree" << dendl; err = ERR_EXPORTING_TREE; } else { + dout(20) << __func__ << ": auth!" << dendl; err = 0; } } @@ -3804,10 +3812,13 @@ bool CDir::should_split_fast() const const CDentry *dn = p.second; if (!dn->get_projected_linkage()->is_null()) { effective_size++; + + if (effective_size > fast_limit) [[unlikely]] + return true; } } - return effective_size > fast_limit; + return false; } bool CDir::should_merge() const |