Whamcloud - gitweb
LU-12207 tests: allow some margin for sanity/76 27/37827/2
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 6 Mar 2020 23:58:46 +0000 (16:58 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 10 Mar 2020 23:36:46 +0000 (23:36 +0000)
With newer slab allocators it is possible that the kernel may keep
some inodes in the per-cpu cache and not release all of them.  This
was resulting sanity test_76 failures with a few (often 12) inodes
not being freed of the inodes that are created by the test, like:

    inode slab grew from 3224 to 3236
    inode slab grew from 70368 to 70380
    inode slab grew from 68878 to 68890

Allow some small number of inodes (8 per core) cached on the client
without considering it a test failure failure.

Clean up test_76 code style to current standards.

Test-Parameters: trivial testlist=sanity env=ONLY=76,ONLY_REPEAT=100
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ia3f60de2fb471bb32da27d36665a3a0fd43ebbe5
Reviewed-on: https://review.whamcloud.com/37827
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Ben Evans <beevans@whamcloud.com>
Reviewed-by: James Nunez <jnunez@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index 1f25579..a2dfedd 100755 (executable)
@@ -8237,28 +8237,27 @@ num_inodes() {
 test_76() { # Now for bug 20433, added originally in bug 1443
        [ $PARALLEL == "yes" ] && skip "skip parallel run"
 
-       local CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
-
        cancel_lru_locks osc
-       BEFORE_INODES=$(num_inodes)
-       echo "before inodes: $BEFORE_INODES"
-       local COUNT=1000
-       [ "$SLOW" = "no" ] && COUNT=100
-       for i in $(seq $COUNT); do
+       local cpus=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
+       local before=$(num_inodes)
+       local count=$((512 * cpus))
+       [ "$SLOW" = "no" ] && count=$((64 * cpus))
+
+       echo "before inodes: $before"
+       for i in $(seq $count); do
                touch $DIR/$tfile
                rm -f $DIR/$tfile
        done
        cancel_lru_locks osc
-       AFTER_INODES=$(num_inodes)
-       echo "after inodes: $AFTER_INODES"
-       local wait=0
-       while [[ $((AFTER_INODES-1*${CPUS:-1})) -gt $BEFORE_INODES ]]; do
-               sleep 2
-               AFTER_INODES=$(num_inodes)
-               wait=$((wait+2))
-               echo "wait $wait seconds inodes: $AFTER_INODES"
-               if [ $wait -gt 30 ]; then
-                       error "inode slab grew from $BEFORE_INODES to $AFTER_INODES"
+       local after=$(num_inodes)
+       echo "after inodes: $after"
+       while (( after > before + 8 * ${cpus:-1} )); do
+               sleep 1
+               after=$(num_inodes)
+               wait=$((wait + 1))
+               (( wait % 5 == 0 )) && echo "wait $wait seconds inodes: $after"
+               if (( wait > 30 )); then
+                       error "inode slab grew from $before to $after"
                fi
        done
 }