Skip to content

osd: pwlc was able to retain values larger than the last_update - #71579

Merged
ljflores merged 1 commit into
ceph:mainfrom
JonBailey1993:pwlc_ahead_of_last_update_assert
Sep 23, 2026
Merged

ljflores merged 1 commit into
ceph:mainfrom
JonBailey1993:pwlc_ahead_of_last_update_assert

Conversation

@JonBailey1993

@JonBailey1993 JonBailey1993 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

In certain scenarios during peering, it was possible for us to tell other nodes they needed to roll back their last update when we have divergent entries. PGLog::proc_replica_log is one of these places where we merge divergent entries and potentially roll back the last update, however what we do not do when we do this is modify the pwlc in like we do in proc_master_log when this happens. Because of this, this means we have the potential to have a pwlc with a newer version in it than the agreed upon latest update, which it is then possible to be propogated out to non-primary shards causing each of those shards to assert as I saw in my local test. I've put together this fix which limits the the value of proc_master_log after deciding on a new value for last_update.

Below is the summary of the timeline where I observed this:

  • (osd.1, shard 0) 45.472 write (tid=15010, 0~4096) started on primary, which would be 536’12007 (and two more which would be 536’12009)
  • (osd.1, shard 0) 45.501 new peering interval started
  • (osd.1, shard 0) 45.502 write (tid=15010) cancelled
  • (osd.1, shard 0) 48.668 rollback pwlc for shard 1 to 536'12006,536'12006
  • (osd.1, shard 0) 48.668 rollback pwlc for shard 2 to 536'12006,536'12006
  • (osd.1, shard 0) 48.668 rollback pwlc for shard 3 to 536'12006,536'12006
  • (osd.1, shard 0) 48.680 rollback pg from 536’12008 to 536’12006
  • (osd.1, shard 0) 48.710 GetMissing::react(MLogRec) received from osd.4, containing info version log((532'11853,536'12008], crt=536'12003)
  • (osd.1, shard 0) 48.713 _merge_object_divergent_entries determines that rollback to 536’12006 is possible for osd.4 and sets in memory copy of osd.4’s last update to 536’12006
  • (osd.1, shard 0) 48.714 update_peer_info sets pwlc to 536’12008 on the current shard using the pwlc of the incoming shard
  • (osd.0, shard 3) 52.742 Stray::react(MLogRec) received, containing info version 536’12006
  • (osd.0, shard 3) 52.748 apply_pwlc, setting last_update and last_complete from 536’12006 to 536’12008
  • (osd.2, shard 1) 52.759 Stray::react(MLogRec) received, containing info version 536’12006
  • (osd.2, shard 1) 52.759 apply_pwlc, setting last_update and last_complete from 536’11854 to 536’12008
  • (osd.2, shard 1) 52.765 apply_pwlc, setting last_update and last_complete from 536’12006 to 536’12008
  • (osd.3, shard 2) 52.858 Stray::react(MLogRec) received, containing info version 536’12006
  • (osd.3, shard 2) 52.865 apply_pwlc, setting last_update and last_complete from 536’12006 to 536’12008
  • (osd.1, shard 0) 53.398 write (tid=15013, 0~4096) started on primary, will be version 544’12007
  • (osd.1, shard 0) 53.400 cache_ready creates Transactions for ALL shards because first_write_in_interval is true, so non-primaries get sent a transaction which includes a setattr for the OI and nothing else
  • (osd.0, shard 3) 53.401 dequeue_op tid=15013
  • (osd.3, shard 2) 53.401 dequeue_op tid=15013
  • (osd.2, shard 1) 53.401 dequeue_op tid=15013
  • (osd.0, shard 3) 53.452 Assert on osd.0 when trying to append log at version 544’12007
  • (osd.2, shard 1) 53.454 Assert on osd.2 when trying to append log at version 544’12007
  • (osd.3, shard 2) 53.456 Assert on osd.3 when trying to append log at version 544’12007

Tracker ticket: https://tracker.ceph.com/issues/80360

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.

@JonBailey1993
JonBailey1993 requested a review from a team as a code owner September 7, 2026 10:52
@JonBailey1993 JonBailey1993 self-assigned this Sep 7, 2026
@github-actions github-actions Bot added the core label Sep 7, 2026
@JonBailey1993
JonBailey1993 marked this pull request as draft September 7, 2026 10:52
@JonBailey1993
JonBailey1993 force-pushed the pwlc_ahead_of_last_update_assert branch from 5fa0c51 to 1bd3e0b Compare September 7, 2026 10:54
@JonBailey1993

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@JonBailey1993
JonBailey1993 marked this pull request as ready for review September 8, 2026 09:03

@bill-scales bill-scales 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.

Genearlly ok, minor additional check required to ensure that the start of the range is not greater than the end of the range.

Comment thread src/osd/PGLog.cc Resolved
In certain scenarios during peering, it was possible for us to tell other nodes
they needed to roll back their last update when we have divergent entries.
We do not modify the pwlc when we rollback the last_update,
but we do potentially update our own pwlc from the peers pwlc in this process,
meaning we have a pwlc with a newer version in it than the agreed upon latest
update. This can then be propogated out to non-primary shards causing each of
those shards to assert.

Signed-off-by: Jon Bailey <[email protected]>
Assisted-by: IBM Bob 2.1.0
@JonBailey1993
JonBailey1993 force-pushed the pwlc_ahead_of_last_update_assert branch from 1bd3e0b to a0e23ce Compare September 9, 2026 08:47

@bill-scales bill-scales 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.

LGTM

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath25-testing-20260918.001212-main.

@ronen-fr

Copy link
Copy Markdown
Contributor

@ljflores
ljflores merged commit 221a920 into ceph:main Sep 23, 2026
16 checks passed
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 1, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 6, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 8, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 5251dff)
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
… activates

In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 5251dff)
(cherry picked from commit f3beb95)
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
… activates

In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 5251dff)
(cherry picked from commit f3beb95)
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
… activates

In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 5251dff)
(cherry picked from commit f3beb95)
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 14, 2026
… activates

In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 5251dff)
(cherry picked from commit f3beb95)
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 15, 2026
… activates

In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 16, 2026
… activates

In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Oct 19, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Nov 16, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
aainscow added a commit to aainscow/ceph that referenced this pull request Nov 23, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 087606b)

Conflicts:
	src/test/osd/TestECFailoverWithPeering.cc
	The test commit of the original PR (f45dea8) is not backported: this file does not exist on tentacle (the EC peering test harness was not backported there).
aainscow added a commit to aainscow/ceph that referenced this pull request Nov 23, 2026
In an optimized EC pool, a sub-stripe write gives the shards it does not
touch a partial_writes_last_complete (pwlc) range ending at that write.
If peering later rolls the write back, a pwlc range that still ends at
it is stale, and applying it moves a nonprimary shard's last_update and
log head to a version that no longer exists.

ceph#71579 ("osd: pwlc was able to retain values larger than the
last_update") trims the pwlc copies the primary holds for divergent
peers in proc_replica_log, but the primary's own copy is not trimmed.
The new primary merges each peer's pwlc in update_peer_info() during
GetInfo, before GetLog has decided the authoritative log, so it keeps a
range ending at a write that peering then rolls back. proc_master_log()
would trim it, but does not run when the primary is its own log source.
activate() then stamps the stale range with a new epoch, making it the
definitive copy, and sends it to the peers. The nonprimary shards apply
it and move their last_update and log head to the rolled-back version,
so the next write to them, which reuses that version number, asserts in
IndexedLog::add; a shard left with such a last_update can also be picked
later as the log source and then never be recovered.

The primary's log is authoritative once it activates, so no pwlc range
may end past its head. activate() now trims pwlc to the head before
stamping the epoch, which also covers ranges merged after GetLog in
WaitUpThru and from peers whose log head already matched.

A nonprimary shard keeps its own pwlc too, and update_peer_info()
applies its own range after merging only the ranges the primary sends.
When no primary-capable shard of the new interval saw a partial write
that skipped it, the primary sends no range for it, so the shard applies
its stale range again right after the primary's MInfoRec has rewound
its log. update_peer_info() now trims a nonprimary shard's pwlc to the
primary's last_update before applying it.

The range for its own shard that a replica applies from an MLogRec
before merging the log is capped at the sender's last_update the same
way. With the activate() change a primary no longer sends such a range;
the cap is defensive, for mixed-version clusters during an upgrade where
the primary still runs older code.

Tested by TestECFailoverWithPeering.RolledBackPeeredWriteLeavesNoStalePwlc
and RolledBackPeeredWriteLeavesNoStaleReplicaPwlc in the following commit.

Fixes: https://tracker.ceph.com/issues/81283
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
(cherry picked from commit 087606b)

Conflicts:
	src/test/osd/TestECFailoverWithPeering.cc
	The test commit of the original PR (f45dea8) is not backported: the test uses set_pool_min_size() from the main test fixture, which umbrella lacks.
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