From: Xiao Yang Date: Mon, 13 Feb 2017 11:21:50 +0000 (+0800) Subject: shared/005,7: make sure debugfs sets negative i_size X-Git-Tag: v2022.05.01~2178 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0e13e40b247a1;p=users%2Fhch%2Fxfstests-dev.git shared/005,7: make sure debugfs sets negative i_size shared/005 and shared/007 work abnornamlly on RHEL6.8GA and RHEL6.9Beta because debugfs fails to set i_size to -1 or -512 and reports "exceeds field size maximum". When debugfs fails to set a negative i_size, we can skip these cases which don't trigger the kernel bug. Signed-off-by: Xiao Yang Reviewed-by: Eryu Guan Signed-off-by: Eryu Guan --- diff --git a/tests/shared/005 b/tests/shared/005 index 296de178e..76c551c10 100755 --- a/tests/shared/005 +++ b/tests/shared/005 @@ -67,6 +67,13 @@ $DEBUGFS_PROG -w -R "sif /a size -1" $SCRATCH_DEV >> $seqres.full 2>&1 echo "Remount, try to append" _scratch_mount + +# check whether debugfs succeeds to set i_size to -1 or not +i_size=$(stat -c "%s" $testdir/a) +if [ $i_size -ne -1 ]; then + _notrun "Could not set i_size to -1 successfully, skip test." +fi + dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." sync diff --git a/tests/shared/007 b/tests/shared/007 index 0729ab852..77636f401 100755 --- a/tests/shared/007 +++ b/tests/shared/007 @@ -69,6 +69,13 @@ $DEBUGFS_PROG -w -R "sif /a size 0xFFFFFFFFFFFFFE00" $SCRATCH_DEV >> $seqres.ful echo "Remount, try to append" _scratch_mount + +# check whether debugfs succeeds to set i_size to -512 or not +i_size=$(stat -c "%s" $testdir/a) +if [ $i_size -ne -512 ]; then + _notrun "Could not set i_size to -512 successfully, skip test." +fi + dd if=/dev/zero of=$testdir/a bs=512 count=1 oflag=direct,append conv=notrunc >> $seqres.full 2>&1 || echo "Write did not succeed (ok)." sync