From: Vikentsi Lapa Date: Tue, 3 Dec 2024 12:48:33 +0000 (+0000) Subject: LU-17224 tests: improve OST out-of-space testing X-Git-Tag: 2.16.55~103 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=dcd5f6c0a0139c9d0f338509b19d9e4dce01a29e;p=fs%2Flustre-release.git LU-17224 tests: improve OST out-of-space testing Add file system reservation with fallocate to reduce I/O size with dd command Test-Parameters: trivial testlist=sanityn env=MAXFREE=60000000 Signed-off-by: Vikentsi Lapa Change-Id: I40b64c1825aa5067788b6b31902d282ba59ccd13 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57260 Reviewed-by: Andreas Dilger Reviewed-by: Rajeev Mishra Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/tests/oos2.sh b/lustre/tests/oos2.sh index 5e3d3bb..8ab2800 100644 --- a/lustre/tests/oos2.sh +++ b/lustre/tests/oos2.sh @@ -12,20 +12,25 @@ MOUNT2=${MOUNT2:-$2} MOUNT2=${MOUNT2:-${MOUNT}2} OOS=$MOUNT/oosfile OOS2=$MOUNT2/oosfile2 +OOSFALLOCATE=$MOUNT/oosfile_fallocate LOG=$TMP/$(basename $0 .sh).log LOG2=${LOG}2 SUCCESS=1 -rm -f $OOS $OOS2 $LOG $LOG2 +rm -f $OOS $OOS2 $LOG $LOG2 $OOSFALLOCATE sync; sleep 1; sync # to ensure we get up-to-date statfs info STRIPECOUNT=$($LCTL get_param -n lov.*.activeobd | head -n 1) ORIGFREE=$($LCTL get_param -n llite.*.kbytesavail | head -n 1) -MAXFREE=${MAXFREE:-$((400000 * $STRIPECOUNT))} +NUMBER_OF_FREE_BLOCKS=4096 # for dd command keep only 4MB space +FALLOCATE_SIZE=$(( $ORIGFREE - $NUMBER_OF_FREE_BLOCKS )) # space to fill FS +MAXFREE=${MAXFREE:-$((1048576000 * $STRIPECOUNT))} echo STRIPECOUNT=$STRIPECOUNT ORIGFREE=$ORIGFREE MAXFREE=$MAXFREE -if [ $ORIGFREE -gt $MAXFREE ]; then + + +if (( $ORIGFREE > $MAXFREE )); then skip "$0: ${ORIGFREE}kB free gt MAXFREE ${MAXFREE}kB, increase $MAXFREE (or reduce test fs size) to proceed" exit 0 fi @@ -35,9 +40,21 @@ export LANG=C LC_LANG=C # for "No space left on device" message # make sure we stripe over all OSTs to avoid OOS on only a subset of OSTs $LFS setstripe $OOS -c $STRIPECOUNT $LFS setstripe $OOS2 -c $STRIPECOUNT -dd if=/dev/zero of=$OOS count=$((3 * $ORIGFREE / 4 + 100)) bs=1k 2>> $LOG & +$LFS setstripe $OOSFALLOCATE -c $STRIPECOUNT + +# skip ZFS due to https://github.com/openzfs/zfs/issues/326 +# TODO: check support for zfs set reservation=10G to reduce free space +if [[ $(facet_fstype $facet) != zfs ]]; then + if ! fallocate -l $FALLOCATE_SIZE $OOSFALLOCATE 2>> $LOG; then + echo "ERROR: fallocate -l $FALLOCATE_SIZE $OOSFALLOCATE failed" + SUCCESS=0 + fi +fi + +NUMBER_OF_IO_BLOCKS=$((3 * $ORIGFREE / 4 + 100)) # use 75% or 3/4 of free space +dd if=/dev/zero of=$OOS count=$NUMBER_OF_IO_BLOCKS bs=1k 2>> $LOG & DDPID=$! -if dd if=/dev/zero of=$OOS2 count=$((3*$ORIGFREE/4 + 100)) bs=1k 2>> $LOG2; then +if dd if=/dev/zero of=$OOS2 count=$NUMBER_OF_IO_BLOCKS bs=1k 2>> $LOG2; then echo "ERROR: dd2 did not fail" SUCCESS=0 fi @@ -74,7 +91,7 @@ fi echo LOG LOG2 file cat $LOG $LOG2 -rm -f $OOS $OOS2 +rm -f $OOS $OOS2 $OOSFALLOCATE sync; sleep 1; sync if [ $SUCCESS -eq 1 ]; then