Whamcloud - gitweb
LU-6529 ldlm: cancel aged locks for LRUR
[fs/lustre-release.git] / lustre / tests / sanity.sh
index b37ceb6..e7747e5 100644 (file)
@@ -8395,6 +8395,38 @@ test_124b() {
 }
 run_test 124b "lru resize (performance test) ======================="
 
+test_124c() {
+       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ -z "$($LCTL get_param -n mdc.*.connect_flags | grep lru_resize)" ] &&
+               skip "no lru resize on server" && return 0
+
+       # cache ununsed locks on client
+       local nr=100
+       cancel_lru_locks mdc
+       test_mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+       createmany -o $DIR/$tdir/f $nr ||
+               error "failed to create $nr files in $DIR/$tdir"
+       ls -l $DIR/$tdir > /dev/null
+
+       local nsdir="ldlm.namespaces.*-MDT0000-mdc-*"
+       local unused=$($LCTL get_param -n $nsdir.lock_unused_count)
+       local max_age=$($LCTL get_param -n $nsdir.lru_max_age)
+       local recalc_p=$($LCTL get_param -n $nsdir.pool.recalc_period)
+       echo "unused=$unused, max_age=$max_age, recalc_p=$recalc_p"
+
+       # set lru_max_age to 1 sec
+       $LCTL set_param $nsdir.lru_max_age=1000 # jiffies
+       echo "sleep $((recalc_p * 2)) seconds..."
+       sleep $((recalc_p * 2))
+
+       local remaining=$($LCTL get_param -n $nsdir.lock_unused_count)
+       # restore lru_max_age
+       $LCTL set_param -n $nsdir.lru_max_age $max_age
+       [ $remaining -eq 0 ] || error "$remaining locks are not canceled"
+       unlinkmany $DIR/$tdir/f $nr
+}
+run_test 124c "LRUR cancel very aged locks"
+
 test_125() { # 13358
        [ -z "$(lctl get_param -n llite.*.client_type | grep local)" ] && skip "must run as local client" && return
        [ -z "$(lctl get_param -n mdc.*-mdc-*.connect_flags | grep acl)" ] && skip "must have acl enabled" && return
@@ -12008,12 +12040,19 @@ test_224c() { # LU-6441
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        local pages_per_rpc=$($LCTL get_param \
                                osc.*.max_pages_per_rpc)
-       local at_max=$(do_facet mgs "$LCTL get_param -n at_max")
-       local timeout=$(do_facet mgs "$LCTL get_param -n timeout")
+       local at_max=$($LCTL get_param -n at_max)
+       local timeout=$($LCTL get_param -n timeout)
+       local test_at="$LCTL get_param -n at_max"
+       local param_at="$FSNAME.sys.at_max"
+       local test_timeout="$LCTL get_param -n timeout"
+       local param_timeout="$FSNAME.sys.timeout"
 
        $LCTL set_param -n osc.*.max_pages_per_rpc=1024
-       do_facet mgs "$LCTL conf_param $FSNAME.sys.at_max=0"
-       do_facet mgs "$LCTL conf_param $FSNAME.sys.timeout=5"
+
+       set_conf_param_and_check client "$test_at" "$param_at" 0 ||
+               error "conf_param at_max=0 failed"
+       set_conf_param_and_check client "$test_timeout" "$param_timeout" 5 ||
+               error "conf_param timeout=5 failed"
 
        #define OBD_FAIL_PTLRPC_CLIENT_BULK_CB3   0x520
        $LCTL set_param fail_loc=0x520
@@ -12021,10 +12060,11 @@ test_224c() { # LU-6441
        sync
        $LCTL set_param fail_loc=0
 
-       do_facet mgs "$LCTL conf_param $FSNAME.sys.at_max=" \
-                               "$at_max"
-       do_facet mgs "$LCTL conf_param $FSNAME.sys.timeout=" \
-                               "$timeout"
+       set_conf_param_and_check client "$test_at" "$param_at" $at_max ||
+               error "conf_param at_max=$at_max failed"
+       set_conf_param_and_check client "$test_timeout" "$param_timeout" \
+               $timeout || error "conf_param timeout=$timeout failed"
+
        $LCTL set_param -n $pages_per_rpc
 }
 run_test 224c "Don't hang if one of md lost during large bulk RPC"