ext4: only call ext4_truncate when size <= isize
commit9d3562bbfd343009c1541727e83fe7c1634b5722
authorJosef Bacik <jbacik@fb.com>
Mon, 22 Jun 2015 04:31:26 +0000 (22 00:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 07:18:03 +0000 (12 09:18 +0200)
tree98324a148811c645783a8c637b05187f9bba330d
parentf5a35eb7a803973c45fb2245a2290591a4d33c77
ext4: only call ext4_truncate when size <= isize

commit 3da40c7b089810ac9cf2bb1e59633f619f3a7312 upstream.

At LSF we decided that if we truncate up from isize we shouldn't trim
fallocated blocks that were fallocated with KEEP_SIZE and are past the
new i_size.  This patch fixes ext4 to do this.

[ Completely reworked patch so that i_disksize would actually get set
  when truncating up.  Also reworked the code for handling truncate so
  that it's easier to handle. -- tytso ]

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c