From 5ba1d7847eac265ff4e6e746c62855009efd3a11 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Wed, 8 Feb 2006 14:30:43 +0000 Subject: [PATCH] Couple more QA tests - one ENOSPC condition, one bulkstat error case. Merge of master-melb:xfs-cmds:25142a by kenmcd. --- 109 | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++ 109.out | 12 +++++++ 111 | 56 +++++++++++++++++++++++++++++ 111.out | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ group | 2 ++ src/Makefile | 9 +++-- src/itrash.c | 41 +++++++++++++++++++++ 7 files changed, 316 insertions(+), 3 deletions(-) create mode 100755 109 create mode 100644 109.out create mode 100755 111 create mode 100644 111.out create mode 100644 src/itrash.c diff --git a/109 b/109 new file mode 100755 index 00000000..2b69a943 --- /dev/null +++ b/109 @@ -0,0 +1,99 @@ +#! /bin/sh +# FS QA Test No. 108 +# +# ENOSPC deadlock case from Asano Masahiro. +# +#----------------------------------------------------------------------- +# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved. +#----------------------------------------------------------------------- +# +# creator +owner=nathans@sgi.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux XFS +_require_scratch + +populate() +{ + # "faststart" lets us effectively skip (re-)population + [ "X$faststart" != "X" ] && rm -f $SCRATCH_MNT/F* + + # create many small files using most available space + echo "creating small files..." + i=0 + while [ $i -le $files -a "X$faststart" = "X" ]; do + file=$SCRATCH_MNT/f$i + xfs_io -f -d -c 'pwrite -b 64k 0 64k' $file >/dev/null + i=`expr $i + 1` + done + + # remove every second file, freeing up lots of space + echo "removing small files..." + i=1 + while [ $i -le $files -a "X$faststart" = "X" ]; do + rm $SCRATCH_MNT/f$i + i=`expr $i + 2` + done + + echo "flushing changes via umount/mount." + umount $SCRATCH_DEV + _scratch_mount +} + +allocate() +{ + # now try to hit the deadlock + echo "starting parallel allocators..." + i=0 + while [ $i -le 10 ]; do + file=$SCRATCH_MNT/F$i + { + j=0 + while [ $j -lt 100 ]; do + xfs_io -f -c 'pwrite -b 64k 0 16m' $file \ + >/dev/null 2>&1 + rm $file + j=`expr $j + 1` + done + } & + i=`expr $i + 1` + done + + wait + echo "all done!" +} + +# real QA test starts here +umount $SCRATCH_DEV 2>/dev/null +_scratch_mount + +# see if faststart is possible (and requested) +files=2000 +faststart="" +if [ -n "$FASTSTART" -a -f $SCRATCH_MNT/f0 ]; then + faststart="-N" # causes us to skip the mkfs step +fi +umount $SCRATCH_DEV + +_scratch_mkfs_xfs -dsize=160m,agcount=4 $faststart | _filter_mkfs 2>$tmp.mkfs +cat $tmp.mkfs >>$seq.full +_scratch_mount + +populate +allocate +status=0 +exit diff --git a/109.out b/109.out new file mode 100644 index 00000000..7041e6de --- /dev/null +++ b/109.out @@ -0,0 +1,12 @@ +QA output created by 109 +meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks +data = bsize=XXX blocks=XXX, imaxpct=PCT + = sunit=XXX swidth=XXX, unwritten=X +naming =VERN bsize=XXX +log =LDEV bsize=XXX blocks=XXX +realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX +creating small files... +removing small files... +flushing changes via umount/mount. +starting parallel allocators... +all done! diff --git a/111 b/111 new file mode 100755 index 00000000..8e16a629 --- /dev/null +++ b/111 @@ -0,0 +1,56 @@ +#! /bin/sh +# FS QA Test No. 108 +# +# Infinite xfs_bulkstat bad-inode loop case from Roger Willcocks. +# +#----------------------------------------------------------------------- +# Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved. +#----------------------------------------------------------------------- +# +# creator +owner=nathans@sgi.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# real QA test starts here +_supported_fs xfs +_supported_os Linux +_require_scratch + +# real QA test starts here +umount $SCRATCH_DEV 2>/dev/null +MKFS_OPTIONS="-bsize=4096" +MOUNT_OPTIONS="-o noatime" +_scratch_mkfs_xfs | _filter_mkfs 2>$tmp.mkfs +_scratch_mount + +echo Create some files +I=0 +while [ $I -lt 1000 ] +do + cp src/itrash.c $SCRATCH_MNT/${I} + I=`expr $I + 1` +done +umount $SCRATCH_DEV + +echo Blat inode clusters +src/itrash $SCRATCH_DEV + +_scratch_mount + +echo Attempting bulkstat +#src/bstat -q $SCRATCH_MNT +xfs_fsr $SCRATCH_MNT + +status=0 +exit diff --git a/111.out b/111.out new file mode 100644 index 00000000..88a5c997 --- /dev/null +++ b/111.out @@ -0,0 +1,100 @@ +QA output created by 111 +meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks +data = bsize=XXX blocks=XXX, imaxpct=PCT + = sunit=XXX swidth=XXX, unwritten=X +naming =VERN bsize=XXX +log =LDEV bsize=XXX blocks=XXX +realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX +Create some files +Blat inode clusters +Starting overwrite +Overwrote IN @offset 2048 +Overwrote IN @offset 2304 +Overwrote IN @offset 2560 +Overwrote IN @offset 2816 +Overwrote IN @offset 3072 +Overwrote IN @offset 3328 +Overwrote IN @offset 3584 +Overwrote IN @offset 3840 +Overwrote IN @offset 4096 +Overwrote IN @offset 4352 +Overwrote IN @offset 4608 +Overwrote IN @offset 4864 +Overwrote IN @offset 5120 +Overwrote IN @offset 5376 +Overwrote IN @offset 5632 +Overwrote IN @offset 5888 +Overwrote IN @offset 6144 +Overwrote IN @offset 6400 +Overwrote IN @offset 6656 +Overwrote IN @offset 6912 +Overwrote IN @offset 7168 +Overwrote IN @offset 7424 +Overwrote IN @offset 7680 +Overwrote IN @offset 7936 +Overwrote IN @offset 8192 +Overwrote IN @offset 8448 +Overwrote IN @offset 8704 +Overwrote IN @offset 8960 +Overwrote IN @offset 9216 +Overwrote IN @offset 9472 +Overwrote IN @offset 9728 +Overwrote IN @offset 9984 +Overwrote IN @offset 10240 +Overwrote IN @offset 10496 +Overwrote IN @offset 10752 +Overwrote IN @offset 11008 +Overwrote IN @offset 11264 +Overwrote IN @offset 11520 +Overwrote IN @offset 11776 +Overwrote IN @offset 12032 +Overwrote IN @offset 12288 +Overwrote IN @offset 12544 +Overwrote IN @offset 12800 +Overwrote IN @offset 13056 +Overwrote IN @offset 13312 +Overwrote IN @offset 13568 +Overwrote IN @offset 13824 +Overwrote IN @offset 14080 +Overwrote IN @offset 14336 +Overwrote IN @offset 14592 +Overwrote IN @offset 14848 +Overwrote IN @offset 15104 +Overwrote IN @offset 15360 +Overwrote IN @offset 15616 +Overwrote IN @offset 15872 +Overwrote IN @offset 16128 +Overwrote IN @offset 24576 +Overwrote IN @offset 24832 +Overwrote IN @offset 25088 +Overwrote IN @offset 25344 +Overwrote IN @offset 25600 +Overwrote IN @offset 25856 +Overwrote IN @offset 26112 +Overwrote IN @offset 26368 +Overwrote IN @offset 26624 +Overwrote IN @offset 26880 +Overwrote IN @offset 27136 +Overwrote IN @offset 27392 +Overwrote IN @offset 27648 +Overwrote IN @offset 27904 +Overwrote IN @offset 28160 +Overwrote IN @offset 28416 +Overwrote IN @offset 28672 +Overwrote IN @offset 28928 +Overwrote IN @offset 29184 +Overwrote IN @offset 29440 +Overwrote IN @offset 29696 +Overwrote IN @offset 29952 +Overwrote IN @offset 30208 +Overwrote IN @offset 30464 +Overwrote IN @offset 30720 +Overwrote IN @offset 30976 +Overwrote IN @offset 31232 +Overwrote IN @offset 31488 +Overwrote IN @offset 31744 +Overwrote IN @offset 32000 +Overwrote IN @offset 32256 +Overwrote IN @offset 32512 +Overwrite complete +Attempting bulkstat diff --git a/group b/group index 508875af..b9233c85 100644 --- a/group +++ b/group @@ -185,7 +185,9 @@ aio nathans@sgi.com 106 quota 107 quota 108 quota +109 metadata 110 repair +111 ioctl 112 rw aio auto 113 rw aio 114 parent attr diff --git a/src/Makefile b/src/Makefile index f9393b15..84d34681 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,7 +9,7 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \ nametest permname randholes runas truncfile usemem \ mmapcat append_reader append_writer dirperf metaperf \ devzero feature alloc fault fstest t_access_root \ - godown resvtest writemod makeextents + godown resvtest writemod makeextents itrash LINUX_TARGETS = loggen xfsctl bstat t_mtab getdevicesize @@ -66,6 +66,9 @@ fstest: fstest.o resvtest: resvtest.o $(LINKTEST) +itrash: itrash.o + $(LINKTEST) + #scaleread: scaleread.o $(LDLIBS) # $(LINKTEST) @@ -74,10 +77,10 @@ acl_get: acl_get.o $(LIBACL) $(LIBATTR) ifeq ($(PKG_PLATFORM),irix) -fill2: fill2.o +fill2: fill2.o $(LINKTEST) -lgen -runas: runas.o +runas: runas.o $(LINKTEST) -lgen open_unlink: open_unlink.o $(LIBHANDLE) diff --git a/src/itrash.c b/src/itrash.c new file mode 100644 index 00000000..21e1c5c5 --- /dev/null +++ b/src/itrash.c @@ -0,0 +1,41 @@ +/* + * Bulkstat test case from Roger Willcocks + */ +#include +#include +#include +#include +#include + +char buffer[32768]; + +void die(char *func) +{ + perror(func); + exit(1); +} + +void nuke() +{ + int i; + for (i = 2048; i < 32768-1; i++) + if (buffer[i] == 'I' && buffer[i+1] == 'N') { + buffer[i] = buffer[i+1] = 'X'; + printf("Overwrote IN @offset %d\n", i); + } +} + +int main(int argc, char* argv[]) +{ + int f = open(argv[1], O_RDWR); + if (f < 0) die("open"); + if (lseek(f, 32768, SEEK_SET) < 0) die("lseek"); + if (read(f, buffer, 32768) != 32768) die("read"); + printf("Starting overwrite\n"); + nuke(); + if (lseek(f, 32768, SEEK_SET) < 0) die("lseek"); + if (write(f, buffer, 32768) != 32768) die("write"); + printf("Overwrite complete\n"); + close(f); + return 0; +} -- 2.47.3