Repository navigation
osdc/Objecter: re-target forced-OSD direct reads when the PG changes - #72236
Merged
Merged
Conversation
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 1, 2026
op_target_t::respects_full() treats CEPH_OSD_FLAG_RWORDERED ops like writes, so _scan_requests() force-resends them when a pool fills or has space again, but target_should_be_paused() paused only CEPH_OSD_FLAG_WRITE ops on a full pool. An ORDER_READS_WRITES read issued after writes that a full pool had paused was sent, or resent, straight away and completed before them, breaking the order the flag asks for; ceph_test_rados aborted with "finished tid 1 when last_acked_tid was 3" when an OSD went failsafe-full, and the same abort was reproduced on a replicated pool by pulsing a max_objects quota under ceph_test_rados. c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full", https://tracker.ceph.com/issues/19133) made _op_submit() pause every op that respects_full() on a full pool. target_should_be_paused(), which _calc_target() applies when a map arrives, folded that check into the PAUSEWR condition that only CEPH_OSD_FLAG_WRITE ops test, so a read already in flight when the pool filled was resent at once. c0482d7 ("osdc/Objecter: remove duplicated pause check code") then dropped the check from _op_submit() as a duplicate, so reads submitted while the pool was full were no longer paused either. Pause every op that respects_full() while its pool or the cluster is full. Such a read now waits with the writes ahead of it, and once the pool has space _scan_requests() resends them in tid order. PAUSEWR alone still pauses only writes, FULL_TRY and FULL_FORCE ops are still sent, and reads without CEPH_OSD_FLAG_RWORDERED are unaffected. As before c0482d7, the in-tree RWORDERED readers wait while their pool is full: Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use (the MDS's Objecter ignores pool full), and the OSD's tier promotes, copy-gets and proxied RWORDERED reads. This change stands alone. It is based on ceph#72236 only because the tests in the following commit use that PR's TestSplitOpMapChange harness in unittest_objecter_direct_reads. Tested by TestSplitOpMapChange.RWOrderedReadWaitsForWriteOnFullPool and RWOrderedReadResentAfterWriteWhenPoolFull in the following commit. Fixes: https://tracker.ceph.com/issues/81205 Assisted-by: Claude Code
4 of 14 tasks
aainscow
force-pushed
the
wip-objecter-forced-osd-retarget
branch
from
October 1, 2026 10:48
d4d5b96 to
f24e3ff
Compare
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 1, 2026
op_target_t::respects_full() treats CEPH_OSD_FLAG_RWORDERED ops like writes, so _scan_requests() force-resends them when a pool fills or has space again, but target_should_be_paused() paused only CEPH_OSD_FLAG_WRITE ops on a full pool. An ORDER_READS_WRITES read issued after writes that a full pool had paused was sent, or resent, straight away and completed before them, breaking the order the flag asks for; ceph_test_rados aborted with "finished tid 1 when last_acked_tid was 3" when an OSD went failsafe-full, and the same abort was reproduced on a replicated pool by pulsing a max_objects quota under ceph_test_rados. c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full", https://tracker.ceph.com/issues/19133) made _op_submit() pause every op that respects_full() on a full pool. target_should_be_paused(), which _calc_target() applies when a map arrives, folded that check into the PAUSEWR condition that only CEPH_OSD_FLAG_WRITE ops test, so a read already in flight when the pool filled was resent at once. c0482d7 ("osdc/Objecter: remove duplicated pause check code") then dropped the check from _op_submit() as a duplicate, so reads submitted while the pool was full were no longer paused either. Pause every op that respects_full() while its pool or the cluster is full. Such a read now waits with the writes ahead of it, and once the pool has space _scan_requests() resends them in tid order. PAUSEWR alone still pauses only writes, FULL_TRY and FULL_FORCE ops are still sent, and reads without CEPH_OSD_FLAG_RWORDERED are unaffected. As before c0482d7, the in-tree RWORDERED readers wait while their pool is full: Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use (the MDS's Objecter ignores pool full), and the OSD's tier promotes, copy-gets and proxied RWORDERED reads. This change stands alone. It is based on ceph#72236 only because the tests in the following commit use that PR's TestSplitOpMapChange harness in unittest_objecter_direct_reads. Tested by TestSplitOpMapChange.RWOrderedReadWaitsForWriteOnFullPool and RWOrderedReadResentAfterWriteWhenPoolFull in the following commit. Fixes: https://tracker.ceph.com/issues/81205 Assisted-by: Claude Code
JonBailey1993
approved these changes
Oct 1, 2026
JonBailey1993
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Just this change left outstanding: #72236 (comment)
4 of 14 tasks
aainscow
force-pushed
the
wip-objecter-forced-osd-retarget
branch
from
October 1, 2026 22:48
f24e3ff to
d96ba9f
Compare
JonBailey1993
marked this pull request as ready for review
October 2, 2026 13:37
bill-scales
approved these changes
Oct 2, 2026
bill-scales
left a comment
Contributor
There was a problem hiding this comment.
LGTM.
I think there is another PR in flight that has added src/test/osdc/. Maybe once everything has merged we should look at moving TestObjecterDirectReads to this directory.
Contributor
|
This PR has been added to wip-bharath20-testing-20261002.224634-main. |
rzarzynski
approved these changes
Oct 5, 2026
Comment on lines
+3295
to
+3313
| // A direct read gets one attempt, so fail it back once its PG changes. | ||
| // If FAIL_ON_EAGAIN is set, we must not failover - the caller expects | ||
| // -EAGAIN to be returned. Otherwise, clear the direct read flags and | ||
| // redrive to the primary OSD (similar to what happens when we get -EAGAIN). | ||
| if (t->flags & CEPH_OSD_FLAG_FAIL_ON_EAGAIN) { | ||
| ldout(cct, 10) << __func__ << " forced osd." << t->osd | ||
| << " pg changed, acting " << t->acting | ||
| << ", FAIL_ON_EAGAIN set, returning POOL_DNE to trigger -EAGAIN" | ||
| << dendl; | ||
| t->osd = -1; | ||
| return RECALC_OP_TARGET_POOL_DNE; | ||
| } else { | ||
| ldout(cct, 10) << __func__ << " forced osd." << t->osd | ||
| << " pg changed, acting " << t->acting | ||
| << ", clearing direct read flags and redriving to primary" | ||
| << dendl; | ||
| // Clear all direct read flags (EC_DIRECT_READ, BALANCE_READS, LOCALIZE_READS) | ||
| t->flags &= ~CEPH_OSD_FLAGS_DIRECT_READ; | ||
| t->flags &= ~CEPH_OSD_FLAG_FORCE_OSD; |
Comment on lines
+3223
to
+3226
| // A forced OSD can leave the acting set without the primary changing, and | ||
| // drops ops sent to it in an earlier interval. | ||
| if ((any_change || (t->flags & CEPH_OSD_FLAG_FORCE_OSD)) && | ||
| PastIntervals::is_new_interval( |
Contributor
There was a problem hiding this comment.
Perhaps this could have been merged with the previous commit.
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 6, 2026
op_target_t::respects_full() treats CEPH_OSD_FLAG_RWORDERED ops like writes, so _scan_requests() force-resends them when a pool fills or has space again, but target_should_be_paused() paused only CEPH_OSD_FLAG_WRITE ops on a full pool. An ORDER_READS_WRITES read issued after writes that a full pool had paused was sent, or resent, straight away and completed before them, breaking the order the flag asks for; ceph_test_rados aborted with "finished tid 1 when last_acked_tid was 3" when an OSD went failsafe-full, and the same abort was reproduced on a replicated pool by pulsing a max_objects quota under ceph_test_rados. c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full", https://tracker.ceph.com/issues/19133) made _op_submit() pause every op that respects_full() on a full pool. target_should_be_paused(), which _calc_target() applies when a map arrives, folded that check into the PAUSEWR condition that only CEPH_OSD_FLAG_WRITE ops test, so a read already in flight when the pool filled was resent at once. c0482d7 ("osdc/Objecter: remove duplicated pause check code") then dropped the check from _op_submit() as a duplicate, so reads submitted while the pool was full were no longer paused either. Pause every op that respects_full() while its pool or the cluster is full. Such a read now waits with the writes ahead of it, and once the pool has space _scan_requests() resends them in tid order. PAUSEWR alone still pauses only writes, FULL_TRY and FULL_FORCE ops are still sent, and reads without CEPH_OSD_FLAG_RWORDERED are unaffected. As before c0482d7, the in-tree RWORDERED readers wait while their pool is full: Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use (the MDS's Objecter ignores pool full), and the OSD's tier promotes, copy-gets and proxied RWORDERED reads. This change stands alone. It is based on ceph#72236 only because the tests in the following commit use that PR's TestSplitOpMapChange harness in unittest_objecter_direct_reads. Tested by TestSplitOpMapChange.RWOrderedReadWaitsForWriteOnFullPool and RWOrderedReadResentAfterWriteWhenPoolFull in the following commit. Fixes: https://tracker.ceph.com/issues/81205 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
4 of 14 tasks
5 of 14 tasks
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 16, 2026
…w interval Carried from ceph#72236; drop when this is rebased onto a main that has it. Add unittest_objecter_direct_reads with TestSplitOpMapChange, which initialises a real Objecter with a recording connection per OSD, submits reads through op_submit(), delivers OSDMaps through handle_osd_map() and replies through ms_dispatch2(). PG 1.0 of a 2+1 EC pool has acting [0,1,2]. A direct read gets one attempt. A non-primary OSD drops direct reads sent in an earlier interval, so once the PG starts a new interval a split sub-read should fail with -EAGAIN, so that the parent read is retried at the primary, and a single-chunk direct read should be redriven to the primary. For a balanced EC split read, the sub-read outstanding to a non-primary shard OSD is neither resent nor failed when the pool's min_size changes, so the parent read never completes. When another shard's OSD goes down, the sub-read is resent to the same OSD without its shard id, and the OSD parks it waiting for a PG that never appears. A single-chunk direct read is likewise ignored on a min_size change, and after a primary change it is resent to its shard OSD without its shard id. ECSplitReadRedrivesWhenShardOsdDown, where the sub-read's own OSD goes down, already passes. 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
… changes Carried from ceph#72236; drop when this is rebased onto a main that has it. Split sub-reads and single-chunk EC direct reads pin each read to one OSD with CEPH_OSD_FLAG_FORCE_OSD. When _calc_target() recalculates such a target because its PG changed, it only fails the read back if the forced OSD is no longer at its position in the new acting set. Otherwise it keeps the forced OSD but rebuilds actual_pgid from the raw pgid, and the erasure-pool branch that would choose a shard skips forced targets. The read is resent to its shard OSD without the shard, and the OSD parks it waiting for a PG that never appears. The direct-read design gives a direct read one attempt before it falls back to the primary. Do that whenever a forced target is recalculated: a split sub-read fails with -EAGAIN so that the parent is retried at the primary, and a single-chunk direct read is redriven to the primary. Replica split sub-reads carry no shard, so they were already failed on every recalculation. With this, TestSplitOpMapChange.ECSplitReadRedrivesWhenOtherShardOsdDown and ECDirectReadRedrivesWhenPrimaryMoves from "test/osd: demonstrate EC direct reads not failed back on a new interval" pass. 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
…hange Carried from ceph#72236; drop when this is rebased onto a main that has it. Split reads and single-chunk EC direct reads pin each read to one shard OSD with CEPH_OSD_FLAG_FORCE_OSD. _calc_target() only reacts to an acting-set change that leaves the primary alone if used_replica is set, and ignores a new interval that leaves the acting set alone, such as a min_size change. A non-primary OSD drops direct reads sent in an earlier interval, so such a read was neither resent nor failed back, and hung. Check forced-OSD targets for a new interval in _calc_target() as if any_change were set, so that every new interval of their PG reaches the forced-OSD check and the read falls back to the primary. Targets whose PG interval is unchanged are still left alone. Makes TestSplitOpMapChange.ECSplitReadRedrivesWhenMinSizeChanges and ECDirectReadRedrivesWhenMinSizeChanges from "test/osd: demonstrate EC direct reads not failed back on a new interval" pass. Fixes: https://tracker.ceph.com/issues/81194 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
Carried from ceph#72236; drop when this is rebased onto a main that has it. ECSplitReadShardsMoveDuringSubmit sets objecter_debug_inject_relock_delay so that a map moving every shard of the PG lands while _op_submit() has dropped the rwlock for the first sub-read of a balanced EC split read. The first sub-read's target is recalculated after the relock, its PG has changed, and it is parked in the homeless session with a map check registered. The second sub-read copies the parent's target from before the map and, as an EC direct read, skips _calc_target() in _op_submit(), so it is sent to its old OSD with its old shard. The next map that changes the PG completes the parked sub-read with -EAGAIN through _check_op_pool_dne(), which calls _finish_op() while the op is still in check_latest_map_ops, and the client aborts. advance_map() now wants the next OSDMap from the MonClient before delivering each map, so that an op left without an OSD does not make the unconnected MonClient try to open a session. 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
…s an op Carried from ceph#72236; drop when this is rebased onto a main that has it. If _op_submit() relocks, a map lands and the recalculated target gives RECALC_OP_TARGET_POOL_DNE, the op is parked in the homeless session and registered in check_latest_map_ops until the monitor reports the latest OSDMap. If another map changes the PG first, _scan_requests() gets POOL_DNE again and calls _check_op_pool_dne(). For a pool that existed, that completes the op and calls _finish_op() at once, which asserts that the op is not in check_latest_map_ops. A split sub-read whose PG has changed gets POOL_DNE on purpose, so that it fails with -EAGAIN, which makes this easy to reach. A pool deleted during the relock reaches it too. Cancel any map check before finishing the op. When the monitor's reply calls _check_op_pool_dne(), the entry has already been removed and the cancel does nothing. With this, TestSplitOpMapChange.ECSplitReadShardsMoveDuringSubmit from "test/osd: demonstrate split sub-reads racing a map during submit" no longer aborts. 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
… submit Carried from ceph#72236; drop when this is rebased onto a main that has it. _op_submit() skips _calc_target() for CEPH_OSD_FLAG_EC_DIRECT_READ ops because SplitOp has just calculated their targets. A split read copies the parent's target into each sub-read, so if _op_submit() relocks for one sub-read and a map lands, the later sub-reads keep a target from the older map and are sent to the OSD that held their shard in it, which may have moved or gone down. Nothing corrects this until the next map changes the PG. Recalculate a direct read's target in _op_submit() when it was calculated with an older map. A target whose PG is unchanged is kept, and a sub-read whose PG has changed is parked until the monitor's reply or the next map fails it with -EAGAIN, so the parent is retried at the primary. Makes TestSplitOpMapChange.ECSplitReadShardsMoveDuringSubmit from "test/osd: demonstrate split sub-reads racing a map during submit" pass. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
force-pushed
the
wip-objecter-forced-osd-retarget
branch
from
October 19, 2026 08:18
d96ba9f to
fcaee06
Compare
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 21, 2026
…w interval Carried from ceph#72236; drop when this is rebased onto a main that has it. Add unittest_objecter_direct_reads with TestSplitOpMapChange, which initialises a real Objecter with a recording connection per OSD, submits reads through op_submit(), delivers OSDMaps through handle_osd_map() and replies through ms_dispatch2(). PG 1.0 of a 2+1 EC pool has acting [0,1,2]. A direct read gets one attempt. A non-primary OSD drops direct reads sent in an earlier interval, so once the PG starts a new interval a split sub-read should fail with -EAGAIN, so that the parent read is retried at the primary, and a single-chunk direct read should be redriven to the primary. For a balanced EC split read, the sub-read outstanding to a non-primary shard OSD is neither resent nor failed when the pool's min_size changes, so the parent read never completes. When another shard's OSD goes down, the sub-read is resent to the same OSD without its shard id, and the OSD parks it waiting for a PG that never appears. A single-chunk direct read is likewise ignored on a min_size change, and after a primary change it is resent to its shard OSD without its shard id. ECSplitReadRedrivesWhenShardOsdDown, where the sub-read's own OSD goes down, already passes. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 21, 2026
… changes Carried from ceph#72236; drop when this is rebased onto a main that has it. Split sub-reads and single-chunk EC direct reads pin each read to one OSD with CEPH_OSD_FLAG_FORCE_OSD. When _calc_target() recalculates such a target because its PG changed, it only fails the read back if the forced OSD is no longer at its position in the new acting set. Otherwise it keeps the forced OSD but rebuilds actual_pgid from the raw pgid, and the erasure-pool branch that would choose a shard skips forced targets. The read is resent to its shard OSD without the shard, and the OSD parks it waiting for a PG that never appears. The direct-read design gives a direct read one attempt before it falls back to the primary. Do that whenever a forced target is recalculated: a split sub-read fails with -EAGAIN so that the parent is retried at the primary, and a single-chunk direct read is redriven to the primary. Replica split sub-reads carry no shard, so they were already failed on every recalculation. With this, TestSplitOpMapChange.ECSplitReadRedrivesWhenOtherShardOsdDown and ECDirectReadRedrivesWhenPrimaryMoves from "test/osd: demonstrate EC direct reads not failed back on a new interval" pass. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 21, 2026
…hange Carried from ceph#72236; drop when this is rebased onto a main that has it. Split reads and single-chunk EC direct reads pin each read to one shard OSD with CEPH_OSD_FLAG_FORCE_OSD. _calc_target() only reacts to an acting-set change that leaves the primary alone if used_replica is set, and ignores a new interval that leaves the acting set alone, such as a min_size change. A non-primary OSD drops direct reads sent in an earlier interval, so such a read was neither resent nor failed back, and hung. Check forced-OSD targets for a new interval in _calc_target() as if any_change were set, so that every new interval of their PG reaches the forced-OSD check and the read falls back to the primary. Targets whose PG interval is unchanged are still left alone. Makes TestSplitOpMapChange.ECSplitReadRedrivesWhenMinSizeChanges and ECDirectReadRedrivesWhenMinSizeChanges from "test/osd: demonstrate EC direct reads not failed back on a new interval" pass. Fixes: https://tracker.ceph.com/issues/81194 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 21, 2026
Carried from ceph#72236; drop when this is rebased onto a main that has it. ECSplitReadShardsMoveDuringSubmit sets objecter_debug_inject_relock_delay so that a map moving every shard of the PG lands while _op_submit() has dropped the rwlock for the first sub-read of a balanced EC split read. The first sub-read's target is recalculated after the relock, its PG has changed, and it is parked in the homeless session with a map check registered. The second sub-read copies the parent's target from before the map and, as an EC direct read, skips _calc_target() in _op_submit(), so it is sent to its old OSD with its old shard. The next map that changes the PG completes the parked sub-read with -EAGAIN through _check_op_pool_dne(), which calls _finish_op() while the op is still in check_latest_map_ops, and the client aborts. advance_map() now wants the next OSDMap from the MonClient before delivering each map, so that an op left without an OSD does not make the unconnected MonClient try to open a session. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 21, 2026
…s an op Carried from ceph#72236; drop when this is rebased onto a main that has it. If _op_submit() relocks, a map lands and the recalculated target gives RECALC_OP_TARGET_POOL_DNE, the op is parked in the homeless session and registered in check_latest_map_ops until the monitor reports the latest OSDMap. If another map changes the PG first, _scan_requests() gets POOL_DNE again and calls _check_op_pool_dne(). For a pool that existed, that completes the op and calls _finish_op() at once, which asserts that the op is not in check_latest_map_ops. A split sub-read whose PG has changed gets POOL_DNE on purpose, so that it fails with -EAGAIN, which makes this easy to reach. A pool deleted during the relock reaches it too. Cancel any map check before finishing the op. When the monitor's reply calls _check_op_pool_dne(), the entry has already been removed and the cancel does nothing. With this, TestSplitOpMapChange.ECSplitReadShardsMoveDuringSubmit from "test/osd: demonstrate split sub-reads racing a map during submit" no longer aborts. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 21, 2026
… submit Carried from ceph#72236; drop when this is rebased onto a main that has it. _op_submit() skips _calc_target() for CEPH_OSD_FLAG_EC_DIRECT_READ ops because SplitOp has just calculated their targets. A split read copies the parent's target into each sub-read, so if _op_submit() relocks for one sub-read and a map lands, the later sub-reads keep a target from the older map and are sent to the OSD that held their shard in it, which may have moved or gone down. Nothing corrects this until the next map changes the PG. Recalculate a direct read's target in _op_submit() when it was calculated with an older map. A target whose PG is unchanged is kept, and a sub-read whose PG has changed is parked until the monitor's reply or the next map fails it with -EAGAIN, so the parent is retried at the primary. Makes TestSplitOpMapChange.ECSplitReadShardsMoveDuringSubmit from "test/osd: demonstrate split sub-reads racing a map during submit" pass. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 22, 2026
…w interval Carried from ceph#72236; drop when this is rebased onto a main that has it. Add unittest_objecter_direct_reads with TestSplitOpMapChange, which initialises a real Objecter with a recording connection per OSD, submits reads through op_submit(), delivers OSDMaps through handle_osd_map() and replies through ms_dispatch2(). PG 1.0 of a 2+1 EC pool has acting [0,1,2]. A direct read gets one attempt. A non-primary OSD drops direct reads sent in an earlier interval, so once the PG starts a new interval a split sub-read should fail with -EAGAIN, so that the parent read is retried at the primary, and a single-chunk direct read should be redriven to the primary. For a balanced EC split read, the sub-read outstanding to a non-primary shard OSD is neither resent nor failed when the pool's min_size changes, so the parent read never completes. When another shard's OSD goes down, the sub-read is resent to the same OSD without its shard id, and the OSD parks it waiting for a PG that never appears. A single-chunk direct read is likewise ignored on a min_size change, and after a primary change it is resent to its shard OSD without its shard id. ECSplitReadRedrivesWhenShardOsdDown, where the sub-read's own OSD goes down, already passes. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 22, 2026
… changes Carried from ceph#72236; drop when this is rebased onto a main that has it. Split sub-reads and single-chunk EC direct reads pin each read to one OSD with CEPH_OSD_FLAG_FORCE_OSD. When _calc_target() recalculates such a target because its PG changed, it only fails the read back if the forced OSD is no longer at its position in the new acting set. Otherwise it keeps the forced OSD but rebuilds actual_pgid from the raw pgid, and the erasure-pool branch that would choose a shard skips forced targets. The read is resent to its shard OSD without the shard, and the OSD parks it waiting for a PG that never appears. The direct-read design gives a direct read one attempt before it falls back to the primary. Do that whenever a forced target is recalculated: a split sub-read fails with -EAGAIN so that the parent is retried at the primary, and a single-chunk direct read is redriven to the primary. Replica split sub-reads carry no shard, so they were already failed on every recalculation. With this, TestSplitOpMapChange.ECSplitReadRedrivesWhenOtherShardOsdDown and ECDirectReadRedrivesWhenPrimaryMoves from "test/osd: demonstrate EC direct reads not failed back on a new interval" pass. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 22, 2026
…hange Carried from ceph#72236; drop when this is rebased onto a main that has it. Split reads and single-chunk EC direct reads pin each read to one shard OSD with CEPH_OSD_FLAG_FORCE_OSD. _calc_target() only reacts to an acting-set change that leaves the primary alone if used_replica is set, and ignores a new interval that leaves the acting set alone, such as a min_size change. A non-primary OSD drops direct reads sent in an earlier interval, so such a read was neither resent nor failed back, and hung. Check forced-OSD targets for a new interval in _calc_target() as if any_change were set, so that every new interval of their PG reaches the forced-OSD check and the read falls back to the primary. Targets whose PG interval is unchanged are still left alone. Makes TestSplitOpMapChange.ECSplitReadRedrivesWhenMinSizeChanges and ECDirectReadRedrivesWhenMinSizeChanges from "test/osd: demonstrate EC direct reads not failed back on a new interval" pass. Fixes: https://tracker.ceph.com/issues/81194 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 22, 2026
Carried from ceph#72236; drop when this is rebased onto a main that has it. ECSplitReadShardsMoveDuringSubmit sets objecter_debug_inject_relock_delay so that a map moving every shard of the PG lands while _op_submit() has dropped the rwlock for the first sub-read of a balanced EC split read. The first sub-read's target is recalculated after the relock, its PG has changed, and it is parked in the homeless session with a map check registered. The second sub-read copies the parent's target from before the map and, as an EC direct read, skips _calc_target() in _op_submit(), so it is sent to its old OSD with its old shard. The next map that changes the PG completes the parked sub-read with -EAGAIN through _check_op_pool_dne(), which calls _finish_op() while the op is still in check_latest_map_ops, and the client aborts. advance_map() now wants the next OSDMap from the MonClient before delivering each map, so that an op left without an OSD does not make the unconnected MonClient try to open a session. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 22, 2026
…s an op Carried from ceph#72236; drop when this is rebased onto a main that has it. If _op_submit() relocks, a map lands and the recalculated target gives RECALC_OP_TARGET_POOL_DNE, the op is parked in the homeless session and registered in check_latest_map_ops until the monitor reports the latest OSDMap. If another map changes the PG first, _scan_requests() gets POOL_DNE again and calls _check_op_pool_dne(). For a pool that existed, that completes the op and calls _finish_op() at once, which asserts that the op is not in check_latest_map_ops. A split sub-read whose PG has changed gets POOL_DNE on purpose, so that it fails with -EAGAIN, which makes this easy to reach. A pool deleted during the relock reaches it too. Cancel any map check before finishing the op. When the monitor's reply calls _check_op_pool_dne(), the entry has already been removed and the cancel does nothing. With this, TestSplitOpMapChange.ECSplitReadShardsMoveDuringSubmit from "test/osd: demonstrate split sub-reads racing a map during submit" no longer aborts. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 22, 2026
… submit Carried from ceph#72236; drop when this is rebased onto a main that has it. _op_submit() skips _calc_target() for CEPH_OSD_FLAG_EC_DIRECT_READ ops because SplitOp has just calculated their targets. A split read copies the parent's target into each sub-read, so if _op_submit() relocks for one sub-read and a map lands, the later sub-reads keep a target from the older map and are sent to the OSD that held their shard in it, which may have moved or gone down. Nothing corrects this until the next map changes the PG. Recalculate a direct read's target in _op_submit() when it was calculated with an older map. A target whose PG is unchanged is kept, and a sub-read whose PG has changed is parked until the monitor's reply or the next map fails it with -EAGAIN, so the parent is retried at the primary. Makes TestSplitOpMapChange.ECSplitReadShardsMoveDuringSubmit from "test/osd: demonstrate split sub-reads racing a map during submit" pass. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Add unittest_objecter_direct_reads, in src/test/osdc, with TestSplitOpMapChange, which initialises a real Objecter with a recording connection per OSD, submits reads through op_submit(), delivers OSDMaps through handle_osd_map() and replies through ms_dispatch2(). PG 1.0 of a 2+1 EC pool has acting [0,1,2]. A direct read gets one attempt. A non-primary OSD drops direct reads sent in an earlier interval, so once the PG starts a new interval a split sub-read should fail with -EAGAIN, so that the parent read is retried at the primary, and a single-chunk direct read should be redriven to the primary. For a balanced EC split read, the sub-read outstanding to a non-primary shard OSD is neither resent nor failed when the pool's min_size changes, so the parent read never completes. When another shard's OSD goes down, the sub-read is resent to the same OSD without its shard id, and the OSD parks it waiting for a PG that never appears. A single-chunk direct read is likewise ignored on a min_size change, and after a primary change it is resent to its shard OSD without its shard id. ECSplitReadRedrivesWhenShardOsdDown, where the sub-read's own OSD goes down, already passes. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Split sub-reads and single-chunk EC direct reads pin each read to one OSD with CEPH_OSD_FLAG_FORCE_OSD. When _calc_target() recalculates such a target because its PG changed, it only fails the read back if the forced OSD is no longer at its position in the new acting set. Otherwise it keeps the forced OSD but rebuilds actual_pgid from the raw pgid, and the erasure-pool branch that would choose a shard skips forced targets. The read is resent to its shard OSD without the shard, and the OSD parks it waiting for a PG that never appears. _calc_target() also only reacts to an acting-set change that leaves the primary alone if used_replica is set, and ignores a new interval that leaves the acting set alone, such as a min_size change. A non-primary OSD drops direct reads sent in an earlier interval, so such a read was neither resent nor failed back, and hung. The direct-read design gives a direct read one attempt before it falls back to the primary. Do that whenever a forced target is recalculated: a split sub-read fails with -EAGAIN so that the parent is retried at the primary, and a single-chunk direct read is redriven to the primary. Replica split sub-reads carry no shard, so they were already failed on every recalculation. Check forced-OSD targets for a new interval as if any_change were set, so that every new interval of their PG reaches the forced-OSD check; targets whose PG interval is unchanged are still left alone. With this, TestSplitOpMapChange.ECSplitReadRedrivesWhenOtherShardOsdDown, ECDirectReadRedrivesWhenPrimaryMoves, ECSplitReadRedrivesWhenMinSizeChanges and ECDirectReadRedrivesWhenMinSizeChanges from "test/osdc: demonstrate EC direct reads not failed back on a new interval" pass. Fixes: https://tracker.ceph.com/issues/81194 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
If _op_submit() relocks, a map lands and the recalculated target gives RECALC_OP_TARGET_POOL_DNE, the op is parked in the homeless session and registered in check_latest_map_ops until the monitor reports the latest OSDMap. If another map changes the PG first, _scan_requests() gets POOL_DNE again and calls _check_op_pool_dne(). For a pool that existed, that completes the op and calls _finish_op() at once, which asserts that the op is not in check_latest_map_ops. A split sub-read whose PG has changed gets POOL_DNE on purpose, so that it fails with -EAGAIN, which makes this easy to reach. A pool deleted during the relock reaches it too. Cancel any map check before finishing the op. When the monitor's reply calls _check_op_pool_dne(), the entry has already been removed and the cancel does nothing. Reaching this needs a map to land while _op_submit() has the rwlock dropped. ceph#72289 adds a test hook for that and TestSplitOpMapChange.ECSplitReadNewIntervalDuringSubmit, which aborts without this change. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
_op_submit() skips _calc_target() for CEPH_OSD_FLAG_EC_DIRECT_READ ops because SplitOp has just calculated their targets. A split read copies the parent's target into each sub-read, so if _op_submit() relocks for one sub-read and a map lands, the later sub-reads keep a target from the older map and are sent to the OSD that held their shard in it, which may have moved or gone down. Nothing corrects this until the next map changes the PG. Recalculate a direct read's target in _op_submit() when it was calculated with an older map. A target whose PG is unchanged is kept, and a sub-read whose PG has changed is parked until the monitor's reply or the next map fails it with -EAGAIN, so the parent is retried at the primary. Reaching this needs a map to land while _op_submit() has the rwlock dropped. ceph#72289 adds a test hook for that and TestSplitOpMapChange.ECSplitReadNewIntervalDuringSubmit, which fails without this change. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
force-pushed
the
wip-objecter-forced-osd-retarget
branch
from
October 23, 2026 10:22
075302f to
cda61a7
Compare
Contributor
Author
|
jenkins test make check |
4 of 14 tasks
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 27, 2026
op_target_t::respects_full() treats CEPH_OSD_FLAG_RWORDERED ops like writes, so _scan_requests() force-resends them when a pool fills or has space again, but target_should_be_paused() paused only CEPH_OSD_FLAG_WRITE ops on a full pool. An ORDER_READS_WRITES read issued after writes that a full pool had paused was sent, or resent, straight away and completed before them, breaking the order the flag asks for; ceph_test_rados aborted with "finished tid 1 when last_acked_tid was 3" when an OSD went failsafe-full, and the same abort was reproduced on a replicated pool by pulsing a max_objects quota under ceph_test_rados. c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full", https://tracker.ceph.com/issues/19133) made _op_submit() pause every op that respects_full() on a full pool. target_should_be_paused(), which _calc_target() applies when a map arrives, folded that check into the PAUSEWR condition that only CEPH_OSD_FLAG_WRITE ops test, so a read already in flight when the pool filled was resent at once. c0482d7 ("osdc/Objecter: remove duplicated pause check code") then dropped the check from _op_submit() as a duplicate, so reads submitted while the pool was full were no longer paused either. Pause every op that respects_full() while its pool or the cluster is full. Such a read now waits with the writes ahead of it, and once the pool has space _scan_requests() resends them in tid order. PAUSEWR alone still pauses only writes, FULL_TRY and FULL_FORCE ops are still sent, and reads without CEPH_OSD_FLAG_RWORDERED are unaffected. As before c0482d7, the in-tree RWORDERED readers wait while their pool is full: Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use (the MDS's Objecter ignores pool full), and the OSD's tier promotes, copy-gets and proxied RWORDERED reads. This change stands alone. It is based on ceph#72236 only because the tests in the following commit use that PR's TestSplitOpMapChange harness in unittest_objecter_direct_reads. Tested by TestSplitOpMapChange.RWOrderedReadWaitsForWriteOnFullPool and RWOrderedReadResentAfterWriteWhenPoolFull in the following commit. Fixes: https://tracker.ceph.com/issues/81205 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 27, 2026
The comments on the forced-OSD handling from ceph#72236 left the reader to work out the rule: - In _op_submit(), say how a direct read's target can be from an older map: one can land while an earlier sub-read relocks. - Above the new-interval check in _calc_target(), say why a forced-OSD target must notice every new interval, not only a primary change. - In the fail-back block, state the rule and its two outcomes in one comment instead of four stacked lines. No change in behaviour. Assisted-by: Claude Code
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 27, 2026
Test a map landing during _op_submit()'s relock without a second thread or a sleep. ECSplitReadNewIntervalDuringSubmit sets objecter_debug_inject_relock_delay and replaces relock_delay with code that turns the option off again, so that only the first sub-read of a balanced EC split read relocks, and raises the pool's min_size while _op_submit() has the rwlock dropped. The PG starts a new interval. The first sub-read is recalculated after the relock and parked. The second, whose target was copied from the parent before the map, must be recalculated too rather than sent to osd.1. The next map that changes the PG fails both back, and the whole read is redriven to the primary. This covers two fixes from ceph#72236: without "osdc: recalculate EC direct-read targets from an older map at submit" the second sub-read is sent to osd.1, and without "osdc: cancel the map check when _check_op_pool_dne() completes an op" the client aborts when the next map fails the parked sub-reads. advance_map()'s comment now also names ops left without an OSD, as the parked sub-reads are, as a reason the Objecter asks for the next map. Assisted-by: Claude Code
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 28, 2026
op_target_t::respects_full() treats CEPH_OSD_FLAG_RWORDERED ops like writes, so _scan_requests() force-resends them when a pool fills or has space again, but target_should_be_paused() paused only CEPH_OSD_FLAG_WRITE ops on a full pool. An ORDER_READS_WRITES read issued after writes that a full pool had paused was sent, or resent, straight away and completed before them, breaking the order the flag asks for; ceph_test_rados aborted with "finished tid 1 when last_acked_tid was 3" when an OSD went failsafe-full, and the same abort was reproduced on a replicated pool by pulsing a max_objects quota under ceph_test_rados. c4b73f1 ("osdc/Objecter: resend RWORDERED ops on full", https://tracker.ceph.com/issues/19133) made _op_submit() pause every op that respects_full() on a full pool. target_should_be_paused(), which _calc_target() applies when a map arrives, folded that check into the PAUSEWR condition that only CEPH_OSD_FLAG_WRITE ops test, so a read already in flight when the pool filled was resent at once. c0482d7 ("osdc/Objecter: remove duplicated pause check code") then dropped the check from _op_submit() as a duplicate, so reads submitted while the pool was full were no longer paused either. Pause every op that respects_full() while its pool or the cluster is full. Such a read now waits with the writes ahead of it, and once the pool has space _scan_requests() resends them in tid order. PAUSEWR alone still pauses only writes, FULL_TRY and FULL_FORCE ops are still sent, and reads without CEPH_OSD_FLAG_RWORDERED are unaffected. As before c0482d7, the in-tree RWORDERED readers wait while their pool is full: Filer::_probe(), which Journaler recovery and so cephfs-journal-tool use (the MDS's Objecter ignores pool full), and the OSD's tier promotes, copy-gets and proxied RWORDERED reads. This change stands alone. It is based on ceph#72236 only because the tests in the following commit use that PR's TestSplitOpMapChange harness in unittest_objecter_direct_reads. Tested by TestSplitOpMapChange.RWOrderedReadWaitsForWriteOnFullPool and RWOrderedReadResentAfterWriteWhenPoolFull in the following commit. Fixes: https://tracker.ceph.com/issues/81205 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 28, 2026
The comments on the forced-OSD handling from ceph#72236 left the reader to work out the rule: - In _op_submit(), say how a direct read's target can be from an older map: one can land while an earlier sub-read relocks. - Above the new-interval check in _calc_target(), say why a forced-OSD target must notice every new interval, not only a primary change. - In the fail-back block, state the rule and its two outcomes in one comment instead of four stacked lines. No change in behaviour. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
aainscow
added a commit
to aainscow/ceph
that referenced
this pull request
Oct 28, 2026
Test a map landing during _op_submit()'s relock without a second thread or a sleep. ECSplitReadNewIntervalDuringSubmit sets objecter_debug_inject_relock_delay and replaces relock_delay with code that turns the option off again, so that only the first sub-read of a balanced EC split read relocks, and raises the pool's min_size while _op_submit() has the rwlock dropped. The PG starts a new interval. The first sub-read is recalculated after the relock and parked. The second, whose target was copied from the parent before the map, must be recalculated too rather than sent to osd.1. The next map that changes the PG fails both back, and the whole read is redriven to the primary. This covers two fixes from ceph#72236: without "osdc: recalculate EC direct-read targets from an older map at submit" the second sub-read is sent to osd.1, and without "osdc: cancel the map check when _check_op_pool_dne() completes an op" the client aborts when the next map fails the parked sub-reads. advance_map()'s comment now also names ops left without an OSD, as the parked sub-reads are, as a reason the Objecter asks for the next map. Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split sub-reads and single-chunk EC direct reads are pinned to one shard OSD with CEPH_OSD_FLAG_FORCE_OSD. If that OSD leaves the acting set, the Objecter is supposed to fail the sub-read with -EAGAIN so that the parent op is retried at the primary (or, for a single direct read, redrive it to the primary). In vstart testing with thrashing, a localized or balanced EC split read with a sub-read outstanding to a shard OSD that died or was marked down never completed, even after the OSD came back and every PG was active+clean. The client log showed the sub-op move to the homeless session and every later map report 'no change'. It reproduced 3 times out of 3.
The causes were in the Objecter's retargeting. _calc_target() only re-targets such a sub-read on a change of primary unless the target is marked used_replica, and it clears used_replica whenever it recomputes a target, so even a correctly marked target lost it after the first resend. A resend after a primary change rebuilt the pgid without the forced shard, so the shard OSD parked the read waiting for a PG that never appears. A new interval that left the acting set alone (for example a min_size change) did not resend the read, although a non-primary OSD drops direct reads from an earlier interval.
Unit tests with a real Objecter then found two more ways the same path fails when a map lands while _op_submit() has dropped its lock: later sub-reads were sent using the parent's target from the older map, and the parked sub-read completed with -EAGAIN through _check_op_pool_dne() while still registered for a map check, which aborts the client. A deterministic test of that race needs a hook in the Objecter, so #72289, which is stacked on this PR, adds the hook and the test. Any client using localize or balance reads on EC pools (librbd, CephFS, librados) is affected; for stretch pools these are the normal read paths.
Fixes: https://tracker.ceph.com/issues/81194
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.