]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commit
generic: test post-EOF gap zeroing persistence
authorZhang Yi <yi.zhang@huawei.com>
Tue, 28 Apr 2026 08:57:50 +0000 (16:57 +0800)
committerZorro Lang <zlang@kernel.org>
Fri, 1 May 2026 16:57:03 +0000 (00:57 +0800)
commit95155ec233fad04d8701bfec74accefec691342c
treea240f4c8b6e8c445c5cb0e9fcead6efdd1fd8764
parent55e172c4c9144d2b944f0c03801b507f9e74c5ba
generic: test post-EOF gap zeroing persistence

Test that extending a file past a non-block-aligned EOF correctly
zero-fills the gap [old_EOF, block_boundary), and that this zeroing
persists through a filesystem shutdown+remount cycle.

Stale data beyond EOF can persist on disk when append write data blocks
are flushed before the on-disk file size update, or when concurrent
append writeback and mmap writes persist non-zero data past EOF.
Subsequent post-EOF operations (append write, fallocate, truncate up)
must zero-fill and persist the gap to prevent exposing stale data.

The test pollutes the file's last physical block (via FIEMAP + raw
device write) with a sentinel pattern beyond i_size, then performs each
extend operation and verifies the gap is zeroed both in memory and on
disk.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/794 [new file with mode: 0755]
tests/generic/794.out [new file with mode: 0644]