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 _begin_fstest repair auto
14 status=0 # failure is the default!
16 # Import common functions.
19 # real QA test starts here
23 _scratch_mkfs >$seqres.full 2>&1
26 mkdir -p $SCRATCH_MNT/dir/subdir
28 #get inodes to be changed
29 DIR_INO=`ls -i $SCRATCH_MNT |awk '{print $1}'`
30 SUBDIR_INO=`ls -i $SCRATCH_MNT/dir |awk '{print $1}'`
34 echo "Silence is goodness..."
37 _scratch_xfs_set_metadata_field "$1" 0 "inode $2" >> $seqres.full
40 sfdir_prefix="$(_scratch_get_sfdir_prefix "$DIR_INO" || \
41 _fail "Cannot determine sfdir prefix")"
45 set_ifield "${sfdir_prefix}.list[0].inumber.i4" "$DIR_INO"
46 set_ifield "${sfdir_prefix}.list[0].name" "$DIR_INO"
47 set_ifield "${sfdir_prefix}.list[0].offset" "$DIR_INO"
48 set_ifield "${sfdir_prefix}.list[0].namelen" "$DIR_INO"
49 set_ifield "${sfdir_prefix}.hdr.parent.i4" "$DIR_INO"
50 set_ifield "core.nlinkv2" "$DIR_INO"
53 set_ifield "${sfdir_prefix}.hdr.parent.i4" "$SUBDIR_INO"
54 set_ifield "core.nlinkv2" "$SUBDIR_INO"
56 echo "===== BEGIN of xfs_repair =====" >> $seqres.full
57 echo "" >>$seqres.full
59 _scratch_xfs_repair >> $seqres.full 2>&1
60 echo "===== END of xfs_repair =====" >> $seqres.full