osd: call deref_object_state on recheck_state mismatch in remove_object_from_state #91

Merged
vitalif merged 1 commits from changwei.ye/vitastor:fix-remove-object-from-state into master 2026-10-17 21:21:35 +03:00
Contributor

Description

osd: call deref_object_state on recheck_state mismatch in remove_object_from_state

When recheck_state != *object_state, the old object_state reference should be
released via deref_object_state() instead of raw ref_count--. Otherwise, if the
old state has no remaining objects (object_count == 0) and this was its last
reference, it would never be erased from pg.state_dict, leaking memory and state
dictionary entries.

Contributor Name

Changwei Ye (Datatom, https://www.datatom.com/)

CLA

### Description osd: call deref_object_state on recheck_state mismatch in remove_object_from_state When recheck_state != *object_state, the old object_state reference should be released via deref_object_state() instead of raw ref_count--. Otherwise, if the old state has no remaining objects (object_count == 0) and this was its last reference, it would never be erased from pg.state_dict, leaking memory and state dictionary entries. ### Contributor Name Changwei Ye (Datatom, https://www.datatom.com/) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
changwei.ye added 1 commit 2026-10-15 07:06:11 +03:00
When recheck_state != *object_state, the old object_state reference should be
released via deref_object_state() instead of raw ref_count--. Otherwise, if the
old state has no remaining objects (object_count == 0) and this was its last
reference, it would never be erased from pg.state_dict, leaking memory and state
dictionary entries.
changwei.ye requested review from vitalif 2026-10-15 07:06:12 +03:00
vitalif merged commit 8dd76839f1 into master 2026-10-17 21:21:35 +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#91
No description provided.