ext4: fix races of writeback with punch hole and zero range
authorJan Kara <jack@suse.com>
Mon, 7 Dec 2015 19:34:49 +0000 (14:34 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:02:21 +0000 (19:02 +0100)
commit6a293f46d3eaafcbc4a3316f2ac80de9b1398415
treefcaa43fb5cd622152818365a4c3d7e85e7b1f701
parent8a76993a673d694c17cd6fd6d7d9fc323fe224d4
ext4: fix races of writeback with punch hole and zero range

commit 011278485ecc3cd2a3954b5d4c73101d919bf1fa upstream.

When doing delayed allocation, update of on-disk inode size is postponed
until IO submission time. However hole punch or zero range fallocate
calls can end up discarding the tail page cache page and thus on-disk
inode size would never be properly updated.

Make sure the on-disk inode size is updated before truncating page
cache.

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/inode.c