• Brian Foster's avatar
    fuse: truncate pagecache range on hole punch · 3634a632
    Brian Foster authored
    fuse supports hole punch via the fallocate() FALLOC_FL_PUNCH_HOLE
    interface. When a hole punch is passed through, the page cache
    is not cleared and thus allows reading stale data from the cache.
    This is easily demonstrable (using FOPEN_KEEP_CACHE) by reading a
    smallish random data file into cache, punching a hole and creating
    a copy of the file. Drop caches or remount and observe that the
    original file no longer matches the file copied after the hole
    punch. The original file contains a zeroed range and the latter
    file contains stale data.
    Protect against writepage requests in progress and punch out the
    associated page cache range after a successful client fs hole
    Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
file.c 61.7 KB