Skip to content

crimson/osd: gate write ops at OSDOp boundary when local store is full - #69351

Merged
Matan-B merged 3 commits into
ceph:mainfrom
fultheim:seastore-generic-stability-fixes
Aug 23, 2026
Merged

Matan-B merged 3 commits into
ceph:mainfrom
fultheim:seastore-generic-stability-fixes

Conversation

@fultheim

@fultheim fultheim commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

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 from osd_failsafe_full_ratio, default 0.97), exempting CEPH_OSD_FLAG_FULL_TRY exactly as classic does.

The mon-driven pool FLAG_FULL handling in run_executer is 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 -EAGAIN matches both classic's silent drop (PrimaryLogPG.cc:2164) and Crimson's own mon-driven full path (the "drop request" case in pg.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

  • Tracker (select at least one)
    • New feature (ticket optional)
  • Component impact
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • No doc update is appropriate
  • Tests (select at least one)
    • No tests

Copilot AI review requested due to automatic review settings June 9, 2026 12:13
@fultheim
fultheim requested a review from a team as a code owner June 9, 2026 12:13
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() from AsyncCleaner → ExtentPlacementManager → TransactionManager → SeaStore → ShardServices and gate selected OSD ops with -ENOSPC.
  • Extend PGBackend write errorator to include enospc.
  • 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.

Comment thread src/crimson/osd/ops_executer.cc Resolved
Comment thread src/crimson/osd/shard_services.h Resolved
Comment thread src/crimson/os/seastore/seastore.h Resolved
Comment thread src/crimson/os/seastore/async_cleaner.h Resolved
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to help if bandwidth is limited!
CC @amathuria

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@Matan-B
Matan-B requested a review from xxhdx1985126 June 11, 2026 10:33
@Matan-B Matan-B moved this from Awaits review to In Progress in Crimson Jun 11, 2026
@fultheim
fultheim force-pushed the seastore-generic-stability-fixes branch from e433400 to 1b0e785 Compare June 11, 2026 20:32
@github-actions

Copy link
Copy Markdown

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]>
@fultheim
fultheim force-pushed the seastore-generic-stability-fixes branch from 8f9da50 to 0c4cba1 Compare July 31, 2026 23:11
Copilot AI review requested due to automatic review settings July 31, 2026 23:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, but ExtentPlacementManager::init() supports a segmented main tier with an RBM cold tier. In that configuration the main SegmentCleaner always reports false while the cold RBMCleaner can 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;
  }

Comment on lines +622 to +626
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:
Comment on lines +1892 to +1894
const double failsafe_full_ratio =
crimson::common::get_conf<double>("osd_failsafe_full_ratio");
return st.available < st.total * (1.0 - failsafe_full_ratio);
@fultheim

Copy link
Copy Markdown
Contributor Author

Rebased onto current main — no functional change. The only conflict was in extent_placement_manager.h, where main grew BackgroundProcess::is_full() at the exact spot this PR anchors get_main_cleaner(); resolved by keeping both, main's version untouched. git range-diff shows commits 2 and 3 byte-identical and commit 1 differing only in context anchors. Compile-checked extent_placement_manager.cc, ops_executer.cc, and test_transaction_manager.cc. Now MERGEABLE — ready to merge once CI finishes.

@Matan-B

Matan-B commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

jenkins retest this please

@Matan-B Matan-B moved this from Tested to Needs QA in Crimson Aug 3, 2026
@Matan-B

Matan-B commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

restesting due to rebase for sanity

@perezjosibm

perezjosibm commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor
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 

https://pulpito-ng.ceph.com/jjperez-2026-08-04_06:40:38-crimson-rados-wip-perezjos-crimson-only-03-08-2026-PR69351-distro-debug-trial/

Most failures are infrastructure problems:

  • 123 jobs: Failure: Command failed on trial023 with status 1: 'sudo yum install -y kernel'
  • 8 jobs failed : 'sudo yum -y install https://dl.fedoraproject.org/pub/epel/9...'
  • 2 failed with 'Cannot download, all mirrors were already tried without success'

  • Attempting a re-run:
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 

https://pulpito-ng.ceph.com/jjperez-2026-08-12_14:31:38-crimson-rados-wip-perezjos-crimson-only-03-08-2026-PR69351-distro-debug-trial/

Finally! only 14 jobs failed, what a difference, proceeding analysis:

@perezjosibm perezjosibm moved this from Needs QA to QA in Progress in Crimson Aug 3, 2026
@perezjosibm perezjosibm moved this from QA in Progress to Tested in Crimson Aug 17, 2026
@fultheim

Copy link
Copy Markdown
Contributor Author

@Matan-B - can we merge?

@Matan-B
Matan-B merged commit 18df2de into ceph:main Aug 23, 2026
6 checks passed
@Matan-B Matan-B moved this from Tested to Merged (Main) in Crimson Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Merged (Main)

Development

Successfully merging this pull request may close these issues.

8 participants