mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-17 18:26:55 +00:00
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>
27 lines
680 B
Bash
Executable File
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
|