2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle. All Rights Reserved.
7 # Make sure that attrs are handled properly when repair has to reset the root
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 7 15
25 # get standard environment, filters and checks
31 # real QA test starts here
33 _require_scratch_nocheck
34 _require_populate_commands
35 _require_xfs_db_command "fuzz"
39 echo "Format and populate btree attr root dir"
40 _scratch_mkfs > "$seqres.full" 2>&1
43 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
44 __populate_create_attr "${SCRATCH_MNT}" "$((64 * blksz / 40))" true
47 echo "Break the root directory"
48 _scratch_xfs_fuzz_metadata_field core.mode zeroes 'sb 0' 'addr rootino' >> $seqres.full 2>&1
50 echo "Detect bad root directory"
51 _scratch_xfs_repair -n >> $seqres.full 2>&1 && \
52 echo "Should have detected bad root dir"
54 echo "Fix bad root directory"
55 _scratch_xfs_repair >> $seqres.full 2>&1
57 echo "Detect fixed root directory"
58 _scratch_xfs_repair -n >> $seqres.full 2>&1