Store v1: Do not skip checksum verification of reads that start after a parallel flush #128

Merged
vitalif merged 2 commits from koolkhel/vitastor:blockstore-v1-sticky-was-changed into master 2026-11-20 18:21:19 +03:00

2 Commits

Author SHA1 Message Date
42ca04ad8c Store v1: Fix false checksum mismatches of reads running in parallel to a flush
A read of a clean block which was still running when the same data was
overwritten and flushed could fail with a false -EDOM in two cases:

- The flush moved the object to a new block (redirect-write). The metadata
  entry of the old block is zeroed out, in memory too, so the read verified
  its data against zero bitmap and checksums. Only the new location was
  marked as changed in used_clean_objects.
- csum_block_size == bitmap_granularity and the same blocks were overwritten
  in place. The read verified old data against new checksums, because this
  branch never skipped verification.

Mark the old location as changed too, and do not verify clean data in the
second branch if its location was changed during the read. Reads which start
during a flush are still verified there, because they take the overwritten
blocks from the journal.
2026-11-19 21:07:35 +03:00
dff684b27a Store v1: Do not skip checksum verification of reads that start after a parallel flush
used_clean_obj_t::was_changed was set by a flush (or by a read started
during one) and never reset while the entry had references, so a read
started after the flush had finished, but while an older read still held
the same clean block, also returned data without verifying checksums.
Count flushes in the entry instead and remember the count at the start
of each read, skipping verification only if it changed or a flush was
already running.
2026-11-18 11:15:47 +03:00