2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 Red Hat, Inc. All Rights Reserved.
7 # Test xfs_repair to ensure it fixes the lost+found link count
8 # at the first run. See also commit 198b747f255346bca64408875763b6ca0ed3d57d
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=0 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
30 # real QA test starts here
35 _scratch_mkfs >$seqres.full 2>&1
38 mkdir -p $SCRATCH_MNT/dir/subdir
40 #get inodes to be changed
41 DIR_INO=`ls -i $SCRATCH_MNT |awk '{print $1}'`
42 SUBDIR_INO=`ls -i $SCRATCH_MNT/dir |awk '{print $1}'`
46 echo "Silence is goodness..."
49 _scratch_xfs_set_metadata_field "$1" 0 "inode $2" >> $seqres.full
52 sfdir_prefix="$(_scratch_get_sfdir_prefix "$DIR_INO" || \
53 _fail "Cannot determine sfdir prefix")"
57 set_ifield "${sfdir_prefix}.list[0].inumber.i4" "$DIR_INO"
58 set_ifield "${sfdir_prefix}.list[0].name" "$DIR_INO"
59 set_ifield "${sfdir_prefix}.list[0].offset" "$DIR_INO"
60 set_ifield "${sfdir_prefix}.list[0].namelen" "$DIR_INO"
61 set_ifield "${sfdir_prefix}.hdr.parent.i4" "$DIR_INO"
62 set_ifield "core.nlinkv2" "$DIR_INO"
65 set_ifield "${sfdir_prefix}.hdr.parent.i4" "$SUBDIR_INO"
66 set_ifield "core.nlinkv2" "$SUBDIR_INO"
68 echo "===== BEGIN of xfs_repair =====" >> $seqres.full
69 echo "" >>$seqres.full
71 _scratch_xfs_repair >> $seqres.full 2>&1
72 echo "===== END of xfs_repair =====" >> $seqres.full