osd: Finish a read with -EPIPE when its PG stops instead of marking copies corrupted #164
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:read-epipe-stopped-pg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
bitmapsmap 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