View Incident:
http://co-op.engr.sgi.com/BugWorks/code/bwxquery.cgi?search=Search&wlong=1&view_type=Bug&wi=801241
Submitter : ivanr Submitter Domain : engr
Assigned Engineer : nb Assigned Domain : sgi.com
Assigned Group : xfs-linux Category : software
Customer Reported : F Priority : 1
Project : xfs-linux Status : open
Description :
QA for xfsdump/xfsrestore revealed that it is possible for
xfsdump to cause filesystem corruption. The test involves
creating a filesystem, creating a whole buncha files, xfsdumping
them to a file somewhere, then removing all the files. xfs_check
reports lots of inodes with zero link counts, etc. It's probably
due to xfsdump using bulkstat on the entire fs.
The following is a script which will reliably (at least on
bruce.melbourne) produce the error. Run it in cmd/xfs/stress -
it needs the src/fill program, and make sure you fix the
variables at the top.
=======================================
#!/bin/sh
#TEST_DIR=/mnt/xfs1
#TEST_DEV=/dev/sda10
TEST_DIR=<put something here>
TEST_DEV=<put something here>
tmp=/tmp/$$
dump_dir=$TEST_DIR/dump.$$
dump_file=$tmp.dumpfile
here=`pwd`
trap "rm -rf $tmp\*; exit" 0 1 2 3 15
_wipe_dev()
{
umount $1
mkfs.xfs -f $1
mount $1
}
_create_dumpdir_fill()
{
echo "Creating directory system to dump using src/fill."
# wipe test dir clean first
rm -rf $TEST_DIR/*
cat <<End-of-File >$tmp.config
# pathname size in bytes
#
small 10
big 102400
sub/small 10
sub/big 102400
#
sub/a 1
sub/b 2
sub/c 4
sub/d 8
sub/e 16
sub/f 32
sub/g 64
sub/h 128
sub/i 256
sub/j 512
sub/k 1024
sub/l 2048
sub/m 4096
sub/n 8192
#
sub/a00 100
sub/b00 200
sub/c00 400
sub/d00 800
sub/e00 1600
sub/f00 3200
sub/g00 6400
sub/h00 12800
sub/i00 25600
sub/j00 51200
sub/k00 102400
sub/l00 204800
sub/m00 409600
sub/n00 819200
#
sub/a000 1000
sub/e000 16000
sub/h000 128000
sub/k000 1024000
End-of-File
if mkdir -p $dump_dir
then
:
else
echo "Error: cannot mkdir \"$dump_dir\""
exit 1
fi
cd $dump_dir
sed -e '/^#/d' $tmp.config \
| while read file nbytes
do
dir=`dirname $file`
if [ "$dir" != "." ]
then
if [ ! -d $dir ]
then
if mkdir $dir
then
:
else
echo "Error: cannot mkdir \"$dir\""
exit 1
fi
fi
fi
rm -f $file
if $here/src/fill $file $file $nbytes
then
:
else
echo "Error: cannot create \"$file\""
exit 1
fi
done
cd $here
}
_fix_malloc()
{
# filter out the Electric Fence notice
perl -e '
undef $/;
$_ = <>;
s/\n Electric Fence .*\n//g;
print'
}
NO_REMOUNT=1
_check_fs()
{
device=$1
xfs_check $device 2>&1 | _fix_malloc > $tmp.xfscheck
if [ -s $tmp.xfscheck ]
then
echo "_check_fs: filesystem on $device is inconsistent (xfs_check)"
rm -f $tmp.xfscheck
fi
if ! xfs_repair -n $device > /dev/null 2>&1
then
echo "_check_fs: filesystem on $device is inconsistent (xfs_repair)"
fi
}
_wipe_dev $TEST_DEV
_create_dumpdir_fill
sync
sleep 15
xfsdump -f $dump_file -M med -L sess $TEST_DIR > /dev/null
rm -rf $dump_dir
_check_fs $TEST_DEV
=======================================
|