osd/ECOmapJournal: bind by reference when clearing omap keys

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: 7289e4d2ec ("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>
This commit is contained in:
Sun Yuechi 2026-06-26 20:28:31 +08:00
parent f3dcff54f5
commit aa82faec86

View File

@ -234,7 +234,7 @@ void ECOmapJournal::process_entries(const hobject_t &hoid) {
// 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);
}