Whamcloud - gitweb
Fix bug in get_per_page_niobufs() which always used the niobuf flags from
authoradilger <adilger>
Wed, 21 Jan 2004 09:44:50 +0000 (09:44 +0000)
committeradilger <adilger>
Wed, 21 Jan 2004 09:44:50 +0000 (09:44 +0000)
the first niobuf (which had OBD_BRW_FROM_GRANT set) and not any subsequent
niobuf (which generally didn't have it set).  This confused the obdfilter
into thinking the client was claiming a write was from grant.  With the old
limit scheme that was fatal, but the credits scheme handled it easily and
just reported an ungranted write until I could track it down.

Fix accounting for truncated pages, hopefully.  Also paves the way for
grant expiry in the future.

Change "CDEBUG(0, ...)" to mean "don't print" (compiler should remove it
entirely) so that we can turn off debug messages without deleting them
from the code.  That was only used in one place to mean "always print".

Add /proc/*/OSC/*/cur_grant_bytes for debugging.

Remove some old cruft to make room for grant fields.

b=974

lustre/tests/oos.sh

index 8519dad..2954472 100755 (executable)
@@ -1,9 +1,14 @@
 #!/bin/bash
 
+set -e
+set -vx
+
 export NAME=${NAME:-local}
 export OSTSIZE=10000
 
 MOUNT=${MOUNT:-/mnt/lustre}
+OOS=$MOUNT/oosfile
+LOG=$TMP/oosfile
 TMP=${TMP:-/tmp}
 
 echo "mnt.."
@@ -12,35 +17,46 @@ echo "done"
 
 SUCCESS=1
 
-FREESPACE=`df |grep $MOUNT|tr -s ' '|cut -d ' ' -f4`
+ORIGFREE=`df | grep $MOUNT | awk '{ print $4}'`
 
-rm -f $TMP/oosfile
-dd if=/dev/zero of=$MOUNT/oosfile count=$[$FREESPACE + 1] bs=1k 2>$TMP/oosfile
+export LANG=C LC_LANG=C # for "No space left on device" message
 
-RECORDSOUT=`grep "records out" $TMP/oosfile|cut -d + -f1`
+if dd if=/dev/zero of=$OOS count=$(($ORIGFREE + 16)) bs=1k 2> $LOG; then
+       echo "ERROR: dd did not fail"
+       SUCCESS=0
+fi
 
-[ -z "`grep "No space left on device" $TMP/oosfile`" ] && \
-        echo "failed:dd not return ENOSPC" && SUCCESS=0
+RECORDSOUT=`grep "records out" $LOG | cut -d + -f1`
 
-REMAINEDFREE=`df |grep $MOUNT|tr -s ' '|cut -d ' ' -f4`
-[ $[$FREESPACE - $REMAINEDFREE ] -lt $RECORDSOUT ] && \
-        echo "failed:the space written by dd not equal to available space" && \
-        SUCCESS=0 && echo "$FREESPACE - $REMAINEDFREE $RECORDSOUT"
+if [ -z "`grep "No space left on device" $LOG`" ]; then
+        echo "ERROR: dd not return ENOSPC"
+       SUCCESS=0
+fi
+
+LEFTFREE=`df | grep $MOUNT | awk '{ print $4 }'`
+if [ $(($ORIGFREE - $LEFTFREE)) -lt $RECORDSOUT ]; then
+        echo "ERROR: space used by dd not equal to available space"
+        SUCCESS=0
+       echo "$ORIGFREE - $LEFTFREE $RECORDSOUT"
+fi
 
-[ $REMAINEDFREE -gt 100 ] && \
-       echo "failed:too many space left $REMAINEDFREE and -ENOSPC returned" &&\
+if [ $LEFTFREE -gt 100 ]; then
+       echo "ERROR: too much space left $LEFTFREE and -ENOSPC returned"
        SUCCESS=0
+fi
 
-FILESIZE=`ls -l $MOUNT/oosfile|tr -s ' '|cut -d ' ' -f5`
-[ $RECORDSOUT -ne $[$FILESIZE/1024] ] && \
-        echo "failed:the space written by dd not equal to the size of file" && \
+FILESIZE=`ls -l $OOS | awk '{ print $5 }'`
+if [ $RECORDSOUT -ne $(($FILESIZE / 1024)) ]; then
+        echo "ERROR: blocks written by dd not equal to the size of file"
         SUCCESS=0
+fi
 
-[ $SUCCESS -eq 1 ] && echo "Success!"
+if [ $SUCCESS -eq 1 ]; then
+       echo "Success!"
 
-rm -f $MOUNT/oosfile*
-rm -f $TMP/oosfile
+       rm -f $OOS
+       rm -f $LOG
 
-echo ""
-echo "cln.."
-sh llmountcleanup.sh
+       echo -e "\ncln.."
+       sh llmountcleanup.sh
+fi