osd: Fail a chained read through an incomplete replicated object instead of aborting #170

Merged
vitalif merged 1 commits from koolkhel/vitastor:chain-read-incomplete-parent into master 2026-11-24 03:43:30 +03:00
Contributor

Description

When every copy of a replicated object has been dropped from its OSD set (each answered ENOENT: a chunk that answers ENOENT is erased from the set by mark_object_corrupted(), unlike EIO/EDOM, which only sets LOC_CORRUPTED), the object is incomplete and its read_target holds no OSD, while the PG stays active (active+has_incomplete). A plain read of the object then answers EIO. A chained read (a clone or snapshot child) through it doesn't get that far: with the PG not exactly PG_ACTIVE it skips the bitmap fast path, and collect_bitmap_requests() hits assert(read_target != 0) before submit_chained_read_requests() reaches its own OBJ_INCOMPLETE check. Asserts stay enabled in release builds, so the OSD aborts on the first such read, and on every one after its restart while the object stays that way.

Peering never makes a replicated object incomplete, so it takes ENOENT answers that drop every copy: recovery or reads racing a delete (see #168 for the chained read part), or a store that lost the object.

Fix: fail the read with EIO there, as the EC branch of the same function already does when extend_missing_stripes() fails. submit_bitmap_subops() returns the error and read_bitmaps() finishes the op with EIO.

The test uses the fixture hunk of #167/#168 unchanged, so it doesn't conflict with them.

Tested: new test_chained_read_through_incomplete_parent in osd_test: the parent object only on the primary, recovery gets ENOENT from it, the object is incomplete with an empty set and the PG active+has_incomplete; a plain read of the parent and a chained read of the child must both answer EIO. Without the fix the OSD aborts on assert(read_target != 0); with it the whole osd_test passes.

Contributor Name

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

CLA

### Description When every copy of a replicated object has been dropped from its OSD set (each answered ENOENT: a chunk that answers ENOENT is erased from the set by `mark_object_corrupted()`, unlike EIO/EDOM, which only sets `LOC_CORRUPTED`), the object is incomplete and its `read_target` holds no OSD, while the PG stays active (`active+has_incomplete`). A plain read of the object then answers EIO. A chained read (a clone or snapshot child) through it doesn't get that far: with the PG not exactly `PG_ACTIVE` it skips the bitmap fast path, and `collect_bitmap_requests()` hits `assert(read_target != 0)` before `submit_chained_read_requests()` reaches its own `OBJ_INCOMPLETE` check. Asserts stay enabled in release builds, so the OSD aborts on the first such read, and on every one after its restart while the object stays that way. Peering never makes a replicated object incomplete, so it takes ENOENT answers that drop every copy: recovery or reads racing a delete (see #168 for the chained read part), or a store that lost the object. Fix: fail the read with EIO there, as the EC branch of the same function already does when `extend_missing_stripes()` fails. `submit_bitmap_subops()` returns the error and `read_bitmaps()` finishes the op with EIO. The test uses the fixture hunk of #167/#168 unchanged, so it doesn't conflict with them. Tested: new `test_chained_read_through_incomplete_parent` in `osd_test`: the parent object only on the primary, recovery gets ENOENT from it, the object is incomplete with an empty set and the PG `active+has_incomplete`; a plain read of the parent and a chained read of the child must both answer EIO. Without the fix the OSD aborts on `assert(read_target != 0)`; with it the whole `osd_test` passes. ### 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-24 03:06:59 +03:00
When every copy of a replicated object has been dropped from its set
(each answered ENOENT, for example to recovery), the object is
incomplete with no OSD to read from while the PG stays active. A plain
read of it answers EIO, but a chained read through it hit
assert(read_target != 0) in collect_bitmap_requests() before reaching
its own incomplete check, and the OSD aborted.

Fail the read with EIO there, as the EC branch already does.
vitalif merged commit eb51a5d978 into master 2026-11-24 03:43:30 +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#170
No description provided.