Compare commits

...

1 Commits

Author SHA1 Message Date
Changwei Ye
6509cb85b3 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.
2026-10-15 10:07:18 +08:00

View File

@@ -776,7 +776,7 @@ bool osd_t::remove_object_from_state(object_id & oid, pg_osd_set_state_t **objec
{
if (recheck_state)
recheck_state->ref_count++;
(*object_state)->ref_count--;
deref_object_state(pg, object_state, true);
*object_state = recheck_state;
return false;
}