← Back to Pull requests

libceph: EC direct reads, pool migration and stretch EC #1

Closed
unknown closed this pull request without merging on Nov 25, 2026 17:05 UTC
View on GitHub
unknown unknown commented on Nov 12, 2026 07:59 UTC
Author

Kernel client (libceph) support for three Ceph server features, for review by the team before an RFC to ceph-devel. The base branch kport-base-testing is ceph-client testing (ccd87864c, 7.4-rc2). The diff is the series, then two DNM commits: debugfs counters used by the test harness, and the test plan for a real machine in kport-notes/TEST-PLAN.md.

v6, 2026-11-13: the FIXUPs from Bill Scales' reviews and from Bob's review are folded in, and the large patches are split for review: no patch is over 700 lines. Patch 1 is a fix for mainline, independent of the rest. The tree is the one tested overnight (wip-kport-v3c on this fork keeps that head with its FIXUPs) plus that fix and its KUnit test. 33 patches:

  • A mainline fix (patch 1): libceph: don't put a linger request twice when its watch is cancelled. A use-after-free in mainline since 75dbb685f4e8, which KASAN found in krbd_data_pool.sh during this testing. It applies to ceph-client testing on its own (branch wip-libceph-linger-uaf); its KUnit test is patch 33, as it needs the series' test helpers.

  • Part A, needs only ceph.git main (patches 2-21):

  • 2. feature bits SERVER_OCTOPUS..SERVER_VAMPIRE
    3. decode pg_pool_t up to v33
    4. decode pg_pool_t v34 (pool migration state)
    5. pg_upmap_primaries
    6. the primary-first pg_temp order of optimized EC pools
    7. enabling EC optimizations as a new interval
    8. decode the migration watermark of a redirect reply
    9. follow pool migrations (routing)
    10. keep the migration watermarks of redirected requests
    11. show pool migrations in debugfs
    12. move linger requests on a pool migration redirect
    13. advertise SERVER_OCTOPUS..SERVER_VAMPIRE
    14. GET_INTERNAL_VERSIONS_V2 and the EC direct read flags
    15. a reply carrying data for more than one op
    16. ceph: read from the primary when the object version is needed
    17. decode a pool's tiering and dedup tier
    18. EC direct reads
    19. one-shot requests to a given shard
    20. split EC direct reads across shards
    21. fall back to GET_INTERNAL_VERSIONS for split reads
  • Part B, the formats of https://github.com/ceph/ceph/pull/72643 and https://github.com/ceph/ceph/pull/73794, which are final (patches 22-25): bit 54, pg_pool_t v35, direct reads in pools over zones, advertising bit 54. Clusters without those PRs never encode v35 for a client or use bit 54, so these patches change nothing there.

  • KUnit (patches 26-33), one patch per area: pool decoding; OSD map decoding and placement; EC direct read helpers; request targeting; new intervals of direct reads; EC split reads; OSD replies and pool migrations; the linger fix of patch 1. They come after Part B because they cover zones too.
  • Patch 20 (split reads, about 550 lines) is kept whole: every way of splitting it leaves an intermediate kernel that either returns torn data (assembly before the version check) or writes into the buffers of a cancelled request (no cancel handling).

    Changes from Bob's review

    1. Split-read cancel races: a split read's completion now runs under osdc->lock (for read when the data is put together, for write when the read is resent to the primary) and calls the callback after dropping it, so ceph_osdc_cancel_request() either cancels the read first or finds it completed or resent. The split keeps the OSD client, so nothing reads the request before the cancel check.
    2. A cancel during the fallback to the primary is no longer lost (same change).
    3. The watermark entry is allocated before osdc->lock is taken for write; without it the redirected request fails with -ENOMEM instead of bouncing between source and target.
    4. Pools of size 0 are refused at decode, whatever the encoding.
    5. EC direct reads follow pg_pool_t::allows_nonprimary_reads(): not for tiers, pools with tiers or pools with a dedup tier (tier_of, tiers and the dedup tier pool option are decoded now). Replica reads of replicated pools are unchanged.
    6. Only the version op's own -EOPNOTSUPP switches the client to GET_INTERNAL_VERSIONS; the commit message says the switch lasts until remount.
    7. The SERVER_* commit message now says what SERVER_QUINCY changes: rules match any pool size.
    8. checkpatch: the KUnit help text is longer; (1ULL << n) is kept, as in the rest of the file. The FIXUPs are folded and the DNM commits stay last.
    9. Patch structure: see above. Not done yet: a struct for ceph_is_new_interval()'s arguments (left for after this round, as it changes code that has been tested), and the recalc_linger_target() declaration stays next to its user, since its return type is defined mid-file.

    Every fix comes with a KUnit test that fails without it, except the allocation failure (3), which can't be injected without a hook in the code.

    Found overnight

    Requests to a pool that had migrated hung across a PG merge in the migration target. libceph learns of PG merges only from the force resend epoch that the monitors set in the pool being merged, and calc_target() checked it in the base pool only. Now the pool a migration sends the request to is checked too (patch 9). In a chaos run, two krbd writes waited 15 minutes, until the next migration moved them; there were no data errors. KUnit migration_merge_test fails without the fix. In a recreate on the test machine, a migrated pool's pg_num went from 32 to 16 under three krbd clients. All three stalled for 12 minutes before the fix and none stalled with it.

    Testing

  • KUnit (CONFIG_CEPH_LIB_KUNIT_TEST): 6 suites, 57 cases, all passing under KASAN and lockdep, kmemleak clean.

  • - The tests drive the client's real paths with OSD sessions that never connect:
    - whole OSD maps are encoded as the monitors encode them, including a CRUSH map of two datacenters, and decoded with ceph_osdmap_decode();
    - new maps go through handle_one_map();
    - OSD replies, including migration redirects, go through handle_reply();
    - reply data goes through osd_sparse_read().
    - Every defect fixed in the series has a test shown failing without its fix, except the allocation failure of Bob's item 3 and the fs/ceph change (covered on the libceph side only).
  • Builds: every commit builds with W=1 without warnings (net/ceph, fs/ceph, rbd). checkpatch --strict is clean apart from the missing Signed-off-by, BIT_ULL and MAINTAINERS notes for the new test files.

  • Real machine (12 BlueStore OSDs on SSD partitions in two datacenters, KVM guests, debug kernel with KASAN, lockdep and kmemleak), on the head before Bob's fixes:

  • - the regression suite, migrations M01-M09 and watch/notify/lock tests L01-L05, thrashing S01-S02 (150 verify cycles each);
    - ported qa: fsx on krbd on five pools (replicated, EC 4+2, EC 8+3, EC 4+2 over zones with balance and with localize), the krbd fs workunits, and nine kcephfs workunits, all passing;
    - zone tests 4/4 (a first failure was the test running during a PG merge);
    - one kernel bug found: M04 (EC to replicated migration) showed that a direct read redirected into a replicated pool kept its EC direct-read flag, which OSDs with https://github.com/ceph/ceph/pull/72651 refuse. Fixed in patch 18, with a KUnit test; M04 then passed 3 of 3.
    - CephFS fscrypt truncate-then-extend fails on unpatched 7.3 as well, so it is not from the series.
  • Overnight, on the v4 tree and this one (details in the PR comment of 2026-11-13):

  • - the whole suite again, the krbd cram tests (14/14), the RBD workunits (12/13: a guest udev race in krbd_data_pool.sh), the krbd fs workunits (4/4), the kcephfs workunits and xfstests;
    - vstart_chaos runs with kernel clients as the workloads, pool migrations of their pools, zone faults and a rolling upgrade from Umbrella under kernel I/O: over 150 guest runs and 11,000 verify cycles, 0 errors;
    - the only series bug found was the PG merge hang above.
  • The Ceph cluster used is main + https://github.com/ceph/ceph/pull/72643 + https://github.com/ceph/ceph/pull/73794 + https://github.com/ceph/ceph/pull/72651. Without 72651, balanced EC split reads that run past an object's end crash OSDs (an OSD bug, plain librados reads hit it too).
  • Not done yet

  • Not supported: CRUSH MSR rules (the monitors treat this kernel as Reef-like) and split reads of replicated pools. Split reads are copied rather than received straight into the caller's buffer.

  • Runs still to do: a long soak and performance.
  • The commits carry Assisted-by: Claude Code and no Signed-off-by yet.

    🤖 Raised by Claude Code.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: aainscow Review duration: 19265m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.75) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.75 · 650 lines diff across 8 files
    0.75
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.075
    Real PR Conversation Timeline
    1 comments
    "Review active on #1"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 75.2% (HIGH) · Higher = larger blast radius
    75.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.7% · Safe to merge
    29.7%