]> git.baikalelectronics.ru Git - kernel.git/commit
udf: Discard preallocation before extending file with a hole
authorJan Kara <jack@suse.cz>
Wed, 7 Dec 2022 17:17:34 +0000 (18:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:40:46 +0000 (11:40 +0100)
commit0720a7bbeb303039530bb60c2d26af57fe440955
treef7bf43d111b767d3fc988bd9352409d143498aa9
parente1d026bff1826d39557ab6f90d684bbc0acb2a48
udf: Discard preallocation before extending file with a hole

commit 189b02ac597cf04d9912b7a7c40fc7539e5450d8 upstream.

When extending file with a hole, we tried to preserve existing
preallocation for the file. However that is not very useful and
complicates code because the previous extent may need to be rounded to
block boundary as well (which we forgot to do thus causing data
corruption for sequence like:

xfs_io -f -c "pwrite 0x75e63 11008" -c "truncate 0x7b24b" \
  -c "truncate 0xabaa3" -c "pwrite 0xac70b 22954" \
  -c "pwrite 0x93a43 11358" -c "pwrite 0xb8e65 52211" file

with 512-byte block size. Just discard preallocation before extending
file to simplify things and also fix this data corruption.

CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/udf/inode.c