xfs: fix tests to handle removal of no-alloc create nonfeature
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 13 Dec 2017 22:45:01 +0000 (14:45 -0800)
committerEryu Guan <eguan@redhat.com>
Fri, 15 Dec 2017 07:16:46 +0000 (15:16 +0800)
We're removing from XFS the ability to perform no-allocation file
creation.  This was added years ago because some customer of SGI
demanded that we still be able to create (empty?) files with zero
free blocks remaining so long as there were free inodes and space in
existing directory blocks.  This came at an unacceptable risk of
ENOSPC'ing midway through a transaction and shutting down the fs, so
we're removing it for the create case having changed our minds 20
years later.

However, some tests fail as a result, so fix them to be more
flexible about not failing when a dir/file creation fails due to
ENOSPC.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
tests/xfs/013
tests/xfs/014
tests/xfs/104
tests/xfs/109

index 80298caba87e2d8ae683aefe30d38675b7a48d06..394b9bce84f3334843ee0a8f9a7ba7a6bc69e5e8 100755 (executable)
@@ -145,8 +145,10 @@ $FSSTRESS_PROG -d $SCRATCH_MNT/fsstress -n 9999999 -p 2 -S t \
 for i in $(seq 1 $LOOPS)
 do
        # hard link the content of the current directory to the next
-       cp -Rl $SCRATCH_MNT/dir$i $SCRATCH_MNT/dir$((i+1)) 2>&1 | \
-               filter_enospc
+       while ! test -d $SCRATCH_MNT/dir$((i+1)); do
+               cp -Rl $SCRATCH_MNT/dir$i $SCRATCH_MNT/dir$((i+1)) 2>&1 | \
+                       filter_enospc
+       done
 
        # do a random replacement of files in the new directory
        _rand_replace $SCRATCH_MNT/dir$((i+1)) $COUNT
index 875ab400ca38bb86372d1c581a7f6b4c0b17c525..08cd001f74d9cf6accb0044b2ded01b098e27333 100755 (executable)
@@ -111,6 +111,9 @@ _test_enospc()
 
        # consume 1/2 of the current preallocation across the set of 4 writers
        write_size=$((TOTAL_PREALLOC / 2 / 4))
+       for i in $(seq 0 3); do
+               touch $dir/file.$i
+       done
        for i in $(seq 0 3); do
                $XFS_IO_PROG -f -c "pwrite 0 $write_size" $dir/file.$i \
                        >> $seqres.full &
index 785027e4c7fbc1d952d75c2bd78353ca26880e1b..c3b59775fdadc7d623e5ca662c097acce15edb3b 100755 (executable)
@@ -65,7 +65,7 @@ _stress_scratch()
        # -w ensures that the only ops are ones which cause write I/O
        FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -w -p $procs \
            -n $nops $FSSTRESS_AVOID`
-       $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full &
+       $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full 2>&1 &
 }
 
 # real QA test starts here
index e0fdec3dd7994dcfedd862be9438d370958960ff..2625f154a62f73e0e1cce379d0519f9630637d27 100755 (executable)
@@ -79,7 +79,7 @@ allocate()
                        while [ $j -lt 100 ]; do
                                $XFS_IO_PROG -f -c 'pwrite -b 64k 0 16m' $file \
                                        >/dev/null 2>&1
-                               rm $file
+                               test -e $file && rm $file
                                let j=$j+1
                        done
                } &