osd: Free the old object state in mark_object() only after inserting the new one #169

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:mark-object-reuse into master

1 Commits

Author SHA1 Message Date
2b716f60b4 osd: Free the old object state in mark_object() only after inserting the new one
mark_object() freed the object's old state entry before it inserted the
new one. When the object was alone in its state, malloc returned the
same block, so the new state had the old address. Callers tell a swap
by comparing the pointers, so a primary read that had just marked a
copy corrupted saw no change and failed with EIO instead of retrying on
the copy that is left.

Unlink the object from the old state first, insert it into the new one,
and release the old entry last.
2026-11-24 03:03:59 +03:00