]> git.ipfire.org Git - thirdparty/util-linux.git/commit
fallocate: fix --dig-holes at end of files
authorGero Treuner <gero@70t.de>
Thu, 10 Sep 2020 19:43:03 +0000 (21:43 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 13 Nov 2020 11:02:22 +0000 (12:02 +0100)
commited423e56ec43e6cdd5a8475e698f693b56512a63
tree1190e9a493b07d547469be5a98073f8eda305325
parent9931d2d174c9ebb726e0869def19d4f67e945d12
fallocate: fix --dig-holes at end of files

I discovered that making a file sparse with "fallocate -d filename"
fails on the last block of a file, because - usually being partial -
the system call only zeroes that part instead of deallocating the
block. See man fallocate(2) - section "Deallocating file space".

The expected call is punching the whole block beyond eof, which
doesn't change the file length because of flag FALLOC_FL_KEEP_SIZE.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/fallocate.c