btrfs-progs: fsck-tests: Add test image for valid half-dropped orphan inode
Btrfs check used to report false alerts on half dropped orphan inodes. Add test cases to prevent such problem from happening again. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c31bd8db54
commit
7cb441ba56
Binary file not shown.
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
# To check if btrfs check can handle half dropped inodes.
|
||||
# Such inodes are orphan inodes going through file items evicting.
|
||||
# During that evicting, btrfs won't bother updating the nbytes of the orphan
|
||||
# inode as they will soon be removed completely.
|
||||
#
|
||||
# Btrfs check should be able to recognize such inodes without giving false
|
||||
# alerts
|
||||
#
|
||||
# The way to reproduce the image:
|
||||
# - Create a lot of regular file extents for one inode
|
||||
# Using direct IO with small block size is the easiy method
|
||||
# - Modify kernel to commit transaction more aggresively
|
||||
# Two locations are needed:
|
||||
# * btrfs_unlink():
|
||||
# To make the ORPHAN item reach disk asap
|
||||
# * btrfs_evict_inode():
|
||||
# Make the btrfs_end_transaction() call after btrfs_trncate_inode_items()
|
||||
# to commit transaction, so we can catch every file item deletion
|
||||
# - Setup dm-log-writes
|
||||
# To catch every transaction commit
|
||||
# - Delete the inode
|
||||
# - Sync the fs
|
||||
# - Replay the log
|
||||
|
||||
source "$TEST_TOP/common"
|
||||
|
||||
check_prereq btrfs
|
||||
|
||||
check_image() {
|
||||
run_check "$TOP/btrfs" check "$1"
|
||||
}
|
||||
|
||||
check_all_images
|
Loading…
Reference in New Issue