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
37 echo "Format and populate btree attr root dir"
38 _scratch_mkfs > "$seqres.full" 2>&1
41 blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
42 __populate_create_attr "${SCRATCH_MNT}" "$((64 * blksz / 40))" true
45 echo "Break the root directory"
46 _scratch_xfs_fuzz_metadata_field core.mode zeroes 'sb 0' 'addr rootino' >> $seqres.full 2>&1
48 echo "Detect bad root directory"
49 _scratch_xfs_repair -n >> $seqres.full 2>&1 && \
50 echo "Should have detected bad root dir"
52 echo "Fix bad root directory"
53 _scratch_xfs_repair >> $seqres.full 2>&1
55 echo "Detect fixed root directory"
56 _scratch_xfs_repair -n >> $seqres.full 2>&1