← Back to Pull requests

objectfs: copy-on-write Inode rows (never mutate a shared Inode row in place) #177

Closed
unknown closed this pull request without merging on Oct 04, 2026 23:32 UTC
View on GitHub
unknown unknown commented on Oct 04, 2026 22:16 UTC
Author

objectfs: copy-on-write Inode rows to prevent in-place mutation of shared rows

Previously, CachedInode.Row was mutated in place across write operations in the
controller. Because this row pointer was shared with sds.Change (and thus the
unapplied view overlay and read cache), RPC responses, and WatchVolume event
broadcasts, in-place mutations caused races with readers outside the volume lock
and corrupted historical overlay entries. Stopgap cloning in toEntryAttr worked
around serialization races but left overlay entries mutable across subsequent writes.

This change introduces copy-on-write semantics for Inode rows in objectfs:

  • Adds a CachedInode.mutate helper that clones the Inode row before modifications

  • and updates CachedInode.Row with the new cloned pointer.
  • Refactors all write operations in the controller (SetAttr, Mkdir, CreateFile,

  • Symlink, Link, WriteFile, TruncateFile, Unlink, Rmdir, Rename, buildErofsTree)
    to use mutate or freshly allocated row messages.
  • Treats published Inode rows as immutable once shared, allowing the unconditional

  • proto.Clone in toEntryAttr to be safely removed while keeping only the root Ino
    remapping clone when needed.
  • The runtime cost is a single small allocation per modified row per write operation,

  • which is negligible compared to logging changes to the transaction stream, while
    enabling readers, caches, overlays, and broadcaster subscribers to share row pointers
    safely without holding the volume lock.
  • Extends TestConcurrentAttributeMutationAndReadRace under -race to exercise parallel

  • GetAttr/Lookup/ReadDir alongside concurrent SetAttr/WriteFile/Rename, WatchVolume
    subscribers, and the background applier.
  • Adds TestOverlayEntryKeepsRowAsOfChange to verify that overlay entries retain their

  • row state as of their change sequence across subsequent mutations.

    Fixes #176

    Diff: 233 lines (+174 / -59) across 2 files Reviewer: justinsb Review duration: 75m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 233 lines diff across 2 files
    0.37
    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.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #177"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 37.1% (MEDIUM) · Higher = larger blast radius
    37.1%
    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: 14.6% · Safe to merge
    14.6%