]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: avoid exposure of stale data in ext4_punch_hole()
authorMaxim Patlasov <MPatlasov@parallels.com>
Thu, 20 Feb 2014 21:58:05 +0000 (16:58 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 20 Feb 2014 21:58:05 +0000 (16:58 -0500)
commit5720f3038c81b59ab7a7872dcdad8effb4b80ce0
tree413d9b1af6fd9b916c0bdb9f7380d5657c093efb
parent4aa21dbe7e202632ad70e276f7d7f0a306d7be72
ext4: avoid exposure of stale data in ext4_punch_hole()

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: Maxim Patlasov <mpatlasov@parallels.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
fs/ext4/inode.c