6 # bug number for skipped test: 3192 12652 9977
7 ALWAYS_EXCEPT=" 14b 14c 28 $SANITYN_EXCEPT"
8 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
10 # bug number for skipped test: 12652 12652
11 grep -q 'Enterprise Server 10' /etc/SuSE-release && ALWAYS_EXCEPT="$ALWAYS_EXCEPT 11 14" || true
13 # Tests that fail on uml
14 [ "$UML" = "true" ] && EXCEPT="$EXCEPT 7"
17 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
20 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
21 CREATETEST=${CREATETEST:-createtest}
22 GETSTRIPE=${GETSTRIPE:-lfs getstripe}
23 SETSTRIPE=${SETSTRIPE:-lstripe}
24 MCREATE=${MCREATE:-mcreate}
25 OPENFILE=${OPENFILE:-openfile}
26 OPENUNLINK=${OPENUNLINK:-openunlink}
27 TOEXCL=${TOEXCL:-toexcl}
28 TRUNCATE=${TRUNCATE:-truncate}
29 export TMP=${TMP:-/tmp}
30 MOUNT_2=${MOUNT_2:-"yes"}
31 CHECK_GRANT=${CHECK_GRANT:-"yes"}
32 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
36 export NAME=${NAME:-local}
38 LUSTRE=${LUSTRE:-`dirname $0`/..}
39 . $LUSTRE/tests/test-framework.sh
43 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
45 [ "$SLOW" = "no" ] && EXCEPT_SLOW="12 16"
47 SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
55 [ "$SANITYLOG" ] && rm -f $SANITYLOG || true
57 check_and_setup_lustre
60 LOVNAME=`lctl get_param -n llite.*.lov.common_name | tail -n 1`
61 OSTCOUNT=`lctl get_param -n lov.$LOVNAME.numobd`
63 rm -rf $DIR1/[df][0-9]* $DIR1/lnk
65 # $RUNAS_ID may get set incorrectly somewhere else
66 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
68 check_runas_id $RUNAS_ID $RUNAS
74 [ -f $DIR2/f1 ] || error
76 run_test 1a "check create on 2 mtpt's =========================="
80 $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
83 run_test 1b "check attribute updates on 2 mtpt's ==============="
86 $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
88 run_test 1c "check after remount attribute updates on 2 mtpt's ="
92 $CHECKSTAT -a $DIR1/f1 || error
94 run_test 1d "unlink on one mountpoint removes file on other ===="
100 $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
102 run_test 2a "check cached attribute updates on 2 mtpt's ========"
108 $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
110 run_test 2b "check cached attribute updates on 2 mtpt's ========"
112 # NEED TO SAVE ROOT DIR MODE
115 $CHECKSTAT -t dir -p 0777 $DIR2 || error
117 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
121 $CHECKSTAT -t dir -p 0755 $DIR2 || error
123 run_test 2d "check cached attribute updates on 2 mtpt's root ==="
130 $RUNAS dd if=/dev/zero of=$DIR2/$tfile count=1 || error
132 run_test 2e "check chmod on root is propagated to others"
135 ( cd $DIR1 ; ln -s this/is/good lnk )
136 [ "this/is/good" = "`perl -e 'print readlink("'$DIR2/lnk'");'`" ] || \
139 run_test 3 "symlink on one mtpt, readlink on another ==========="
142 multifstat $DIR1/f4 $DIR2/f4
144 run_test 4 "fstat validation on multiple mount points =========="
148 truncate $DIR2/f5 100
149 $CHECKSTAT -t file -s 100 $DIR1/f5 || error
152 run_test 5 "create a file on one mount, truncate it on the other"
155 openunlink $DIR1/$tfile $DIR2/$tfile || \
156 error "openunlink $DIR1/$tfile $DIR2/$tfile"
158 run_test 6 "remove of open file on other node =================="
161 # run_one creates uniq $tdir (bug 13798)
162 # opendirunlink failes if it exists
163 rmdir $DIR1/$tdir || true
164 opendirunlink $DIR1/$tdir $DIR2/$tdir || \
165 error "opendirunlink $DIR1/$tdir $DIR2/$tdir"
167 run_test 7 "remove of open directory on other node ============="
170 opendevunlink $DIR1/$tfile $DIR2/$tfile || \
171 error "opendevunlink $DIR1/$tfile $DIR2/$tfile"
173 run_test 8 "remove of open special file on other node =========="
178 for C in a b c d e f g h i j k l; do
179 DIR=`eval echo \\$DIR$MTPT`
180 echo -n $C >> $DIR/f9
181 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
183 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
184 error "`od -a $DIR1/f9` != abcdefghijkl"
186 run_test 9 "append of file with sub-page size on multiple mounts"
192 for C in a b c d e f g h i j k l; do
193 DIR=`eval echo \\$DIR$MTPT`
194 echo -n $C | dd of=$DIR/f10 bs=1 seek=$OFFSET count=1
195 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
196 OFFSET=`expr $OFFSET + 1`
198 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
199 error "`od -a $DIR1/f10` != abcdefghijkl"
201 run_test 10a "write of file with sub-page size on multiple mounts "
204 yes "R" | dd of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
206 truncate $DIR1/f10b 4096 || error "truncate 4096"
208 dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
210 # create a test file locally to compare
211 yes "R" | dd of=$TMP/f10b bs=3k count=1 || error "dd random"
212 truncate $TMP/f10b 4096 || error "truncate 4096"
213 cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
214 rm $TMP/f10b $TMP/f10b-lustre
216 run_test 10b "write of file with sub-page size on multiple mounts "
220 multiop_bg_pause $DIR1/d11/f O_c || return 1
222 cp -p /bin/ls $DIR1/d11/f
226 wait $MULTIPID || error
227 [ $RC -eq 0 ] && error || true
229 run_test 11 "execution of file opened for write should return error ===="
232 DIR=$DIR DIR2=$DIR2 sh lockorder.sh
234 run_test 12 "test lock ordering (link, stat, unlink) ==========="
236 test_13() { # bug 2451 - directory coherency
238 mkdir $DIR1/d13 || error
239 cd $DIR1/d13 || error
241 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
243 rm -f $DIR2/d13/f13 || error
244 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
245 # need to run it twice
246 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
248 rm -f $DIR2/d13/f13 || error
249 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
251 run_test 13 "test directory page revocation ===================="
255 cp -p /bin/ls $DIR1/d14/ls
256 exec 100>> $DIR1/d14/ls
257 $DIR2/d14/ls && error || true
260 run_test 14 "execution of file open for write returns -ETXTBSY ="
264 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
265 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
267 multiop $DIR2/d14/multiop Oc && error "expected error, got success"
268 kill -USR1 $MULTIOP_PID || return 2
269 wait $MULTIOP_PID || return 3
270 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
272 run_test 14a "open(RDWR) of executing file returns -ETXTBSY ===="
274 test_14b() { # bug 3192, 7040
276 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
277 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
279 truncate $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \
280 error "expected truncate error, got success"
281 kill -USR1 $MULTIOP_PID || return 2
282 wait $MULTIOP_PID || return 3
283 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
284 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
286 run_test 14b "truncate of executing file returns -ETXTBSY ======"
288 test_14c() { # bug 3430, 7040
290 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
291 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
293 cp /etc/hosts $DIR2/d14/multiop && error "expected error, got success"
294 kill -USR1 $MULTIOP_PID || return 2
295 wait $MULTIOP_PID || return 3
296 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
297 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
299 run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
301 test_14d() { # bug 10921
303 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
304 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
307 chmod 600 $DIR1/d14/multiop || error "chmod failed"
308 kill -USR1 $MULTIOP_PID || return 2
309 wait $MULTIOP_PID || return 3
310 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
311 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
313 run_test 14d "chmod of executing file is still possible ========"
315 test_15() { # bug 974 - ENOSPC
317 sh oos2.sh $MOUNT1 $MOUNT2
318 grant_error=`dmesg | grep "> available"`
319 [ -z "$grant_error" ] || error "$grant_error"
321 run_test 15 "test out-of-space with multiple writers ==========="
324 rm -f $MOUNT1/fsxfile
325 lfs setstripe $MOUNT1/fsxfile -c -1 # b=10919
326 fsx -c 50 -p 100 -N 2500 -l $((SIZE * 256)) -S 0 $MOUNT1/fsxfile $MOUNT2/fsxfile
328 run_test 16 "2500 iterations of dual-mount fsx ================="
330 test_17() { # bug 3513, 3667
331 [ ! -d /proc/fs/lustre/ost ] && skip "remote OST, skipping OST-only test" && return
333 cp /etc/termcap $DIR1/f17
334 cancel_lru_locks osc > /dev/null
335 #define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a
336 sysctl -w lustre.fail_loc=0x8000030a
337 ls -ls $DIR1/f17 | awk '{ print $1,$6 }' > $DIR1/f17-1 & \
338 ls -ls $DIR2/f17 | awk '{ print $1,$6 }' > $DIR2/f17-2
340 diff -u $DIR1/f17-1 $DIR2/f17-2 || error "files are different"
342 run_test 17 "resource creation/LVB creation race ==============="
345 ./mmap_sanity -d $MOUNT1 -m $MOUNT2
348 run_test 18 "mmap sanity check ================================="
350 test_19() { # bug3811
351 [ -d /proc/fs/lustre/obdfilter ] || return 0
353 MAX=`cat /proc/fs/lustre/obdfilter/*/readcache_max_filesize | head -n 1`
354 for O in /proc/fs/lustre/obdfilter/*OST*; do
355 echo 4096 > $O/readcache_max_filesize
357 dd if=/dev/urandom of=$TMP/f19b bs=512k count=32
358 SUM=`cksum $TMP/f19b | cut -d" " -f 1,2`
359 cp $TMP/f19b $DIR1/f19b
360 for i in `seq 1 20`; do
361 [ $((i % 5)) -eq 0 ] && log "test_18 loop $i"
362 cancel_lru_locks osc > /dev/null
363 cksum $DIR1/f19b | cut -d" " -f 1,2 > $TMP/sum1 & \
364 cksum $DIR2/f19b | cut -d" " -f 1,2 > $TMP/sum2
366 [ "`cat $TMP/sum1`" = "$SUM" ] || \
367 error "$DIR1/f19b `cat $TMP/sum1` != $SUM"
368 [ "`cat $TMP/sum2`" = "$SUM" ] || \
369 error "$DIR2/f19b `cat $TMP/sum2` != $SUM"
371 for O in /proc/fs/lustre/obdfilter/*OST*; do
372 echo $MAX > $O/readcache_max_filesize
376 #run_test 19 "test concurrent uncached read races ==============="
381 CNT=$((`cat /proc/fs/lustre/llite/*/dump_page_cache | wc -l`))
382 multiop $DIR1/f20 Ow8190c
383 multiop $DIR2/f20 Oz8194w8190c
384 multiop $DIR1/f20 Oz0r8190c
386 CNTD=$((`cat /proc/fs/lustre/llite/*/dump_page_cache | wc -l` - $CNT))
388 error $CNTD" page left in cache after lock cancel" || true
390 run_test 20 "test extra readahead page left in cache ===="
397 test_21() { # Bug 5907
399 mount /etc $DIR1/d21 --bind || error "mount failed" # Poor man's mount.
401 rmdir -v $DIR1/d21 && error "Removed mounted directory"
402 rmdir -v $DIR2/d21 && echo "Removed mounted directory from another mountpoint, needs to be fixed"
403 test -d $DIR1/d21 || error "Mounted directory disappeared"
405 test -d $DIR2/d21 || test -d $DIR1/d21 && error "Removed dir still visible after umount"
408 run_test 21 " Try to remove mountpoint on another dir ===="
410 JOIN=${JOIN:-"lfs join"}
412 test_22() { # Bug 9926
414 dd if=/dev/urandom of=$DIR1/d21/128k bs=1024 count=128
415 cp -p $DIR1/d21/128k $DIR1/d21/f_head
416 for ((i=0;i<10;i++)); do
417 cp -p $DIR1/d21/128k $DIR1/d21/f_tail
418 $JOIN $DIR1/d21/f_head $DIR1/d21/f_tail || error "join error"
419 $CHECKSTAT -a $DIR1/d21/f_tail || error "tail file exist after join"
421 echo aaaaaaaaaaa >> $DIR1/d21/no_joined
423 mv $DIR2/d21/f_head $DIR2/
424 munlink $DIR2/f_head || error "unlink joined file error"
425 cat $DIR2/d21/no_joined || error "cat error"
426 rm -rf $DIR2/d21/no_joined || error "unlink normal file error"
428 run_test 22 " After joining in one dir, open/close unlink file in anther dir"
430 test_23() { # Bug 5972
431 echo "others should see updated atime while another read" > $DIR1/f23
433 # clear the lock(mode: LCK_PW) gotten from creating operation
439 multiop_bg_pause $DIR1/f23 or20_c || return 1
442 time2=`stat -c "%X" $DIR2/f23`
444 if (( $time2 <= $time1 )); then
446 error "atime doesn't update among nodes"
449 kill -USR1 $MULTIPID || return 1
450 rm -f $DIR1/f23 || error "rm -f $DIR1/f23 failed"
453 run_test 23 " others should see updated atime while another read===="
457 lfs df || error "lfs df failed"
458 lfs df -ih || error "lfs df -ih failed"
459 lfs df -h $DIR1 || error "lfs df -h $DIR1 failed"
460 lfs df -i $DIR2 || error "lfs df -i $DIR2 failed"
461 lfs df $DIR1/$tfile || error "lfs df $DIR1/$tfile failed"
462 lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
464 OSC=`lctl dl | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1`
465 lctl --device %$OSC deactivate
466 lfs df -i || error "lfs df -i with deactivated OSC failed"
467 lctl --device %$OSC recover
468 lfs df || error "lfs df with reactivated OSC failed"
470 run_test 24 "lfs df [-ih] [path] test ========================="
473 [ `lctl get_param -n mdc.*-mdc-*.connect_flags | grep -c acl` -lt 2 ] && \
474 skip "must have acl, skipping" && return
476 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
477 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
479 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
480 setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #1"
481 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
482 setfacl -m u:$RUNAS_ID:r-x $DIR1/$tdir || error "setfacl $DIR2/$tdir #2"
483 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
484 setfacl -m u:$RUNAS_ID:--- $DIR1/$tdir || error "setfacl $DIR2/$tdir #3"
485 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
486 setfacl -x u:$RUNAS_ID: $DIR1/$tdir || error "setfacl $DIR2/$tdir #4"
487 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
491 run_test 25 "change ACL on one mountpoint be seen on another ==="
494 utime $DIR1/f26a -s $DIR2/f26a || error
496 run_test 26a "allow mtime to get older"
501 echo "aaa" >> $DIR1/$tfile
503 chmod a+x $DIR2/$tfile
504 mt1=`stat -c %Y $DIR1/$tfile`
505 mt2=`stat -c %Y $DIR2/$tfile`
507 if [ x"$mt1" != x"$mt2" ]; then
508 error "not equal mtime, client1: "$mt1", client2: "$mt2"."
511 run_test 26b "sync mtime between ost and mds"
516 dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
521 dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
526 dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
528 lctl set_param -n ldlm.dump_namespaces ""
529 wait $DD1_PID $DD2_PID
530 [ $? -ne 0 ] && lctl dk $TMP/debug || true
532 run_test 27 "align non-overlapping extent locks from request ==="
534 test_28() { # bug 9977
535 ostID=`$LCTL dl | awk '/-osc-|OSC.*MNT/ { ost++; if (ost == 2) { print $1 } }'`
537 lfs setstripe $DIR1/$tfile -s 1048576 -i 0 -c 2
538 tOBJID=`lfs getstripe $DIR1/$tfile | awk '/^[[:space:]]+1/ {print $2}'`
539 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
541 $LCTL --device $ostID destroy "${tOBJID}"
543 # reading of 1st stripe should pass
544 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error
545 # reading of 2nd stripe should fail (this stripe was destroyed)
546 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 && error
548 # now, recreating test file
549 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2 || error
550 # reading of 1st stripe should pass
551 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error
552 # reading of 2nd stripe should pass
553 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 || error
555 run_test 28 "read/write/truncate file with lost stripes"
557 test_29() { # bug 10999
559 #define OBD_FAIL_LDLM_GLIMPSE 0x30f
560 sysctl -w lustre.fail_loc=0x8000030f
563 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1
566 #bug 11549 - permanently turn test off in b1_5
567 #run_test 29 "lock put race between glimpse and enqueue ========="
569 test_30() { #bug #11110
570 cp -f /bin/bash $DIR1/$tdir/bash
571 /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
572 err=$($DIR1/$tdir/bash -c 'sleep 2; openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?')
574 [ $err -ne 116 ] && error_ignore 12900 "return code ($err) != -ESTALE" && return
578 run_test 30 "recreate file race ========="
581 mkdir -p $DIR1/$tdir || error "Creating dir $DIR1/$tdir"
582 writes=`LANG=C dd if=/dev/zero of=$DIR/$tdir/$tfile count=1 2>&1 |
583 awk 'BEGIN { FS="+" } /out/ {print $1}'`
584 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
585 sysctl -w lustre.fail_loc=0x314
586 reads=`LANG=C dd if=$DIR2/$tdir/$tfile of=/dev/null 2>&1 |
587 awk 'BEGIN { FS="+" } /in/ {print $1}'`
588 [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
590 run_test 31 "voluntary cancel / blocking ast race=============="
592 # enable/disable lockless truncate feature, depending on the arg 0/1
593 enable_lockless_truncate() {
594 lctl set_param -n llite.*.lockless_truncate $1
597 test_32a() { # bug 11270
598 local p="$TMP/sanityN-$TESTNAME.parameters"
599 save_lustre_params $HOSTNAME llite.*.lockless_truncate > $p
602 enable_lockless_truncate 1
603 dd if=/dev/zero of=$DIR1/$tfile count=10 bs=1M > /dev/null 2>&1
605 log "checking cached lockless truncate"
606 $TRUNCATE $DIR1/$tfile 8000000
607 $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
608 [ $(calc_llite_stats lockless_truncate) -eq 0 ] ||
609 error "lockless truncate doesn't use cached locks"
611 log "checking not cached lockless truncate"
612 $TRUNCATE $DIR2/$tfile 5000000
613 $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
614 [ $(calc_llite_stats lockless_truncate) -ne 0 ] ||
615 error "not cached trancate isn't lockless"
617 log "disabled lockless truncate"
618 enable_lockless_truncate 0
620 $TRUNCATE $DIR2/$tfile 3000000
621 $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
622 [ $(calc_llite_stats lockless_truncate) -eq 0 ] ||
623 error "lockless truncate disabling failed"
625 # restore lockless_truncate default values
626 restore_lustre_params < $p
629 run_test 32a "lockless truncate"
631 test_32b() { # bug 11270
633 local p="$TMP/sanityN-$TESTNAME.parameters"
634 save_lustre_params $HOSTNAME "llite.*.contention_seconds" > $p
635 for node in $(osts_nodes); do
636 save_lustre_params $node "ldlm.namespaces.filter-*.max_nolock_bytes" >> $p
637 save_lustre_params $node "ldlm.namespaces.filter-*.contended_locks" >> $p
638 save_lustre_params $node "ldlm.namespaces.filter-*.contention_seconds" >> $p
641 # agressive lockless i/o settings
642 for node in $(osts_nodes); do
643 do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 2000000; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 0; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 60'
645 lctl set_param -n llite.*.contention_seconds 60
646 for i in $(seq 5); do
647 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
648 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
650 [ $(calc_llite_stats lockless_write_bytes) -ne 0 ] || error "lockless i/o was not triggered"
651 # disable lockless i/o (it is disabled by default)
652 for node in $(osts_nodes); do
653 do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 0; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 32; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 0'
655 # set contention_seconds to 0 at client too, otherwise Lustre still
656 # remembers lock contention
657 lctl set_param -n llite.*.contention_seconds 0
659 for i in $(seq 5); do
660 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
661 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
663 [ $(calc_llite_stats lockless_write_bytes) -eq 0 ] ||
664 error "lockless i/o works when disabled"
666 restore_lustre_params <$p
669 run_test 32b "lockless i/o"
671 log "cleanup: ======================================================"
673 check_and_cleanup_lustre
675 echo '=========================== finished ==============================='
676 [ -f "$SANITYLOG" ] && cat $SANITYLOG && grep -q FAIL $SANITYLOG && exit 1 || true