From ec72e1c68e0008b1952e55b100205402ba30350c Mon Sep 17 00:00:00 2001 From: komaln <komaln> Date: Sun, 2 Mar 2008 19:19:15 +0000 Subject: [PATCH] b=14471 r=Adilger Changed sanity.sh to use 'lctl {get,set}_param' --- lustre/tests/sanity.sh | 389 +++++++++++++++++++---------------------- 1 file changed, 181 insertions(+), 208 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index dcdf12b549..5c02aa4fd1 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -87,10 +87,9 @@ setup() { check_kernel_version() { - VERSION_FILE=$LPROC/version + VERSION_FILE=version WANT_VER=$1 - [ ! -f $VERSION_FILE ] && echo "can't find kernel version" && return 1 - GOT_VER=$(awk '/kernel:/ {print $2}' $VERSION_FILE) + GOT_VER=$(lctl get_param -n $VERSION_FILE | awk '/kernel:/ {print $2}') [ $GOT_VER == "patchless" ] && return 0 [ $GOT_VER -ge $WANT_VER ] && return 0 log "test needs at least kernel version $WANT_VER, running $GOT_VER" @@ -109,11 +108,11 @@ check_and_setup_lustre DIR=${DIR:-$MOUNT} [ -z "`echo $DIR | grep $MOUNT`" ] && echo "$DIR not in $MOUNT" && exit 99 -LOVNAME=`cat $LPROC/llite/*/lov/common_name | tail -n 1` -OSTCOUNT=`cat $LPROC/lov/$LOVNAME/numobd` -STRIPECOUNT=`cat $LPROC/lov/$LOVNAME/stripecount` -STRIPESIZE=`cat $LPROC/lov/$LOVNAME/stripesize` -ORIGFREE=`cat $LPROC/lov/$LOVNAME/kbytesavail` +LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1` +OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd` +STRIPECOUNT=`lctl get_param -n lov.$LOVNAME.stripecount` +STRIPESIZE=`lctl get_param -n lov.$LOVNAME.stripesize` +ORIGFREE=`lctl get_param -n lov.$LOVNAME.kbytesavail` MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))} [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo @@ -901,11 +900,11 @@ reset_enospc() { exhaust_precreations() { OSTIDX=$1 - OST=$(grep ${OSTIDX}": " $LPROC/lov/${LOVNAME}/target_obd | \ + OST=$(lctl get_param -n lov.${LOVNAME}.target_obd | grep ${OSTIDX}": " | \ awk '{print $2}' | sed -e 's/_UUID$//') # on the mdt's osc - last_id=$(cat $LPROC/osc/${OST}-osc/prealloc_last_id) - next_id=$(cat $LPROC/osc/${OST}-osc/prealloc_next_id) + last_id=$(lctl get_param -n osc.${OST}-osc.prealloc_last_id) + next_id=$(lctl get_param -n osc.${OST}-osc.prealloc_next_id) mkdir -p $DIR/d27/${OST} $SETSTRIPE $DIR/d27/${OST} -i $OSTIDX -c 1 @@ -913,7 +912,7 @@ exhaust_precreations() { sysctl -w lustre.fail_loc=0x215 echo "Creating to objid $last_id on ost $OST..." createmany -o $DIR/d27/${OST}/f $next_id $((last_id - next_id + 2)) - grep '[0-9]' $LPROC/osc/${OST}-osc/prealloc* + lctl get_param -n osc.${OST}-osc.prealloc* | grep '[0-9]' reset_enospc $2 } @@ -1101,17 +1100,16 @@ test_29() { touch $DIR/d29/foo log 'first d29' ls -l $DIR/d29 - MDCDIR=${MDCDIR:-`find $LPROC/ldlm/namespaces | grep mdc | head -1`} - LOCKCOUNTORIG=`cat $MDCDIR/lock_count` - LOCKUNUSEDCOUNTORIG=`cat $MDCDIR/lock_unused_count` + LOCKCOUNTORIG=`lctl get_param -n ldlm.namespaces.*mdc*.lock_count` + LOCKUNUSEDCOUNTORIG=`lctl get_param -n ldlm.namespaces.*mdc*.lock_unused_count` [ -z $"LOCKCOUNTORIG" ] && echo "No mdc lock count" && return 1 log 'second d29' ls -l $DIR/d29 log 'done' - LOCKCOUNTCURRENT=`cat $MDCDIR/lock_count` - LOCKUNUSEDCOUNTCURRENT=`cat $MDCDIR/lock_unused_count` + LOCKCOUNTCURRENT=`lctl get_param -n ldlm.namespaces.*mdc*.lock_count` + LOCKUNUSEDCOUNTCURRENT=`lctl get_param -n ldlm.namespaces.*mdc*.lock_unused_count` if [ "$LOCKCOUNTCURRENT" -gt "$LOCKCOUNTORIG" ]; then - echo > $LPROC/ldlm/dump_namespaces + lctl set_param -n ldlm.dump_namespaces "" error "CURRENT: $LOCKCOUNTCURRENT > $LOCKCOUNTORIG" $LCTL dk | sort -k4 -t: > $TMP/test_29.dk log "dumped log to $TMP/test_29.dk (bug 5793)" @@ -1571,7 +1569,7 @@ run_test 36f "utime on file racing with OST BRW write ==========" test_36g() { remote_ost && skip "remote OST" && return - export FMD_MAX_AGE=`do_facet ost1 cat $LPROC/obdfilter/*/client_cache_seconds 2> /dev/null | head -n 1` + export FMD_MAX_AGE=`do_facet ost1 lctl get_param -n obdfilter.*.client_cache_seconds 2> /dev/null | head -n 1` FMD_BEFORE="`awk '/ll_fmd_cache/ { print $2 }' /proc/slabinfo`" touch $DIR/d36/$tfile sleep $((FMD_MAX_AGE + 12)) @@ -1631,7 +1629,7 @@ test_41() { run_test 41 "test small file write + fstat =====================" count_ost_writes() { - cat $LPROC/osc/*/stats | + lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }' } @@ -1694,7 +1692,7 @@ test_42a() { stop_writeback sync; sleep 1; sync # just to be safe BEFOREWRITES=`count_ost_writes` - grep "[0-9]" $LPROC/osc/*[oO][sS][cC][_-]*/cur_grant_bytes + lctl get_param -n osc.*[oO][sS][cC][_-]*.cur_grant_bytes | grep "[0-9]" dd if=/dev/zero of=$DIR/f42a bs=1024 count=100 AFTERWRITES=`count_ost_writes` [ $BEFOREWRITES -eq $AFTERWRITES ] || \ @@ -1865,8 +1863,8 @@ run_test 44a "test sparse pwrite ===============================" dirty_osc_total() { tot=0 - for d in $LPROC/osc/*/cur_dirty_bytes; do - tot=$(($tot + `cat $d`)) + for d in `lctl get_param -n osc.*.cur_dirty_bytes`; do + tot=$(($tot + d)) done echo $tot } @@ -2168,15 +2166,16 @@ run_test 52c "immutable flag test for client < 1.4.7 =======" test_53() { remote_mds && skip "remote MDS" && return - for i in `ls -d $LPROC/osc/*-osc 2> /dev/null` ; do - ostname=`basename $i | cut -d - -f 1-2` - ost_last=`cat $LPROC/obdfilter/$ostname/last_id` - mds_last=`cat $i/prealloc_last_id` - echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" - if [ $ost_last != $mds_last ]; then - error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" - fi - done + for VALUE in `lctl get_param osc.*-osc.prealloc_last_id`; do + param=`echo ${VALUE[0]} | cut -d "=" -f1`; + ostname=`echo $param | cut -d "." -f2 | cut -d - -f 1-2` + mds_last=`lctl get_param -n $param` + ost_last=`lctl get_param -n obdfilter.$ostname.last_id` + echo "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" + if [ $ost_last != $mds_last ]; then + error "$ostname.last_id=$ost_last ; MDS.last_id=$mds_last" + fi + done } run_test 53 "verify that MDS and OSTs agree on pre-creation ====" @@ -2475,10 +2474,10 @@ run_test 56o "check lfs find -mtime for old files ==========================" test_57a() { remote_mds && skip "remote MDS" && return - local MNTDEV="$LPROC/mds/*/mntdev" - DEV=$(cat $MNTDEV) + local MNTDEV="mds.*.mntdev" + DEV=$(lctl get_param -n $MNTDEV) [ -z "$DEV" ] && error "can't access $MNTDEV" - for DEV in `cat $MNTDEV`; do + for DEV in `lctl get_param -n $MNTDEV`; do dumpe2fs -h $DEV > $TMP/t57a.dump || error "can't access $DEV" DEVISIZE=`awk '/Inode size:/ { print $3 }' $TMP/t57a.dump` [ "$DEVISIZE" -gt 128 ] || error "inode size $DEVISIZE" @@ -2501,8 +2500,8 @@ test_57b() { $GETSTRIPE $FILE1 2>&1 | grep -q "no stripe" || error "$FILE1 has an EA" $GETSTRIPE $FILEN 2>&1 | grep -q "no stripe" || error "$FILEN has an EA" - MDSFREE="`cat $LPROC/mds/*/kbytesfree 2> /dev/null`" - MDCFREE="`cat $LPROC/mdc/*/kbytesfree | head -n 1`" + MDSFREE="`lctl get_param -n mds.*.kbytesfree 2> /dev/null`" + MDCFREE="`lctl get_param -n mdc.*.kbytesfree | head -n 1`" echo "opening files to create objects/EAs" for FILE in `seq -f $DIR/d57b/f%g 1 $FILECOUNT`; do $OPENFILE -f O_RDWR $FILE > /dev/null || error "opening $FILE" @@ -2513,8 +2512,8 @@ test_57b() { $GETSTRIPE $FILEN | grep -q "obdidx" || error "$FILEN missing EA" sleep 1 # make sure we get new statfs data - MDSFREE2="`cat $LPROC/mds/*/kbytesfree 2> /dev/null`" - MDCFREE2="`cat $LPROC/mdc/*/kbytesfree | head -n 1`" + MDSFREE2="`lctl get_param -n mds.*.kbytesfree 2> /dev/null`" + MDCFREE2="`lctl get_param -n mdc.*.kbytesfree | head -n 1`" if [ "$MDCFREE2" -lt "$((MDCFREE - 8))" ]; then if [ "$MDSFREE" != "$MDSFREE2" ]; then error "MDC before $MDCFREE != after $MDCFREE2" @@ -2624,10 +2623,8 @@ test_62() { # bug 2319 - oig_wait() interrupted causes crash because of invalid waitq. test_63() { - MAX_DIRTY_MB=`cat $LPROC/osc/*/max_dirty_mb | head -n 1` - for i in $LPROC/osc/*/max_dirty_mb ; do - echo 0 > $i - done + MAX_DIRTY_MB=`lctl get_param -n osc.*.max_dirty_mb | head -n 1` + lctl set_param -n osc.*.max_dirty_mb 0 for i in `seq 10` ; do dd if=/dev/zero of=$DIR/f63 bs=8k & sleep 5 @@ -2635,9 +2632,7 @@ test_63() { sleep 1 done - for i in $LPROC/osc/*/max_dirty_mb ; do - echo $MAX_DIRTY_MB > $i - done + lctl set_param -n osc.*.max_dirty_mb $MAX_DIRTY_MB rm -f $DIR/f63 || true } run_test 63 "Verify oig_wait interruption does not crash =======" @@ -2657,7 +2652,7 @@ test_63b() { multiop $DIR/$tfile Owy && \ error "sync didn't return ENOMEM" sync; sleep 2; sync # do a real sync this time to flush page - grep locked $LPROC/llite/*/dump_page_cache && \ + lctl get_param -n llite.*.dump_page_cache | grep locked && \ error "locked page left in cache after async error" || true debugrestore } @@ -2665,7 +2660,7 @@ run_test 63b "async write errors should be returned to fsync ===" test_64a () { df $DIR - grep "[0-9]" $LPROC/osc/*[oO][sS][cC][_-]*/cur* + lctl get_param -n osc.*[oO][sS][cC][_-]*.cur* | grep "[0-9]" } run_test 64a "verify filter grant calculations (in kernel) =====" @@ -2777,7 +2772,7 @@ test_65k() { # bug11679 do_facet mds lctl --device %$INACTIVE_OSC deactivate for STRIPE_OSC in $MDS_OSCS; do STRIPE_OST=`osc_to_ost $STRIPE_OSC` - STRIPE_INDEX=`do_facet mds cat $LPROC/lov/*md*/target_obd | + STRIPE_INDEX=`do_facet mds lctl get_param -n lov.*md*.target_obd | grep $STRIPE_OST | awk -F: '{print $1}'` echo "$SETSTRIPE $DIR/$tdir/${STRIPE_INDEX} -i ${STRIPE_INDEX} -c 1" do_facet client $SETSTRIPE $DIR/$tdir/${STRIPE_INDEX} -i ${STRIPE_INDEX} -c 1 @@ -2816,22 +2811,18 @@ test_67() { # bug 3285 - supplementary group fails on MDS, passes on client chgrp $RUNAS_ID $DIR/$tdir $RUNAS -u $RUNAS_ID -g $(($RUNAS_ID + 1)) -G1,2,$RUNAS_ID ls $DIR/$tdir RC=$? - MDS=$(\ls $LPROC/mds 2> /dev/null | grep -v num_refs | tail -n 1) - if [ "$MDS" ]; then - # can't tell which is correct otherwise - GROUP_UPCALL=`cat $LPROC/mds/$MDS/group_upcall` - [ "$GROUP_UPCALL" = "NONE" -a $RC -eq 0 ] && \ - error "no-upcall passed" || true - [ "$GROUP_UPCALL" != "NONE" -a $RC -ne 0 ] && \ - error "upcall failed" || true - fi + GROUP_UPCALL=`lctl get_param -n mds.*.group_upcall` + [ "$GROUP_UPCALL" = "NONE" -a $RC -eq 0 ] && \ + error "no-upcall passed" || true + [ "$GROUP_UPCALL" != "NONE" -a $RC -ne 0 ] && \ + error "upcall failed" || true } run_test 67 "supplementary group failure (should return error) =" cleanup_67b() { set +vx trap 0 - echo NONE > $LPROC/mds/$MDS/group_upcall + lctl set_param -n mds.$MDS.group_upcall NONE } test_67b() { # bug 3285 - supplementary group fails on MDS, passes on client @@ -2839,14 +2830,14 @@ test_67b() { # bug 3285 - supplementary group fails on MDS, passes on client [ "$UID" = "$T67_UID" ] && skip "UID = T67_UID = $UID -- skipping" && return check_kernel_version 35 || return 0 remote_mds && skip "remote MDS" && return - GROUP_UPCALL=`cat $LPROC/mds/$MDS/group_upcall` + GROUP_UPCALL=`lctl get_param -n mds.$MDS.group_upcall` [ "$GROUP_UPCALL" != "NONE" ] && skip "skip test - upcall" &&return set -vx trap cleanup_67b EXIT mkdir -p $DIR/$tdir chmod 771 $DIR/$tdir chgrp $T67_UID $DIR/$tdir - echo `which l_getgroups` > $LPROC/mds/$MDS/group_upcall + lctl set_param -n mds.$MDS.group_upcall `which l_getgroups` l_getgroups -d $T67_UID $RUNAS -u $T67_UID -g 999 -G8,9,$T67_UID touch $DIR/$tdir/$tfile || \ error "'touch $DIR/$tdir/$tfile' failed" @@ -2880,7 +2871,7 @@ swap_used() { # and then consuming memory until it is used. test_68() { [ "$UID" != 0 ] && skip "must run as root" && return - grep -q obdfilter $LPROC/devices && \ + lctl get_param -n devices | grep -q obdfilter && \ skip "local OST" && return grep -q llite_lloop /proc/modules @@ -2917,7 +2908,7 @@ run_test 68 "support swapping to Lustre ========================" # bug5265, obdfilter oa2dentry return -ENOENT # #define OBD_FAIL_OST_ENOENT 0x217 test_69() { - [ $(grep -c obdfilter $LPROC/devices) -eq 0 ] && + [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && skip "skipping test for remote OST" && return f="$DIR/$tfile" @@ -3183,7 +3174,8 @@ run_test 76 "destroy duplicate inodes in client inode cache ====" export ORIG_CSUM="" set_checksums() { - [ "$ORIG_CSUM" ] || ORIG_CSUM=`cat $LPROC/osc/*/checksums | head -n1` + [ "$ORIG_CSUM" ] || ORIG_CSUM=`lctl get_param -n osc.*.checksums | + head -n1` for f in $LPROC/osc/*/checksums; do echo $1 >> $f done @@ -3195,11 +3187,10 @@ CKSUM_TYPES=${CKSUM_TYPES:-"crc32 adler"} set_checksum_type() { [ "$ORIG_CSUM_TYPE" ] || \ - ORIG_CSUM_TYPE=`sed 's/.*\[\(.*\)\].*/\1/g' \ - $LPROC/osc/*osc-[^mM]*/checksum_type | head -n1` - for f in $LPROC/osc/*osc-*/checksum_type; do - echo $1 > $f - done + ORIG_CSUM_TYPE=`lctl get_param -n osc.*osc-[^mM]*.checksum_type | sed 's/.*\[\(.*\)\].*/\1/g' \ + | head -n1` + echo "chksum..."$ORIG_CSUM_TYPE + lctl set_param -n osc.*osc-*.checksum_type $1 log "set checksum type to $1" return 0 } @@ -3287,7 +3278,7 @@ test_77f() { # bug 10889 run_test 77f "repeat checksum error on write (expect error) ====" test_77g() { # bug 10889 - [ $(grep -c obdfilter $LPROC/devices) -eq 0 ] && \ + [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && \ skip "remote OST" && return [ ! -f $F77_TMP ] && setup_f77 #define OBD_FAIL_OST_CHECKSUM_RECEIVE 0x21a @@ -3301,7 +3292,7 @@ test_77g() { # bug 10889 run_test 77g "checksum error on OST write ======================" test_77h() { # bug 10889 - [ $(grep -c obdfilter $LPROC/devices) -eq 0 ] && \ + [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && \ skip "remote OST" && return [ ! -f $DIR/f77g ] && skip "requires 77g - skipping" && return cancel_lru_locks osc @@ -3319,8 +3310,9 @@ test_77i() { # bug 13805 sysctl -w lustre.fail_loc=0x40b remount_client $MOUNT sysctl -w lustre.fail_loc=0 - for f in $LPROC/osc/*osc-[^mM]*/checksum_type; do - algo=`sed 's/.*\[\(.*\)\].*/\1/g' $f` + for VALUE in `lctl get_param osc.*osc-[^mM]*.checksum_type`; do + param=`echo ${VALUE[0]} | cut -d "=" -f1` + algo=`lctl get_param -n $param | sed 's/.*\[\(.*\)\].*/\1/g'` [ "$algo" = "crc32" ] || error "algo set to $algo instead of crc32" done remount_client $MOUNT @@ -3332,8 +3324,9 @@ test_77j() { # bug 13805 sysctl -w lustre.fail_loc=0x40c remount_client $MOUNT sysctl -w lustre.fail_loc=0 - for f in $LPROC/osc/*osc-[^mM]*/checksum_type; do - algo=`sed 's/.*\[\(.*\)\].*/\1/g' $f` + for VALUE in `lctl get_param osc.*osc-[^mM]*.checksum_type`; do + param=`echo ${VALUE[0]} | cut -d "=" -f1` + algo=`lctl get_param -n $param | sed 's/.*\[\(.*\)\].*/\1/g'` [ "$algo" = "adler" ] || error "algo set to $algo instead of adler" done remount_client $MOUNT @@ -3375,17 +3368,17 @@ test_78() { # bug 10901 run_test 78 "handle large O_DIRECT writes correctly ============" test_79() { # bug 12743 - [ $(grep -c obdfilter $LPROC/devices) -eq 0 ] && + [ $(lctl get_param -n devices | grep -c obdfilter) -eq 0 ] && skip "skipping test for remote OST" && return wait_delete_completed - BKTOTAL=`awk 'BEGIN{total=0}; {total+=$1}; END{print total}' \ - $LPROC/obdfilter/*/kbytestotal` - BKFREE=`awk 'BEGIN{free=0}; {free+=$1}; END{print free}' \ - $LPROC/obdfilter/*/kbytesfree` - BKAVAIL=`awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}' \ - $LPROC/obdfilter/*/kbytesavail` + BKTOTAL=`lctl get_param -n obdfilter.*.kbytestotal | + awk 'BEGIN{total=0}; {total+=$1}; END{print total}'` + BKFREE=`lctl get_param -n obdfilter.*.kbytesfree | + awk 'BEGIN{free=0}; {free+=$1}; END{print free}'` + BKAVAIL=`lctl get_param -n obdfilter.*.kbytesavail | + awk 'BEGIN{avail=0}; {avail+=$1}; END{print avail}'` STRING=`df -P $MOUNT | tail -n 1 | awk '{print $2","$3","$4}'` DFTOTAL=`echo $STRING | cut -d, -f1` DFUSED=`echo $STRING | cut -d, -f2` @@ -3519,11 +3512,9 @@ function get_named_value() done } -export CACHE_MAX=`cat $LPROC/llite/*/max_cached_mb | head -n 1` +export CACHE_MAX=`lctl get_param -n llite/*/max_cached_mb | head -n 1` cleanup_101() { - for s in $LPROC/llite/*/max_cached_mb; do - echo $CACHE_MAX > $s - done + lctl set_param -n llite.*.max_cached_mb $CACHE_MAX trap 0 } @@ -3534,14 +3525,11 @@ test_101() { [ "$CPU" = "UML" ] && nreads=1000 local cache_limit=32 - for s in $LPROC/osc/*/rpc_stats; do - echo 0 > $s - done + lctl set_param -n osc.*.rpc_stats 0 trap cleanup_101 EXIT - for s in $LPROC/llite/*; do - echo 0 > $s/read_ahead_stats - echo $cache_limit > $s/max_cached_mb - done + + lctl set_param -n llite.*.read_ahead_stats 0 + lctl set_param -n llite.*.max_cached_mb $cache_limit # # randomly read 10000 of 64K chunks from file 3x 32MB in size @@ -3550,18 +3538,14 @@ test_101() { $RANDOM_READS -f $DIR/$tfile -s$((cache_limit * 3192 * 1024)) -b65536 -C -n$nreads -t 180 discard=0 - for s in $LPROC/llite/*; do - discard=$(($discard + $(cat $s/read_ahead_stats | get_named_value 'read but discarded'))) + for s in `lctl get_param -n llite.*.read_ahead_stats | get_named_value 'read but discarded'`; do + discard=$(($discard + $s)) done cleanup_101 if [ $(($discard * 10)) -gt $nreads ] ;then - for s in $LPROC/osc/*/rpc_stats; do - echo $s; cat $s - done - for s in $LPROC/llite/*/read_ahead_stats; do - echo $s; cat $s - done + lctl get_param osc.*.rpc_stats + lctl get_param llite.*.read_ahead_stats error "too many ($discard) discarded pages" fi rm -f $DIR/$tfile || true @@ -3613,7 +3597,8 @@ test_102a() { touch $testfile [ "$UID" != 0 ] && skip "must run as root" && return - [ -z "`grep xattr $LPROC/mdc/*[mM][dD][cC]*/connect_flags`" ] && skip "must have user_xattr" && return + [ -z "`lctl get_param -n mdc.*[mM][dD][cC]*.connect_flags | grep xattr`" ] && + skip "must have user_xattr" && return [ -z "$(which setfattr 2>/dev/null)" ] && skip "could not find setfattr" && return echo "set/get xattr..." @@ -3842,7 +3827,7 @@ run_acl_subtest() test_103 () { [ "$UID" != 0 ] && skip "must run as root" && return - [ -z "$(grep acl $LPROC/mdc/*[mM][dD][cC]*/connect_flags)" ] && skip "must have acl enabled" && return + [ -z "$(lctl get_param mdc.*[mM][dD][cC]*.connect_flags | grep acl)" ] && skip "must have acl enabled" && return [ -z "$(which setfacl 2>/dev/null)" ] && skip "could not find setfacl" && return SAVE_UMASK=`umask` @@ -3882,7 +3867,7 @@ test_104() { lfs df $DIR/$tfile || error "lfs df $DIR/$tfile failed" lfs df -ih $DIR/$tfile || error "lfs df -ih $DIR/$tfile failed" - OSC=`awk '/-osc-|OSC.*MNT/ {print $4}' $LPROC/devices | head -n 1` + OSC=`lctl get_param -n devices | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1` lctl --device %$OSC deactivate lfs df || error "lfs df with deactivated OSC failed" lctl --device %$OSC recover @@ -3986,7 +3971,7 @@ run_test 115 "verify dynamic thread creation====================" free_min_max () { wait_delete_completed - AVAIL=($(cat $LPROC/osc/*[oO][sS][cC][-_]*/kbytesavail)) + AVAIL=($(lctl get_param -n osc.*[oO][sS][cC][-_]*.kbytesavail)) echo OST kbytes available: ${AVAIL[@]} MAXI=0; MAXV=${AVAIL[0]} MINI=0; MINV=${AVAIL[0]} @@ -4008,8 +3993,8 @@ test_116() { remote_mds && skip "remote MDS" && return echo -n "Free space priority " - cat $LPROC/lov/*/qos_prio_free - DELAY=$(cat $LPROC/lov/*/qos_maxage | head -1 | awk '{print $1}') + lctl get_param -n lov.*.qos_prio_free + DELAY=$(lctl get_param -n lov.*.qos_maxage | head -1 | awk '{print $1}') declare -a AVAIL free_min_max [ $MINV -gt 960000 ] && skip "too much free space in OST$MINI" &&\ @@ -4073,11 +4058,11 @@ test_116() { [ $DIFF -gt 0 ] && echo "Wrote $(($DIFF2 * 100 / $DIFF - 100))% more data to larger OST $MAXI1" # Figure out which files were written where - UUID=$(awk '/'$MINI1': / {print $2; exit}' $LPROC/lov/${FSNAME}-clilov-*/target_obd) + UUID=$(lctl get_param -n lov.${FSNAME}-clilov-*.target_obd | awk '/'$MINI1': / {print $2; exit}') echo $UUID MINC=$($GETSTRIPE --obd $UUID $DIR/$tdir | wc -l) echo "$MINC files created on smaller OST $MINI1" - UUID=$(awk '/'$MAXI1': / {print $2; exit}' $LPROC/lov/${FSNAME}-clilov-*/target_obd) + UUID=$(lctl get_param -n lov.${FSNAME}-clilov-*.target_obd | (awk '/'$MAXI1': / {print $2; exit}')) MAXC=$($GETSTRIPE --obd $UUID $DIR/$tdir | wc -l) echo "$MAXC files created on larger OST $MAXI1" [ $MINC -gt 0 ] && echo "Wrote $(($MAXC * 100 / $MINC - 100))% more files to larger OST $MAXI1" @@ -4098,12 +4083,10 @@ run_test 117 "verify fsfilt_extend =============================" export OLD_RESENDCOUNT="" set_resend_count () { - local PROC_RESENDCOUNT="$LPROC/osc/${FSNAME}-OST*-osc-*/resend_count" - OLD_RESENDCOUNT=$(cat $PROC_RESENDCOUNT | head -1) - for i in $PROC_RESENDCOUNT; do - echo $1 >$i - done - echo resend_count is set to $(cat $PROC_RESENDCOUNT) + local PROC_RESENDCOUNT="osc.${FSNAME}-OST*-osc-*.resend_count" + OLD_RESENDCOUNT=$(lctl get_param -n $PROC_RESENDCOUNT | head -1) + lctl set_param -n $PROC_RESENDCOUNT $1 + echo resend_count is set to $(lctl get_param -n $PROC_RESENDCOUNT) } [ "$SLOW" = "no" ] && set_resend_count 4 # for reduce test_118* time (bug 14842) @@ -4124,8 +4107,8 @@ test_118a() #bug 11710 reset_async multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param llite.*.dump_page_cache | grep -c writeback) if [[ $DIRTY -ne 0 || $WRITEBACK -ne 0 ]]; then error "Dirty pages not flushed to disk, dirty=$DIRTY, writeback=$WRITEBACK" @@ -4145,8 +4128,8 @@ test_118b() multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c RC=$? do_facet ost sysctl -w lustre.fail_loc=0 - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + DIRTY=$(lctl get_param llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $RC -eq 0 ]]; then error "Must return error due to dropped pages, rc=$RC" @@ -4187,7 +4170,7 @@ test_118c() error "Multiop failed to block on fsync, pid=$MULTIPID" fi - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + WRITEBACK=$(lctl get_param -n llite/*/dump_page_cache | grep -c writeback) if [[ $WRITEBACK -eq 0 ]]; then error "No page in writeback, writeback=$WRITEBACK" fi @@ -4199,8 +4182,8 @@ test_118c() error "Multiop fsync failed, rc=$RC" fi - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $DIRTY -ne 0 || $WRITEBACK -ne 0 ]]; then error "Dirty pages not flushed to disk, dirty=$DIRTY, writeback=$WRITEBACK" fi @@ -4228,7 +4211,7 @@ test_118d() error "Multiop failed to block on fsync, pid=$MULTIPID" fi - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $WRITEBACK -eq 0 ]]; then error "No page in writeback, writeback=$WRITEBACK" fi @@ -4236,8 +4219,8 @@ test_118d() wait $MULTIPID || error "Multiop fsync failed, rc=$?" do_facet ost sysctl -w lustre.fail_loc=0 - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $DIRTY -ne 0 || $WRITEBACK -ne 0 ]]; then error "Dirty pages not flushed to disk, dirty=$DIRTY, writeback=$WRITEBACK" fi @@ -4263,9 +4246,9 @@ test_118f() { sysctl -w lustre.fail_loc=0x0 - LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache) - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + LOCKED=$(lctl get_param -n llite.*.dump_page_cache | grep -c locked) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $LOCKED -ne 0 ]]; then error "Locked pages remain in cache, locked=$LOCKED" fi @@ -4297,9 +4280,9 @@ test_118g() { error "Must return error due to dropped pages, rc=$RC" fi - LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache) - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + LOCKED=$(lctl get_param -n llite.*.dump_page_cache | grep -c locked) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $LOCKED -ne 0 ]]; then error "Locked pages remain in cache, locked=$LOCKED" fi @@ -4332,9 +4315,9 @@ test_118h() { error "Must return error due to dropped pages, rc=$RC" fi - LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache) - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + LOCKED=$(lctl get_param -n llite.*.dump_page_cache | grep -c locked) + DIRTY=$(lctl get_param -n llite/*/dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite/*/dump_page_cache | grep -c writebac) if [[ $LOCKED -ne 0 ]]; then error "Locked pages remain in cache, locked=$LOCKED" fi @@ -4370,9 +4353,9 @@ test_118i() { error "got error, but should be not, rc=$RC" fi - LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache) - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + LOCKED=$(lctl get_param -n llite.*.dump_page_cache | grep -c locked) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $LOCKED -ne 0 ]]; then error "Locked pages remain in cache, locked=$LOCKED" fi @@ -4404,9 +4387,9 @@ test_118j() { error "Must return error due to dropped pages, rc=$RC" fi - LOCKED=$(grep -c locked $LPROC/llite/*/dump_page_cache) - DIRTY=$(grep -c dirty $LPROC/llite/*/dump_page_cache) - WRITEBACK=$(grep -c writeback $LPROC/llite/*/dump_page_cache) + LOCKED=$(lctl get_param -n llite.*.dump_page_cache | grep -c locked) + DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty) + WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback) if [[ $LOCKED -ne 0 ]]; then error "Locked pages remain in cache, locked=$LOCKED" fi @@ -4483,17 +4466,17 @@ test_119c() # bug 13099 run_test 119c "Testing for direct read hitting hole" test_120a() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc cancel_lru_locks mdc stat $DIR/$tdir > /dev/null - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` mkdir -p $DIR/$tdir/d1 - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured." lru_resize_enable mdc @@ -4502,17 +4485,17 @@ test_120a() { run_test 120a "Early Lock Cancel: mkdir test ===================" test_120b() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc cancel_lru_locks mdc stat $DIR/$tdir > /dev/null - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` touch $DIR/$tdir/f1 - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured." lru_resize_enable mdc @@ -4521,7 +4504,7 @@ test_120b() { run_test 120b "Early Lock Cancel: create test ==================" test_120c() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc @@ -4529,11 +4512,11 @@ test_120c() { touch $DIR/$tdir/d1/f1 cancel_lru_locks mdc stat $DIR/$tdir/d1 $DIR/$tdir/d2 $DIR/$tdir/d1/f1 > /dev/null - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` ln $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2 - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured." lru_resize_enable mdc @@ -4542,18 +4525,18 @@ test_120c() { run_test 120c "Early Lock Cancel: link test ====================" test_120d() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc touch $DIR/$tdir cancel_lru_locks mdc stat $DIR/$tdir > /dev/null - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` chmod a+x $DIR/$tdir - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured." lru_resize_enable mdc @@ -4562,7 +4545,7 @@ test_120d() { run_test 120d "Early Lock Cancel: setattr test =================" test_120e() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc @@ -4571,11 +4554,11 @@ test_120e() { cancel_lru_locks osc dd if=$DIR/$tdir/f1 of=/dev/null stat $DIR/$tdir $DIR/$tdir/f1 > /dev/null - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` unlink $DIR/$tdir/f1 - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured." lru_resize_enable mdc @@ -4584,7 +4567,7 @@ test_120e() { run_test 120e "Early Lock Cancel: unlink test ==================" test_120f() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc @@ -4596,11 +4579,11 @@ test_120f() { dd if=$DIR/$tdir/d1/f1 of=/dev/null dd if=$DIR/$tdir/d2/f2 of=/dev/null stat $DIR/$tdir/d1 $DIR/$tdir/d2 $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2 > /dev/null - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm/services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` mv $DIR/$tdir/d1/f1 $DIR/$tdir/d2/f2 - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." [ $blk1 -eq $blk2 ] || error $((blk2-blk1)) "blocking RPC occured." lru_resize_enable mdc @@ -4609,7 +4592,7 @@ test_120f() { run_test 120f "Early Lock Cancel: rename test ==================" test_120g() { - [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 lru_resize_disable mdc lru_resize_disable osc @@ -4620,19 +4603,19 @@ test_120g() { cancel_lru_locks osc t0=`date +%s` - can0=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk0=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can0=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk0=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` createmany -o $DIR/$tdir/f $count sync - can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can1=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` t1=`date +%s` echo total: $((can1-can0)) cancels, $((blk1-blk0)) blockings echo rm $count files rm -r $DIR/$tdir sync - can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` - blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` + can2=`lctl get_param -n ldlm.services.ldlm_canceld.stats | awk '/ldlm_cancel/ {print $2}'` + blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'` t2=`date +%s` echo total: $count removes in $((t2-t1)) echo total: $((can2-can1)) cancels, $((blk2-blk1)) blockings @@ -4676,7 +4659,7 @@ test_123() # statahead(bug 11401) for ((i=1, j=0; i<=$NUMFREE; j=$i, i=$((i * MULT)) )); do createmany -o $DIR/$tdir/$tfile $j $((i - j)) - grep '[0-9]' $LPROC/llite/*/statahead_max + lctl get_param -n llite.*.statahead_max | grep '[0-9]' cancel_lru_locks mdc cancel_lru_locks osc stime=`date +%s` @@ -4685,26 +4668,16 @@ test_123() # statahead(bug 11401) delta_sa=$((etime - stime)) log "ls $i files with statahead: $delta_sa sec" - for client in $LPROC/llite/*; do - max=`cat $client/statahead_max` - cat $client/statahead_stats - echo 0 > $client/statahead_max - done + max=`lctl get_param -n llite.*.statahead_max | head -n 1` + lctl set_param -n llite.*.statahead_max 0 + lctl get_param llite.*.statahead_max - grep '[0-9]' $LPROC/llite/*/statahead_max - cancel_lru_locks mdc - cancel_lru_locks osc - stime=`date +%s` ls -l $DIR/$tdir > /dev/null etime=`date +%s` delta=$((etime - stime)) log "ls $i files without statahead: $delta sec" - for client in $LPROC/llite/*; do - cat $client/statahead_stats - echo $max > $client/statahead_max - done - + lctl set_param llite.*.statahead_max=$max if [ $delta_sa -gt $(($delta + 2)) ]; then log "ls $i files is slower with statahead!" error=1 @@ -4723,7 +4696,7 @@ test_123() # statahead(bug 11401) delta=$((etime - stime)) log "rm -r $DIR/$tdir/: $delta seconds" log "rm done" - cat $LPROC/llite/*/statahead_stats + lctl get_param -n llite.*.statahead_stats # wait for commitment of removal sleep 2 [ $error -ne 0 ] && error "statahead is slow!" @@ -4732,7 +4705,7 @@ test_123() # statahead(bug 11401) run_test 123 "verify statahead work" test_124a() { - [ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep lru_resize`" ] && \ skip "no lru resize on server" && return 0 NR=2000 mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir" @@ -4747,10 +4720,11 @@ test_124a() { NSDIR="" LRU_SIZE=0 - for F in $LPROC/ldlm/namespaces/*mdc-*/lru_size; do - LRU_SIZE=$(cat $F) + for VALUE in ldlm/namespaces/*mdc-*/lru_size; do + PARAM=`echo ${VALUE[0]} | cut -d "=" -f1` + LRU_SIZE=$(lctl get_param -n $PARAM) if [ $LRU_SIZE -gt $(default_lru_size) ]; then - NSDIR=$(dirname $F) + NSDIR=$(dirname $PARAM) log "using $(basename $NSDIR) namespace" break fi @@ -4770,7 +4744,7 @@ test_124a() { MAX_HRS=10 # get the pool limit - LIMIT=`cat $NSDIR/pool/limit` + LIMIT=`lctl get_param -n ldlm.namespaces.*mdc*.pool.limit` # calculate lock volume factor taking into account data set size and the # rule that number of locks will be getting smaller durring sleep interval @@ -4780,12 +4754,12 @@ test_124a() { LVF=$(($MAX_HRS * 60 * 60 * $LIMIT / $SLEEP)) LRU_SIZE_B=$LRU_SIZE log "make client drop locks $LVF times faster so that ${SLEEP}s is enough to cancel $LRU_SIZE lock(s)" - OLD_LVF=`cat $NSDIR/pool/lock_volume_factor` - echo "$LVF" > $NSDIR/pool/lock_volume_factor + OLD_LVF=`lctl get_param -n $NSDIR/pool/lock_volume_factor` + lctl set_param -n $NSDIR/pool/lock_volume_factor $LVF log "sleep for $((SLEEP+SLEEP_ADD))s" sleep $((SLEEP+SLEEP_ADD)) - echo "$OLD_LVF" > $NSDIR/pool/lock_volume_factor - LRU_SIZE_A=`cat $NSDIR/lru_size` + lctl set_param -n $NSDIR/pool/lock_volume_factor $OLD_LVF + LRU_SIZE_A=`lctl get_param -n $NSDIR/lru_size` [ $LRU_SIZE_B -gt $LRU_SIZE_A ] || { error "No locks dropped in "$((SLEEP+SLEEP_ADD))"s. LRU size: $LRU_SIZE_A" @@ -4800,13 +4774,12 @@ test_124a() { run_test 124a "lru resize =======================================" test_124b() { - [ -z "`grep lru_resize $LPROC/mdc/*/connect_flags`" ] && \ + [ -z "`lctl get_param -n mdc.*.connect_flags | grep lru_resize`" ] && \ skip "no lru resize on server" && return 0 # even for cmd no matter what metadata namespace to use for getting # the limit, we use appropriate. - NSDIR=`find $LPROC/ldlm/namespaces | grep mdc | head -1` - LIMIT=`cat $NSDIR/pool/limit` + LIMIT=`lctl get_param -n ldlm.namespaces.*mdc*.pool.limit` NR=$(($(default_lru_size)*20)) if [ $NR -gt $LIMIT ]; then @@ -4833,7 +4806,7 @@ test_124b() { etime=`date +%s` nolruresize_delta=$((etime-stime)) log "ls -la time: $nolruresize_delta seconds" - log "lru_size = $(cat $NSDIR/lru_size)" + log "lru_size = $(lctl get_param -n ldlm.namespaces.*mdc*.lru_size)" unlinkmany $DIR/$tdir/disable_lru_resize/f $NR lru_resize_enable mdc @@ -4857,7 +4830,7 @@ test_124b() { etime=`date +%s` lruresize_delta=$((etime-stime)) log "ls -la time: $lruresize_delta seconds" - log "lru_size = $(cat $NSDIR/lru_size)" + log "lru_size = $(lctl get_param -n ldlm.namespaces.*mdc*.lru_size)" if [ $lruresize_delta -gt $nolruresize_delta ]; then log "ls -la is $(((lruresize_delta - $nolruresize_delta) * 100 / $nolruresize_delta))% slower with lru resize enabled" @@ -4871,7 +4844,7 @@ test_124b() { run_test 124b "lru resize (performance test) =======================" test_125() { # 13358 - [ -z "$(grep acl $LPROC/mdc/*-mdc-*/connect_flags)" ] && skip "must have acl enabled" && return + [ -z "$(lctl get_param -n mdc.*-mdc-*.connect_flags | grep acl)" ] && skip "must have acl enabled" && return mkdir -p $DIR/d125 || error "mkdir failed" $SETSTRIPE $DIR/d125 -s 65536 -c -1 || error "setstripe failed" setfacl -R -m u:bin:rwx $DIR/d125 || error "setfacl $DIR/d125 failes" -- GitLab