btrfs-progs/tests/fuzz-tests/003-multi-check-unmounted/test.sh
Johannes Thumshirn e388bf386b btrfs-progs: check: warn users about the possible dangers of --repair
The manual page of btrfsck clearly states 'btrfs check --repair' is a
dangerous operation.

Although this warning is in place users do not read the manual page
and/or are used to the behaviour of fsck utilities which repair the
filesystem, and thus potentially cause harm.

Similar to 'btrfs balance' without any filters, add a warning and a
countdown, so users can bail out before eventual corrupting the
filesystem more than it already is.

To override the timeout, let --force skip it and continue.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-22 19:07:20 +01:00

27 lines
680 B
Bash
Executable File

#!/bin/bash
# iterate over all fuzzed images and run 'btrfs check', try various options to
# get more code coverage
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
# redefine the one provided by common
check_image() {
local image
image=$1
run_mayfail $TOP/btrfs check -s 1 "$image"
run_mayfail $TOP/btrfs check --init-csum-tree "$image"
run_mayfail $TOP/btrfs check --repair --force --init-extent-tree "$image"
run_mayfail $TOP/btrfs check --repair --force --check-data-csum "$image"
run_mayfail $TOP/btrfs check --subvol-extents "$image"
run_mayfail $TOP/btrfs check --repair --force "$image"
}
check_all_images "$TEST_TOP/fuzz-tests/images"
exit 0