• Maxim Patlasov's avatar
    ext4: avoid exposure of stale data in ext4_punch_hole() · e251f9bc
    Maxim Patlasov authored
    While handling punch-hole fallocate, it's useless to truncate page cache
    before removing the range from extent tree (or block map in indirect case)
    because page cache can be re-populated (by read-ahead or read(2) or mmap-ed
    read) immediately after truncating page cache, but before updating extent
    tree (or block map). In that case the user will see stale data even after
    fallocate is completed.
    
    Until the problem of data corruption resulting from pages backed by
    already freed blocks is fully resolved, the simple thing we can do now
    is to add another truncation of pagecache after punch hole is done.
    Signed-off-by: default avatarMaxim Patlasov <mpatlasov@parallels.com>
    Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    e251f9bc
inode.c 150 KB