Skip to content

fix(page-cache): scope page keys by device; never drop a dirty victim - #710

Merged
alexis900 merged 1 commit into
developfrom
fix/page-cache-devtag-709
Oct 15, 2026
Merged

alexis900 merged 1 commit into
developfrom
fix/page-cache-devtag-709

Conversation

@alexis900

Copy link
Copy Markdown
Collaborator

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).

  • Clave 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_lru prefiere una víctima clean para no descartar páginas dirty.
  • Test de regresión 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_file al cargar muchos .kbd (presión de caché), así que su causa raíz es otra (probablemente invalidate_* descartando páginas dirty sin flush, o el snapshot/COW de NE2). #709 queda abierta con esta evidencia.

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.
@alexis900
alexis900 merged commit 532d554 into develop Oct 15, 2026
3 of 4 checks passed
@alexis900
alexis900 deleted the fix/page-cache-devtag-709 branch October 15, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant