ext4: fix punch hole for inline_data file systems
authorTheodore Ts'o <tytso@mit.edu>
Sat, 24 Aug 2019 02:38:00 +0000 (22:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:10:11 +0000 (13:10 +0200)
commit091c754d5ca943fd3bb0cadd20140184911b695d
treed6d20fada186f872aa98ba1220b090d578ae24fc
parent775e3e734bd35fa4d11bc0d9abb91a44815bacaa
ext4: fix punch hole for inline_data file systems

commit c1e8220bd316d8ae8e524df39534b8a412a45d5e upstream.

If a program attempts to punch a hole on an inline data file, we need
to convert it to a normal file first.

This was detected using ext4/032 using the adv configuration.  Simple
reproducer:

mke2fs -Fq -t ext4 -O inline_data /dev/vdc
mount /vdc
echo "" > /vdc/testfile
xfs_io -c 'truncate 33554432' /vdc/testfile
xfs_io -c 'fpunch 0 1048576' /vdc/testfile
umount /vdc
e2fsck -fy /dev/vdc

Cc: stable@vger.kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c