--- /dev/null
+#! /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
--- /dev/null
+#! /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
--- /dev/null
+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
--- /dev/null
+/*
+ * Bulkstat test case from Roger Willcocks <willcor@gmail.com>
+ */
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+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;
+}