Skip to content
  • Mikulas Patocka's avatar
    dm io: flush cpu cache with vmapped io · bb91bc7b
    Mikulas Patocka authored
    
    
    For normal kernel pages, CPU cache is synchronized by the dma layer.
    However, this is not done for pages allocated with vmalloc. If we do I/O
    to/from vmallocated pages, we must synchronize CPU cache explicitly.
    
    Prior to doing I/O on vmallocated page we must call
    flush_kernel_vmap_range to flush dirty cache on the virtual address.
    After finished read we must call invalidate_kernel_vmap_range to
    invalidate cache on the virtual address, so that accesses to the virtual
    address return newly read data and not stale data from CPU cache.
    
    This patch fixes metadata corruption on dm-snapshots on PA-RISC and
    possibly other architectures with caches indexed by virtual address.
    
    Cc: stable <stable@kernel.org>
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
    bb91bc7b