From: Andreas Dilger Date: Mon, 18 Jan 2016 14:41:46 +0000 (-0500) Subject: LU-5030 tests: remove /proc paths from tests X-Git-Tag: 2.7.66~30 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=072d6b3156bf3b5d1738b43aadcba5c378c59ee9;ds=sidebyside LU-5030 tests: remove /proc paths from tests Remove the hard-coded /proc paths from cancel_lru_locks(). This was only kept around because of a legacy implementation of that function where it listed all lru_size files and then clear'd them manually. If the filenames contained '.' then "lctl {get_param,set_param}" get unhappy, but if the "lctl {get_param,set_param}" built-in globbing is used with a wildcard parameter like "MGC*" then the '.' in the param does not get replaced by '/' during processing and it just works. Fix sanity-sec.sh test_24 to use "lctl get_param -R". I couldn't see a functional difference between the two read checks in that test, so only left a single check. Signed-off-by: Andreas Dilger Signed-off-by: Emoly Liu Change-Id: I0aff1dd29d44b9272f56e18f0e443c7fab3ebbe5 Reviewed-on: http://review.whamcloud.com/17082 Tested-by: Jenkins Reviewed-by: John L. Hammond Reviewed-by: Ryan Haasken Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index ded5b51..612cba1 100755 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -1514,14 +1514,8 @@ test_24() { nodemap_test_setup trap nodemap_test_cleanup EXIT - for node in $(all_server_nodes); do - local node_ip=$(host_nids_address $node $NETTYPE) - do_node $node_ip 'find /proc/fs/lustre/nodemap -exec \ - cat {} \;' &> /dev/null - do_node $node_ip 'find /proc/fs/lustre/nodemap \ - -type f -perm /444 | xargs cat' &> /dev/null || - error "proc readable file read failed" - done + do_nodes $(comma_list $(all_server_nodes)) $LCTL get_param -R nodemap || + error "proc readable file read failed" nodemap_test_cleanup } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 498e3b2..ac56464 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9423,31 +9423,24 @@ test_133e() { } run_test 133e "Verifying OST {read,write}_bytes nid stats =================" -test_133f() { - local proc_dirs - - local dirs="/proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/ \ -/sys/fs/lustre/ /sys/fs/lnet/" - local dir - for dir in $dirs; do - if [ -d $dir ]; then - proc_dirs="$proc_dirs $dir" - fi - done - - local facet +proc_dirs="" +for dir in /proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/ \ + /sys/fs/lustre/ /sys/fs/lnet/ /sys/kernel/debug/lustre/; do + [[ -d $dir ]] && proc_dirs+=" $dir" +done +test_133f() { remote_mds_nodsh && skip "remote MDS with nodsh" && return remote_ost_nodsh && skip "remote OST with nodsh" && return # First without trusting modes. find $proc_dirs -exec cat '{}' \; &> /dev/null # Second verifying readability. - find $proc_dirs \ - -type f \ - -exec cat '{}' \; &> /dev/null || - error "proc file read failed" + $LCTL get_param -R &> /dev/null || error "proc file read failed" + # eventually, this can also be replaced with "lctl get_param -R", + # but not until that option is always available on the server + local facet for facet in $SINGLEMDS ost1; do do_facet $facet find $proc_dirs \ ! -name req_history \ @@ -9463,20 +9456,7 @@ test_133f() { run_test 133f "Check for LBUGs/Oopses/unreadable files in /proc" test_133g() { - local proc_dirs - - local dirs="/proc/fs/lustre/ /proc/sys/lnet/ /proc/sys/lustre/ \ -/sys/fs/lustre/ /sys/fs/lnet/" - local dir - for dir in $dirs; do - if [ -d $dir ]; then - proc_dirs="$proc_dirs $dir" - fi - done - - local facet - - # Second verifying readability. + # Second verifying writability. find $proc_dirs \ -type f \ -not -name force_lbug \ @@ -9490,6 +9470,7 @@ test_133g() { [ $(lustre_version_code ost1) -le $(version_code 2.5.54) ] && skip "Too old lustre on ost1" && return + local facet for facet in $SINGLEMDS ost1; do do_facet $facet find $proc_dirs \ -type f \ @@ -13380,7 +13361,7 @@ run_test 240 "race between ldlm enqueue and the connection RPC (no ASSERT)" test_241_bio() { for LOOP in $(seq $1); do dd if=$DIR/$tfile of=/dev/null bs=40960 count=1 2>/dev/null - cancel_lru_locks osc + cancel_lru_locks osc || true done } @@ -14307,22 +14288,13 @@ test_400b() { # LU-1606, LU-5011 run_test 400b "packaged headers can be compiled" test_401() { #LU-7437 - local params - local procs - #count the number of parameters by "list_param -R" - params=$($LCTL list_param -R '*' 2>/dev/null | wc -l) + local params=$($LCTL list_param -R '*' 2>/dev/null | wc -l) #count the number of parameters by listing proc files - ls -lRL /proc/{fs,sys}/{lnet,lustre} 2>/dev/null | - grep -v "^t" | grep -v "^d" > $TMP/$tfile - #Since there is no /proc/fs/lnet, we need to remove other - #3 directories, /proc/{fs,sys}/lustre and /proc/sys/lnet. - procs=$(($(sed /^$/d $TMP/$tfile | wc -l)-3)) + local procs=$(find -L $proc_dirs -mindepth 1 2>/dev/null | wc -l) [ $params -eq $procs ] || error "found $params parameters vs. $procs proc files" - - rm -f $TMP/$tfile } run_test 401 "Verify if 'lctl list_param -R' can list parameters recursively" diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index a81c609..57d4f24 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -4562,33 +4562,10 @@ set_nodes_failloc () { } cancel_lru_locks() { - $LCTL mark "cancel_lru_locks $1 start" - - if [ $1 != "MGC" ]; then - for d in $(lctl get_param -N ldlm.namespaces.*.lru_size | - egrep -i $1); do - $LCTL set_param -n $d=clear - done - $LCTL get_param ldlm.namespaces.*.lock_unused_count | egrep -i $1 | - grep -v '=0' - else - for d in $(find \ - /{proc,sys}/fs/lustre/ldlm/namespaces/*$1*/lru_size \ - 2> /dev/null); do - echo "clear" > $d - done - - for d in $(find \ - /{proc,sys}/fs/lustre/ldlm/namespaces/*$1*/lock_unused_count \ - 2> /dev/null); do - if [ $(cat $d) != 0 ]; then - echo "ldlm.namespaces.$(echo "$d" | - cut -f 7 -d'/').lock_unused_count=$(cat $d)" - fi - done - fi - - $LCTL mark "cancel_lru_locks $1 stop" + #$LCTL mark "cancel_lru_locks $1 start" + $LCTL set_param -n ldlm.namespaces.*$1*.lru_size=clear + $LCTL get_param ldlm.namespaces.*$1*.lock_unused_count | grep -v '=0' + #$LCTL mark "cancel_lru_locks $1 stop" } default_lru_size() diff --git a/lustre/utils/llobdstat b/lustre/utils/llobdstat index 2e63840..3ab51c6 100755 --- a/lustre/utils/llobdstat +++ b/lustre/utils/llobdstat @@ -10,7 +10,7 @@ my $obdstats = "stats"; sub usage() { print STDERR "Usage: $pname [ [}]\n"; - print STDERR "where ost_name : ost name under /{proc,sys}/fs/lustre/obdfilter\n"; + print STDERR "where ost_name : ost name under obdfilter\n"; print STDERR " interval : sample interval in seconds\n"; print STDERR "example: $pname lustre-OST0000 2\n"; print STDERR "Use CTRL + C to stop statistics printing\n";