osd: Use role 0 for tombstone copies in replicated pools, revert the stripes guard #161

Merged
vitalif merged 2 commits from koolkhel/vitastor:tomb-replica-role into master 2026-11-24 03:52:22 +03:00
Contributor

Description

Root cause of the replica-pool overflow that 3e4aa533 guarded against, plus the revert of that guard, as discussed.

  • osd: Use role 0 for tombstone copies in replicated pools. register_tombstone(..., all_applied=true) took the copy roles from pg.cur_loc_set. That set holds the index in the target set even in a replicated pool, so the copies got roles 1 and 2. Every other replicated object state uses role 0: the all_applied=false branch does rep ? 0 : ..., and the delete paths compare with rep || c.role == loc.role. mark_object_corrupted() over such a tombstone state indexed its one-element stripes array by that role. The roles also broke the (role, osd) dedupe of outdated copies in register_tombstone().
  • Revert "Fix buffer overflow on mark_object_corrupted in a replica pool". With the roles fixed, stripes[chunk.role] is stripes[0] again.

Tested:

  • New osd_test case test_tombstone_replicated_roles: a delete in a replicated x3 pool, where the tombstone is registered for a later cleanup, must leave every copy at role 0. On master it fails with roles 1 and 2. The whole osd_test passes with both commits.
  • Before writing this, test_pg_chaos --replicated [--recovery] ran 9000 seeds on master with an assert on role != 0 in mark_object_corrupted(). It never fired, so the chaos test doesn't reach this path by itself; the new unit test does.

Contributor Name

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

CLA

### Description Root cause of the replica-pool overflow that 3e4aa533 guarded against, plus the revert of that guard, as discussed. - **osd: Use role 0 for tombstone copies in replicated pools.** `register_tombstone(..., all_applied=true)` took the copy roles from `pg.cur_loc_set`. That set holds the index in the target set even in a replicated pool, so the copies got roles 1 and 2. Every other replicated object state uses role 0: the `all_applied=false` branch does `rep ? 0 : ...`, and the delete paths compare with `rep || c.role == loc.role`. `mark_object_corrupted()` over such a tombstone state indexed its one-element `stripes` array by that role. The roles also broke the `(role, osd)` dedupe of outdated copies in `register_tombstone()`. - **Revert "Fix buffer overflow on mark_object_corrupted in a replica pool".** With the roles fixed, `stripes[chunk.role]` is `stripes[0]` again. Tested: - New `osd_test` case `test_tombstone_replicated_roles`: a delete in a replicated x3 pool, where the tombstone is registered for a later cleanup, must leave every copy at role 0. On master it fails with roles 1 and 2. The whole `osd_test` passes with both commits. - Before writing this, `test_pg_chaos --replicated [--recovery]` ran 9000 seeds on master with an assert on `role != 0` in `mark_object_corrupted()`. It never fired, so the chaos test doesn't reach this path by itself; the new unit test does. ### 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 2 commits 2026-11-23 13:16:24 +03:00
register_tombstone() took the roles of an applied tombstone's copies
from pg.cur_loc_set, which holds the index in the target set even in a
replicated pool. Every other object state of a replicated pool uses
role 0, and code that indexes per-role arrays by chunk.role relies on
it: mark_object_corrupted() over such a tombstone state read past its
one-element stripes array. The roles also broke the (role, osd) dedupe
of outdated copies in register_tombstone().
This reverts commit 3e4aa53357.

Copies of a replicated object always have role 0 again, so
stripes[chunk.role] is stripes[0].
vitalif merged commit f2de842662 into master 2026-11-24 03:52:22 +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#161
No description provided.