osd: Don't mark a copy of a chained read's layer object lost on ENOENT from a racing delete #168
Reference in New Issue
Block a user
No description provided.
Delete Branch "koolkhel/vitastor:chain-read-enoent-race"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
A chained read (a clone or a snapshot child) can read a parent layer object's bitmap before a delete of that object and its data after it. The data read answers ENOENT. Chained reads never set
OP_DATA_ENOENT_OKand have no racing-op check likecontinue_primary_read(), socheck_corrupted_chained()marked that copy as missing:clean_countand leaves the new degraded state behind: the deleted object stays degraded.assert(read_target != 0)incollect_bitmap_requests(), aborting the OSD (reproduced on a downstream tree; the same assert is on master).Fix: treat ENOENT the way plain reads do. While a write or delete runs on the object (it is in
pg->write_queue), or when the object is clean and every part read answered ENOENT (theOP_DATA_ENOENT_OKrule for clean objects), the object was deleted under the read, so the copy is not marked. The existing retry reads the bitmaps again; a store zeroes the bitmap of a deleted object, so the retry no longer reads that layer.osd_test.capturing_bs_t::read_bitmap()in the fixture with exactly the same hunk, so the two don't conflict with each other; #158 changes the same function, and whichever goes in later I'll rebase.Tested: new
test_chained_read_enoent_races_parent_delete(false/true)inosd_test(legacy delete and tombstones): replicated pool, child and parent layers, the parent object clean on both OSDs, the delete applied locally and in flight to the peer when the chained read gets ENOENT. Without the fix the parent object is degraded right after the ENOENT and stays degraded after the delete; with it the PG stays active and clean and the read returns. The wholeosd_testpasses.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA