Repository navigation
crimson/osd: gate write ops at OSDOp boundary when local store is full - #69351
Conversation
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
16 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a best-effort “near-full” signal from SeaStore/RBM cleaning up to the OSD op boundary so write-like ops can be rejected with -ENOSPC earlier, and fixes potential extent leaks in OMap btree node replacement paths.
Changes:
- Plumb
is_storage_full()fromAsyncCleaner→ExtentPlacementManager→TransactionManager→SeaStore→ShardServicesand gate selected OSD ops with-ENOSPC. - Extend
PGBackendwrite errorator to includeenospc. - Retire/reclaim logical addresses during OMap node split/merge/balance to avoid extent leaks; adjust background wake logic to re-check blocked IO.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/crimson/osd/shard_services.h | Exposes a shard-level “local storage full” accessor for op-level gating. |
| src/crimson/osd/pg_backend.h | Adds enospc to the write error set. |
| src/crimson/osd/ops_executer.cc | Adds early -ENOSPC gating for selected mutating ops. |
| src/crimson/os/seastore/transaction_manager.h | Exposes is_storage_full() by delegating to EPM. |
| src/crimson/os/seastore/seastore.h | Implements store-level is_storage_full() override for SeaStore. |
| src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc | Retires old node logical addresses on split/merge/balance to prevent leaks. |
| src/crimson/os/seastore/extent_placement_manager.h | Adds EPM is_storage_full() and exposes main cleaner pointer. |
| src/crimson/os/seastore/extent_placement_manager.cc | Wakes blocked IO after background thread wakes from blocking. |
| src/crimson/os/seastore/async_cleaner.h | Adds default is_storage_full() hook on cleaners. |
| src/crimson/os/futurized_store.h | Adds a virtual is_storage_full() hook to the store interface. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
There was a problem hiding this comment.
This looks right.
I think omap_manager unit tests (omap_manager_test_t) could be a great place to add to also assert retirement.
For example, TEST_P(omap_manager_test_t, leafnode_split_merge_balancing) or innernode_split_merge_balancing
to assert something like:
EXPECT_EQ(final_live_omap_extents, expected_count);
There was a problem hiding this comment.
Happy to help if bandwidth is limited!
CC @amathuria
There was a problem hiding this comment.
We took your test suggestion — and it proved to be the right instrument in an unexpected way: with retirement assertions in place, the original commit aborts in the dec_ref helper. The old nodes are already retired one level up by the callers (do_merge's //retire extent of {l,r}, do_balance, handle_split, and OMapLeafNode::insert on split), so the in-helper retire was a second tm.remove of the same laddr → ENOENT. fixed_kv_btree retires inside split_level, while the omap tree retires at the caller layer — that asymmetry (plus a benchmark counter that was really measuring never-deleted per-object omap-init extents) misled us.
We've dropped the retirement commit and kept the assertions as a test-only commit, including the exact-count EXPECT_EQ checks you suggested (exactly 1 root leaf after contraction to depth 1, exactly 0 after clear), so the caller-layer retirement contract is enforced by CI.
There was a problem hiding this comment.
See the following flags used by classical OSD:
#define CEPH_OSD_FULL (1<<4) /* osd is at or above full threshold */
#define CEPH_OSD_NEARFULL (1<<5) /* osd is at or above nearfull threshold */
#define CEPH_OSD_BACKFILLFULL (1<<6) /* osd is at or above backfillfull threshold */
Most notably, OSDService::is_nearfull(). The monitor (OSDMonitor.cc) handles these flags accrodingly:
if (!full_pool_ids.empty()) {
dout(10) << __func__ << " marking pool(s) " << full_pool_ids
<< " as full" << dendl;
for (auto &p: full_pool_ids) {
if (tmp.get_pg_pool(p)->has_flag(pg_pool_t::FLAG_FULL)) {
continue;
}
if (pending_inc.new_pools.count(p) == 0) {
pending_inc.new_pools[p] = tmp.pools[p];
}
pending_inc.new_pools[p].flags |= pg_pool_t::FLAG_FULL;
pending_inc.new_pools[p].flags &= ~pg_pool_t::FLAG_BACKFILLFULL;
pending_inc.new_pools[p].flags &= ~pg_pool_t::FLAG_NEARFULL;
}
Crimson's executer does checl for fullnes:
// check for full
if ((ox.delta_stats.num_bytes > 0 ||
ox.delta_stats.num_objects > 0) &&
get_pgpool().info.has_flag(pg_pool_t::FLAG_FULL)) {
const auto& m = ox.get_message();
if (m.get_reqid().name.is_mds() || // FIXME: ignore MDS for now
m.has_flag(CEPH_OSD_FLAG_FULL_FORCE)) {
INFODPP("full, but proceeding due to FULL_FORCE, or MDS", *this);
} else if (m.has_flag(CEPH_OSD_FLAG_FULL_TRY)) {
But I think we miss concepts like CEPH_OSD_NEARFULL to avoid the issue described here. I don't think that querying the store directly is the right apprach as this overrides the monitors logic. wdyt?
Can you please move this to a separate PR so it would be easier to merge/test the omap leak?
Thanks!
There was a problem hiding this comment.
Reworked per your pointer. Policy stays with the mon — the existing pool FLAG_FULL handling in run_executer remains the authoritative path with its FULL_TRY/FULL_FORCE/MDS semantics. The new gate is scoped as Crimson's analog of classic's failsafe check (PrimaryLogPG.cc:2162), which exists because OSDMap flag propagation can't outrun local allocator exhaustion; like classic, it exempts FULL_TRY.
One deliberate deviation, noted in the commit message: we reply -ENOSPC instead of dropping, since a dropped op from a client not yet blocked by full flags would hang. Mon-side NEARFULL/FULL integration via statfs reporting is a natural follow-up once RBM capacity moves to the allocator's authoritative view (#69352).
e433400 to
1b0e785
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
When SeaStore runs out of space, allocations in object_data_handler.cc hit enospc::assert_failure and abort the OSD. Gating on monitor OSDMap pool FULL flags alone is insufficient: flag propagation lags by seconds-to-minutes and cannot protect the local allocator from sudden exhaustion. Add a local failsafe gate at the OpsExecuter boundary, Crimson's analog of classic's osd_failsafe_full_ratio check (PrimaryLogPG.cc:2162). Data-allocating ops (CREATE/WRITE/WRITEFULL/WRITESAME/APPEND/COPY_FROM2) are dropped with -EAGAIN so the client resends, matching Crimson's existing mon-driven full path (the "drop request" case in pg.cc) and classic's silent drop. This keeps behavior uniform regardless of whether pool full flags have reached the client yet. CEPH_OSD_FLAG_FULL_TRY is exempt; space-reclaiming ops (ZERO/TRUNCATE/ROLLBACK) are deliberately not gated. The mon-driven pool FLAG_FULL path in run_executer is untouched and remains authoritative. The threshold uses the store's statfs accounting (stats.used_bytes). The follow-on (ceph#69352) moves RBM capacity checks to the allocator's authoritative view and wires mon-side NEARFULL/FULL via statfs, so clients get a clean stop rather than resend-until-resolved. Signed-off-by: Shai Fultheim <[email protected]>
…_full_ratio RBMCleaner::is_storage_full() hardcoded a 3% free limit. Read the same config classic uses for its failsafe check (osd_failsafe_full_ratio, default 0.97) instead, treating the store as full once the free fraction drops below (1 - ratio), so the threshold tracks the knob rather than a magic constant. Signed-off-by: Shai Fultheim <[email protected]>
Add storage_full_failsafe_threshold to the RBM-backed transaction manager tests: a fresh store reports not-full at the default ratio, real extent allocations flip is_storage_full() once the used fraction crosses osd_failsafe_full_ratio, and restoring the default ratio clears the condition, verifying the threshold tracks the config knob. Signed-off-by: Shai Fultheim <[email protected]>
8f9da50 to
0c4cba1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Suppressed comments (1)
src/crimson/os/seastore/extent_placement_manager.h:700
- This checks only
main_cleaner, butExtentPlacementManager::init()supports a segmented main tier with an RBM cold tier. In that configuration the mainSegmentCleaneralways reports false while the coldRBMCleanercan fill, so the OSD gate never engages for the exhausted device. Include every configured RBM cleaner (main and cold) when computing store fullness.
bool is_storage_full() const {
auto *cleaner = background_process.get_main_cleaner();
return cleaner ? cleaner->is_storage_full() : false;
}
| case CEPH_OSD_OP_WRITE: | ||
| case CEPH_OSD_OP_WRITEFULL: | ||
| case CEPH_OSD_OP_WRITESAME: | ||
| case CEPH_OSD_OP_APPEND: | ||
| case CEPH_OSD_OP_COPY_FROM2: |
| const double failsafe_full_ratio = | ||
| crimson::common::get_conf<double>("osd_failsafe_full_ratio"); | ||
| return st.available < st.total * (1.0 - failsafe_full_ratio); |
|
Rebased onto current |
|
jenkins retest this please |
|
restesting due to rebase for sanity |
PR=wip-perezjos-crimson-only-03-08-2026-PR69351
$ teuthology-suite -s crimson-rados -p 101 --force-priority -c $PR -f debug --filter-out rgw --suite-branch main --suite-repo https://github.com/ceph/ceph.git
2026-08-04 06:46:24,677.677 INFO:teuthology.suite.run:Test results viewable at Most failures are infrastructure problems:
PR=wip-perezjos-crimson-only-03-08-2026-PR69351
$ teuthology-suite --rerun jjperez-2026-08-04_06:40:38-crimson-rados-wip-perezjos-crimson-only-03-08-2026-PR69351-distro-debug-trial -m trial -p 101 --force-priority -c $PR -f debug --suite-branch main --suite-repo https://github.com/ceph/ceph.git
2026-08-12 14:36:37,590.590 INFO:teuthology.suite.run:Scheduled 154 jobs in total.
2026-08-12 14:36:39,450.450 INFO:teuthology.suite.run:Test results viewable at Finally! only 14 jobs failed, what a difference, proceeding analysis:
|
|
@Matan-B - can we merge? |
Crimson's analog of classic's failsafe full check (
PrimaryLogPG.cc:2162): data-allocating client ops (CREATE/WRITE/WRITEFULL/WRITESAME/APPEND/COPY_FROM2) are dropped with-EAGAIN(the client resends) when the local store reports full (RBMCleaner, threshold derived fromosd_failsafe_full_ratio, default 0.97), exemptingCEPH_OSD_FLAG_FULL_TRYexactly as classic does.The mon-driven pool
FLAG_FULLhandling inrun_executeris untouched and remains the authoritative policy path with its FULL_TRY/FULL_FORCE/MDS semantics. This gate exists for the same reason classic's failsafe does: OSDMap flag propagation can't outrun local allocator exhaustion. Space-reclaiming ops (ZERO/TRUNCATE/ROLLBACK) are deliberately not gated.Dropping via
-EAGAINmatches both classic's silent drop (PrimaryLogPG.cc:2164) and Crimson's own mon-driven full path (the "drop request" case inpg.cc), so the outcome is consistent regardless of whether the pool full flags have reached the client yet: the write retries until space is freed or the flags propagate.The threshold currently derives from the store's statfs accounting; #69352 moves RBM capacity checks to the allocator's authoritative view, and mon-side NEARFULL/FULL integration via statfs reporting is the natural follow-up that lets clients get a clean stop rather than resend-until-resolved.
Restructured per review (thanks @Matan-B): this PR is now scoped to the failsafe gate alone, on top of
main. The omap extent-retirement test coverage that was previously bundled here is split out into #69482.Checklist