6 # bug number for skipped test: 9977/LU-7105
8 ALWAYS_EXCEPT=" 28 $SANITYN_EXCEPT"
9 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
12 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
16 OPENFILE=${OPENFILE:-openfile}
17 OPENUNLINK=${OPENUNLINK:-openunlink}
18 export MULTIOP=${MULTIOP:-multiop}
19 export TMP=${TMP:-/tmp}
20 MOUNT_2=${MOUNT_2:-"yes"}
21 CHECK_GRANT=${CHECK_GRANT:-"yes"}
22 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
26 export NAME=${NAME:-local}
28 LUSTRE=${LUSTRE:-`dirname $0`/..}
29 . $LUSTRE/tests/test-framework.sh
33 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
37 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
38 # bug number for skipped test:
39 ALWAYS_EXCEPT="$ALWAYS_EXCEPT "
40 # LU-2829 / LU-2887 - make allowances for ZFS slowness
41 TEST33_NFILES=${TEST33_NFILES:-1000}
44 [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
51 check_and_setup_lustre
56 rm -rf $DIR1/[df][0-9]* $DIR1/lnk $DIR/[df].${TESTSUITE}*
58 SAMPLE_FILE=$TMP/$(basename $0 .sh).junk
59 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1
61 # $RUNAS_ID may get set incorrectly somewhere else
62 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
64 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
70 [ -f $DIR2/$tfile ] || error "Check create"
71 chmod 777 $DIR2/$tfile
72 $CHECKSTAT -t file -p 0777 $DIR1/$tfile ||
73 error "Check attribute update for 0777"
75 chmod a-x $DIR2/$tfile
76 $CHECKSTAT -t file -p 0666 $DIR1/$tfile ||
77 error "Check attribute update for 0666"
80 $CHECKSTAT -a $DIR1/$tfile ||
81 error "Check unlink - removes file on other mountpoint"
83 run_test 1 "Check attribute updates on 2 mount points"
89 $CHECKSTAT -t file -p 0777 $DIR1/f2a ||
90 error "Either not file type or perms not 0777"
92 run_test 2a "check cached attribute updates on 2 mtpt's ========"
98 $CHECKSTAT -t file -p 0777 $DIR2/f2b ||
99 error "Either not file type or perms not 0777"
101 run_test 2b "check cached attribute updates on 2 mtpt's ========"
103 # NEED TO SAVE ROOT DIR MODE
106 $CHECKSTAT -t dir -p 0777 $DIR2 ||
107 error "Either not dir type or perms not 0777"
109 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
113 $CHECKSTAT -t dir -p 0755 $DIR2 ||
114 error "Either not file type or perms not 0775"
116 run_test 2d "check cached attribute updates on 2 mtpt's root ==="
123 $RUNAS dd if=/dev/zero of=$DIR2/$tfile count=1 ||
126 run_test 2e "check chmod on root is propagated to others"
129 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
131 local remote_dir=$tdir/remote_dir
134 $LFS mkdir -i $MDTIDX $DIR1/$remote_dir ||
135 error "Create remote directory failed"
137 touch $DIR1/$remote_dir/$tfile ||
138 error "Create file under remote directory failed"
139 chmod 777 $DIR1/$remote_dir/$tfile ||
140 error "Chmod file under remote directory failed"
142 $CHECKSTAT -t file -p 0777 $DIR2/$remote_dir/$tfile ||
143 error "Check attr of file under remote directory failed"
145 chown $RUNAS_ID:$RUNAS_GID $DIR1/$remote_dir/$tfile ||
146 error "Chown file under remote directory failed"
148 $CHECKSTAT -u \#$RUNAS_ID -g \#$RUNAS_GID $DIR2/$remote_dir/$tfile ||
149 error "Check owner of file under remote directory failed"
151 cd $DIR2/$remote_dir || error "enter remote dir"
152 rm -rf $DIR1/$remote_dir/$tfile ||
153 error "Unlink remote directory failed"
155 $CHECKSTAT -t file $DIR2/$remote_dir/$tfile &&
156 error "unlink file still exists!"
158 cd $DIR2/$tdir || error "exit remote dir"
159 rm -rf $DIR1/$tdir || error "unlink directory failed"
161 run_test 2f "check attr/owner updates on DNE with 2 mtpt's"
164 dd if=/dev/zero of=$DIR1/$tfile oflag=sync bs=1M count=2
166 local block1=$(stat $DIR1/$tfile | awk '/Blocks/ {print $4} ')
168 local block2=$(stat $DIR2/$tfile | awk '/Blocks/ {print $4} ')
169 echo "$DIR1/$tfile has $block1 blocks"
170 echo "$DIR2/$tfile has $block2 blocks"
171 [ $block1 -eq $block2 ] || error "$block1 not equal to $block2"
173 run_test 2g "check blocks update on sync write"
176 local target="this/is/good"
177 ln -s $target $DIR1/$tfile || error "ln -s $target $DIR1/$tfile failed"
178 [ "$(ls -l $DIR2/$tfile | sed -e 's/.* -> //')" = "$target" ] ||
179 error "link $DIR2/$tfile not as expected"
181 run_test 3 "symlink on one mtpt, readlink on another ==========="
184 multifstat $DIR1/f4 $DIR2/f4
186 run_test 4 "fstat validation on multiple mount points =========="
190 $TRUNCATE $DIR2/f5 100
191 $CHECKSTAT -t file -s 100 $DIR1/f5 ||
192 error "Either not file type or size not equal to 100 bytes"
195 run_test 5 "create a file on one mount, truncate it on the other"
198 openunlink $DIR1/$tfile $DIR2/$tfile || \
199 error "openunlink $DIR1/$tfile $DIR2/$tfile"
201 run_test 6 "remove of open file on other node =================="
205 opendirunlink $DIR1/$dir $DIR2/$dir || \
206 error "opendirunlink $DIR1/$dir $DIR2/$dir"
208 run_test 7 "remove of open directory on other node ============="
211 opendevunlink $DIR1/$tfile $DIR2/$tfile || \
212 error "opendevunlink $DIR1/$tfile $DIR2/$tfile"
214 run_test 8 "remove of open special file on other node =========="
220 for C in a b c d e f g h i j k l; do
221 dir=`eval echo \\$DIR$MTPT`
222 echo -n $C >> $dir/f9
223 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
225 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
226 error "`od -a $DIR1/f9` != abcdefghijkl"
228 run_test 9a "append of file with sub-page size on multiple mounts"
230 #LU-10681 - tiny writes & appending to sparse striped file
232 [[ $OSTCOUNT -ge 2 ]] || { skip "needs >= 2 OSTs"; return; }
234 $LFS setstripe -c 2 -S 1M $DIR/$tfile
235 echo "foo" >> $DIR/$tfile
236 dd if=/dev/zero of=$DIR2/$tfile bs=1M count=1 seek=1 conv=notrunc ||
237 error "sparse dd $DIR2/$tfile failed"
238 echo "foo" >> $DIR/$tfile
240 data=$(dd if=$DIR2/$tfile bs=1 count=3 skip=$((2 * 1048576)) conv=notrunc)
241 echo "Data read (expecting 'foo')": $data
242 [ "$data" = "foo" ] || error "append to sparse striped file failed"
244 run_test 9b "append to striped sparse file"
251 for C in a b c d e f g h i j k l; do
252 dir=`eval echo \\$DIR$MTPT`
253 echo -n $C | dd of=$dir/f10 bs=1 seek=$OFFSET count=1
254 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
255 OFFSET=`expr $OFFSET + 1`
257 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
258 error "`od -a $DIR1/f10` != abcdefghijkl"
260 run_test 10a "write of file with sub-page size on multiple mounts "
264 yes "R" | head -c 4000 >$TMP/f10b-seed
265 dd if=$TMP/f10b-seed of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
267 $TRUNCATE $DIR1/f10b 4096 || error "truncate 4096"
269 dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
271 # create a test file locally to compare
272 dd if=$TMP/f10b-seed of=$TMP/f10b bs=3k count=1 || error "dd random"
273 $TRUNCATE $TMP/f10b 4096 || error "truncate 4096"
274 cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
275 rm $TMP/f10b $TMP/f10b-lustre $TMP/f10b-seed
277 run_test 10b "write of file with sub-page size on multiple mounts "
281 multiop_bg_pause $DIR1/d11/f O_c || return 1
283 cp -p /bin/ls $DIR1/d11/f
287 wait $MULTIPID || error "wait for PID $MULTIPID failed"
288 [ $RC -eq 0 ] && error || true
290 run_test 11 "execution of file opened for write should return error ===="
293 DIR=$DIR DIR2=$DIR2 sh lockorder.sh
295 run_test 12 "test lock ordering (link, stat, unlink)"
297 test_13() { # bug 2451 - directory coherency
299 cd $DIR1/d13 || error "cd to $DIR1/d13 failed"
301 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
303 rm -f $DIR2/d13/f13 || error "Cannot remove $DIR2/d13/f13"
304 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
305 # need to run it twice
306 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
308 rm -f $DIR2/d13/f13 || error "Cannot remove $DIR2/d13/f13"
309 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
311 run_test 13 "test directory page revocation"
314 test_mkdir $DIR1/$tdir
315 cp -p /bin/ls $DIR1/$tdir/$tfile
316 multiop_bg_pause $DIR1/$tdir/$tfile Ow_c || return 1
319 $DIR2/$tdir/$tfile && error || true
321 wait $MULTIPID || return 2
323 run_test 14aa "execution of file open for write returns -ETXTBSY"
326 test_mkdir $DIR1/$tdir
327 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
328 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
331 $MULTIOP $DIR2/$tdir/multiop Oc && error "expected error, got success"
332 kill -USR1 $MULTIOP_PID || return 2
333 wait $MULTIOP_PID || return 3
334 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
336 run_test 14ab "open(RDWR) of executing file returns -ETXTBSY"
338 test_14b() { # bug 3192, 7040
339 test_mkdir $DIR1/$tdir
340 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
341 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
344 $TRUNCATE $DIR2/$tdir/multiop 0 && kill -9 $MULTIOP_PID && \
345 error "expected truncate error, got success"
346 kill -USR1 $MULTIOP_PID || return 2
347 wait $MULTIOP_PID || return 3
348 cmp $(which multiop) $DIR1/$tdir/multiop || error "binary changed"
349 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
351 run_test 14b "truncate of executing file returns -ETXTBSY ======"
353 test_14c() { # bug 3430, 7040
354 test_mkdir $DIR1/$tdir
355 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
356 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
359 cp /etc/hosts $DIR2/$tdir/multiop && error "expected error, got success"
360 kill -USR1 $MULTIOP_PID || return 2
361 wait $MULTIOP_PID || return 3
362 cmp $(which multiop) $DIR1/$tdir/multiop || error "binary changed"
363 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
365 run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
367 test_14d() { # bug 10921
368 test_mkdir $DIR1/$tdir
369 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
370 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
374 chmod 600 $DIR1/$tdir/multiop || error "chmod failed"
375 kill -USR1 $MULTIOP_PID || return 2
376 wait $MULTIOP_PID || return 3
377 cmp $(which multiop) $DIR1/$tdir/multiop || error "binary changed"
378 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
380 run_test 14d "chmod of executing file is still possible ========"
382 test_15() { # bug 974 - ENOSPC
384 sh oos2.sh $MOUNT1 $MOUNT2
385 wait_delete_completed
386 grant_error=`dmesg | grep "> available"`
387 [ -z "$grant_error" ] || error "$grant_error"
389 run_test 15 "test out-of-space with multiple writers ==========="
392 # The FSXNUM reduction for ZFS is needed until ORI-487 is fixed.
393 # We don't want to skip it entirely, but ZFS is VERY slow and cannot
394 # pass a 2500 operation dual-mount run within the time limit.
395 if [ "$(facet_fstype ost1)" = "zfs" ]; then
396 FSXNUM=$((COUNT / 5))
398 elif [ "$SLOW" = "yes" ]; then
399 FSXNUM=$((COUNT * 5))
407 local file1=$DIR1/$tfile
408 local file2=$DIR2/$tfile
409 local stripe_size=$(do_facet $SINGLEMDS \
410 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
412 # to allocate grant because it may run out due to test_15.
413 $LFS setstripe -c -1 $file1
414 dd if=/dev/zero of=$file1 bs=$stripe_size count=$OSTCOUNT oflag=sync
415 dd if=/dev/zero of=$file2 bs=$stripe_size count=$OSTCOUNT oflag=sync
418 $LFS setstripe -c -1 $file1 # b=10919
419 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2 \
420 || error "fsx failed"
423 # O_DIRECT reads and writes must be aligned to the device block size.
424 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 -Z -r 4096 \
425 -w 4096 $file1 $file2 || error "fsx with O_DIRECT failed."
427 run_test 16a "$FSXNUM iterations of dual-mount fsx"
429 # Consistency check for tiny writes, LU-9409
431 local file1=$DIR1/$tfile
432 local file2=$DIR2/$tfile
434 # to allocate grant because it may run out due to test_15.
435 lfs setstripe -c -1 $file1
436 dd if=/dev/zero of=$file1 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
437 dd if=/dev/zero of=$file2 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
440 lfs setstripe -c -1 $file1 # b=10919
441 # -o is set to 8192 because writes < 1 page and between 1 and 2 pages
442 # create a mix of tiny writes & normal writes
443 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -o 8192 -S 0 $file1 \
446 run_test 16b "$FSXNUM iterations of dual-mount fsx at small size"
449 local file1=$DIR1/$tfile
450 local file2=$DIR2/$tfile
451 local stripe_size=$(do_facet $SINGLEMDS \
452 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
454 [ $(facet_fstype ost1) != ldiskfs ] && skip "dio on ldiskfs only"
456 # to allocate grant because it may run out due to test_15.
457 $LFS setstripe -c -1 $file1
458 dd if=/dev/zero of=$file1 bs=$stripe_size count=$OSTCOUNT oflag=sync
459 dd if=/dev/zero of=$file2 bs=$stripe_size count=$OSTCOUNT oflag=sync
461 wait_delete_completed
463 local list=$(comma_list $(osts_nodes))
464 if ! get_osd_param $list '' read_cache_enable >/dev/null; then
465 skip "not cache-capable obdfilter"
468 set_osd_param $list '' read_cache_enable 0
469 set_osd_param $list '' writethrough_cache_enable 0
471 $LFS setstripe -c -1 $file1 # b=10919
472 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2 \
473 || error "fsx failed"
476 set_osd_param $list '' read_cache_enable 1
477 set_osd_param $list '' writethrough_cache_enable 1
481 run_test 16c "verify data consistency on ldiskfs with cache disabled (b=17397)"
484 test_17() { # bug 3513, 3667
485 remote_ost_nodsh && skip "remote OST with nodsh" && return
487 lfs setstripe $DIR1/$tfile -i 0 -c 1
488 cp $SAMPLE_FILE $DIR1/$tfile
489 cancel_lru_locks osc > /dev/null
490 #define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a
491 do_facet ost1 lctl set_param fail_loc=0x8000030a
492 ls -ls $DIR1/$tfile | awk '{ print $1,$6 }' > $DIR1/$tfile-1 & \
493 ls -ls $DIR2/$tfile | awk '{ print $1,$6 }' > $DIR2/$tfile-2
495 diff -u $DIR1/$tfile-1 $DIR2/$tfile-2 || error "files are different"
497 run_test 17 "resource creation/LVB creation race ==============="
500 # turn e.g. ALWAYS_EXCEPT="18c" into "-e 3"
503 for idx in {a..z}; do
504 local ptr=EXCEPT_ALWAYS_18$idx
505 [ x${!ptr} = xtrue ] || continue
507 excepts="$excepts -e $(($(printf %d \'$idx)-96))"
510 $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2 $excepts
513 run_test 18 "mmap sanity check ================================="
515 test_19() { # bug3811
516 local node=$(facet_active_host ost1)
518 [ "x$DOM" = "xyes" ] && node=$(facet_active_host $SINGLEMDS)
520 # check whether obdfilter is cache capable at all
521 get_osd_param $node '' read_cache_enable >/dev/null ||
522 skip "not cache-capable obdfilter"
524 local MAX=$(get_osd_param $node '' readcache_max_filesize | head -n 1)
525 set_osd_param $node '' readcache_max_filesize 4096
526 dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
527 local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
528 cp $TMP/$tfile $DIR1/$tfile
529 for i in `seq 1 20`; do
530 [ $((i % 5)) -eq 0 ] && log "$testname loop $i"
531 cancel_lru_locks $OSC > /dev/null
532 cksum $DIR1/$tfile | cut -d" " -f 1,2 > $TMP/sum1 & \
533 cksum $DIR2/$tfile | cut -d" " -f 1,2 > $TMP/sum2
535 [ "$(cat $TMP/sum1)" = "$SUM" ] || \
536 error "$DIR1/$tfile $(cat $TMP/sum1) != $SUM"
537 [ "$(cat $TMP/sum2)" = "$SUM" ] || \
538 error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
540 set_osd_param $node '' readcache_max_filesize $MAX
543 run_test 19 "test concurrent uncached read races ==============="
547 cancel_lru_locks $OSC
548 CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
549 $MULTIOP $DIR1/f20 Ow8190c
550 $MULTIOP $DIR2/f20 Oz8194w8190c
551 $MULTIOP $DIR1/f20 Oz0r8190c
552 cancel_lru_locks $OSC
553 CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
555 error $CNTD" page left in cache after lock cancel" || true
557 run_test 20 "test extra readahead page left in cache ===="
564 test_21() { # Bug 5907
565 test_mkdir $DIR1/$tdir
566 mount /etc $DIR1/$tdir --bind || error "mount failed" # Poor man's mount.
568 rmdir -v $DIR1/$tdir && error "Removed mounted directory"
569 rmdir -v $DIR2/$tdir && echo "Removed mounted directory from another mountpoint, needs to be fixed"
570 test -d $DIR1/$tdir || error "Mounted directory disappeared"
572 test -d $DIR2/$tdir || test -d $DIR1/$tdir && error "Removed dir still visible after umount"
575 run_test 21 " Try to remove mountpoint on another dir ===="
577 test_23() { # Bug 5972
578 local at_diff=$(do_facet $SINGLEMDS \
579 $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -n1)
580 echo "atime should be updated while another read" > $DIR1/$tfile
582 # clear the lock(mode: LCK_PW) gotten from creating operation
583 cancel_lru_locks $OSC
586 sleep $((at_diff + 1))
588 echo "starting reads"
589 multiop_bg_pause $DIR1/$tfile or20_c || return 1
590 # with SOM and opencache enabled, we need to close a file and cancel
591 # open lock to get atime propogated to MDS
592 kill -USR1 $! || return 2
595 time2=$(stat -c "%X" $DIR/$tfile)
596 echo "new atime is $time2"
598 [ $time2 -gt $time1 ] || error "atime was not updated"
599 rm -f $DIR1/$tfile || error "rm -f $DIR1/$tfile failed"
602 run_test 23 " others should see updated atime while another read===="
606 lfs df || error "lfs df failed"
607 lfs df -ih || error "lfs df -ih failed"
608 lfs df -h $DIR1 || error "lfs df -h $DIR1 failed"
609 lfs df -i $DIR2 || error "lfs df -i $DIR2 failed"
610 lfs df $DIR1/$tfile || error "lfs df $DIR1/$tfile failed"
611 lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
613 OSC=`lctl dl | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1`
614 # OSC=`lctl dl | awk '/-osc-/ {print $4}' | head -n 1`
615 lctl --device %osc deactivate
616 lfs df -i || error "lfs df -i with deactivated OSC failed"
617 lctl --device %osc activate
618 lfs df || error "lfs df with reactivated OSC failed"
620 run_test 24a "lfs df [-ih] [path] test ========================="
624 fsnum=$(lfs_df | grep -c "summary")
625 [ $fsnum -eq 2 ] || error "lfs df shows $fsnum != 2 filesystems."
627 run_test 24b "lfs df should show both filesystems ==============="
630 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
632 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
635 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
636 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
638 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
639 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
640 error "setfacl $DIR2/$tdir #1"
641 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
642 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
643 error "setfacl $DIR2/$tdir #2"
644 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
645 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
646 error "setfacl $DIR2/$tdir #3"
647 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
648 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
649 error "setfacl $DIR2/$tdir #4"
650 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
654 run_test 25a "change ACL on one mountpoint be seen on another ==="
657 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
659 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
661 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
664 $LFS mkdir -i 1 $DIR1/$tdir
665 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
666 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
668 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
669 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
670 error "setfacl $DIR2/$tdir #1"
671 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
672 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
673 error "setfacl $DIR2/$tdir #2"
674 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
675 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
676 error "setfacl $DIR2/$tdir #3"
677 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
678 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
679 error "setfacl $DIR2/$tdir #4"
680 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
684 run_test 25b "change ACL under remote dir on one mountpoint be seen on another"
687 utime $DIR1/f26a -s $DIR2/f26a || error "utime failed for $DIR1/f26a"
689 run_test 26a "allow mtime to get older"
694 echo "aaa" >> $DIR1/$tfile
696 chmod a+x $DIR2/$tfile
697 mt1=`stat -c %Y $DIR1/$tfile`
698 mt2=`stat -c %Y $DIR2/$tfile`
700 if [ x"$mt1" != x"$mt2" ]; then
701 error "not equal mtime, client1: "$mt1", client2: "$mt2"."
704 run_test 26b "sync mtime between ost and mds"
707 cancel_lru_locks $OSC
709 dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
714 dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
719 dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
721 lctl set_param -n ldlm.dump_namespaces ""
722 wait $DD1_PID $DD2_PID
723 [ $? -ne 0 ] && lctl dk $TMP/debug || true
725 run_test 27 "align non-overlapping extent locks from request ==="
727 test_28() { # bug 9977
728 ECHO_UUID="ECHO_osc1_UUID"
729 tOST=$($LCTL dl | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -n1)
731 $LFS setstripe $DIR1/$tfile -S 1048576 -i 0 -c 2
732 tOBJID=`$LFS getstripe $DIR1/$tfile | awk '$1 == 1 {print $2}'`
733 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
737 attach echo_client ECHO_osc1 $ECHO_UUID
741 tECHOID=`$LCTL dl | grep $ECHO_UUID | awk '{ print $1 }'`
742 $LCTL --device $tECHOID destroy "${tOBJID}:0"
750 # reading of 1st stripe should pass
751 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error "dd failed"
752 # reading of 2nd stripe should fail (this stripe was destroyed)
753 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 && error
755 # now, recreating test file
756 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2 || error "dd failed"
757 # reading of 1st stripe should pass
758 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error "dd failed"
759 # reading of 2nd stripe should pass
760 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 ||
763 run_test 28 "read/write/truncate file with lost stripes"
765 test_30() { #b=11110, LU-2523
766 test_mkdir $DIR1/$tdir
767 cp -f /bin/bash $DIR1/$tdir/bash
768 /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
769 $DIR1/$tdir/bash -c 'sleep 2;
770 openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?'
774 run_test 30 "recreate file race"
777 test_mkdir $DIR1/$tdir
778 local writes=$(LANG=C dd if=/dev/zero of=$DIR/$tdir/$tfile \
779 count=1 2>&1 | awk 'BEGIN { FS="+" } /out/ {print $1}')
780 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
781 lctl set_param fail_loc=0x314
782 local reads=$(LANG=C dd if=$DIR2/$tdir/$tfile of=/dev/null 2>&1 |
783 awk 'BEGIN { FS="+" } /in/ {print $1}')
784 [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
786 run_test 31a "voluntary cancel / blocking ast race=============="
789 remote_ost || { skip "local OST" && return 0; }
790 remote_ost_nodsh && skip "remote OST w/o dsh" && return 0
792 # make sure there is no local locks due to destroy
793 wait_mds_ost_sync || error "wait_mds_ost_sync()"
794 wait_delete_completed || error "wait_delete_completed()"
796 test_mkdir $DIR1/$tdir
797 lfs setstripe $DIR/$tdir/$tfile -i 0 -c 1
798 cp /etc/hosts $DIR/$tdir/$tfile
799 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
800 lctl set_param fail_loc=0x314
801 #define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316
802 do_facet ost1 lctl set_param fail_loc=0x316
804 cat $DIR2/$tdir/$tfile > /dev/null 2>&1
805 lctl set_param fail_loc=0
806 do_facet ost1 lctl set_param fail_loc=0
807 # cleanup: reconnect the client back
810 run_test 31b "voluntary OST cancel / blocking ast race=============="
812 # enable/disable lockless truncate feature, depending on the arg 0/1
813 enable_lockless_truncate() {
814 lctl set_param -n $OSC.*.lockless_truncate $1
817 test_32a() { # bug 11270
818 local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
819 local stripe_size=$(do_facet $SINGLEMDS \
820 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
822 save_lustre_params client "$OSC.*.lockless_truncate" > $save
823 # restore lockless_truncate default values on exit
824 stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
825 cancel_lru_locks $OSC
826 enable_lockless_truncate 1
828 lfs setstripe -c -1 $DIR1/$tfile
829 dd if=/dev/zero of=$DIR1/$tfile count=$OSTCOUNT bs=$stripe_size > \
831 clear_stats $OSC.*.${OSC}_stats
833 log "checking cached lockless truncate"
834 $TRUNCATE $DIR1/$tfile 8000000
835 $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
836 [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
837 error "cached truncate isn't lockless"
839 log "checking not cached lockless truncate"
840 $TRUNCATE $DIR2/$tfile 5000000
841 $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
842 [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
843 error "not cached truncate isn't lockless"
845 log "disabled lockless truncate"
846 enable_lockless_truncate 0
847 clear_stats $OSC.*.${OSC}_stats
848 $TRUNCATE $DIR2/$tfile 3000000
849 $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
850 [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -eq 0 ] ||
851 error "lockless truncate disabling failed"
854 run_test 32a "lockless truncate"
856 test_32b() { # bug 11270
857 remote_ost_nodsh && skip "remote OST with nodsh" && return
860 local facets=$(get_facets OST)
861 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
863 save_lustre_params client "osc.*.contention_seconds" > $p
864 save_lustre_params $facets \
865 "ldlm.namespaces.filter-*.max_nolock_bytes" >> $p
866 save_lustre_params $facets \
867 "ldlm.namespaces.filter-*.contended_locks" >> $p
868 save_lustre_params $facets \
869 "ldlm.namespaces.filter-*.contention_seconds" >> $p
870 clear_stats $OSC.*.${OSC}_stats
872 # agressive lockless i/o settings
873 do_nodes $(comma_list $(osts_nodes)) \
874 "lctl set_param -n ldlm.namespaces.*.max_nolock_bytes=2000000 \
875 ldlm.namespaces.filter-*.contended_locks=0 \
876 ldlm.namespaces.filter-*.contention_seconds=60"
877 lctl set_param -n $OSC.*.contention_seconds=60
879 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > \
881 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > \
884 [ $(calc_stats $OSC.*.${OSC}_stats lockless_write_bytes) -ne 0 ] ||
885 error "lockless i/o was not triggered"
886 # disable lockless i/o (it is disabled by default)
887 do_nodes $(comma_list $(osts_nodes)) \
888 "lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes=0 \
889 ldlm.namespaces.filter-*.contended_locks=32 \
890 ldlm.namespaces.filter-*.contention_seconds=0"
891 # set contention_seconds to 0 at client too, otherwise Lustre still
892 # remembers lock contention
893 lctl set_param -n $OSC.*.contention_seconds=0
894 clear_stats $OSC.*.${OSC}_stats
896 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > \
898 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > \
901 [ $(calc_stats $OSC.*.${OSC}_stats lockless_write_bytes) -eq 0 ] ||
902 error "lockless i/o works when disabled"
904 restore_lustre_params <$p
907 run_test 32b "lockless i/o"
911 local mdts=$(get_facets MDS)
916 for mds in ${mdts//,/ }; do
918 dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
919 xargs readlink -f" ))
920 val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
923 stat=$(( stat + val))
928 # commit on sharing tests
930 remote_mds_nodsh && skip "remote MDS with nodsh" && return
932 [ -z "$CLIENTS" ] && skip "Need two or more clients, have $CLIENTS" && return 0
933 [ $CLIENTCOUNT -lt 2 ] &&
934 skip "Need two or more clients, have $CLIENTCOUNT" && return 0
936 local nfiles=${TEST33_NFILES:-10000}
937 local param_file=$TMP/$tfile-params
938 local fstype=$(facet_fstype $SINGLEMDS)
940 save_lustre_params $(get_facets MDS) \
941 "mdt.*.commit_on_sharing" > $param_file
949 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
953 do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
955 [ $fstype = ldiskfs ] && jbdold=$(print_jbd_stat)
956 echo "=== START createmany old: $jbdold transaction"
957 local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- -r$DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > /dev/null 2>&1")
958 [ $fstype = ldiskfs ] && jbdnew=$(print_jbd_stat)
959 [ $fstype = ldiskfs ] && jbd=$(( jbdnew - jbdold ))
960 echo "=== END createmany new: $jbdnew transaction : $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
961 [ $fstype = ldiskfs ] && avgjbd=$(( avgjbd + jbd ))
962 avgtime=$(( avgtime + elapsed ))
964 eval cos${COS}_jbd=$((avgjbd / 3))
965 eval cos${COS}_time=$((avgtime / 3))
968 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
969 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
970 [ "$cos0_jbd" != 0 ] && echo "COS=1 vs COS=0 jbd: $((((cos1_jbd/cos0_jbd - 1)) * 100 )) %"
971 [ "$cos0_time" != 0 ] && echo "COS=1 vs COS=0 time: $((((cos1_time/cos0_time - 1)) * 100 )) %"
973 restore_lustre_params < $param_file
977 run_test 33a "commit on sharing, cross crete/delete, 2 clients, benchmark"
979 # commit on sharing tests
981 remote_mds_nodsh && skip "remote MDS with nodsh" && return
983 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
984 [ $CLIENTCOUNT -ge 2 ] ||
985 { skip "Need two or more clients, have $CLIENTCOUNT" &&
987 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
989 local nfiles=${TEST33_NFILES:-10000}
990 local param_file=$TMP/$tfile-params
992 save_lustre_params $(get_facets MDS) \
993 "mdt.*.commit_on_sharing" > $param_file
1002 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
1006 do_node $CLIENT1 "$LFS mkdir -i $MDTIDX \
1007 $DIR1/$tdir-\\\$(hostname)-$i"
1009 jbdold=$(print_jbd_stat)
1010 echo "=== START createmany old: $jbdold transaction"
1011 local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2\
1012 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- \
1013 -r$DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > \
1015 jbdnew=$(print_jbd_stat)
1016 jbd=$(( jbdnew - jbdold ))
1017 echo "=== END createmany new: $jbdnew transaction : \
1018 $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
1019 avgjbd=$(( avgjbd + jbd ))
1020 avgtime=$(( avgtime + elapsed ))
1022 eval cos${COS}_jbd=$((avgjbd / 3))
1023 eval cos${COS}_time=$((avgtime / 3))
1026 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
1027 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
1028 [ "$cos0_jbd" != 0 ] &&
1029 echo "COS=1 vs COS=0 jbd: $(((cos1_jbd/cos0_jbd - 1) * 100)) %"
1030 [ "$cos0_time" != 0 ] &&
1031 echo "COS=1 vs COS=0 time: $(((cos1_time/cos0_time - 1) * 100)) %"
1033 restore_lustre_params < $param_file
1037 run_test 33b "COS: cross create/delete, 2 clients, benchmark under remote dir"
1040 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1041 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
1042 skip "DNE CoS not supported" && return
1048 do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
1049 # do twice in case transaction is committed before unlock, see LU-8200
1051 # remote dir is created on MDT1, which enqueued lock of $tdir on
1053 $LFS mkdir -i 1 $DIR/$tdir/remote.$i
1054 mkdir $DIR/$tdir/local.$i
1056 sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count")
1057 echo "sync_count $sync_count"
1058 [ $sync_count -eq 0 ] && error "Sync-Lock-Cancel not triggered"
1061 do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
1062 $LFS mkdir -i 1 $DIR/$tdir/remote.3
1063 # during sleep remote mkdir should have been committed and canceled
1064 # remote lock spontaneously, which shouldn't trigger sync
1066 mkdir $DIR/$tdir/local.3
1067 sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count")
1068 echo "sync_count $sync_count"
1069 [ $sync_count -eq 0 ] || error "Sync-Lock-Cancel triggered"
1071 run_test 33c "Cancel cross-MDT lock should trigger Sync-Lock-Cancel"
1073 # arg1 is operations done before CoS, arg2 is the operation that triggers CoS
1077 local nodes=$(comma_list $(mdts_nodes))
1081 # trigger CoS twice in case transaction commit before unlock
1084 do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
1086 commit_nr=$(do_nodes $nodes \
1087 "lctl get_param -n mdt.*.async_commit_count" | calc_sum)
1088 total=$((total + commit_nr));
1093 echo "CoS count $total"
1094 [ $total -gt 0 ] || error "$2 didn't trigger CoS"
1098 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1099 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
1100 skip "DNE CoS not supported" && return
1102 # remote directory create
1103 op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -i 1 $DIR/$tdir/subdir"
1104 # remote directory unlink
1105 op_trigger_cos "$LFS mkdir -i 1 $DIR/$tdir" "rmdir $DIR/$tdir"
1106 # striped directory create
1107 op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -c 2 $DIR/$tdir/subdir"
1108 # striped directory setattr
1109 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; touch $DIR/$tdir" \
1110 "chmod 713 $DIR/$tdir"
1111 # striped directory unlink
1112 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; touch $DIR/$tdir" \
1115 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; \
1116 $LFS mkdir -i 0 $DIR/$tdir/d1; \
1117 $LFS mkdir -i 1 $DIR/$tdir/d2; \
1118 touch $DIR/$tdir/d1/tgt" \
1119 "ln $DIR/$tdir/d1/tgt $DIR/$tdir/d2/src"
1121 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; \
1122 $LFS mkdir -i 0 $DIR/$tdir/d1; \
1123 $LFS mkdir -i 1 $DIR/$tdir/d2; \
1124 touch $DIR/$tdir/d1/src" \
1125 "mv $DIR/$tdir/d1/src $DIR/$tdir/d2/tgt"
1127 op_trigger_cos "$LFS mkdir -i 0 $DIR/$tdir" \
1128 "$LFS migrate -m 1 $DIR/$tdir"
1132 run_test 33d "DNE distributed operation should trigger COS"
1135 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
1136 [ $CLIENTCOUNT -ge 2 ] ||
1137 { skip "Need two or more clients, have $CLIENTCOUNT" &&
1139 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1140 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
1141 skip "DNE CoS not supported" && return
1143 local client2=${CLIENT2:-$(hostname)}
1147 local nodes=$(comma_list $(mdts_nodes))
1148 do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
1150 $LFS mkdir -c 2 $DIR/$tdir
1151 mkdir $DIR/$tdir/subdir
1152 echo abc > $DIR/$tdir/$tfile
1153 do_node $client2 echo dfg >> $DIR/$tdir/$tfile
1154 do_node $client2 touch $DIR/$tdir/subdir
1156 local async_commit_count=$(do_nodes $nodes \
1157 "lctl get_param -n mdt.*.async_commit_count" | calc_sum)
1158 [ $async_commit_count -gt 0 ] && error "CoS triggerred"
1162 run_test 33e "DNE local operation shouldn't trigger COS"
1164 # End commit on sharing tests
1166 get_ost_lock_timeouts() {
1167 local nodes=${1:-$(comma_list $(osts_nodes))}
1169 local locks=$(do_nodes $nodes \
1170 "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
1178 do_nodes $(comma_list $(osts_nodes)) \
1179 "lctl set_param -n fail_loc=0 2>/dev/null || true"
1180 for i in $(seq $OSTCOUNT); do
1181 wait_osc_import_ready client ost$i
1186 remote_ost_nodsh && skip "remote OST with nodsh" && return
1190 trap cleanup_34 EXIT RETURN
1191 for OPER in notimeout timeout ; do
1192 rm $DIR1/$tfile 2>/dev/null
1193 lock_in=$(get_ost_lock_timeouts)
1194 if [ $OPER == "timeout" ] ; then
1195 for j in `seq $OSTCOUNT`; do
1196 #define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT 0x511
1197 do_facet ost$j lctl set_param fail_loc=0x511
1199 echo lock should expire
1201 for j in `seq $OSTCOUNT`; do
1202 #define OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT 0x512
1203 do_facet ost$j lctl set_param fail_loc=0x512
1205 echo lock should not expire
1207 echo writing on client1
1208 dd if=/dev/zero of=$DIR1/$tfile count=100 conv=notrunc > /dev/null 2>&1
1210 echo reading on client2
1211 dd of=/dev/null if=$DIR2/$tfile > /dev/null 2>&1
1212 # wait for a lock timeout
1214 lock_out=$(get_ost_lock_timeouts)
1215 if [ $OPER == "timeout" ] ; then
1216 if [ $lock_in == $lock_out ]; then
1217 error "no lock timeout happened"
1222 if [ $lock_in != $lock_out ]; then
1223 error "lock timeout happened"
1231 run_test 34 "no lock timeout under IO"
1233 test_35() { # bug 17645
1236 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1237 awk '/generation/{print $2}')
1239 generation[count]=$g
1243 test_mkdir $MOUNT1/$tdir
1244 cancel_lru_locks mdc
1246 # Let's initiate -EINTR situation by setting fail_loc and take
1247 # write lock on same file from same client. This will not cause
1248 # bl_ast yet as lock is already in local cache.
1249 #define OBD_FAIL_LDLM_INTR_CP_AST 0x317
1250 do_facet client "lctl set_param fail_loc=0x80000317"
1251 local timeout=$(do_facet $SINGLEMDS lctl get_param -n timeout)
1252 let timeout=timeout*3
1254 while test $nr -lt 10; do
1255 log "Race attempt $nr"
1256 local blk1=$(lctl get_param -n ldlm.services.ldlm_cbd.stats |
1257 awk '/ldlm_bl_callback/ { print $2 }')
1258 test "x$blk1" = "x" && blk1=0
1259 createmany -o $MOUNT2/$tdir/a 4000 &
1263 # Let's make conflict and bl_ast
1264 ls -la $MOUNT1/$tdir > /dev/null &
1267 log "Wait for $pid1 $pid2 for $timeout sec..."
1269 kill -9 $pid1 $pid2 > /dev/null 2>&1
1271 local blk2=$(lctl get_param -n ldlm.services.ldlm_cbd.stats |
1272 awk '/ldlm_bl_callback/ { print $2 }')
1273 test "x$blk2" = "x" && blk2=0
1274 test $blk2 -gt $blk1 && break
1275 rm -fr $MOUNT1/$tdir
1276 cancel_lru_locks mdc
1279 do_facet client "lctl set_param fail_loc=0x0"
1280 df -h $MOUNT1 $MOUNT2
1282 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1283 awk '/generation/{print $2}')
1285 if ! test "$g" -eq "${generation[count]}"; then
1286 list=$(lctl list_param mdc.$FSNAME-MDT*-mdc-*.import)
1288 for imp in $list; do
1289 if [ $c = $count ]; then
1294 imp=$(echo "$imp" | awk -F"." '{print $2}')
1295 error "Eviction happened on import $imp"
1300 run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
1302 test_36() { #bug 16417
1307 test_mkdir $DIR1/$tdir
1308 $LFS setstripe -c -1 $DIR1/$tdir
1311 let SIZE_B=SIZE*1024*1024
1312 sync; sleep 2; sync # wait for delete thread
1313 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1314 wait_destroy_complete || error "wait_destroy_complete failed"
1316 while [ $i -le 10 ]; do
1317 lctl mark "start test - cycle ($i)"
1318 local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1319 dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
1320 error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
1321 sync # sync data from client cache
1322 sync_all_data # sync data from server cache (delayed allocation)
1324 local after_dd=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1325 multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
1327 rm -f $DIR1/$tdir/$tfile
1328 kill -USR1 $read_pid
1330 sync; sleep 2; sync # Ensure new statfs
1331 wait_delete_completed
1332 local after=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1333 echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
1335 # this free space! not used
1336 (( $after_dd <= $after)) ||
1337 error "space leaked after_dd:$after_dd > after:$after"
1341 run_test 36 "handle ESTALE/open-unlink correctly"
1343 test_37() { # bug 18695
1344 test_mkdir $DIR1/$tdir
1345 multiop_bg_pause $DIR1/$tdir D_c || return 1
1347 # create large directory (32kB seems enough from e2fsck, ~= 1000 files)
1348 createmany -m $DIR2/$tdir/f 10000
1349 # set mtime/atime backward
1350 touch -t 198001010000 $DIR2/$tdir
1351 kill -USR1 $MULTIPID
1352 nr_files=`lfs find $DIR1/$tdir -type f | wc -l`
1353 [ $nr_files -eq 10000 ] || error "$nr_files != 10000 truncated directory?"
1356 run_test 37 "check i_size is not updated for directory on close (bug 18695) =============="
1358 # this should be set to past
1359 TEST_39_MTIME=`date -d "1 year ago" +%s`
1363 local client1=${CLIENT1:-`hostname`}
1364 local client2=${CLIENT2:-`hostname`}
1366 do_node $client1 "touch $DIR1/$tfile"
1368 do_node $client1 "touch -m -d @$TEST_39_MTIME $DIR1/$tfile"
1369 local mtime1=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1370 [ "$mtime1" = $TEST_39_MTIME ] || \
1371 error "mtime is not set to past: $mtime1, should be $TEST_39_MTIME"
1373 local d1=`do_node $client1 date +%s`
1374 do_node $client1 'echo hello >> '$DIR1/$tfile
1375 local d2=`do_node $client1 date +%s`
1377 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1378 [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] || \
1379 error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
1381 do_node $client1 "mv $DIR1/$tfile $DIR1/$tfile-1"
1383 for (( i=0; i < 2; i++ )) ; do
1384 local mtime3=`do_node $client2 "stat -c %Y $DIR1/$tfile-1"`
1385 [ "$mtime2" = "$mtime3" ] || \
1386 error "mtime ($mtime2) changed (to $mtime3) on rename"
1388 cancel_lru_locks osc
1389 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1392 run_test 39a "test from 11063 =================================="
1395 local client1=${CLIENT1:-`hostname`}
1396 local client2=${CLIENT2:-`hostname`}
1400 local mtime1=`stat -c %Y $DIR1/$tfile`
1401 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1404 touch -m -d @$TEST_39_MTIME $DIR1/$tfile
1406 for (( i=0; i < 2; i++ )) ; do
1407 local mtime3=`stat -c %Y $DIR1/$tfile`
1408 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1410 [ "$mtime3" = "$mtime4" ] || \
1411 error "different mtime on clients: $mtime3, $mtime4"
1412 [ "$mtime3" = $TEST_39_MTIME ] || \
1413 error "lost mtime: $mtime3, should be $TEST_39_MTIME"
1415 cancel_lru_locks osc
1416 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1419 run_test 39b "11063 problem 1 =================================="
1422 local client1=${CLIENT1:-`hostname`}
1423 local client2=${CLIENT2:-`hostname`}
1425 echo hello > $DIR1/$tfile
1427 local mtime1=`stat -c %Y $DIR1/$tfile`
1428 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1429 [ "$mtime1" = "$mtime2" ] || \
1430 error "create: different mtime on clients: $mtime1, $mtime2"
1433 $TRUNCATE $DIR1/$tfile 1
1435 for (( i=0; i < 2; i++ )) ; do
1436 local mtime3=`stat -c %Y $DIR1/$tfile`
1437 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1439 [ "$mtime3" = "$mtime4" ] || \
1440 error "different mtime on clients: $mtime3, $mtime4"
1441 [ "$mtime3" -gt $mtime2 ] || \
1442 error "truncate did not update mtime: $mtime2, $mtime3"
1444 cancel_lru_locks osc
1445 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1448 run_test 39c "check truncate mtime update ======================"
1450 test_39d() { # LU-7310
1452 touch -m -d @$TEST_39_MTIME $DIR1/$tfile
1454 local mtime1=$(stat -c %Y $DIR2/$tfile)
1455 [ "$mtime1" = $TEST_39_MTIME ] ||
1456 error "mtime: $mtime1, should be $TEST_39_MTIME"
1459 # define OBD_FAIL_OSC_NO_GRANT 0x411
1460 $LCTL set_param fail_loc=0x411
1462 local d1=$(date +%s)
1463 echo hello >> $DIR1/$tfile
1464 local d2=$(date +%s)
1466 $LCTL set_param fail_loc=0
1468 cancel_lru_locks $OSC
1470 local mtime2=$(stat -c %Y $DIR2/$tfile)
1471 [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] ||
1472 error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
1474 run_test 39d "sync write should update mtime"
1476 # check that pid exists hence second operation wasn't blocked by first one
1477 # if it is so then there is no conflict, return 0
1478 # else second operation is conflicting with first one, return 1
1479 check_pdo_conflict() {
1482 sleep 1 # to ensure OP1 is finished on client if OP2 is blocked by OP1
1483 if [[ `ps --pid $pid | wc -l` == 1 ]]; then
1493 # test 40: check non-blocking operations
1495 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1496 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1497 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1499 mkdir $DIR1/$tfile &
1502 touch $DIR2/$tfile-2
1503 check_pdo_conflict $PID1 || error "create is blocked"
1504 mkdir $DIR2/$tfile-3
1505 check_pdo_conflict $PID1 || error "mkdir is blocked"
1506 link $DIR2/$tfile-2 $DIR2/$tfile-4
1507 check_pdo_conflict $PID1 || error "link is blocked"
1508 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1509 check_pdo_conflict $PID1 || error "rename is blocked"
1510 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1511 check_pdo_conflict $PID1 || error "getattr is blocked"
1512 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1513 rmdir $DIR2/$tfile-3
1514 check_pdo_conflict $PID1 || error "unlink is blocked"
1516 # all operations above shouldn't wait the first one
1517 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1522 run_test 40a "pdirops: create vs others =============="
1525 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1526 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1527 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1528 touch $DIR1/$tfile &
1532 touch $DIR2/$tfile-2
1533 check_pdo_conflict $PID1 || error "create is blocked"
1534 mkdir $DIR2/$tfile-3
1535 check_pdo_conflict $PID1 || error "mkdir is blocked"
1536 link $DIR2/$tfile-2 $DIR2/$tfile-4
1537 check_pdo_conflict $PID1 || error "link is blocked"
1538 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1539 check_pdo_conflict $PID1 || error "rename is blocked"
1540 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1541 check_pdo_conflict $PID1 || error "getattr is blocked"
1542 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1543 rmdir $DIR2/$tfile-3
1544 check_pdo_conflict $PID1 || error "unlink is blocked"
1545 # all operations above shouldn't wait the first one
1547 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1552 run_test 40b "pdirops: open|create and others =============="
1555 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1557 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1558 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1559 link $DIR1/$tfile $DIR1/$tfile-0 &
1563 touch $DIR2/$tfile-2
1564 check_pdo_conflict $PID1 || error "create is blocked"
1565 mkdir $DIR2/$tfile-3
1566 check_pdo_conflict $PID1 || error "mkdir is blocked"
1567 link $DIR2/$tfile-2 $DIR2/$tfile-4
1568 check_pdo_conflict $PID1 || error "link is blocked"
1569 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1570 check_pdo_conflict $PID1 || error "rename is blocked"
1571 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1572 check_pdo_conflict $PID1 || error "getattr is blocked"
1573 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1574 rmdir $DIR2/$tfile-3
1575 check_pdo_conflict $PID1 || error "unlink is blocked"
1577 # all operations above shouldn't wait the first one
1578 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1583 run_test 40c "pdirops: link and others =============="
1586 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1588 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1589 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1594 touch $DIR2/$tfile-2
1595 check_pdo_conflict $PID1 || error "create is blocked"
1596 mkdir $DIR2/$tfile-3
1597 check_pdo_conflict $PID1 || error "mkdir is blocked"
1598 link $DIR2/$tfile-2 $DIR2/$tfile-4
1599 check_pdo_conflict $PID1 || error "link is blocked"
1600 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1601 check_pdo_conflict $PID1 || error "rename is blocked"
1602 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1603 check_pdo_conflict $PID1 || error "getattr is blocked"
1604 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1605 rmdir $DIR2/$tfile-3
1606 check_pdo_conflict $PID1 || error "unlink is blocked"
1608 # all operations above shouldn't wait the first one
1609 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1613 run_test 40d "pdirops: unlink and others =============="
1616 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1618 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1619 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1620 mv $DIR1/$tfile $DIR1/$tfile-0 &
1624 touch $DIR2/$tfile-2
1625 check_pdo_conflict $PID1 || error "create is blocked"
1626 mkdir $DIR2/$tfile-3
1627 check_pdo_conflict $PID1 || error "mkdir is blocked"
1628 link $DIR2/$tfile-2 $DIR2/$tfile-4
1629 check_pdo_conflict $PID1 || error "link is blocked"
1630 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1631 check_pdo_conflict $PID1 || error "getattr is blocked"
1632 rm $DIR2/$tfile-4 $DIR2/$tfile-2
1633 rmdir $DIR2/$tfile-3
1634 check_pdo_conflict $PID1 || error "unlink is blocked"
1636 # all operations above shouldn't wait the first one
1637 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1642 run_test 40e "pdirops: rename and others =============="
1644 # test 41: create blocking operations
1646 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1647 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1648 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1651 mkdir $DIR2/$tfile && error "mkdir must fail"
1652 check_pdo_conflict $PID1 && { wait $PID1; echo "mkdir isn't blocked"; }
1656 run_test 41a "pdirops: create vs mkdir =============="
1659 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1660 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1661 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1664 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1665 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1669 run_test 41b "pdirops: create vs create =============="
1672 touch $DIR1/$tfile-2
1673 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1674 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1675 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1678 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1679 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1683 run_test 41c "pdirops: create vs link =============="
1686 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1687 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1688 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1691 rm $DIR2/$tfile || error "unlink must succeed"
1692 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1696 run_test 41d "pdirops: create vs unlink =============="
1699 touch $DIR1/$tfile-2
1700 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1701 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1702 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1705 mv $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1706 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1710 run_test 41e "pdirops: create and rename (tgt) =============="
1713 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1714 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1715 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1718 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1719 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1723 run_test 41f "pdirops: create and rename (src) =============="
1726 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1727 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1728 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1731 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1732 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1736 run_test 41g "pdirops: create vs getattr =============="
1739 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1740 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1741 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1744 ls -lia $DIR2/ > /dev/null
1745 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1749 run_test 41h "pdirops: create vs readdir =============="
1751 # test 42: unlink and blocking operations
1753 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1754 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1755 mkdir $DIR1/$tfile &
1758 mkdir $DIR2/$tfile && error "mkdir must fail"
1759 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1763 run_test 42a "pdirops: mkdir vs mkdir =============="
1766 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1767 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1768 mkdir $DIR1/$tfile &
1771 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1772 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1776 run_test 42b "pdirops: mkdir vs create =============="
1779 touch $DIR1/$tfile-2
1780 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1781 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1782 mkdir $DIR1/$tfile &
1785 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1786 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1790 run_test 42c "pdirops: mkdir vs link =============="
1793 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1794 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1795 mkdir $DIR1/$tfile &
1798 rmdir $DIR2/$tfile || error "unlink must succeed"
1799 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1803 run_test 42d "pdirops: mkdir vs unlink =============="
1806 touch $DIR1/$tfile-2
1807 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1808 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1809 mkdir $DIR1/$tfile &
1812 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
1813 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1817 run_test 42e "pdirops: mkdir and rename (tgt) =============="
1820 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1821 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1822 mkdir $DIR1/$tfile &
1825 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1826 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1830 run_test 42f "pdirops: mkdir and rename (src) =============="
1833 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1834 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1835 mkdir $DIR1/$tfile &
1838 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1839 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1843 run_test 42g "pdirops: mkdir vs getattr =============="
1846 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1847 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1848 mkdir $DIR1/$tfile &
1851 ls -lia $DIR2/ > /dev/null
1852 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1856 run_test 42h "pdirops: mkdir vs readdir =============="
1858 # test 43: unlink and blocking operations
1861 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1862 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1866 mkdir $DIR2/$tfile || error "mkdir must succeed"
1867 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1871 run_test 43a "pdirops: unlink vs mkdir =============="
1875 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1876 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1880 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
1881 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1885 run_test 43b "pdirops: unlink vs create =============="
1889 touch $DIR1/$tfile-2
1890 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1891 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1895 link $DIR2/$tfile-2 $DIR2/$tfile || error "link must succeed"
1896 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1900 run_test 43c "pdirops: unlink vs link =============="
1904 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1905 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1909 rm $DIR2/$tfile && error "unlink must fail"
1910 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1914 run_test 43d "pdirops: unlink vs unlink =============="
1918 touch $DIR1/$tfile-2
1919 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1920 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1924 mv -u $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1925 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1929 run_test 43e "pdirops: unlink and rename (tgt) =============="
1933 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1934 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1938 mv $DIR2/$tfile $DIR2/$tfile-2 && error "rename must fail"
1939 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1943 run_test 43f "pdirops: unlink and rename (src) =============="
1947 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1948 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1952 stat $DIR2/$tfile > /dev/null && error "stat must fail"
1953 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1957 run_test 43g "pdirops: unlink vs getattr =============="
1961 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1962 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1966 ls -lia $DIR2/ > /dev/null
1967 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1971 run_test 43h "pdirops: unlink vs readdir =============="
1974 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1976 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1977 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1981 $LFS mkdir -i 1 $DIR2/$tfile || error "remote mkdir must succeed"
1982 check_pdo_conflict $PID1 &&
1983 { wait $PID1; error "remote mkdir isn't blocked"; }
1987 run_test 43i "pdirops: unlink vs remote mkdir"
1989 # test 44: rename tgt and blocking operations
1991 touch $DIR1/$tfile-2
1992 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1993 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1994 mv $DIR1/$tfile-2 $DIR1/$tfile &
1997 mkdir $DIR2/$tfile && error "mkdir must fail"
1998 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2002 run_test 44a "pdirops: rename tgt vs mkdir =============="
2005 touch $DIR1/$tfile-2
2006 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2007 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2008 mv $DIR1/$tfile-2 $DIR1/$tfile &
2011 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2012 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2016 run_test 44b "pdirops: rename tgt vs create =============="
2019 touch $DIR1/$tfile-2
2020 touch $DIR1/$tfile-3
2021 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2022 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2023 mv $DIR1/$tfile-2 $DIR1/$tfile &
2026 link $DIR2/$tfile-3 $DIR2/$tfile && error "link must fail"
2027 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2031 run_test 44c "pdirops: rename tgt vs link =============="
2034 touch $DIR1/$tfile-2
2035 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2036 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2037 mv $DIR1/$tfile-2 $DIR1/$tfile &
2040 rm $DIR2/$tfile || error "unlink must succeed"
2041 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2045 run_test 44d "pdirops: rename tgt vs unlink =============="
2049 touch $DIR1/$tfile-2
2050 touch $DIR1/$tfile-3
2051 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2052 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2053 mv $DIR1/$tfile-2 $DIR1/$tfile &
2056 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2057 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2061 run_test 44e "pdirops: rename tgt and rename (tgt) =============="
2064 touch $DIR1/$tfile-2
2065 touch $DIR1/$tfile-3
2066 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2067 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2068 mv $DIR1/$tfile-2 $DIR1/$tfile &
2071 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
2072 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2076 run_test 44f "pdirops: rename tgt and rename (src) =============="
2079 touch $DIR1/$tfile-2
2080 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2081 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2082 mv $DIR1/$tfile-2 $DIR1/$tfile &
2085 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2086 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2090 run_test 44g "pdirops: rename tgt vs getattr =============="
2093 touch $DIR1/$tfile-2
2094 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2095 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2096 mv $DIR1/$tfile-2 $DIR1/$tfile &
2099 ls -lia $DIR2/ > /dev/null
2100 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
2104 run_test 44h "pdirops: rename tgt vs readdir =============="
2106 # test 44: rename tgt and blocking operations
2108 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2109 touch $DIR1/$tfile-2
2110 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2111 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2112 mv $DIR1/$tfile-2 $DIR1/$tfile &
2115 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
2116 check_pdo_conflict $PID1 && { wait $PID1;
2117 error "remote mkdir isn't blocked"; }
2121 run_test 44i "pdirops: rename tgt vs remote mkdir"
2123 # test 45: rename src and blocking operations
2126 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2127 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2128 mv $DIR1/$tfile $DIR1/$tfile-2 &
2131 mkdir $DIR2/$tfile || error "mkdir must succeed"
2132 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2136 run_test 45a "pdirops: rename src vs mkdir =============="
2140 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2141 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2142 mv $DIR1/$tfile $DIR1/$tfile-2 &
2145 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
2146 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2150 run_test 45b "pdirops: rename src vs create =============="
2154 touch $DIR1/$tfile-3
2155 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2156 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2157 mv $DIR1/$tfile $DIR1/$tfile-2 &
2160 link $DIR2/$tfile-3 $DIR2/$tfile || error "link must succeed"
2161 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2165 run_test 45c "pdirops: rename src vs link =============="
2169 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2170 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2171 mv $DIR1/$tfile $DIR1/$tfile-2 &
2174 rm $DIR2/$tfile && error "unlink must fail"
2175 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2179 run_test 45d "pdirops: rename src vs unlink =============="
2183 touch $DIR1/$tfile-3
2184 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2185 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2186 mv $DIR1/$tfile $DIR1/$tfile-2 &
2189 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2190 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2194 run_test 45e "pdirops: rename src and rename (tgt) =============="
2198 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2199 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2200 mv $DIR1/$tfile $DIR1/$tfile-2 &
2203 mv $DIR2/$tfile $DIR2/$tfile-3 && error "rename must fail"
2204 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2208 run_test 45f "pdirops: rename src and rename (src) =============="
2212 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2213 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2214 mv $DIR1/$tfile $DIR1/$tfile-2 &
2217 stat $DIR2/$tfile > /dev/null && error "stat must fail"
2218 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2222 run_test 45g "pdirops: rename src vs getattr =============="
2226 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2227 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2228 mv $DIR1/$tfile $DIR1/$tfile-2 &
2231 ls -lia $DIR2/ > /dev/null
2232 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
2236 run_test 45h "pdirops: unlink vs readdir =============="
2239 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2241 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2242 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2243 mv $DIR1/$tfile $DIR1/$tfile-2 &
2246 $LFS mkdir -i 1 $DIR2/$tfile || error "create remote dir must succeed"
2247 check_pdo_conflict $PID1 && { wait $PID1;
2248 error "create remote dir isn't blocked"; }
2252 run_test 45i "pdirops: rename src vs remote mkdir"
2254 # test 46: link and blocking operations
2256 touch $DIR1/$tfile-2
2257 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2258 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2259 link $DIR1/$tfile-2 $DIR1/$tfile &
2262 mkdir $DIR2/$tfile && error "mkdir must fail"
2263 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2267 run_test 46a "pdirops: link vs mkdir =============="
2270 touch $DIR1/$tfile-2
2271 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2272 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2273 link $DIR1/$tfile-2 $DIR1/$tfile &
2276 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2277 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2281 run_test 46b "pdirops: link vs create =============="
2284 touch $DIR1/$tfile-2
2285 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2286 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2287 link $DIR1/$tfile-2 $DIR1/$tfile &
2290 link $DIR2/$tfile $DIR2/$tfile && error "link must fail"
2291 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2295 run_test 46c "pdirops: link vs link =============="
2298 touch $DIR1/$tfile-2
2299 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2300 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2301 link $DIR1/$tfile-2 $DIR1/$tfile &
2304 rm $DIR2/$tfile || error "unlink must succeed"
2305 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2309 run_test 46d "pdirops: link vs unlink =============="
2312 touch $DIR1/$tfile-2
2313 touch $DIR1/$tfile-3
2314 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2315 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2316 link $DIR1/$tfile-2 $DIR1/$tfile &
2319 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2320 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2324 run_test 46e "pdirops: link and rename (tgt) =============="
2327 touch $DIR1/$tfile-2
2328 touch $DIR1/$tfile-3
2329 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2330 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2331 link $DIR1/$tfile-2 $DIR1/$tfile &
2334 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
2335 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2339 run_test 46f "pdirops: link and rename (src) =============="
2342 touch $DIR1/$tfile-2
2343 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2344 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2345 link $DIR1/$tfile-2 $DIR1/$tfile &
2348 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2349 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2353 run_test 46g "pdirops: link vs getattr =============="
2356 touch $DIR1/$tfile-2
2357 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2358 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2359 link $DIR1/$tfile-2 $DIR1/$tfile &
2362 ls -lia $DIR2/ > /dev/null
2363 check_pdo_conflict $PID1 && { wait $PID1;
2364 error "readdir isn't blocked"; }
2368 run_test 46h "pdirops: link vs readdir =============="
2371 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2372 touch $DIR1/$tfile-2
2373 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2374 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2375 link $DIR1/$tfile-2 $DIR1/$tfile &
2378 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
2379 check_pdo_conflict $PID1 && { wait $PID1;
2380 error "remote mkdir isn't blocked"; }
2384 run_test 46i "pdirops: link vs remote mkdir"
2386 # test 47: remote mkdir and blocking operations
2388 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2389 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2390 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2391 $LFS mkdir -i 1 $DIR1/$tfile &
2394 mkdir $DIR2/$tfile && error "mkdir must fail"
2395 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2399 run_test 47a "pdirops: remote mkdir vs mkdir"
2402 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2403 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2404 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2405 $LFS mkdir -i 1 $DIR1/$tfile &
2408 multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2409 check_pdo_conflict $PID1 && { wait $PID1;
2410 error "create isn't blocked"; }
2414 run_test 47b "pdirops: remote mkdir vs create"
2417 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2418 touch $DIR1/$tfile-2
2419 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2420 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2421 $LFS mkdir -i 1 $DIR1/$tfile &
2424 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
2425 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2429 run_test 47c "pdirops: remote mkdir vs link"
2432 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2433 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2434 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2435 $LFS mkdir -i 1 $DIR1/$tfile &
2438 rmdir $DIR2/$tfile || error "unlink must succeed"
2439 check_pdo_conflict $PID1 && { wait $PID1;
2440 error "unlink isn't blocked"; }
2444 run_test 47d "pdirops: remote mkdir vs unlink"
2447 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2448 touch $DIR1/$tfile-2
2449 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2450 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2451 $LFS mkdir -i 1 $DIR1/$tfile &
2454 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
2455 check_pdo_conflict $PID1 && { wait $PID1;
2456 error "rename isn't blocked"; }
2460 run_test 47e "pdirops: remote mkdir and rename (tgt)"
2463 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2464 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2465 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2466 $LFS mkdir -i 1 $DIR1/$tfile &
2469 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
2470 check_pdo_conflict $PID1 && { wait $PID1;
2471 error "rename isn't blocked"; }
2475 run_test 47f "pdirops: remote mkdir and rename (src)"
2478 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2481 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2482 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2483 $LFS mkdir -i 1 $DIR1/$tfile &
2486 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2487 check_pdo_conflict $PID1 && { wait $PID1;
2488 error "getattr isn't blocked"; }
2492 run_test 47g "pdirops: remote mkdir vs getattr"
2496 dd if=/dev/zero of=$DIR1/$tfile bs=1K count=10
2497 #define OBD_FAIL_OSC_CP_ENQ_RACE 0x410
2498 do_facet client "lctl set_param fail_loc=0x410"
2499 $TRUNCATE $DIR2/$tfile $trunc_size
2500 do_facet client "lctl set_param fail_loc=0x0"
2502 size=`stat -c %s $DIR2/$tfile`
2503 [ $size -eq $trunc_size ] || error "wrong size"
2505 run_test 50 "osc lvb attrs: enqueue vs. CP AST =============="
2509 local origfile=/etc/hosts
2511 filesize=$(stat -c %s $origfile)
2513 # create an empty file
2514 $MCREATE $DIR1/$tfile || error "can't create $DIR1/$tfile"
2515 # cache layout lock on both mount point
2516 stat $DIR1/$tfile > /dev/null || error "stat $DIR1/$tfile failed"
2517 stat $DIR2/$tfile > /dev/null || error "stat $DIR2/$tfile failed"
2519 # open and sleep 2 seconds then read
2520 $MULTIOP $DIR2/$tfile o_2r${filesize}c &
2524 # create the layout of testing file
2525 dd if=$origfile of=$DIR1/$tfile conv=notrunc > /dev/null ||
2526 error "dd $DIR1/$tfile failed"
2528 # MULTIOP proc should be able to read enough bytes and exit
2529 for ((i = 0; i < 6; i++)); do
2531 kill -0 $pid || break
2533 kill -0 $pid 2> /dev/null && error "multiop is still there"
2534 cmp $origfile $DIR2/$tfile || error "$origfile and $DIR2/$tfile differs"
2538 run_test 51a "layout lock: refresh layout should work"
2541 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.59) ]] ||
2542 { skip "Need MDS version at least 2.3.59"; return 0; }
2544 local tmpfile=`mktemp`
2546 # create an empty file
2547 $MCREATE $DIR1/$tfile || error "mcreate $DIR1/$tfile failed"
2549 # delay glimpse so that layout has changed when glimpse finish
2550 #define OBD_FAIL_GLIMPSE_DELAY 0x1404
2551 $LCTL set_param fail_loc=0x1404
2552 stat -c %s $DIR2/$tfile |tee $tmpfile &
2556 # create layout of testing file
2557 dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc >/dev/null ||
2558 error "dd $DIR1/$tfile failed"
2561 local fsize=$(cat $tmpfile)
2563 [ x$fsize = x1024 ] || error "file size is $fsize, should be 1024"
2565 rm -f $DIR1/$tfile $tmpfile
2567 run_test 51b "layout lock: glimpse should be able to restart if layout changed"
2570 [ $OSTCOUNT -ge 2 ] || { skip "needs >= 2 osts"; return; }
2572 # set default layout to have 1 stripe
2574 $LFS setstripe -c 1 $DIR1/$tdir
2576 # create a file with empty layout
2577 $MCREATE $DIR1/$tdir/$tfile ||
2578 error "$MCREATE $DIR1/$tdir/$tfile failed"
2580 #define OBD_FAIL_MDS_LL_BLOCK 0x172
2581 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x172
2583 # change the layout of testing file
2584 echo "Setting layout to have $OSTCOUNT stripes ..."
2585 $LFS setstripe -c $OSTCOUNT $DIR1/$tdir/$tfile &
2589 # write something to the file, it should be blocked on fetching layout
2590 dd if=/dev/zero of=$DIR2/$tdir/$tfile bs=1k count=1 conv=notrunc
2591 local stripe_count=$($LFS getstripe -c $DIR2/$tdir/$tfile)
2594 # lod_qos.c::min_stripe_count() allows setstripe with a default stripe
2595 # count to succeed with only 3/4 of the number of stripes (rounded up),
2596 # so creating striped files does not fail if an OST is offline or full
2597 [ $stripe_count -ge $((OSTCOUNT - $OSTCOUNT / 4)) ] ||
2598 error "bad layout: getstripe -c $stripe_count < $OSTCOUNT * 3/4"
2602 run_test 51c "layout lock: IT_LAYOUT blocked and correct layout can be returned"
2605 dd if=/dev/zero of=/$DIR1/$tfile bs=1M count=1
2606 cancel_lru_locks mdc
2608 # open should grant LAYOUT lock, mmap and read will install pages
2609 $MULTIOP $DIR1/$tfile oO_RDWR:SMR_Uc &
2613 # rss before revoking
2614 local br=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2615 echo "Before revoking layout lock: $br KB mapped"
2617 # cancel layout lock manually
2618 cancel_lru_locks mdc
2620 # rss after revoking
2621 local ar=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2624 wait $PID || error "wait PID $PID failed"
2626 [ $ar -eq 0 ] || error "rss before: $br, after $ar, some pages remained"
2628 run_test 51d "layout lock: losing layout lock should clean up memory map region"
2632 echo "==> rename vs getattr vs setxattr should not deadlock"
2633 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2635 do_facet mds1 $LCTL set_param fail_loc=$1
2637 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2645 setfattr -n user.attr1 -v value1 $DIR2/d1 || error "(2) setfattr failed"
2646 wait $PID1 || error "(3) mv failed"
2647 wait $PID2 || error "(4) stat failed"
2654 echo "==> rename vs getattr vs open vs getattr should not deadlock"
2655 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2657 do_facet mds1 $LCTL set_param fail_loc=$1
2659 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2667 $MULTIOP $DIR2/d1/d2 Oc &
2671 stat $DIR/d1 || error "(2) stat failed"
2673 wait $PID1 || error "(3) mv failed"
2674 wait $PID2 || error "(4) stat failed"
2675 wait $PID3 && error "(5) multiop failed"
2681 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
2682 save_lustre_params client "llite.*.xattr_cache" > $p
2683 lctl set_param llite.*.xattr_cache 1 ||
2684 { skip "xattr cache is not supported"; return 0; }
2686 #define OBD_FAIL_MDS_RENAME 0x153
2687 #define OBD_FAIL_MDS_RENAME2 0x154
2688 test_54_part1 0x80000153 || error 10
2689 test_54_part1 0x80000154 || error 11
2690 test_54_part2 0x80000153 || error 12
2691 test_54_part2 0x80000154 || error 13
2693 restore_lustre_params < $p
2696 run_test 54 "rename locking"
2699 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2701 #define OBD_FAIL_MDS_RENAME4 0x156
2702 do_facet mds1 $LCTL set_param fail_loc=0x80000156
2704 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2709 wait $PID1 && error "(2) mv succeeded"
2713 run_test 55a "rename vs unlink target dir"
2717 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2719 #define OBD_FAIL_MDS_RENAME4 0x156
2720 do_facet mds1 $LCTL set_param fail_loc=0x80000156
2722 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2727 wait $PID1 && error "(2) mv succeeded"
2731 run_test 55b "rename vs unlink source dir"
2735 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2737 #define OBD_FAIL_MDS_RENAME4 0x156
2738 do_facet mds1 $LCTL set_param fail_loc=0x156
2740 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2744 # while rename is sleeping, open and remove d3
2745 $MULTIOP $DIR2/d3 D_c &
2751 # while rename is sleeping 2nd time, close d3
2753 wait $PID2 || error "(3) multiop failed"
2755 wait $PID1 && error "(2) mv succeeded"
2759 run_test 55c "rename vs unlink orphan target dir"
2765 #define OBD_FAIL_MDS_RENAME3 0x155
2766 do_facet mds1 $LCTL set_param fail_loc=0x155
2767 mv $DIR/f1 $DIR/$tdir &
2771 # while rename is sleeping, create $tdir, but as a directory
2772 mkdir -p $DIR2/$tdir || error "(1) mkdir failed"
2774 # link in reverse locking order
2775 ln $DIR2/f1 $DIR2/$tdir/
2777 wait $PID1 && error "(2) mv succeeded"
2780 run_test 55d "rename file vs link"
2783 local MDSVER=$(lustre_build_version $SINGLEMDS)
2784 [ $(version_code $MDSVER) -lt $(version_code 2.3.0) ] &&
2785 skip "MDS version $MDSVER must be >= 2.3.0" && return 0
2788 test_mkdir $DIR1/$tdir
2789 file1=$DIR1/$tdir/file
2790 file2=$DIR2/$tdir/file
2792 echo orig > $file2 || error "Could not create $file2"
2793 version=$($LFS data_version $file1)
2796 echo append >> $file2 || error "Could not append to $file2"
2797 version2=$($LFS data_version $file1)
2798 [ "$version" != "$version2" ] ||
2799 error "append did not change data version: $version"
2802 echo overwrite > $file2 || error "Could not overwrite $file2"
2803 version3=$($LFS data_version $file1)
2804 [ "$version2" != "$version3" ] ||
2805 error "overwrite did not change data version: $version2"
2807 # Truncate before EOF
2808 $TRUNCATE $file2 3 || error "Could not truncate $file2"
2809 version4=$($LFS data_version $file1)
2810 [ "$version3" != "$version4" ] ||
2811 error "truncate did not change data version: $version3"
2813 # Truncate after EOF
2814 $TRUNCATE $file2 123456 || error "Could not truncate $file2"
2815 version5=$($LFS data_version $file1)
2816 [ "$version4" != "$version5" ] ||
2817 error "truncate did not change data version: $version4"
2819 # Chmod do not change version
2820 chmod 400 $file2 || error "Could not chmod 400 $file2"
2821 version6=$($LFS data_version $file1)
2822 [ "$version5" == "$version6" ] ||
2823 error "chmod should not change data version: $version5 != $version6"
2825 # Chown do not change version
2826 chown $RUNAS_ID $file2 || error "Could not chown $RUNAS_ID $file2"
2827 version7=$($LFS data_version $file1)
2828 [ "$version5" == "$version7" ] ||
2829 error "chown should not change data version: $version5 != $version7"
2831 run_test 60 "Verify data_version behaviour"
2834 local test_dir=$tdir/test_dir
2836 mkdir -p $DIR1/$tdir
2837 if [ $MDSCOUNT -ge 2 ]; then
2839 $LFS mkdir -i $MDTIDX $DIR1/$test_dir ||
2840 error "Create remote directory failed"
2842 mkdir -p $DIR1/$test_dir
2844 cd $DIR2/$test_dir || error "cd directory failed"
2845 rm -rf $DIR1/$test_dir || error "unlink directory failed"
2847 cd $DIR2/$tdir || error "exit directory"
2849 run_test 70a "cd directory && rm directory"
2851 test_70b() { # LU-2781
2853 mkdir -p $DIR1/$tdir
2855 touch $DIR1/$tdir/file
2856 for ((i = 0; i < 32; i++)); do
2857 $LFS rm_entry $DIR1/$tdir/non_existent_dir &>/dev/null
2859 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2861 touch $DIR1/$tdir/file
2862 $LFS mkdir -i0 $DIR1/$tdir/test_dir
2863 $LFS rm_entry $DIR1/$tdir/test_dir &>/dev/null
2864 rm -rf $DIR1/$tdir/test_dir ||
2865 error "cannot remove directory after rm_entry"
2866 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2868 run_test 70b "remove files after calling rm_entry"
2871 local server_version=$(lustre_version_code $SINGLEMDS)
2873 [[ $server_version -lt $(version_code 2.1.6) ]] &&
2874 skip "Need MDS version at least 2.1.6" && return
2876 # Patch not applied to 2.2 and 2.3 branches
2877 [[ $server_version -ge $(version_code 2.2.0) ]] &&
2878 [[ $server_version -lt $(version_code 2.4.0) ]] &&
2879 skip "Need MDS version earlier than 2.2.0 or at least 2.4.0" &&
2882 checkfiemap --test ||
2883 { skip "checkfiemap not runnable: $?" && return; }
2884 # write data this way: hole - data - hole - data
2885 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2886 [ "$(facet_fstype ost$(($($LFS getstripe -i $DIR1/$tfile) + 1)))" = \
2888 skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
2889 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2890 GET_STAT="lctl get_param -n ldlm.services.ldlm_cbd.stats"
2892 local can1=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2894 checkfiemap $DIR2/$tfile 81920 ||
2895 error "data is not flushed from client"
2896 local can2=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2899 # common case of "create file, copy file" on a single node
2900 # should not flush data from ost
2901 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2902 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2904 local can3=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2906 checkfiemap $DIR1/$tfile 81920 ||
2908 local can4=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2910 [ $can3 -eq $can4 ] || error $((can2-can1)) "cancel RPC occured."
2912 run_test 71a "correct file map just after write operation is finished"
2915 local server_version=$(lustre_version_code $SINGLEMDS)
2917 [[ $server_version -lt $(version_code 2.1.6) ]] &&
2918 skip "Need MDS version at least 2.1.6" && return
2920 # Patch not applied to 2.2 and 2.3 branches
2921 [[ $server_version -ge $(version_code 2.2.0) ]] &&
2922 [[ $server_version -lt $(version_code 2.4.0) ]] &&
2923 skip "Need MDS version earlier than 2.2.0 or at least 2.4.0" &&
2925 [[ $OSTCOUNT -ge 2 ]] || { skip "needs >= 2 OSTs"; return; }
2927 checkfiemap --test ||
2928 { skip "error $?: checkfiemap failed" && return; }
2930 mkdir -p $DIR1/$tdir
2932 $LFS setstripe -c -1 $DIR1/$tdir || error "setstripe failed"
2933 dd if=/dev/urandom of=$DIR1/$tdir/$tfile bs=40K count=1
2934 [ "$(facet_fstype ost$(($($LFS getstripe -i $DIR1/$tdir/$tfile) + 1)))" = \
2936 skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
2937 checkfiemap $DIR1/$tdir/$tfile 40960 || error "checkfiemap failed"
2939 run_test 71b "check fiemap support for stripecount > 1"
2942 local p="$TMP/sanityN-$TESTNAME.parameters"
2945 save_lustre_params client "llite.*.xattr_cache" > $p
2946 lctl set_param llite.*.xattr_cache 1 ||
2947 { skip "xattr cache is not supported"; return 0; }
2950 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2951 error "setfattr1 failed"
2952 getfattr -n user.attr1 $DIR2/$tfile | grep value1 ||
2953 error "getfattr1 failed"
2954 setfattr -n user.attr1 -v value2 $DIR2/$tfile ||
2955 error "setfattr2 failed"
2956 getfattr -n user.attr1 $DIR1/$tfile | grep value2 ||
2957 error "getfattr2 failed"
2959 # check that trusted.link is consistent
2960 tlink1=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2961 ln $DIR2/$tfile $DIR2/$tfile-2 || error "failed to link"
2962 tlink2=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2963 echo "$tlink1 $tlink2"
2964 [ "$tlink1" = "$tlink2" ] && error "trusted.link should have changed!"
2968 restore_lustre_params < $p
2971 run_test 72 "getxattr/setxattr cache should be consistent between nodes"
2974 local p="$TMP/sanityN-$TESTNAME.parameters"
2975 save_lustre_params client "llite.*.xattr_cache" > $p
2976 lctl set_param llite.*.xattr_cache 1 ||
2977 { skip "xattr cache is not supported"; return 0; }
2980 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2981 error "setfattr1 failed"
2982 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr1 failed"
2983 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr2 failed"
2984 clear_stats llite.*.stats
2985 # PR lock should be cached by now on both clients
2986 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr3 failed"
2987 # 2 hits for getfattr(0)+getfattr(size)
2988 [ $(calc_stats llite.*.stats getxattr_hits) -eq 2 ] ||
2989 error "not cached in $DIR1"
2990 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr4 failed"
2991 # 4 hits for more getfattr(0)+getfattr(size)
2992 [ $(calc_stats llite.*.stats getxattr_hits) -eq 4 ] ||
2993 error "not cached in $DIR2"
2996 restore_lustre_params < $p
2999 run_test 73 "getxattr should not cause xattr lock cancellation"
3002 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.93) ] &&
3003 skip "Need MDS version at least 2.4.93" && return
3005 dd if=/dev/zero of=$DIR1/$tfile-1 bs=1K count=1
3006 dd if=/dev/zero of=$DIR1/$tfile-2 bs=1K count=1
3007 flocks_test 4 $DIR1/$tfile-1 $DIR2/$tfile-2
3009 run_test 74 "flock deadlock: different mounts =============="
3013 $LFS setstripe -c 2 -S 1m -i 0 $DIR1/$tfile
3014 dd if=/dev/zero of=$DIR1/$tfile bs=1M count=2
3015 cancel_lru_locks osc
3017 dd of=$DIR1/$tfile if=/dev/zero bs=1M count=1 seek=1 conv=notrunc
3020 # define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d
3021 $LCTL set_param fail_loc=0x31d
3022 stat -c %s $DIR1/$tfile &
3027 # For bad lock error handler we should ASSERT and got kernel panic here
3029 $LCTL set_param fail_loc=0
3031 run_test 75 "osc: upcall after unuse lock==================="
3034 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
3035 skip "Need MDS version at least 2.5.53" && return
3037 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3038 local fcount=$((MDSCOUNT * 256))
3043 nid=$($LCTL list_nids | sed "s/\./\\\./g")
3049 test_mkdir $DIR/$tdir
3051 # drop all open locks and close any cached "open" files on the client
3052 cancel_lru_locks mdc
3054 local open_fids_cmd="$LCTL get_param -n mdt.*.exports.'$nid'.open_files"
3055 local fid_list=($(do_nodes $(comma_list $(mdts_nodes)) $open_fids_cmd))
3056 local already=${#fid_list[@]}
3057 for (( i = 0; i < $already; i++ )) ; do
3058 log "already open[$i]: $($LFS fid2path $DIR2 ${fid_list[i]})"
3061 echo -n "opening files: "
3062 ulimit -n $((fcount + 50))
3063 for ((i = 0; i < $fcount; i++)); do
3064 touch $DIR/$tdir/f_$i
3065 local fd=$(free_fd ${fd_list[i]})
3066 local open_cmd="exec $fd<$DIR/$tdir/f_$i"
3071 (( $i % 32 == 0 )) && echo -n "."
3075 fid_list=($(do_nodes $(comma_list $(mdts_nodes)) $open_fids_cmd))
3077 # Possible errors in openfiles FID list.
3078 # 1. Missing FIDs. Check 1
3079 # 2. Extra FIDs. Check 1
3080 # 3. Duplicated FID. Check 2
3081 # 4. Invalid FIDs. Check 2
3082 # 5. Valid FID, points to some other file. Check 3
3085 [ ${#fid_list[@]} -ne $((fcount + already)) ] &&
3086 error "${#fid_list[@]} != $fcount (+$already old) open files"
3088 echo -n "closing files: "
3089 for (( fd = 0, fid = 0; fd < $fcount; fd++, fid++ )) ; do
3090 local close_cmd="exec ${fd_list[fd]}<&-"
3092 filename=$($LFS fid2path $DIR2 ${fid_list[fid]})
3094 while [[ ! "$filename" =~ "$DIR2/$tdir/f_" ]]; do
3095 echo "skip old open file $filename"
3097 filename=$($LFS fid2path $DIR2 ${fid_list[fid]})
3101 rm --interactive=no $filename
3103 error "Nonexisting fid ${fid_list[fid]} listed."
3104 (( $fd % 32 == 0 )) && echo -n "."
3109 ls_op=$(ls $DIR2/$tdir | wc -l)
3111 error "Some openfiles are missing in lproc output"
3115 run_test 76 "Verify MDT open_files listing"
3119 local dir=$DIR/$tdir
3122 mkdir $dir || error "mkdir $dir failed"
3123 $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
3126 do_nodes $CLIENTS $myRUNAS \
3127 dd if=/dev/zero of="$dir/nrs_r_\$HOSTNAME" bs=1M count=$n ||
3128 error "dd at 0 on client failed (1)"
3130 do_nodes $CLIENTS $myRUNAS \
3132 for ((i = 0; i < $n; i++)); do
3133 dd if=/dev/zero of=$dir/nrs_w_\$HOSTNAME bs=1M \
3134 seek=\\\$i count=1 conv=notrunc &
3135 pids_w[\\\$i]=\\\$!;
3138 for ((i = 0; i < $n; i++)); do
3139 wait \\\${pids_w[\\\$i]};
3141 [ \\\$newrc -gt \\\$rc_w ] && rc_w=\\\$newrc;
3145 do_nodes $CLIENTS sync;
3146 cancel_lru_locks osc
3148 do_nodes $CLIENTS $myRUNAS \
3150 for ((i = 0; i < $n; i++)); do
3151 dd if=$dir/nrs_r_\$HOSTNAME bs=1M of=/dev/null \
3152 seek=\\\$i count=1 &
3153 pids_r[\\\$i]=\\\$!;
3156 for ((i = 0; i < $n; i++)); do
3157 wait \\\${pids_r[\\\$i]};
3159 [ \\\$newrc -gt \\\$rc_r ] && rc_r=\\\$newrc;
3163 cancel_lru_locks osc
3165 wait $pid_w || error "dd (write) failed (2)"
3166 wait $pid_r || error "dd (read) failed (3)"
3167 rm -rvf $dir || error "rm -rf $dir failed"
3170 test_77a() { #LU-3266
3173 oss=$(comma_list $(osts_nodes))
3174 do_nodes $oss lctl set_param ost.OSS.*.nrs_policies="fifo" ||
3176 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3177 [[ $rc -ne 0 ]] && error "failed to set fifo policy"
3182 run_test 77a "check FIFO NRS policy"
3184 test_77b() { #LU-3266
3187 oss=$(comma_list $(osts_nodes))
3189 do_nodes $oss lctl set_param ost.OSS.*.nrs_policies="crrn" \
3190 ost.OSS.*.nrs_crrn_quantum=1 || rc=$?
3191 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3192 [[ $rc -ne 0 ]] && error "failed to set crrn_quantum to 1"
3194 echo "policy: crr-n, crrn_quantum 1"
3197 do_nodes $oss lctl set_param \
3198 ost.OSS.*.nrs_crrn_quantum=64 || rc=$?
3199 [[ $rc -ne 0 ]] && error "failed to set crrn_quantum to 64"
3201 echo "policy: crr-n, crrn_quantum 64"
3205 do_nodes $oss lctl set_param \
3206 ost.OSS.ost_io.nrs_policies="fifo" || rc=$?
3207 [[ $rc -ne 0 ]] && error "failed to set fifo policy"
3210 run_test 77b "check CRR-N NRS policy"
3215 oss=$(comma_list $(osts_nodes))
3217 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies=$policy \
3218 ost.OSS.*.nrs_"$policy"_quantum=1 \
3219 ost.OSS.*.nrs_"$policy"_offset_type="physical" \
3220 ost.OSS.*.nrs_"$policy"_supported="reads" || return $?
3222 echo "policy: $policy, ${policy}_quantum 1, ${policy}_offset_type " \
3223 "physical, ${policy}_supported reads"
3226 do_nodes $oss lctl set_param \
3227 ost.OSS.*.nrs_${policy}_supported="writes" \
3228 ost.OSS.*.nrs_${policy}_quantum=64 || return $?
3230 echo "policy: $policy, ${policy}_quantum 64, ${policy}_offset_type " \
3231 "physical, ${policy}_supported writes"
3234 do_nodes $oss lctl set_param \
3235 ost.OSS.*.nrs_${policy}_supported="reads_and_writes" \
3236 ost.OSS.*.nrs_${policy}_offset_type="logical" || return $?
3237 echo "policy: $policy, ${policy}_quantum 64, ${policy}_offset_type " \
3238 "logical, ${policy}_supported reads_and_writes"
3242 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo" ||
3247 test_77c() { #LU-3266
3249 orr_trr "orr" || rc=$?
3250 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3251 [[ $rc -ne 0 ]] && error "orr_trr failed rc:$rc"
3254 run_test 77c "check ORR NRS policy"
3256 test_77d() { #LU-3266
3258 orr_trr "trr" || rc=$?
3259 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3260 [[ $rc -ne 0 ]] && error "orr_trr failed rc:$rc"
3263 run_test 77d "check TRR nrs policy"
3270 do_facet $facet lctl set_param \
3271 ost.OSS.ost_io.nrs_tbf_rule="$*"
3273 error "failed to run operate '$*' on TBF rules"
3276 cleanup_tbf_verify()
3280 echo "cleanup_tbf $DIR/$tdir"
3283 wait_delete_completed
3288 local dir=$DIR/$tdir
3289 local client1=${CLIENT1:-$(hostname)}
3292 local np=$(check_cpt_number ost1)
3293 [ $np -gt 0 ] || error "CPU partitions should not be $np."
3294 echo "cpu_npartitions on ost1 is $np"
3296 mkdir $dir || error "mkdir $dir failed"
3297 $LFS setstripe -c 1 -i 0 $dir || error "setstripe to $dir failed"
3300 trap cleanup_tbf_verify EXIT
3301 echo "Limited write rate: $1, read rate: $2"
3302 echo "Verify the write rate is under TBF control"
3303 local start=$SECONDS
3304 do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \
3305 bs=1M count=100 oflag=direct 2>&1
3306 local runtime=$((SECONDS - start + 1))
3307 local rate=$(bc <<< "scale=6; 100 / $runtime")
3308 echo "Write runtime is $runtime s, speed is $rate IOPS"
3310 # verify the write rate does not exceed TBF rate limit
3311 [ $(bc <<< "$rate < 1.1 * $np * $1") -eq 1 ] ||
3312 error "The write rate ($rate) exceeds 110% of rate limit ($1 * $np)"
3314 cancel_lru_locks osc
3316 echo "Verify the read rate is under TBF control"
3318 do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \
3319 bs=1M count=100 iflag=direct 2>&1
3320 runtime=$((SECONDS - start + 1))
3321 rate=$(bc <<< "scale=6; 100 / $runtime")
3322 echo "Read runtime is $runtime s, speed is $rate IOPS"
3324 # verify the read rate does not exceed TBF rate limit
3325 [ $(bc <<< "$rate < 1.1 * $np * $2") -eq 1 ] ||
3326 error "The read rate ($rate) exceeds 110% of rate limit ($2 * $np)"
3328 cancel_lru_locks osc
3329 cleanup_tbf_verify || error "rm -rf $dir failed"
3335 oss=$(comma_list $(osts_nodes))
3337 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid" ||
3339 [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
3340 [[ $rc -ne 0 ]] && error "failed to set TBF NID policy"
3344 if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
3349 # Only operate rules on ost1 since OSTs might run on the same OSS
3351 tbf_rule_operate ost1 "start\ localhost\ ${idis}{0@lo}\ ${rateis}1000"
3352 local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
3353 local client_nids=$(nids_list $address "\\")
3354 tbf_rule_operate ost1 "start\ clients\ ${idis}{$client_nids}\ ${rateis}100"
3355 tbf_rule_operate ost1 "start\ others\ ${idis}{*.*.*.*@$NETTYPE}\ ${rateis}50"
3359 tbf_rule_operate ost1 "change\ localhost\ ${rateis}1001"
3360 tbf_rule_operate ost1 "change\ clients\ ${rateis}101"
3361 tbf_rule_operate ost1 "change\ others\ ${rateis}51"
3365 tbf_rule_operate ost1 "stop\ localhost"
3366 tbf_rule_operate ost1 "stop\ clients"
3367 tbf_rule_operate ost1 "stop\ others"
3370 # Cleanup the TBF policy
3371 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3372 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3376 run_test 77e "check TBF NID nrs policy"
3381 oss=$(comma_list $(osts_nodes))
3383 do_nodes $oss $LCTL set_param \
3384 ost.OSS.ost_io.nrs_policies="tbf\ jobid" || rc=$?
3385 [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
3386 [[ $rc -ne 0 ]] && error "failed to set TBF JOBID policy"
3388 # Configure jobid_var
3389 local saved_jobid_var=$($LCTL get_param -n jobid_var)
3391 [[ $rc -eq 3 ]] && skip "jobid_var not found" && return
3392 [[ $rc -ne 0 ]] && error "failed to get param jobid_var"
3393 if [ $saved_jobid_var != procname_uid ]; then
3394 set_persistent_param_and_check client \
3395 "jobid_var" "$FSNAME.sys.jobid_var" procname_uid
3400 if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
3405 # Only operate rules on ost1 since OSTs might run on the same OSS
3407 tbf_rule_operate ost1 "start\ runas\ ${idis}{iozone.$RUNAS_ID\ dd.$RUNAS_ID\ tiotest.$RUNAS_ID}\ ${rateis}1000"
3408 tbf_rule_operate ost1 "start\ iozone_runas\ ${idis}{iozone.$RUNAS_ID}\ ${rateis}100"
3409 tbf_rule_operate ost1 "start\ dd_runas\ ${idis}{dd.$RUNAS_ID}\ ${rateis}50"
3410 nrs_write_read "$RUNAS"
3413 tbf_rule_operate ost1 "change\ runas\ ${rateis}1001"
3414 tbf_rule_operate ost1 "change\ iozone_runas\ ${rateis}101"
3415 tbf_rule_operate ost1 "change\ dd_runas\ ${rateis}51"
3416 nrs_write_read "$RUNAS"
3419 tbf_rule_operate ost1 "stop\ runas"
3420 tbf_rule_operate ost1 "stop\ iozone_runas"
3421 tbf_rule_operate ost1 "stop\ dd_runas"
3422 nrs_write_read "$RUNAS"
3424 # Cleanup the TBF policy
3425 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3426 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3427 nrs_write_read "$RUNAS"
3429 local current_jobid_var=$($LCTL get_param -n jobid_var)
3430 [[ $? -ne 0 ]] && error "failed to get param jobid_var"
3431 if [ $saved_jobid_var != $current_jobid_var ]; then
3432 set_persistent_param_and_check client \
3433 "jobid_var" "$FSNAME.sys.jobid_var" $saved_jobid_var
3437 run_test 77f "check TBF JobID nrs policy"
3442 oss=$(comma_list $(osts_nodes))
3444 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid" ||
3446 [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
3447 [[ $rc -ne 0 ]] && error "failed to set TBF NID policy"
3449 do_nodes $oss lctl set_param \
3450 ost.OSS.ost_io.nrs_policies="tbf\ jobid" || rc=$?
3451 [[ $rc -ne 0 ]] && error "failed to set TBF JOBID policy"
3455 if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
3460 # Add a rule that only valid for Jobid TBF. If direct change between
3461 # TBF types is not supported, this operation will fail.
3462 tbf_rule_operate ost1 "start\ dd_runas\ ${idis}{dd.$RUNAS_ID}\ ${rateis}50"
3464 # Cleanup the TBF policy
3465 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3466 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3469 run_test 77g "Change TBF type directly"
3472 [ $(lustre_version_code ost1) -ge $(version_code 2.8.55) ] ||
3473 { skip "Need OST version at least 2.8.55"; return 0; }
3475 local old_policy=$(do_facet ost1 \
3476 lctl get_param ost.OSS.ost_io.nrs_policies)
3479 do_facet ost1 lctl set_param \
3480 ost.OSS.ost_io.nrs_policies="abc"
3481 [ $? -eq 0 ] && error "should return error"
3483 do_facet ost1 lctl set_param \
3484 ost.OSS.ost_io.nrs_policies="tbf\ abc"
3485 [ $? -eq 0 ] && error "should return error"
3487 do_facet ost1 lctl set_param \
3488 ost.OSS.ost_io.nrs_policies="tbf\ reg\ abc"
3489 [ $? -eq 0 ] && error "should return error"
3491 do_facet ost1 lctl set_param \
3492 ost.OSS.ost_io.nrs_policies="tbf\ abc\ efg"
3493 [ $? -eq 0 ] && error "should return error"
3495 new_policy=$(do_facet ost1 lctl get_param ost.OSS.ost_io.nrs_policies)
3496 [ $? -eq 0 ] || error "shouldn't LBUG"
3498 [ "$old_policy" = "$new_policy" ] || error "NRS policy should be same"
3502 run_test 77h "Wrong policy name should report error, not LBUG"
3508 local error_message=$3
3510 for rule in $expected; do
3511 rule_number=$((rule_number + 1))
3513 local stop_line=$(($rule_number + 3))
3514 local awk_command="awk 'NR >= 4 && NR <= $stop_line {print \$1}'"
3516 local output=$(do_facet $facet lctl get_param \
3517 ost.OSS.ost_io.nrs_tbf_rule |
3521 if [ "$output" != "$expected" ]; then
3522 error "$error_message, expected '$expected', got '$output'"
3527 [ $(lustre_version_code ost1) -ge $(version_code 2.8.55) ] ||
3528 { skip "Need OST version at least 2.8.55"; return 0; }
3530 for i in $(seq 1 $OSTCOUNT)
3532 do_facet ost"$i" lctl set_param \
3533 ost.OSS.ost_io.nrs_policies="tbf\ jobid"
3535 error "failed to set TBF policy"
3538 tbf_rule_check ost1 "default" "error before inserting any rule"
3540 tbf_rule_operate ost1 "start\ before\ jobid={jobid}\ rate=1000"
3541 tbf_rule_check ost1 "before default" \
3542 "error when inserting rule 'before'"
3544 tbf_rule_operate ost1 "start\ after\ jobid={jobid}\ rate=1000\ rank=default"
3545 tbf_rule_check ost1 "before after default" \
3546 "error when inserting rule 'after'"
3548 tbf_rule_operate ost1 "start\ target\ jobid={jobid}\ rate=1000\ rank=after"
3549 tbf_rule_check ost1 "before target after default" \
3550 "error when inserting rule 'target'"
3552 echo "Move before itself"
3553 tbf_rule_operate ost1 "change\ target\ rank=target"
3554 tbf_rule_check ost1 "before target after default" \
3555 "error when moving before itself"
3557 echo "Move to higher rank"
3558 tbf_rule_operate ost1 "change\ target\ rank=before"
3559 tbf_rule_check ost1 "target before after default" \
3560 "error when moving to higher rank"
3562 echo "Move to lower rank"
3563 tbf_rule_operate ost1 "change\ target\ rank=after"
3564 tbf_rule_check ost1 "before target after default" \
3565 "error when moving to lower rank"
3567 echo "Move before default"
3568 tbf_rule_operate ost1 "change\ target\ rank=default"
3569 tbf_rule_check ost1 "before after target default" \
3570 error "error when moving before default"
3572 # Cleanup the TBF policy
3573 do_nodes $(comma_list $(osts_nodes)) \
3574 $LCTL set_param ost.OSS.ost_io.nrs_policies=fifo
3577 run_test 77i "Change rank of TBF rule"
3582 local ost_version=$(lustre_version_code ost1)
3584 [ $ost_version -ge $(version_code 2.9.53) ] ||
3585 { skip "Need OST version at least 2.9.53"; return 0; }
3586 if [ $ost_version -ge $(version_code 2.8.60) ]; then
3591 do_nodes $(comma_list $(osts_nodes)) \
3592 lctl set_param jobid_var=procname_uid \
3593 ost.OSS.ost_io.nrs_policies="tbf\ opcode" \
3594 ost.OSS.ost_io.nrs_tbf_rule="start\ ost_r\ ${idis}{ost_read}\ ${rateis}5" \
3595 ost.OSS.ost_io.nrs_tbf_rule="start\ ost_w\ ${idis}{ost_write}\ ${rateis}20"
3596 [ $? -ne 0 ] && error "failed to set TBF OPCode policy"
3601 do_nodes $(comma_list $(osts_nodes)) \
3602 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_r" \
3603 ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_w" \
3604 ost.OSS.ost_io.nrs_policies="fifo"
3606 # sleep 3 seconds to wait the tbf policy stop completely,
3607 # or the next test case is possible get -EAGAIN when
3608 # setting the tbf policy
3611 run_test 77j "check TBF-OPCode NRS policy"
3614 local idstr="${1}id"
3615 local policy="${idstr}={$2}"
3616 local rate="rate=$3"
3618 do_nodes $(comma_list $(osts_nodes)) \
3619 lctl set_param jobid_var=procname_uid \
3620 ost.OSS.ost_io.nrs_policies="tbf\ ${idstr}" \
3621 ost.OSS.ost_io.nrs_tbf_rule="start\ ost_${idstr}\ ${policy}\ ${rate}"
3622 [ $? -ne 0 ] && error "failed to set tbf ${idstr} policy"
3624 nrs_write_read "runas $4"
3625 tbf_verify $3 $3 "runas $4"
3627 do_nodes $(comma_list $(osts_nodes)) \
3628 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_${idstr}" \
3629 ost.OSS.ost_io.nrs_policies="fifo"
3631 # sleep 3 seconds to wait the tbf policy stop completely,
3632 # or the next test case is possible get -eagain when
3633 # setting the tbf policy
3638 if [ $(lustre_version_code ost1) -lt $(version_code 2.11.50) ]; then
3639 skip "Need OST version at least 2.11.50"
3642 test_id "u" "500" "5" "-u 500"
3643 test_id "g" "500" "5" "-u 500 -g 500"
3645 run_test 77ja "check TBF-UID/GID NRS policy"
3653 for rule in $rule_lists; do
3654 do_nodes $(comma_list $(osts_nodes)) \
3655 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ $rule"
3658 do_nodes $(comma_list $(osts_nodes)) \
3659 lctl set_param ost.OSS.ost_io.nrs_policies="$old_nrs"
3665 [[ $(lustre_version_code ost1) -ge $(version_code 2.9.53) ]] ||
3666 { skip "Need OST version at least 2.9.53"; return 0; }
3668 do_nodes $(comma_list $(osts_nodes)) \
3669 lctl set_param ost.OSS.ost_io.nrs_policies="tbf" \
3670 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_w\ jobid={dd.$RUNAS_ID}\&opcode={ost_write}\ rate=20" \
3671 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_r\ jobid={dd.$RUNAS_ID}\&opcode={ost_read}\ rate=10"
3673 nrs_write_read "$RUNAS"
3674 tbf_verify 20 10 "$RUNAS"
3676 local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
3677 local client_nids=$(nids_list $address "\\")
3678 do_nodes $(comma_list $(osts_nodes)) \
3679 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_w" \
3680 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_r" \
3681 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_w\ nid={0@lo\ $client_nids}\&opcode={ost_write}\ rate=20" \
3682 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_r\ nid={0@lo\ $client_nids}\&opcode={ost_read}\ rate=10"
3687 do_nodes $(comma_list $(osts_nodes)) \
3688 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_w" \
3689 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_r" \
3690 ost.OSS.ost_io.nrs_tbf_rule="start\ ext\ nid={0@lo\ $client_nids}\&jobid={dd.$RUNAS_ID}\ rate=20"
3692 nrs_write_read "$RUNAS"
3693 tbf_verify 20 20 "$RUNAS"
3695 do_nodes $(comma_list $(osts_nodes)) \
3696 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext" \
3697 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ jobid={dd.$RUNAS_ID},opcode={ost_write}\ rate=20" \
3698 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ jobid={dd.$RUNAS_ID},opcode={ost_read}\ rate=10"
3700 nrs_write_read "$RUNAS"
3701 # with parameter "RUNAS", it will match the latest rule
3702 # "ext_b" first, so the limited write rate is 10.
3703 tbf_verify 10 10 "$RUNAS"
3706 trap "cleanup_77k \"ext_a ext_b\" \"fifo\"" EXIT
3708 [[ $(lustre_version_code ost1) -ge $(version_code 2.10.58) ]] ||
3709 { skip "Need OST version at least 2.10.58"; return 0; }
3711 do_nodes $(comma_list $(osts_nodes)) \
3712 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_a" \
3713 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_b" \
3714 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ug\ uid={500}\&gid={1000}\ rate=5"
3715 nrs_write_read "runas -u 500 -g 1000"
3716 tbf_verify 5 5 "runas -u 500 -g 1000"
3718 do_nodes $(comma_list $(osts_nodes)) \
3719 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_ug" \
3720 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_uw\ uid={500}\&opcode={ost_write}\ rate=20" \
3721 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ur\ uid={500}\&opcode={ost_read}\ rate=10"
3723 nrs_write_read "runas -u 500"
3724 tbf_verify 20 10 "runas -u 500"
3726 do_nodes $(comma_list $(osts_nodes)) \
3727 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_uw" \
3728 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_ur" \
3729 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ uid={500},opcode={ost_write}\ rate=20" \
3730 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ uid={500},opcode={ost_read}\ rate=10"
3731 nrs_write_read "runas -u 500"
3732 tbf_verify 10 10 "runas -u 500"
3733 tbf_verify 20 10 "runas -u 500"
3734 cleanup_77k "ext_a ext_b" "fifo"
3736 run_test 77k "check TBF policy with NID/JobID/OPCode expression"
3739 [[ $(lustre_version_code ost1) -ge $(version_code 2.10.56) ]] ||
3740 { skip "Need OST version at least 2.10.56"; return 0; }
3742 do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid"
3743 do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="tbf"
3745 local output=$(do_facet ost1 lctl get_param \
3746 ost.OSS.ost_io.nrs_policies | \
3747 awk '/name: tbf/ {print;exit}' | \
3748 awk -F ': ' '{print $2}')
3750 if [ "$output" != "tbf" ]; then
3751 error "The generic TBF output is '$output', not 'tbf'"
3754 do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3756 run_test 77l "check the output of NRS policies for generic TBF"
3759 if [ $(lustre_version_code ost1) -lt $(version_code 2.9.54) ]; then
3760 skip "Need OST version at least 2.9.54"
3764 local dir=$DIR/$tdir
3766 mkdir $dir || error "mkdir $dir failed"
3767 $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
3770 local nodes=$(comma_list $(osts_nodes))
3771 do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies=delay \
3772 ost.OSS.ost_io.nrs_delay_min=4 \
3773 ost.OSS.ost_io.nrs_delay_max=4 \
3774 ost.OSS.ost_io.nrs_delay_pct=100
3775 [ $? -ne 0 ] && error "Failed to set delay policy"
3777 local start=$SECONDS
3778 do_nodes "${SINGLECLIENT:-$HOSTNAME}" "$RUNAS" \
3779 dd if=/dev/zero of="$dir/nrs_delay_$HOSTNAME" bs=1M count=1 \
3780 oflag=direct conv=fdatasync ||
3781 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3782 error "dd on client failed (1)"; }
3783 local elapsed=$((SECONDS - start))
3785 # NRS delay doesn't do sub-second timing, so a request enqueued at
3786 # 0.9 seconds can be dequeued at 4.0
3787 [ $elapsed -lt 3 ] &&
3788 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3789 error "Single 1M write should take at least 3 seconds"; }
3792 do_nodes "${SINGLECLIENT:-$HOSTNAME}" "$RUNAS" \
3793 dd if=/dev/zero of="$dir/nrs_delay_$HOSTNAME" bs=1M count=10 \
3794 oflag=direct conv=fdatasync ||
3795 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3796 error "dd on client failed (2)"; }
3797 elapsed=$((SECONDS - start))
3799 [ $elapsed -lt 30 ] &&
3800 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3801 error "Ten 1M writes should take at least 30 seconds"; }
3803 do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3804 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3808 run_test 77m "check NRS Delay slows write RPC processing"
3810 test_77n() { #LU-10802
3811 if [ $(lustre_version_code ost1) -lt $(version_code 2.10.58) ]; then
3812 skip "Need OST version at least 2.10.58"
3816 # Configure jobid_var
3817 local saved_jobid_var=$($LCTL get_param -n jobid_var)
3818 if [ $saved_jobid_var != procname_uid ]; then
3819 set_persistent_param_and_check client \
3820 "jobid_var" "$FSNAME.sys.jobid_var" procname_uid
3823 do_nodes $(comma_list $(osts_nodes)) \
3824 lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ jobid" \
3825 ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
3826 ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={*.$RUNAS_ID}\ rate=20"
3829 tbf_verify 20 20 "$RUNAS"
3831 do_nodes $(comma_list $(osts_nodes)) \
3832 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
3833 ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={dd.*}\ rate=20"
3838 do_nodes $(comma_list $(osts_nodes)) \
3839 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
3840 ost.OSS.ost_io.nrs_policies="fifo"
3844 local current_jobid_var=$($LCTL get_param -n jobid_var)
3845 if [ $saved_jobid_var != $current_jobid_var ]; then
3846 set_persistent_param_and_check client \
3847 "jobid_var" "$FSNAME.sys.jobid_var" $saved_jobid_var
3850 run_test 77n "check wildcard support for TBF JobID NRS policy"
3852 test_78() { #LU-6673
3855 oss=$(comma_list $(osts_nodes))
3856 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="orr" &
3857 do_nodes $oss lctl set_param ost.OSS.*.nrs_orr_quantum=1
3859 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3860 # Valid return codes are:
3861 # 0: Tuning succeeded
3862 # ENODEV: Policy is still stopped
3863 # EAGAIN: Policy is being initialized
3864 [ $rc -eq 0 -o $rc -eq 19 -o $rc -eq 11 ] ||
3865 error "Expected set_param to return 0|ENODEV|EAGAIN"
3867 # Cleanup the ORR policy
3868 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3869 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3872 run_test 78 "Enable policy and specify tunings right away"
3875 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3876 test_mkdir $DIR/$tdir
3878 # Prevent interference from layout intent RPCs due to
3879 # asynchronous writeback. These will be tested in 130c below.
3880 do_nodes ${CLIENTS:-$HOSTNAME} sync
3882 setfattr -n trusted.name1 -v value1 $DIR/$tdir ||
3883 error "setfattr -n trusted.name1=value1 $DIR/$tdir failed"
3885 #define OBD_FAIL_MDS_INTENT_DELAY 0x160
3886 local mdtidx=$($LFS getstripe -m $DIR/$tdir)
3887 local facet=mds$((mdtidx + 1))
3889 set_nodes_failloc $(facet_active_host $facet) 0x80000160
3890 getfattr -n trusted.name1 $DIR/$tdir 2> /dev/null &
3894 #define OBD_FAIL_MDS_GETXATTR_PACK 0x131
3895 set_nodes_failloc $(facet_active_host $facet) 0x80000131
3900 run_test 79 "xattr: intent error"
3903 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3910 mkdir -p $DIR1/$tdir/dir
3911 createmany -o $DIR1/$tdir/dir/f 10 ||
3912 error "create files under remote dir failed $i"
3914 cp /etc/passwd $DIR1/$tdir/$tfile
3916 #migrate open file should fails
3917 multiop_bg_pause $DIR2/$tdir/$tfile O_c || error "open $file failed"
3919 # give multiop a chance to open
3922 $LFS migrate -m $MDTIDX $DIR1/$tdir &&
3923 error "migrate open files should failed with open files"
3927 $LFS migrate -m $MDTIDX $DIR1/$tdir ||
3928 error "migrate remote dir error"
3930 echo "Finish migration, then checking.."
3931 for file in $(find $DIR1/$tdir); do
3932 mdt_index=$($LFS getstripe -m $file)
3933 [ $mdt_index == $MDTIDX ] ||
3934 error "$file is not on MDT${MDTIDX}"
3937 diff /etc/passwd $DIR1/$tdir/$tfile ||
3938 error "file different after migration"
3940 rm -rf $DIR1/$tdir || error "rm dir failed after migration"
3942 run_test 80a "migrate directory when some children is being opened"
3946 kill -9 $migrate_pid
3950 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3951 local migrate_dir1=$DIR1/$tdir/migrate_dir
3952 local migrate_dir2=$DIR2/$tdir/migrate_dir
3953 local migrate_run=$LUSTRE/tests/migrate.sh
3961 trap cleanup_80b EXIT
3962 #prepare migrate directory
3963 mkdir -p $migrate_dir1
3964 for F in {1,2,3,4,5}; do
3965 echo "$F$F$F$F$F" > $migrate_dir1/file$F
3966 echo "$F$F$F$F$F" > $DIR/$tdir/file$F
3969 #migrate the directories among MDTs
3972 mdt_idx=$((RANDOM % MDSCOUNT))
3973 $LFS migrate -m $mdt_idx $migrate_dir1 &>/dev/null ||
3975 [ $rc -ne 0 -o $rc -ne 16 ] || break
3980 echo "start migration thread $migrate_pid"
3981 #Access the files at the same time
3982 start_time=$(date +%s)
3983 echo "accessing the migrating directory for 5 minutes..."
3985 ls $migrate_dir2 > /dev/null || {
3986 echo "read dir fails"
3989 diff -u $DIR2/$tdir/file1 $migrate_dir2/file1 || {
3990 echo "access file1 fails"
3994 cat $migrate_dir2/file2 > $migrate_dir2/file3 || {
3995 echo "access file2/3 fails"
3999 echo "aaaaa" > $migrate_dir2/file4 > /dev/null || {
4000 echo "access file4 fails"
4004 stat $migrate_dir2/file5 > /dev/null || {
4005 echo "stat file5 fails"
4009 touch $migrate_dir2/source_file > /dev/null || rc1=$?
4010 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
4011 echo "touch file failed with $rc1"
4015 if [ -e $migrate_dir2/source_file ]; then
4016 ln $migrate_dir2/source_file $migrate_dir2/link_file \
4017 &>/dev/null || rc1=$?
4018 if [ -e $migrate_dir2/link_file ]; then
4019 rm -rf $migrate_dir2/link_file
4022 mrename $migrate_dir2/source_file \
4023 $migrate_dir2/target_file &>/dev/null || rc1=$?
4024 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
4025 echo "rename failed with $rc1"
4029 if [ -e $migrate_dir2/target_file ]; then
4030 rm -rf $migrate_dir2/target_file &>/dev/null ||
4033 rm -rf $migrate_dir2/source_file &>/dev/null ||
4036 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
4037 echo "unlink failed with $rc1"
4042 end_time=$(date +%s)
4043 duration=$((end_time - start_time))
4044 if [ $((duration % 10)) -eq 0 ]; then
4045 if [ $show_time -eq 1 ]; then
4046 echo "...$duration seconds"
4053 kill -0 $migrate_pid || {
4054 echo "migration stopped 1"
4058 [ $duration -ge 300 ] && break
4061 #check migration are still there
4062 kill -0 $migrate_pid || error "migration stopped 2"
4065 run_test 80b "Accessing directory during migration"
4068 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4072 mkdir -p $DIR1/$tdir
4074 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d0
4075 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d1
4078 touch d0/0 || error "create 0 failed"
4079 mv d0/0 d1/0 || error "rename d0/0 d1/0 failed"
4080 stat d0/0 && error "stat mv filed succeed"
4081 mv $DIR2/$tdir/d1/0 $DIR2/$tdir/d0/0 || error "rename d1/0 d0/0 failed"
4082 stat d0/0 || error "stat failed"
4084 local t=$(ls -ai $DIR1/$tdir/d0 | sort -u | wc -l)
4086 if [ $t -ne 3 ]; then
4087 ls -ai $DIR1/$tdir/d0
4088 error "expect 3 get $t"
4093 run_test 81a "rename and stat under striped directory"
4096 [ $MDSCOUNT -lt 2 ] &&
4097 skip "We need at least 2 MDTs for this test"
4104 $LFS mkdir -c $MDSCOUNT $DIR1/$tdir || error "$LFS mkdir"
4105 createmany -o $DIR1/$tdir/$tfile. $total || error "createmany"
4114 for i in $(seq $total); do
4115 mrename $DIR2/$tdir/$tfile.$i $DIR2/$tdir/$tfile-new.$i \
4119 kill -9 $setattr_pid
4121 run_test 81b "rename under striped directory doesn't deadlock"
4124 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.6.91) ]] ||
4125 { skip "Need MDS version at least 2.6.92"; return 0; }
4127 # Client 1 creates a file.
4128 multiop_bg_pause $DIR1/$tfile O_ac || error "multiop_bg_pause 1"
4130 # Client 2 opens the file.
4131 multiop_bg_pause $DIR2/$tfile o_Ac || error "multiop_bg_pause 2"
4133 # Client 1 makes the file an orphan.
4134 rm $DIR1/$tfile || error "rm"
4135 # Client 2 sets EA "user.multiop".
4137 wait $pid2 || error "multiop 2"
4138 # Client 1 gets EA "user.multiop". This used to fail because the EA
4139 # cache refill would get "trusted.link" from mdd_xattr_list() but
4140 # -ENOENT when trying to get "trusted.link"'s value. See also sanity
4143 wait $pid1 || error "multiop 1"
4145 run_test 82 "fsetxattr and fgetxattr on orphan files"
4148 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4155 $LFS mkdir -i1 -c2 $tdir
4160 echo "start pid $pid1 to create/unlink striped directory"
4162 # Access the directory at the same time
4166 stat $tdir > /dev/null 2>&1
4170 echo "start pid $pid2 to stat striped directory"
4178 run_test 83 "access striped directory while it is being created/unlinked"
4181 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4186 [ "$SLOW" = "yes" ] && duration=600
4187 # Open/Create under striped directory
4191 $LFS mkdir -c$MDSCOUNT $tdir > /dev/null 2>&1
4192 touch $tdir/f{0..3} > /dev/null 2>&1
4196 echo "start pid $pid1 to open/create under striped directory"
4198 # unlink the striped directory at the same time
4202 rm -rf $tdir > /dev/null 2>&1
4206 echo "start pid $pid2 to unlink striped directory"
4215 run_test 90 "open/create and unlink striped directory"
4218 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4223 [ "$SLOW" = "yes" ] && duration=600
4224 # chmod striped directory
4228 $LFS mkdir -c$MDSCOUNT $tdir > /dev/null 2>&1
4229 chmod go+w $tdir > /dev/null 2>&1
4233 echo "start pid $pid1 to chmod striped directory"
4235 # unlink the striped directory at the same time
4239 rm -rf $tdir > /dev/null 2>&1
4243 echo "start pid $pid2 to unlink striped directory"
4252 run_test 91 "chmod and unlink striped directory"
4255 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4258 local cmd="exec $fd<$DIR1/$tdir"
4259 $LFS setdirstripe -c$MDSCOUNT $DIR1/$tdir || error "mkdir $tdir fails"
4262 trap "eval $cmd" EXIT
4263 cd $DIR1/$tdir || error "cd $DIR1/$tdir fails"
4264 rmdir ../$tdir || error "rmdir ../$tdir fails"
4266 #define OBD_FAIL_LLITE_NO_CHECK_DEAD 0x1408
4267 $LCTL set_param fail_loc=0x1408
4268 mkdir $DIR2/$tdir/dir && error "create dir succeeds"
4269 $LFS setdirstripe -i1 $DIR2/$tdir/remote_dir &&
4270 error "create remote dir succeeds"
4271 $LCTL set_param fail_loc=0
4275 run_test 92 "create remote directory under orphan directory"
4282 mkdir -p $DIR1/$tfile-1/
4283 mkdir -p $DIR2/$tfile-2/
4284 local old_rr=$(do_facet $SINGLEMDS lctl get_param -n \
4285 'lod.lustre-MDT*/qos_threshold_rr' | sed -e 's/%//')
4286 do_facet $SINGLEMDS lctl set_param -n \
4287 'lod.lustre-MDT*/qos_threshold_rr' 100
4288 #define OBD_FAIL_MDS_LOV_CREATE_RACE 0x163
4289 do_facet $SINGLEMDS "lctl set_param fail_loc=0x00000163"
4291 $LFS setstripe -c -1 $DIR1/$tfile-1/file1 &
4294 $LFS setstripe -c -1 $DIR2/$tfile-2/file2 &
4298 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4299 do_facet $SINGLEMDS "lctl set_param -n \
4300 'lod.lustre-MDT*/qos_threshold_rr' $old_rr"
4302 $LFS getstripe $DIR1/$tfile-1/file1
4303 rc1=$($LFS getstripe -q $DIR1/$tfile-1/file1 |
4304 awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
4305 $LFS getstripe $DIR2/$tfile-2/file2
4306 rc2=$($LFS getstripe -q $DIR2/$tfile-2/file2 |
4307 awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
4308 echo "rc1=$rc1 and rc2=$rc2 "
4309 [ $rc1 -eq 0 ] && [ $rc2 -eq 0 ] ||
4310 error "object allocate on same ost detected"
4312 run_test 93 "alloc_rr should not allocate on same ost"
4316 skip "Reserved for glimpse-ahead" && return
4317 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4318 skip "Need MDS version at least 2.10.55" && return
4322 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4324 lctl set_param -n mdc.*.stats=clear
4325 dd if=/dev/zero of=$DIR2/$tdir/dom bs=4096 count=1 || return 1
4327 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #1"
4328 # first stat from server should return size data and save glimpse
4329 local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
4330 [ $gls -eq 0 ] || error "Unexpected $gls glimpse RPCs"
4331 # second stat to check size is NOT cached on client without IO lock
4332 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
4334 local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
4335 [ $gls -ge 1 ] || error "Expect glimpse RPCs but none"
4338 run_test 100a "DoM: glimpse RPCs for stat without IO lock (DoM only file)"
4341 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4342 skip "Need MDS version at least 2.10.55" && return
4346 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4348 lctl set_param -n mdc.*.stats=clear
4349 dd if=/dev/zero of=$DIR2/$tdir/dom bs=4096 count=1 || return 1
4350 cancel_lru_locks mdc
4351 # first stat data from server should have size
4352 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #1"
4353 # second stat to check size is cached on client
4354 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
4356 local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
4357 # both stats should cause no glimpse requests
4358 [ $gls == 0 ] || error "Unexpected $gls glimpse RPCs"
4361 run_test 100b "DoM: no glimpse RPC for stat with IO lock (DoM only file)"
4364 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4365 skip "Need MDS version at least 2.10.55" && return
4369 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4371 lctl set_param -n mdc.*.stats=clear
4372 lctl set_param -n osc.*.stats=clear
4373 dd if=/dev/zero of=$DIR2/$tdir/dom bs=2048K count=1 || return 1
4375 # check that size is merged from MDT and OST correctly
4376 $CHECKSTAT -t file -s 2097152 $DIR/$tdir/dom ||
4377 error "Wrong size from stat #1"
4379 local gls=$(lctl get_param -n osc.*.stats | grep -c ldlm_glimpse)
4380 [ $gls -eq 0 ] && error "Expect OST glimpse RPCs but got none"
4384 run_test 100c "DoM: write vs stat without IO lock (combined file)"
4387 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4388 skip "Need MDS version at least 2.10.55" && return
4392 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4395 dd if=/dev/zero of=$DIR2/$tdir/dom bs=2048K count=1 || return 1
4396 lctl set_param -n mdc.*.stats=clear
4397 $TRUNCATE $DIR2/$tdir/dom 4096
4399 # check that reported size is valid after file grows to OST and
4400 # is truncated back to MDT stripe size
4401 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom ||
4402 error "Wrong size from stat #1"
4404 local gls=$(lctl get_param -n osc.*.stats | grep -c ldlm_glimpse)
4405 [ $gls -eq 0 ] && error "Expect OST glimpse but got none"
4409 run_test 100d "DoM: write+truncate vs stat without IO lock (combined file)"
4412 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4413 skip "Need MDS version at least 2.10.55" && return
4415 $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile
4417 $CHECKSTAT -t file $DIR1/$tfile
4419 local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
4420 sysctl -wq vm.dirty_writeback_centisecs=0
4422 trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
4425 dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 ||
4426 error_noexit "Write fails"
4427 # must discard pages
4428 lctl set_param -n mdc.*.stats=clear
4429 rm $DIR2/$tfile || error "Unlink fails"
4431 local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
4432 [ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
4434 run_test 101a "Discard DoM data on unlink"
4437 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4438 skip "Need MDS version at least 2.10.55" && return
4440 $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile
4441 touch $DIR1/${tfile}_2
4443 $CHECKSTAT -t file $DIR1/$tfile
4445 local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
4446 sysctl -wq vm.dirty_writeback_centisecs=0
4448 trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
4451 dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails"
4452 # must discard pages
4453 lctl set_param -n mdc.*.stats=clear
4454 mv $DIR2/${tfile}_2 $DIR2/$tfile || error "Rename fails"
4456 local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
4457 [ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
4459 run_test 101b "Discard DoM data on rename"
4462 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4463 skip "Need MDS version at least 2.10.55" && return
4465 $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile
4467 $CHECKSTAT -t file $DIR1/$tfile
4469 local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
4470 sysctl -wq vm.dirty_writeback_centisecs=0
4472 trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
4475 dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails"
4476 $MULTIOP $DIR1/$tfile O_c &
4479 lctl set_param -n mdc.*.stats=clear
4480 rm $DIR2/$tfile > /dev/null || error "Unlink fails for opened file"
4481 kill -USR1 $MULTIOP_PID && wait $MULTIOP_PID || error "multiop failure"
4483 local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
4484 [ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
4486 run_test 101c "Discard DoM data on close-unlink"
4488 # test to verify file handle related system calls
4489 # (name_to_handle_at/open_by_handle_at)
4490 # The new system calls are supported in glibc >= 2.14.
4492 # test to verify we can open by handle an unlinked file from > 1 client
4493 # This test opens the file normally on $DIR1, which is on one mount, and then
4494 # opens it by handle on $DIR2, which is on a different mount.
4496 [ $MDS1_VERSION -lt $(version_code 2.11.57) ] &&
4497 skip "Needs MDS version 2.11.57 or later"
4499 echo "Test file_handle syscalls" > $DIR/$tfile ||
4500 error "write failed"
4501 check_fhandle_syscalls $DIR/$tfile $DIR2 ||
4502 error "check_fhandle_syscalls failed"
4505 run_test 102 "Test open by handle of unlinked file"
4507 log "cleanup: ======================================================"
4509 # kill and wait in each test only guarentee script finish, but command in script
4510 # like 'rm' 'chmod' may still be running, wait for all commands to finish
4511 # otherwise umount below will fail
4512 [ "$(mount | grep $MOUNT2)" ] && wait_update $HOSTNAME "fuser -m $MOUNT2" "" ||
4517 check_and_cleanup_lustre