btrfs-progs/tests/fsck-tests
Filipe Manana 7a8d5d5014 Btrfs-progs: add fsck test for filesystem with shared prealloc extents
Verify that a filesystem check operation (fsck) does not report the
following scenario as an error:

An extent is shared between two inodes, as a result of clone/reflink
operation, and for one of the inodes, lets call it inode A, the extent is
referenced through a file extent item as a prealloc extent, while for the
other inode, call it inode B, the extent is referenced through a regular
file extent item, that is, it was written to. The goal of this test is to
make sure a filesystem check operation will not report "odd csum items"
errors for the prealloc extent at inode A, because this scenario is valid
since the extent was written through inode B and therefore it is expected
to have checksum items in the filesystem's checksum btree for that shared
extent.

Such scenario can be created with the following steps for example:

 mkfs.btrfs -f /dev/sdb
 mount /dev/sdb /mnt

 touch /mnt/foo
 xfs_io -c "falloc 0 256K" /mnt/foo
 sync

 xfs_io -c "pwrite -S 0xab 0 256K" /mnt/foo
 touch /mnt/bar
 xfs_io -c "reflink /mnt/foo 0 0 256K" /mnt/bar
 xfs_io -c "fsync" /mnt/bar

 <power fail>
 mount /dev/sdb /mnt
 umount /mnt

This scenario is fixed by the following patch for the filesystem checker:

 "Btrfs-progs: check, fix false error reports for shared prealloc extents"

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-03-30 22:15:54 +02:00
..
001-bad-file-extent-bytenr btrfs-progs: Move btrfs-image dump to corresponding dir 2015-01-14 18:34:18 +01:00
002-bad-transid btrfs-progs: Move btrfs-image dump to corresponding dir 2015-01-14 18:34:18 +01:00
003-shift-offsets btrfs-progs: Move btrfs-image dump to corresponding dir 2015-01-14 18:34:18 +01:00
004-no-dir-index btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errors 2017-10-16 20:33:00 +02:00
005-bad-item-offset btrfs-progs: Move btrfs-image dump to corresponding dir 2015-01-14 18:34:18 +01:00
006-bad-root-items btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
007-bad-offset-snapshots btrfs-progs: Move btrfs-image dump to corresponding dir 2015-01-14 18:34:18 +01:00
008-bad-dir-index-name btrfs-progs: Move btrfs-image dump to corresponding dir 2015-01-14 18:34:18 +01:00
009-no-dir-item-or-index btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errors 2017-10-16 20:33:00 +02:00
010-no-rootdir-inode-item btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errors 2017-10-16 20:33:00 +02:00
011-no-inode-item btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errors 2017-10-16 20:33:00 +02:00
012-leaf-corruption btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
013-extent-tree-rebuild btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
014-no-extent-info btrfs-progs: deal with no extent info 2015-02-09 14:53:07 -05:00
015-tree-reloc-tree btrfs-progs: tests: fix source path for testsuite 2018-03-30 22:15:54 +02:00
016-wrong-inode-nbytes btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errors 2017-10-16 20:33:00 +02:00
017-missing-all-file-extent btrfs-progs: tests: Allow check test to repair in lowmem mode for certain errors 2017-10-16 20:33:00 +02:00
018-leaf-crossing-stripes btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
019-non-skinny-false-alert btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
020-extent-ref-cases btrfs-progs: fsck-tests: Introduce test case with keyed data backref with the extent offset 2018-03-30 22:15:53 +02:00
021-partially-dropped-snapshot-case btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
022-qgroup-rescan-halfway btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
023-qgroup-stack-overflow btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
024-clear-space-cache btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
025-file-extents btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
026-bad-dir-item-name btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
027-bad-extent-inline-ref-type btrfs-progs: fsck-tests: 027/bad_extent_inline_ref_type 2017-11-14 15:59:00 +01:00
028-unaligned-super-dev-sizes btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests 2018-02-13 15:41:32 +01:00
029-valid-orphan-item btrfs-progs: tests: Add test case with valid orphan inode 2018-03-30 22:15:54 +02:00
030-reflinked-prealloc-extents Btrfs-progs: add fsck test for filesystem with shared prealloc extents 2018-03-30 22:15:54 +02:00