btrfs-progs/tests/fsck-tests/054-orphan-directory/test.sh
Josef Bacik babbfa8ac2 btrfs-progs: tests: add a test to check orphaned directories
When adding the GC support I noticed we were failing fsck when we had a
directory that hadn't been cleaned up yet because of rm -rf.  However
this isn't limited to extent-tree-v2, we'll actually fail in the same
way if we were unable to do the evict portion of the deletion and left
the orphan items around for everybody.

This is a valid file system, it'll be cleaned up properly at mount time,
so fsck shouldn't fail in this case.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-03-08 18:47:21 +01:00

21 lines
559 B
Bash
Executable File

#!/bin/bash
# We could potentially have a directory and it's children with ORPHAN items left
# for them without having been cleaned up.
#
# fsck shouldn't complain about this or attempt to do anything about it, the
# orphan cleanup will do the correct thing.
#
# To create this image I simply modified the kernel to skip doing the
# btrfs_truncate_inode_items() and removing the orphan item at evict time, and
# then rm -rf'ed a directory.
source "$TEST_TOP/common"
check_prereq btrfs
check_image() {
run_check "$TOP/btrfs" check "$1"
}
check_all_images