Repository navigation
fix(page-cache): scope page keys by device; never drop a dirty victim - #710
Merged
Merged
Conversation
The page cache hashed pages by LBA only, so two block devices with an overlapping LBA aliased: touching the page on device B found device A's slot and evicted it, dropping A's dirty page without flushing (silent data loss). - `page_key(dev_tag, lba)` scopes every hash op (get/insert/remove). - `evict_lru` prefers a clean victim so a dirty page of any device is not discarded when the cache is full. - regression test `page_cache_devices_do_not_alias` (two devices, same LBA) — fails before, passes now. Partial for #709: this fixes the cross-device aliasing/data-loss, but the `neofs_v2_snapshot_extract_file` failure under cache pressure persists (different root cause), so #709 is not closed by this.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mejora de corrección de la page cache. No cierra #709 (ver abajo).
Qué
La page cache indexaba las páginas solo por LBA, así que dos block devices con un LBA solapado se pisaban: tocar la página en el device B encontraba el slot del device A y lo evictaba, descartando la página dirty de A sin flush (pérdida silenciosa).
page_key(dev_tag, lba)en todas las operaciones del hash (get/insert/remove,read_page/get_page_mut/load_page/get_or_load_slot/populate_slot/evict_slot/evict_lru/invalidate_*/mark_dirty_sector/peek).evict_lruprefiere una víctima clean para no descartar páginas dirty.page_cache_devices_do_not_alias(dos devices, mismo LBA): falla antes, pasa ahora.Verificación
neodev build --image+neodev test→ 969/969.Sobre #709
Con este fix sigue fallando
neofs_v2_snapshot_extract_fileal cargar muchos.kbd(presión de caché), así que su causa raíz es otra (probablementeinvalidate_*descartando páginas dirty sin flush, o el snapshot/COW de NE2). #709 queda abierta con esta evidencia.