Whamcloud - gitweb
b=24051 sanity test_76 fix
authorAndrew Perepechko <andrew.perepechko@oracle.com>
Mon, 15 Nov 2010 12:29:06 +0000 (15:29 +0300)
committerAndrew Perepechko <andrew.perepechko@oracle.com>
Mon, 15 Nov 2010 12:29:06 +0000 (15:29 +0300)
Due to per-cpu slab caches, "active" stat from /proc/slabinfo
is not always accurate.

i=ZhiYong Tian

lustre/tests/sanity.sh

index 0a87269..af4bd91 100644 (file)
@@ -3563,7 +3563,20 @@ num_inodes() {
        awk '/lustre_inode_cache/ {print $2; exit}' /proc/slabinfo
 }
 
+get_inode_slab_tunables() {
+       awk '/lustre_inode_cache/ {print $9," ",$10," ",$11; exit}' /proc/slabinfo
+}
+
+set_inode_slab_tunables() {
+       echo "lustre_inode_cache $1" > /proc/slabinfo
+}
+
 test_76() { # Now for bug 20433, added originally in bug 1443
+       local SLAB_SETTINGS=`get_inode_slab_tunables`
+       local CPUS=`getconf _NPROCESSORS_ONLN`
+       # we cannot set limit below 1 which means 1 inode in each
+       # per-cpu cache is still allowed
+       set_inode_slab_tunables "1 1 0"
        cancel_lru_locks osc
        BEFORE_INODES=`num_inodes`
        echo "before inodes: $BEFORE_INODES"
@@ -3577,7 +3590,7 @@ test_76() { # Now for bug 20433, added originally in bug 1443
        AFTER_INODES=`num_inodes`
        echo "after inodes: $AFTER_INODES"
        local wait=0
-       while [ $AFTER_INODES -gt $BEFORE_INODES ]; do
+       while [ $((AFTER_INODES-1*CPUS)) -gt $BEFORE_INODES ]; do
                sleep 2
                AFTER_INODES=`num_inodes`
                wait=$((wait+2))
@@ -3586,6 +3599,7 @@ test_76() { # Now for bug 20433, added originally in bug 1443
                        error "inode slab grew from $BEFORE_INODES to $AFTER_INODES"
                fi
        done
+       set_inode_slab_tunables "$SLAB_SETTINGS"
 }
 run_test 76 "confirm clients recycle inodes properly ===="