Fix possible OSD crash during parallel read & write to an image with snapshots

OSDs could crash with the following "assertion failed" message (crash didn't affect data
and was caused by OSD thinking upper blocks are full while they weren't). Reproduction
without introducing artificial delays is hard because you have to force OSD to read an
object with enqueued but not handled write which fills previously non-full bitmap. O_o.

```
vitastor-osd: ./src/osd/osd_primary_chain.cpp:613: void osd_t::send_chained_read_results(pg_t&, osd_op_t*): Assertion `stripes[role].read_buf' failed.
```
This commit is contained in:
Vitaliy Filippov
2024-09-21 13:44:36 +03:00
parent f18a749324
commit b58bf3ada5
+2 -1
View File
@@ -993,7 +993,8 @@ int blockstore_impl_t::read_bitmap(object_id oid, uint64_t target_version, void
{
while (dirty_it->first.oid == oid)
{
if (target_version >= dirty_it->first.version)
// Condition has to be the same as in dequeue_read()
if (!IS_IN_FLIGHT(dirty_it->second.state) && target_version >= dirty_it->first.version)
{
if (result_version)
*result_version = dirty_it->first.version;