osd: Finish a read with -EPIPE when its PG stops instead of marking copies corrupted #164

Merged
vitalif merged 4 commits from koolkhel/vitastor:read-epipe-stopped-pg into master 2026-11-24 03:50:47 +03:00
Contributor

Description

A read whose PG stopped while a subop was in flight still judged the copies by the object state when a subop failed. A copy that a repeat delete had just removed answers -ENOENT, the delete itself was cancelled by the stop before the state was updated, and no operation is queued on the object any more, so the -ENOENT was taken for corruption: the object was marked INCOMPLETE ("0 copies available") and the read failed with -EIO. Peering rebuilds the object states anyway, so such a read now ends with -EPIPE like any other operation of a stopped PG.

A read through a snapshot chain (continue_chained_read) had the same problem, and worse: check_corrupted_chained() marked the parent layer's copy corrupted and the read retried; when that was the object's only copy, the retry aborted the OSD on assert(read_target != 0) in collect_bitmap_requests(). It now ends with -EPIPE in a stopped PG too.

What a client sees: before, -EIO, a retry after client_eio_retry_interval and a spurious has_incomplete on the PG until peering; with -EIO retries disabled the read fails. For a chained read, the primary could abort instead. After, -EPIPE and a resend after re-peering. A real EIO/EDOM is still found by the repeated read on the active PG.

Reached with legacy (non-tombstone) deletes: a delete runs while a member is down, the member returns with the old copy, the client repeats the delete (left_on_dead), and the PG set changes while that delete and a read of the object are in flight. Found by test_pg_chaos (seed 736766870 on a tree without tombstone deletes); the new osd_test case builds the read side directly.

Tested: osd_test test_read_enoent_in_stopped_pg_returns_epipe fails without the osd_primary.cpp change (the read returns -EIO), and test_chained_read_in_stopped_pg_returns_epipe aborts without the osd_primary_chain.cpp change (assert(read_target != 0)); osd_test passes with both. The fixture change for the chained test (a bitmaps map in capturing_bs_t::read_bitmap()) is byte-identical to the one in #167, so the two PRs merge in either order. The second commit drops a PG_HAS_INCOMPLETE assert from the first test: peering resets the PG state once the read finishes, so it held even without the fix.

Contributor Name

Yury Luneff (MIND Software LLC, https://mindsw.io)

CLA

### Description A read whose PG stopped while a subop was in flight still judged the copies by the object state when a subop failed. A copy that a repeat delete had just removed answers -ENOENT, the delete itself was cancelled by the stop before the state was updated, and no operation is queued on the object any more, so the -ENOENT was taken for corruption: the object was marked INCOMPLETE ("0 copies available") and the read failed with -EIO. Peering rebuilds the object states anyway, so such a read now ends with -EPIPE like any other operation of a stopped PG. A read through a snapshot chain (continue_chained_read) had the same problem, and worse: check_corrupted_chained() marked the parent layer's copy corrupted and the read retried; when that was the object's only copy, the retry aborted the OSD on assert(read_target != 0) in collect_bitmap_requests(). It now ends with -EPIPE in a stopped PG too. What a client sees: before, -EIO, a retry after client_eio_retry_interval and a spurious has_incomplete on the PG until peering; with -EIO retries disabled the read fails. For a chained read, the primary could abort instead. After, -EPIPE and a resend after re-peering. A real EIO/EDOM is still found by the repeated read on the active PG. Reached with legacy (non-tombstone) deletes: a delete runs while a member is down, the member returns with the old copy, the client repeats the delete (left_on_dead), and the PG set changes while that delete and a read of the object are in flight. Found by test_pg_chaos (seed 736766870 on a tree without tombstone deletes); the new osd_test case builds the read side directly. Tested: osd_test test_read_enoent_in_stopped_pg_returns_epipe fails without the osd_primary.cpp change (the read returns -EIO), and test_chained_read_in_stopped_pg_returns_epipe aborts without the osd_primary_chain.cpp change (assert(read_target != 0)); osd_test passes with both. The fixture change for the chained test (a `bitmaps` map in capturing_bs_t::read_bitmap()) is byte-identical to the one in #167, so the two PRs merge in either order. The second commit drops a PG_HAS_INCOMPLETE assert from the first test: peering resets the PG state once the read finishes, so it held even without the fix. ### Contributor Name Yury Luneff (MIND Software LLC, https://mindsw.io) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
koolkhel added 1 commit 2026-11-23 16:20:36 +03:00
A read whose PG stopped while a subop was in flight still judged the
copies by the object state when a subop failed. A copy that a repeat
delete had just removed answers -ENOENT, the delete itself was cancelled
by the stop before the state was updated, and no operation is queued on
the object any more, so the -ENOENT was taken for corruption: the object
was marked INCOMPLETE and the read failed with -EIO. Peering rebuilds the
object states anyway, so finish such a read with -EPIPE like any other
operation of a stopped PG; the client repeats it after peering.
koolkhel added 2 commits 2026-11-23 22:25:11 +03:00
Once the read finishes, the PG restarts peering and resets its state, so
the assert held even without the fix. The -EPIPE assert is what catches
a read that judged the copies.
A read through a snapshot chain still ran check_corrupted_chained() and
retried when a subop failed after its PG stopped. A copy removed by a
repeat delete that the stop cancelled answered -ENOENT, the copy was
marked corrupted with the stale object state, and the retry aborted the
OSD on assert(read_target != 0) in collect_bitmap_requests(), since the
object had no copy left. End such a read with -EPIPE, like a plain read.
koolkhel added 1 commit 2026-11-24 00:00:47 +03:00
Scrub asks read_bitmap() only for the version and passes no bitmap.
vitalif merged commit 58ddb3b068 into master 2026-11-24 03:50:47 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#164
No description provided.