http://oss.sgi.com/bugzilla/show_bug.cgi?id=874
Summary: non-default extsize values introduces garbage into
holey files
Product: XFS
Version: Current
Platform: All
OS/Version: Linux
Status: NEW
Severity: major
Priority: P1
Component: XFS kernel code
AssignedTo: xfs-masters@xxxxxxxxxxx
ReportedBy: gwehrman@xxxxxxx
Estimated Hours: 0.0
Classification: Unclassified
There is a bug in the XFS extsize allocation hint implementation. Using
non-default values for the extsize attribute causes corruption in holey
files. Follow is a reproducible test case.
#!/bin/sh
CMD="${0##*/}"
TDIR="testdir_$$"
NFILES="10"
EXTSIZE="256k"
# Create the test directory
mkdir ${TDIR}
cd ${TDIR}
# Set the test directory extsize
/usr/sbin/xfs_io > /dev/null <<EOF
open .
extsize ${EXTSIZE}
quit
EOF
# Create the binary to generate holey files
cat > bb.c <<EOF
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <stdio.h>
main()
{
int fd;
int j;
int i;
int buf[1024];
fd = open("./filea",O_RDWR|O_CREAT,0666);
for (i = 1; i < 9100; i++) {
for (j = 0; j < 1024; j++) {
buf[j] = i | i<<5;
}
if (write(fd,buf,253*4*sizeof(int))!= 253*4*sizeof(int)){
printf("Write did not return correct amount\n");
}
if (((i % 9) == 0) && (i < 9001))
lseek(fd, 4096*110,SEEK_CUR);
}
close(fd);
}
EOF
cc -o bb bb.c
# Create a set of holey files
echo "${CMD}: generating ${NFILES} files"
I=0
while [ ${I} -lt ${NFILES} ] ; do
echo "filea_${I}"
./bb
mv filea filea_${I}
(( I += 1 ))
done
# Compare the files
echo "${CMD}: comparing files"
ERRCNT=0
I="0"
while [ ${I} -lt ${NFILES} ] ; do
(( J = ${I} + 1 ))
while [ ${J} -lt ${NFILES} ] ; do
echo "cmp filea_${I} filea_${J}"
if ! cmp filea_${I} filea_${J} ; then
(( ERRCNT += 1 ))
fi
(( J += 1 ))
done
(( I += 1 ))
done
cd ..
if [ ${ERRCNT} -eq 0 ] ; then
# cleanup on success
rm -rf ${TDIR}
fi
echo "${CMD}: ${ERRCNT} errors"
exit ${ERRCNT}
--
Configure bugmail: http://oss.sgi.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
|