mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
9dcfb88ac6
Test that if we truncate a file to a smaller size, then truncate it to its original size or a larger size, then fsyncing it and a power failure happens, the file will have the range [first_truncate_size, last_size[ with all bytes having a value of 0x00 if we read it the next time the filesystem is mounted. This test is motivated by a bug found in btrfs, which is fixed by a patch titled: "Btrfs: fix fsync after truncate when no_holes feature is enabled" Tested against ext3/4, xfs, btrfs (with and without the fix, and with the no_holes feature disabled), f2fs, reiserfs and nilfs2. All filesystems pass the test except for unpatched btrfs with the no_holes feature enabled (as expected) and f2fs. Both produce the following file contents that differ from the golden output: File foo content after log replay: 0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa * 0200000 bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb bb * 0372000 File bar content after log replay: 0000000 ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee * 0200000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff * 0372000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 * 0772000 Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
20 lines
673 B
Plaintext
20 lines
673 B
Plaintext
QA output created by 101
|
|
wrote 65536/65536 bytes at offset 0
|
|
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
wrote 62464/62464 bytes at offset 65536
|
|
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
wrote 65536/65536 bytes at offset 0
|
|
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
wrote 62464/62464 bytes at offset 65536
|
|
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
File foo content after log replay:
|
|
0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
|
|
*
|
|
0200000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
*
|
|
0372000
|
|
File bar content after log replay:
|
|
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
|
*
|
|
0772000
|