Whamcloud - gitweb
LU-9024 tests: improve conf-sanity test_63 output
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 02e2a61..5ee57af 100755 (executable)
@@ -522,6 +522,17 @@ test_5f() {
 }
 run_test 5f "mds down, cleanup after failed mount (bug 2712)"
 
+test_5g() {
+       modprobe lustre
+       [ $(lustre_version_code client) -lt $(version_code 2.9.53) ] &&
+               { skip "automount of debugfs missing before 2.9.53" && return 0; }
+       umount /sys/kernel/debug
+       $LCTL get_param -n devices | egrep -v "error" && \
+               error "lctl can't access debugfs data"
+       grep " debugfs " /etc/mtab || error "debugfs failed to remount"
+}
+run_test 5g "handle missing debugfs"
+
 test_6() {
        setup
        manual_umount_client
@@ -4482,27 +4493,27 @@ test_63() {
                return
        fi
 
-       local inode_slab=$(do_facet $SINGLEMDS \
-               "awk '/ldiskfs_inode_cache/ { print \\\$5 }' /proc/slabinfo")
+       do_rpc_nodes $(facet_active_host $SINGLEMDS) load_module ldiskfs
+       local inode_slab=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
+                          awk '/ldiskfs_inode_cache/ { print $5 / $6 }')
        if [ -z "$inode_slab" ]; then
                skip "ldiskfs module has not been loaded"
                return
        fi
 
-       echo "$inode_slab ldisk inodes per page"
-       if [ "$inode_slab" -ge "3" ] ; then
-               # If kmalloc-128 is also 1 per page - this is a debug kernel
-               # and so this is not an error.
-               local kmalloc128=$(do_facet $SINGLEMDS \
-                       "awk '/^(kmalloc|size)-128 / { print \\\$5 }' /proc/slabinfo")
-               # 32 128-byte chunks in 4k
-               [ "$kmalloc128" -eq "32" ] ||
-                       error "ldisk inode size is too big, $inode_slab objs per page"
-       fi
+       echo "$inode_slab ldiskfs inodes per page"
+       [ "${inode_slab%.*}" -ge "3" ] && return 0
 
-       return
+       # If kmalloc-128 is also 1 per page - this is a debug kernel
+       # and so this is not an error.
+       local kmalloc128=$(do_facet $SINGLEMDS "cat /proc/slabinfo" |
+                          awk '/^(kmalloc|size)-128 / { print $5 / $6 }')
+       # 32 128-byte chunks in 4k
+       [ "${kmalloc128%.*}" -lt "32" ] ||
+               error "ldiskfs inode too big, only $inode_slab objs/page, " \
+                     "kmalloc128 = $kmalloc128 objs/page"
 }
-run_test 63 "Verify each page can at least hold 3 ldisk inodes"
+run_test 63 "Verify each page can at least hold 3 ldiskfs inodes"
 
 test_64() {
        start_mds || error "unable to start MDS"
@@ -7028,6 +7039,43 @@ test_101() {
 }
 run_test 101 "Race MDT->OST reconnection with create"
 
+test_102() {
+       cleanup || error "cleanup failed with $?"
+
+       local mds1dev=$(mdsdevname 1)
+       local mds1mnt=$(facet_mntpt mds1)
+       local mds1fstype=$(facet_fstype mds1)
+       local mds1opts=$MDS_MOUNT_OPTS
+
+       if [ $mds1fstype == ldiskfs ] &&
+          ! do_facet mds1 test -b $mds1dev; then
+               mds1opts=$(csa_add "$mds1opts" -o loop)
+       fi
+       if [[ $mds1fstype == zfs ]]; then
+               import_zpool mds1 || return ${PIPESTATUS[0]}
+       fi
+
+       # unload all and only load libcfs to allow fail_loc setting
+       do_facet mds1 lustre_rmmod || error "unable to unload modules"
+       do_facet mds1 modprobe libcfs || error "libcfs not loaded"
+       do_facet mds1 lsmod \| grep libcfs || error "libcfs not loaded"
+
+       #define OBD_FAIL_OBDCLASS_MODULE_LOAD    0x60a
+       do_facet mds1 "$LCTL set_param fail_loc=0x8000060a"
+
+       do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts &&
+               error "mdt start must fail"
+       do_facet mds1 lsmod \| grep  obdclass && error "obdclass must not load"
+
+       do_facet mds1 "$LCTL set_param fail_loc=0x0"
+
+       do_facet mds1 $MOUNT_CMD $mds1dev $mds1mnt $mds1opts ||
+               error "mdt start must not fail"
+
+       cleanup || error "cleanup failed with $?"
+}
+run_test 102 "obdclass module cleanup upon error"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi