4 # Exercise xfs parallel repair on broken filesystems
5 # This is a clone of test 030 useing xfs_prepair64 instead of xfs_repair
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
9 #-----------------------------------------------------------------------
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
24 umount $SCRATCH_DEV 2>/dev/null
28 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
35 [ -x $XFS_PARALLEL_REPAIR64_PROG ] || _notrun "parallel repair binary xfs_prepair64 is not installed"
37 # force use of parallel repair
38 export XFS_REPAIR_PROG=$XFS_PARALLEL_REPAIR64_PROG
40 # link correct .out file
41 _link_out_file $seq.out
43 # nuke the superblock, AGI, AGF, AGFL; then try repair the damage
47 for structure in 'sb 0' 'agf 0' 'agi 0' 'agfl 0'
49 echo "Corrupting $structure - setting bits to $1"
50 _check_repair $1 "$structure"
54 # real QA test starts here
56 _supported_os IRIX Linux
63 # first we need to ensure there are no bogus secondary
64 # superblocks between the primary and first secondary
65 # superblock (hanging around from earlier tests)...
68 _scratch_mkfs_xfs $DSIZE >/dev/null 2>&1
69 if [ $? -ne 0 ] # probably don't have a big enough scratch
71 _notrun "SCRATCH_DEV too small, results would be non-deterministic"
74 src/feature -U $SCRATCH_DEV && \
75 _notrun "UQuota are enabled, test needs controlled sb recovery"
76 src/feature -G $SCRATCH_DEV && \
77 _notrun "GQuota are enabled, test needs controlled sb recovery"
78 src/feature -P $SCRATCH_DEV && \
79 _notrun "PQuota are enabled, test needs controlled sb recovery"
83 eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_DEV | perl -ne '
84 if (/byte offset (\d+), length (\d+)/) {
85 print "clear=", $1 / 512, "\n"; exit
87 [ -z "$clear" ] && echo "Cannot calculate length to clear"
88 src/devzero -v -1 -n "$clear" $SCRATCH_DEV >/dev/null
90 # now kick off the real prepair test...
92 _scratch_mkfs_xfs $DSIZE | _filter_mkfs 2>$tmp.mkfs