Skip to content

osd: Set projected_size to current_size on cache invalidate. - #70377

Merged
aainscow merged 1 commit into
ceph:mainfrom
aainscow:wip-aainscow-invalidate-ec-extent-cache-fix
Sep 7, 2026
Merged

aainscow merged 1 commit into
ceph:mainfrom
aainscow:wip-aainscow-invalidate-ec-extent-cache-fix

Conversation

@aainscow

@aainscow aainscow commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

NOTE: Unit tests and recreate are under a different PR: #70371

When EC is dealing with resizing objects, it tracks the current_size (which reflects the size of the object on-disk) and projected size, which is the size the object will be once all queued transactions are applied.

Since the expanded space of an object contains either write data, or a hole, the extent cache can void reading it for any future writes while it is active. It does this by marking "do_not_read" with this gap.

The extent cache then relies on do_not_read generating reads beyond the end of current_size.

The bug here is that during a cache invalidate, adding to do_not_read was skipped and in some situations, this could lead to a follow on op attempting to read off the end of an object.

Fixes: https://tracker.ceph.com/issues/78465

Assisted-by: IBM-Bob 2.0.1/Claude Sonnet/GPT-5

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

When EC is dealing with resizing objects, it tracks the current_size (which
reflects the size of the object on-disk) and projected size, which is the
size the object will be once all queued transactions are applied.

Since the expanded space of an object contains either write data, or a hole,
the extent cache can void reading it for any future writes while it is active.
It does this by marking "do_not_read" with this gap.

The extent cache then relies on do_not_read generating reads beyond the end
of current_size.

The bug here is that during a cache invalidate, adding to do_not_read was skipped
and in some situations, this could lead to a follow on op attempting to read
off the end of an object.

Fixes: https://tracker.ceph.com/issues/78465
Signed-off-by: Alex Ainscow <[email protected]>
Assisted-by: IBM-Bob 2.0.1/Claude Sonnet/GPT-5
Signed-off-by: Alex Ainscow <[email protected]>
Comment thread src/osd/ECExtentCache.cc
* track the projected size in the replay.
*/
projected_size = invalidating_op->projected_size;
projected_size = current_size;

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.

ACK: rollback projected_size to current_size then replay the outstanding ops which will increase projected_size again but also set up do_not_read

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath14-testing-20260826.230942-main.

@NitzanMordhai

Copy link
Copy Markdown
Contributor

@aainscow

Copy link
Copy Markdown
Contributor Author

Being reverted by #72666: this change introduced a regression, https://tracker.ceph.com/issues/81611.

aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
…lidate-ec-extent-cache-fix"

This reverts commit 93a785e, reversing
changes made to cb76fd5.

With that change, ECExtentCache::Object::invalidate() sets projected_size
to current_size, so replaying a queued rollback re-adds the rolled-back
data as a growth hole in do_not_read. Writes queued behind the rollback
then skip reading that data and zero-fill the parts of pages they do not
overwrite.

See: https://tracker.ceph.com/issues/81611
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
…lidate-ec-extent-cache-fix"

This reverts commit 93a785e, reversing
changes made to cb76fd5.

With that change, ECExtentCache::Object::invalidate() sets projected_size
to current_size, so replaying a queued rollback re-adds the rolled-back
data as a growth hole in do_not_read. Writes queued behind the rollback
then skip reading that data and zero-fill the parts of pages they do not
overwrite.

See: https://tracker.ceph.com/issues/81611
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
…lidate-ec-extent-cache-fix"

This reverts commit 93a785e, reversing
changes made to cb76fd5.

With that change, ECExtentCache::Object::invalidate() sets projected_size
to current_size, so replaying a queued rollback re-adds the rolled-back
data as a growth hole in do_not_read. Writes queued behind the rollback
then skip reading that data and zero-fill the parts of pages they do not
overwrite.

See: https://tracker.ceph.com/issues/81611
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit that referenced this pull request Oct 22, 2026
osd: revert #70377 "Set projected_size to current_size on cache invalidate."

Reviewed-by: Bill Scales <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants