osd: fix degraded check in add_object_to_set on replicated pools #92

Merged
vitalif merged 1 commits from changwei.ye/vitastor:fix-add-object-to-set into master 2026-10-17 21:23:37 +03:00

1 Commits

Author SHA1 Message Date
Changwei Ye
5826de7e05 osd: fix degraded check in add_object_to_set on replicated pools
In replicated pools, all replicas have role 0, so n_roles is set to 1
as long as at least one healthy copy exists. Comparing
n_roles < pg.pg_cursize was therefore always true for multi-replica
pools (e.g. 1 < 3 or 1 < 2), incorrectly marking healthy objects as
OBJ_DEGRADED and shadowing the OBJ_MISPLACED check below.

Conversely, directly using n_copies is also insufficient because
n_copies includes corrupted copies (n_corrupted). If a replica is
corrupted, n_copies remains equal to pg_cursize, preventing the object
from being marked as OBJ_DEGRADED and leaving it unrepaired.

Fix this by using (n_copies - n_corrupted) for replicated pools to count
only healthy copies, ensuring accurate degradation detection and
recovery.
2026-10-16 14:30:09 +08:00