The clear_omap loop bound each key_map entry by value, so
update_value() mutated a copy and cached keys were never marked
removed.
As a result, clear_omap had no effect on already-cached keys: cleared
omap keys retained stale values and were returned on read.
Introduced-by: 7289e4d2ece ("osd: Add ECOmapJournal class and relocate OmapUpdateType enum class")
Fixes: https://tracker.ceph.com/issues/77750
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
// Clear omap if specified
if (entry_iter->clear_omap) {
// Mark all keys as removed
- for (auto [_, value] : key_map[hoid]) {
+ for (auto &[_, value] : key_map[hoid]) {
value.update_value(entry_iter->version, std::nullopt);
}