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}
36 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
37 # bug number for skipped test:
38 ALWAYS_EXCEPT="$ALWAYS_EXCEPT "
39 # LU-2829 / LU-2887 - make allowances for ZFS slowness
40 TEST33_NFILES=${TEST33_NFILES:-1000}
43 [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
50 check_and_setup_lustre
55 rm -rf $DIR1/[df][0-9]* $DIR1/lnk $DIR/[df].${TESTSUITE}*
57 SAMPLE_FILE=$TMP/$(basename $0 .sh).junk
58 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1
60 # $RUNAS_ID may get set incorrectly somewhere else
61 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
63 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
69 [ -f $DIR2/$tfile ] || error "Check create"
70 chmod 777 $DIR2/$tfile
71 $CHECKSTAT -t file -p 0777 $DIR1/$tfile ||
72 error "Check attribute update for 0777"
74 chmod a-x $DIR2/$tfile
75 $CHECKSTAT -t file -p 0666 $DIR1/$tfile ||
76 error "Check attribute update for 0666"
79 $CHECKSTAT -a $DIR1/$tfile ||
80 error "Check unlink - removes file on other mountpoint"
82 run_test 1 "Check attribute updates on 2 mount points"
88 $CHECKSTAT -t file -p 0777 $DIR1/f2a ||
89 error "Either not file type or perms not 0777"
91 run_test 2a "check cached attribute updates on 2 mtpt's ========"
97 $CHECKSTAT -t file -p 0777 $DIR2/f2b ||
98 error "Either not file type or perms not 0777"
100 run_test 2b "check cached attribute updates on 2 mtpt's ========"
102 # NEED TO SAVE ROOT DIR MODE
105 $CHECKSTAT -t dir -p 0777 $DIR2 ||
106 error "Either not dir type or perms not 0777"
108 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
112 $CHECKSTAT -t dir -p 0755 $DIR2 ||
113 error "Either not file type or perms not 0775"
115 run_test 2d "check cached attribute updates on 2 mtpt's root ==="
122 $RUNAS dd if=/dev/zero of=$DIR2/$tfile count=1 ||
125 run_test 2e "check chmod on root is propagated to others"
128 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
130 local remote_dir=$tdir/remote_dir
133 $LFS mkdir -i $MDTIDX $DIR1/$remote_dir ||
134 error "Create remote directory failed"
136 touch $DIR1/$remote_dir/$tfile ||
137 error "Create file under remote directory failed"
138 chmod 777 $DIR1/$remote_dir/$tfile ||
139 error "Chmod file under remote directory failed"
141 $CHECKSTAT -t file -p 0777 $DIR2/$remote_dir/$tfile ||
142 error "Check attr of file under remote directory failed"
144 chown $RUNAS_ID:$RUNAS_GID $DIR1/$remote_dir/$tfile ||
145 error "Chown file under remote directory failed"
147 $CHECKSTAT -u \#$RUNAS_ID -g \#$RUNAS_GID $DIR2/$remote_dir/$tfile ||
148 error "Check owner of file under remote directory failed"
150 cd $DIR2/$remote_dir || error "enter remote dir"
151 rm -rf $DIR1/$remote_dir/$tfile ||
152 error "Unlink remote directory failed"
154 $CHECKSTAT -t file $DIR2/$remote_dir/$tfile &&
155 error "unlink file still exists!"
157 cd $DIR2/$tdir || error "exit remote dir"
158 rm -rf $DIR1/$tdir || error "unlink directory failed"
160 run_test 2f "check attr/owner updates on DNE with 2 mtpt's"
163 dd if=/dev/zero of=$DIR1/$tfile oflag=sync bs=1M count=2
165 local block1=$(stat $DIR1/$tfile | awk '/Blocks/ {print $4} ')
167 local block2=$(stat $DIR2/$tfile | awk '/Blocks/ {print $4} ')
168 echo "$DIR1/$tfile has $block1 blocks"
169 echo "$DIR2/$tfile has $block2 blocks"
170 [ $block1 -eq $block2 ] || error "$block1 not equal to $block2"
172 run_test 2g "check blocks update on sync write"
175 local target="this/is/good"
176 ln -s $target $DIR1/$tfile || error "ln -s $target $DIR1/$tfile failed"
177 [ "$(ls -l $DIR2/$tfile | sed -e 's/.* -> //')" = "$target" ] ||
178 error "link $DIR2/$tfile not as expected"
180 run_test 3 "symlink on one mtpt, readlink on another ==========="
183 multifstat $DIR1/f4 $DIR2/f4
185 run_test 4 "fstat validation on multiple mount points =========="
189 $TRUNCATE $DIR2/f5 100
190 $CHECKSTAT -t file -s 100 $DIR1/f5 ||
191 error "Either not file type or size not equal to 100 bytes"
194 run_test 5 "create a file on one mount, truncate it on the other"
197 openunlink $DIR1/$tfile $DIR2/$tfile || \
198 error "openunlink $DIR1/$tfile $DIR2/$tfile"
200 run_test 6 "remove of open file on other node =================="
204 opendirunlink $DIR1/$dir $DIR2/$dir || \
205 error "opendirunlink $DIR1/$dir $DIR2/$dir"
207 run_test 7 "remove of open directory on other node ============="
210 opendevunlink $DIR1/$tfile $DIR2/$tfile || \
211 error "opendevunlink $DIR1/$tfile $DIR2/$tfile"
213 run_test 8 "remove of open special file on other node =========="
219 for C in a b c d e f g h i j k l; do
220 dir=`eval echo \\$DIR$MTPT`
221 echo -n $C >> $dir/f9
222 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
224 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
225 error "`od -a $DIR1/f9` != abcdefghijkl"
227 run_test 9a "append of file with sub-page size on multiple mounts"
229 #LU-10681 - tiny writes & appending to sparse striped file
231 [[ $OSTCOUNT -ge 2 ]] || { skip "needs >= 2 OSTs"; return; }
233 $LFS setstripe -c 2 -S 1M $DIR/$tfile
234 echo "foo" >> $DIR/$tfile
235 dd if=/dev/zero of=$DIR2/$tfile bs=1M count=1 seek=1 conv=notrunc ||
236 error "sparse dd $DIR2/$tfile failed"
237 echo "foo" >> $DIR/$tfile
239 data=$(dd if=$DIR2/$tfile bs=1 count=3 skip=$((2 * 1048576)) conv=notrunc)
240 echo "Data read (expecting 'foo')": $data
241 [ "$data" = "foo" ] || error "append to sparse striped file failed"
243 run_test 9b "append to striped sparse file"
250 for C in a b c d e f g h i j k l; do
251 dir=`eval echo \\$DIR$MTPT`
252 echo -n $C | dd of=$dir/f10 bs=1 seek=$OFFSET count=1
253 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
254 OFFSET=`expr $OFFSET + 1`
256 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
257 error "`od -a $DIR1/f10` != abcdefghijkl"
259 run_test 10a "write of file with sub-page size on multiple mounts "
263 yes "R" | head -c 4000 >$TMP/f10b-seed
264 dd if=$TMP/f10b-seed of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
266 $TRUNCATE $DIR1/f10b 4096 || error "truncate 4096"
268 dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
270 # create a test file locally to compare
271 dd if=$TMP/f10b-seed of=$TMP/f10b bs=3k count=1 || error "dd random"
272 $TRUNCATE $TMP/f10b 4096 || error "truncate 4096"
273 cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
274 rm $TMP/f10b $TMP/f10b-lustre $TMP/f10b-seed
276 run_test 10b "write of file with sub-page size on multiple mounts "
280 multiop_bg_pause $DIR1/d11/f O_c || return 1
282 cp -p /bin/ls $DIR1/d11/f
286 wait $MULTIPID || error "wait for PID $MULTIPID failed"
287 [ $RC -eq 0 ] && error || true
289 run_test 11 "execution of file opened for write should return error ===="
292 DIR=$DIR DIR2=$DIR2 sh lockorder.sh
294 run_test 12 "test lock ordering (link, stat, unlink)"
296 test_13() { # bug 2451 - directory coherency
298 cd $DIR1/d13 || error "cd to $DIR1/d13 failed"
300 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
302 rm -f $DIR2/d13/f13 || error "Cannot remove $DIR2/d13/f13"
303 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
304 # need to run it twice
305 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
307 rm -f $DIR2/d13/f13 || error "Cannot remove $DIR2/d13/f13"
308 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
310 run_test 13 "test directory page revocation"
313 test_mkdir $DIR1/$tdir
314 cp -p /bin/ls $DIR1/$tdir/$tfile
315 multiop_bg_pause $DIR1/$tdir/$tfile Ow_c || return 1
318 $DIR2/$tdir/$tfile && error || true
320 wait $MULTIPID || return 2
322 run_test 14aa "execution of file open for write returns -ETXTBSY"
325 test_mkdir $DIR1/$tdir
326 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
327 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
330 $MULTIOP $DIR2/$tdir/multiop Oc && error "expected error, got success"
331 kill -USR1 $MULTIOP_PID || return 2
332 wait $MULTIOP_PID || return 3
333 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
335 run_test 14ab "open(RDWR) of executing file returns -ETXTBSY"
337 test_14b() { # bug 3192, 7040
338 test_mkdir $DIR1/$tdir
339 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
340 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
343 $TRUNCATE $DIR2/$tdir/multiop 0 && kill -9 $MULTIOP_PID && \
344 error "expected truncate error, got success"
345 kill -USR1 $MULTIOP_PID || return 2
346 wait $MULTIOP_PID || return 3
347 cmp $(which multiop) $DIR1/$tdir/multiop || error "binary changed"
348 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
350 run_test 14b "truncate of executing file returns -ETXTBSY ======"
352 test_14c() { # bug 3430, 7040
353 test_mkdir $DIR1/$tdir
354 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
355 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
358 cp /etc/hosts $DIR2/$tdir/multiop && error "expected error, got success"
359 kill -USR1 $MULTIOP_PID || return 2
360 wait $MULTIOP_PID || return 3
361 cmp $(which multiop) $DIR1/$tdir/multiop || error "binary changed"
362 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
364 run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
366 test_14d() { # bug 10921
367 test_mkdir $DIR1/$tdir
368 cp -p $(which multiop) $DIR1/$tdir/multiop || error "cp failed"
369 MULTIOP_PROG=$DIR1/$tdir/multiop multiop_bg_pause $TMP/$tfile O_c ||
373 chmod 600 $DIR1/$tdir/multiop || error "chmod failed"
374 kill -USR1 $MULTIOP_PID || return 2
375 wait $MULTIOP_PID || return 3
376 cmp $(which multiop) $DIR1/$tdir/multiop || error "binary changed"
377 rm $TMP/$tfile $DIR1/$tdir/multiop || error "removing multiop"
379 run_test 14d "chmod of executing file is still possible ========"
381 test_15() { # bug 974 - ENOSPC
383 sh oos2.sh $MOUNT1 $MOUNT2
384 wait_delete_completed
385 grant_error=`dmesg | grep "> available"`
386 [ -z "$grant_error" ] || error "$grant_error"
388 run_test 15 "test out-of-space with multiple writers ==========="
391 # The FSXNUM reduction for ZFS is needed until ORI-487 is fixed.
392 # We don't want to skip it entirely, but ZFS is VERY slow and cannot
393 # pass a 2500 operation dual-mount run within the time limit.
394 if [ "$(facet_fstype ost1)" = "zfs" ]; then
395 FSXNUM=$((COUNT / 5))
397 elif [ "$SLOW" = "yes" ]; then
398 FSXNUM=$((COUNT * 5))
406 local file1=$DIR1/$tfile
407 local file2=$DIR2/$tfile
408 local stripe_size=$(do_facet $SINGLEMDS \
409 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
411 # to allocate grant because it may run out due to test_15.
412 $LFS setstripe -c -1 $file1
413 dd if=/dev/zero of=$file1 bs=$stripe_size count=$OSTCOUNT oflag=sync
414 dd if=/dev/zero of=$file2 bs=$stripe_size count=$OSTCOUNT oflag=sync
417 $LFS setstripe -c -1 $file1 # b=10919
418 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2 \
419 || error "fsx failed"
422 # O_DIRECT reads and writes must be aligned to the device block size.
423 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 -Z -r 4096 \
424 -w 4096 $file1 $file2 || error "fsx with O_DIRECT failed."
426 run_test 16a "$FSXNUM iterations of dual-mount fsx"
428 # Consistency check for tiny writes, LU-9409
430 local file1=$DIR1/$tfile
431 local file2=$DIR2/$tfile
433 # to allocate grant because it may run out due to test_15.
434 lfs setstripe -c -1 $file1
435 dd if=/dev/zero of=$file1 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
436 dd if=/dev/zero of=$file2 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
439 lfs setstripe -c -1 $file1 # b=10919
440 # -o is set to 8192 because writes < 1 page and between 1 and 2 pages
441 # create a mix of tiny writes & normal writes
442 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -o 8192 -S 0 $file1 \
445 run_test 16b "$FSXNUM iterations of dual-mount fsx at small size"
448 local file1=$DIR1/$tfile
449 local file2=$DIR2/$tfile
450 local stripe_size=$(do_facet $SINGLEMDS \
451 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
453 [ $(facet_fstype ost1) != ldiskfs ] && skip "dio on ldiskfs only"
455 # to allocate grant because it may run out due to test_15.
456 $LFS setstripe -c -1 $file1
457 dd if=/dev/zero of=$file1 bs=$stripe_size count=$OSTCOUNT oflag=sync
458 dd if=/dev/zero of=$file2 bs=$stripe_size count=$OSTCOUNT oflag=sync
460 wait_delete_completed
462 local list=$(comma_list $(osts_nodes))
463 if ! get_osd_param $list '' read_cache_enable >/dev/null; then
464 skip "not cache-capable obdfilter"
467 set_osd_param $list '' read_cache_enable 0
468 set_osd_param $list '' writethrough_cache_enable 0
470 $LFS setstripe -c -1 $file1 # b=10919
471 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2 \
472 || error "fsx failed"
475 set_osd_param $list '' read_cache_enable 1
476 set_osd_param $list '' writethrough_cache_enable 1
480 run_test 16c "verify data consistency on ldiskfs with cache disabled (b=17397)"
483 test_17() { # bug 3513, 3667
484 remote_ost_nodsh && skip "remote OST with nodsh" && return
486 lfs setstripe $DIR1/$tfile -i 0 -c 1
487 cp $SAMPLE_FILE $DIR1/$tfile
488 cancel_lru_locks osc > /dev/null
489 #define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a
490 do_facet ost1 lctl set_param fail_loc=0x8000030a
491 ls -ls $DIR1/$tfile | awk '{ print $1,$6 }' > $DIR1/$tfile-1 & \
492 ls -ls $DIR2/$tfile | awk '{ print $1,$6 }' > $DIR2/$tfile-2
494 diff -u $DIR1/$tfile-1 $DIR2/$tfile-2 || error "files are different"
496 run_test 17 "resource creation/LVB creation race ==============="
499 # turn e.g. ALWAYS_EXCEPT="18c" into "-e 3"
502 for idx in {a..z}; do
503 local ptr=EXCEPT_ALWAYS_18$idx
504 [ x${!ptr} = xtrue ] || continue
506 excepts="$excepts -e $(($(printf %d \'$idx)-96))"
509 $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2 $excepts
512 run_test 18 "mmap sanity check ================================="
514 test_19() { # bug3811
515 local node=$(facet_active_host ost1)
517 [ "x$DOM" = "xyes" ] && node=$(facet_active_host $SINGLEMDS)
519 # check whether obdfilter is cache capable at all
520 get_osd_param $node '' read_cache_enable >/dev/null ||
521 skip "not cache-capable obdfilter"
523 local MAX=$(get_osd_param $node '' readcache_max_filesize | head -n 1)
524 set_osd_param $node '' readcache_max_filesize 4096
525 dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
526 local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
527 cp $TMP/$tfile $DIR1/$tfile
528 for i in `seq 1 20`; do
529 [ $((i % 5)) -eq 0 ] && log "$testname loop $i"
530 cancel_lru_locks $OSC > /dev/null
531 cksum $DIR1/$tfile | cut -d" " -f 1,2 > $TMP/sum1 & \
532 cksum $DIR2/$tfile | cut -d" " -f 1,2 > $TMP/sum2
534 [ "$(cat $TMP/sum1)" = "$SUM" ] || \
535 error "$DIR1/$tfile $(cat $TMP/sum1) != $SUM"
536 [ "$(cat $TMP/sum2)" = "$SUM" ] || \
537 error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
539 set_osd_param $node '' readcache_max_filesize $MAX
542 run_test 19 "test concurrent uncached read races ==============="
546 cancel_lru_locks $OSC
547 CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
548 $MULTIOP $DIR1/f20 Ow8190c
549 $MULTIOP $DIR2/f20 Oz8194w8190c
550 $MULTIOP $DIR1/f20 Oz0r8190c
551 cancel_lru_locks $OSC
552 CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
554 error $CNTD" page left in cache after lock cancel" || true
556 run_test 20 "test extra readahead page left in cache ===="
563 test_21() { # Bug 5907
564 test_mkdir $DIR1/$tdir
565 mount /etc $DIR1/$tdir --bind || error "mount failed" # Poor man's mount.
567 rmdir -v $DIR1/$tdir && error "Removed mounted directory"
568 rmdir -v $DIR2/$tdir && echo "Removed mounted directory from another mountpoint, needs to be fixed"
569 test -d $DIR1/$tdir || error "Mounted directory disappeared"
571 test -d $DIR2/$tdir || test -d $DIR1/$tdir && error "Removed dir still visible after umount"
574 run_test 21 " Try to remove mountpoint on another dir ===="
576 test_23() { # Bug 5972
577 local at_diff=$(do_facet $SINGLEMDS \
578 $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -n1)
579 echo "atime should be updated while another read" > $DIR1/$tfile
581 # clear the lock(mode: LCK_PW) gotten from creating operation
582 cancel_lru_locks $OSC
585 sleep $((at_diff + 1))
587 echo "starting reads"
588 multiop_bg_pause $DIR1/$tfile or20_c || return 1
589 # with SOM and opencache enabled, we need to close a file and cancel
590 # open lock to get atime propogated to MDS
591 kill -USR1 $! || return 2
594 time2=$(stat -c "%X" $DIR/$tfile)
595 echo "new atime is $time2"
597 [ $time2 -gt $time1 ] || error "atime was not updated"
598 rm -f $DIR1/$tfile || error "rm -f $DIR1/$tfile failed"
601 run_test 23 " others should see updated atime while another read===="
605 lfs df || error "lfs df failed"
606 lfs df -ih || error "lfs df -ih failed"
607 lfs df -h $DIR1 || error "lfs df -h $DIR1 failed"
608 lfs df -i $DIR2 || error "lfs df -i $DIR2 failed"
609 lfs df $DIR1/$tfile || error "lfs df $DIR1/$tfile failed"
610 lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
612 OSC=`lctl dl | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1`
613 # OSC=`lctl dl | awk '/-osc-/ {print $4}' | head -n 1`
614 lctl --device %osc deactivate
615 lfs df -i || error "lfs df -i with deactivated OSC failed"
616 lctl --device %osc activate
617 lfs df || error "lfs df with reactivated OSC failed"
619 run_test 24a "lfs df [-ih] [path] test ========================="
623 fsnum=$(lfs_df | grep -c "summary")
624 [ $fsnum -eq 2 ] || error "lfs df shows $fsnum != 2 filesystems."
626 run_test 24b "lfs df should show both filesystems ==============="
629 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
631 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
634 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
635 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
637 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
638 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
639 error "setfacl $DIR2/$tdir #1"
640 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
641 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
642 error "setfacl $DIR2/$tdir #2"
643 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
644 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
645 error "setfacl $DIR2/$tdir #3"
646 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
647 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
648 error "setfacl $DIR2/$tdir #4"
649 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
653 run_test 25a "change ACL on one mountpoint be seen on another ==="
656 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
658 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
660 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
663 $LFS mkdir -i 1 $DIR1/$tdir
664 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
665 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
667 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
668 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
669 error "setfacl $DIR2/$tdir #1"
670 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
671 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
672 error "setfacl $DIR2/$tdir #2"
673 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
674 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
675 error "setfacl $DIR2/$tdir #3"
676 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
677 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
678 error "setfacl $DIR2/$tdir #4"
679 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
683 run_test 25b "change ACL under remote dir on one mountpoint be seen on another"
686 utime $DIR1/f26a -s $DIR2/f26a || error "utime failed for $DIR1/f26a"
688 run_test 26a "allow mtime to get older"
693 echo "aaa" >> $DIR1/$tfile
695 chmod a+x $DIR2/$tfile
696 mt1=`stat -c %Y $DIR1/$tfile`
697 mt2=`stat -c %Y $DIR2/$tfile`
699 if [ x"$mt1" != x"$mt2" ]; then
700 error "not equal mtime, client1: "$mt1", client2: "$mt2"."
703 run_test 26b "sync mtime between ost and mds"
706 cancel_lru_locks $OSC
708 dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
713 dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
718 dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
720 lctl set_param -n ldlm.dump_namespaces ""
721 wait $DD1_PID $DD2_PID
722 [ $? -ne 0 ] && lctl dk $TMP/debug || true
724 run_test 27 "align non-overlapping extent locks from request ==="
726 test_28() { # bug 9977
727 ECHO_UUID="ECHO_osc1_UUID"
728 tOST=$($LCTL dl | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -n1)
730 $LFS setstripe $DIR1/$tfile -S 1048576 -i 0 -c 2
731 tOBJID=`$LFS getstripe $DIR1/$tfile | awk '$1 == 1 {print $2}'`
732 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
736 attach echo_client ECHO_osc1 $ECHO_UUID
740 tECHOID=`$LCTL dl | grep $ECHO_UUID | awk '{ print $1 }'`
741 $LCTL --device $tECHOID destroy "${tOBJID}:0"
749 # reading of 1st stripe should pass
750 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error "dd failed"
751 # reading of 2nd stripe should fail (this stripe was destroyed)
752 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 && error
754 # now, recreating test file
755 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2 || error "dd failed"
756 # reading of 1st stripe should pass
757 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error "dd failed"
758 # reading of 2nd stripe should pass
759 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 ||
762 run_test 28 "read/write/truncate file with lost stripes"
764 test_30() { #b=11110, LU-2523
765 test_mkdir $DIR1/$tdir
766 cp -f /bin/bash $DIR1/$tdir/bash
767 /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash; cp /bin/bash $DIR2/$tdir' &
768 $DIR1/$tdir/bash -c 'sleep 2;
769 openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?'
773 run_test 30 "recreate file race"
776 test_mkdir $DIR1/$tdir
777 local writes=$(LANG=C dd if=/dev/zero of=$DIR/$tdir/$tfile \
778 count=1 2>&1 | awk 'BEGIN { FS="+" } /out/ {print $1}')
779 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
780 lctl set_param fail_loc=0x314
781 local reads=$(LANG=C dd if=$DIR2/$tdir/$tfile of=/dev/null 2>&1 |
782 awk 'BEGIN { FS="+" } /in/ {print $1}')
783 [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
785 run_test 31a "voluntary cancel / blocking ast race=============="
788 remote_ost || { skip "local OST" && return 0; }
789 remote_ost_nodsh && skip "remote OST w/o dsh" && return 0
791 # make sure there is no local locks due to destroy
792 wait_mds_ost_sync || error "wait_mds_ost_sync()"
793 wait_delete_completed || error "wait_delete_completed()"
795 test_mkdir $DIR1/$tdir
796 lfs setstripe $DIR/$tdir/$tfile -i 0 -c 1
797 cp /etc/hosts $DIR/$tdir/$tfile
798 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
799 lctl set_param fail_loc=0x314
800 #define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316
801 do_facet ost1 lctl set_param fail_loc=0x316
803 cat $DIR2/$tdir/$tfile > /dev/null 2>&1
804 lctl set_param fail_loc=0
805 do_facet ost1 lctl set_param fail_loc=0
806 # cleanup: reconnect the client back
809 run_test 31b "voluntary OST cancel / blocking ast race=============="
811 # enable/disable lockless truncate feature, depending on the arg 0/1
812 enable_lockless_truncate() {
813 lctl set_param -n $OSC.*.lockless_truncate $1
816 test_32a() { # bug 11270
817 local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
818 local stripe_size=$(do_facet $SINGLEMDS \
819 "$LCTL get_param -n lod.$(facet_svc $SINGLEMDS)*.stripesize")
821 save_lustre_params client "$OSC.*.lockless_truncate" > $save
822 # restore lockless_truncate default values on exit
823 stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
824 cancel_lru_locks $OSC
825 enable_lockless_truncate 1
827 lfs setstripe -c -1 $DIR1/$tfile
828 dd if=/dev/zero of=$DIR1/$tfile count=$OSTCOUNT bs=$stripe_size > \
830 clear_stats $OSC.*.${OSC}_stats
832 log "checking cached lockless truncate"
833 $TRUNCATE $DIR1/$tfile 8000000
834 $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
835 [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
836 error "cached truncate isn't lockless"
838 log "checking not cached lockless truncate"
839 $TRUNCATE $DIR2/$tfile 5000000
840 $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
841 [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -ne 0 ] ||
842 error "not cached truncate isn't lockless"
844 log "disabled lockless truncate"
845 enable_lockless_truncate 0
846 clear_stats $OSC.*.${OSC}_stats
847 $TRUNCATE $DIR2/$tfile 3000000
848 $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
849 [ $(calc_stats $OSC.*.${OSC}_stats lockless_truncate) -eq 0 ] ||
850 error "lockless truncate disabling failed"
853 run_test 32a "lockless truncate"
855 test_32b() { # bug 11270
856 remote_ost_nodsh && skip "remote OST with nodsh" && return
859 local facets=$(get_facets OST)
860 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
862 save_lustre_params client "osc.*.contention_seconds" > $p
863 save_lustre_params $facets \
864 "ldlm.namespaces.filter-*.max_nolock_bytes" >> $p
865 save_lustre_params $facets \
866 "ldlm.namespaces.filter-*.contended_locks" >> $p
867 save_lustre_params $facets \
868 "ldlm.namespaces.filter-*.contention_seconds" >> $p
869 clear_stats $OSC.*.${OSC}_stats
871 # agressive lockless i/o settings
872 do_nodes $(comma_list $(osts_nodes)) \
873 "lctl set_param -n ldlm.namespaces.*.max_nolock_bytes=2000000 \
874 ldlm.namespaces.filter-*.contended_locks=0 \
875 ldlm.namespaces.filter-*.contention_seconds=60"
876 lctl set_param -n $OSC.*.contention_seconds=60
878 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > \
880 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > \
883 [ $(calc_stats $OSC.*.${OSC}_stats lockless_write_bytes) -ne 0 ] ||
884 error "lockless i/o was not triggered"
885 # disable lockless i/o (it is disabled by default)
886 do_nodes $(comma_list $(osts_nodes)) \
887 "lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes=0 \
888 ldlm.namespaces.filter-*.contended_locks=32 \
889 ldlm.namespaces.filter-*.contention_seconds=0"
890 # set contention_seconds to 0 at client too, otherwise Lustre still
891 # remembers lock contention
892 lctl set_param -n $OSC.*.contention_seconds=0
893 clear_stats $OSC.*.${OSC}_stats
895 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > \
897 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > \
900 [ $(calc_stats $OSC.*.${OSC}_stats lockless_write_bytes) -eq 0 ] ||
901 error "lockless i/o works when disabled"
903 restore_lustre_params <$p
906 run_test 32b "lockless i/o"
910 local mdts=$(get_facets MDS)
915 for mds in ${mdts//,/ }; do
917 dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
918 xargs readlink -f" ))
919 val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
922 stat=$(( stat + val))
927 # commit on sharing tests
929 remote_mds_nodsh && skip "remote MDS with nodsh" && return
931 [ -z "$CLIENTS" ] && skip "Need two or more clients, have $CLIENTS" && return 0
932 [ $CLIENTCOUNT -lt 2 ] &&
933 skip "Need two or more clients, have $CLIENTCOUNT" && return 0
935 local nfiles=${TEST33_NFILES:-10000}
936 local param_file=$TMP/$tfile-params
937 local fstype=$(facet_fstype $SINGLEMDS)
939 save_lustre_params $(get_facets MDS) \
940 "mdt.*.commit_on_sharing" > $param_file
948 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
952 do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
954 [ $fstype = ldiskfs ] && jbdold=$(print_jbd_stat)
955 echo "=== START createmany old: $jbdold transaction"
956 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")
957 [ $fstype = ldiskfs ] && jbdnew=$(print_jbd_stat)
958 [ $fstype = ldiskfs ] && jbd=$(( jbdnew - jbdold ))
959 echo "=== END createmany new: $jbdnew transaction : $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
960 [ $fstype = ldiskfs ] && avgjbd=$(( avgjbd + jbd ))
961 avgtime=$(( avgtime + elapsed ))
963 eval cos${COS}_jbd=$((avgjbd / 3))
964 eval cos${COS}_time=$((avgtime / 3))
967 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
968 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
969 [ "$cos0_jbd" != 0 ] && echo "COS=1 vs COS=0 jbd: $((((cos1_jbd/cos0_jbd - 1)) * 100 )) %"
970 [ "$cos0_time" != 0 ] && echo "COS=1 vs COS=0 time: $((((cos1_time/cos0_time - 1)) * 100 )) %"
972 restore_lustre_params < $param_file
976 run_test 33a "commit on sharing, cross crete/delete, 2 clients, benchmark"
978 # commit on sharing tests
980 remote_mds_nodsh && skip "remote MDS with nodsh" && return
982 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
983 [ $CLIENTCOUNT -ge 2 ] ||
984 { skip "Need two or more clients, have $CLIENTCOUNT" &&
986 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
988 local nfiles=${TEST33_NFILES:-10000}
989 local param_file=$TMP/$tfile-params
991 save_lustre_params $(get_facets MDS) \
992 "mdt.*.commit_on_sharing" > $param_file
1001 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
1005 do_node $CLIENT1 "$LFS mkdir -i $MDTIDX \
1006 $DIR1/$tdir-\\\$(hostname)-$i"
1008 jbdold=$(print_jbd_stat)
1009 echo "=== START createmany old: $jbdold transaction"
1010 local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2\
1011 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- \
1012 -r$DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > \
1014 jbdnew=$(print_jbd_stat)
1015 jbd=$(( jbdnew - jbdold ))
1016 echo "=== END createmany new: $jbdnew transaction : \
1017 $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
1018 avgjbd=$(( avgjbd + jbd ))
1019 avgtime=$(( avgtime + elapsed ))
1021 eval cos${COS}_jbd=$((avgjbd / 3))
1022 eval cos${COS}_time=$((avgtime / 3))
1025 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
1026 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
1027 [ "$cos0_jbd" != 0 ] &&
1028 echo "COS=1 vs COS=0 jbd: $(((cos1_jbd/cos0_jbd - 1) * 100)) %"
1029 [ "$cos0_time" != 0 ] &&
1030 echo "COS=1 vs COS=0 time: $(((cos1_time/cos0_time - 1) * 100)) %"
1032 restore_lustre_params < $param_file
1036 run_test 33b "COS: cross create/delete, 2 clients, benchmark under remote dir"
1039 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1040 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
1041 skip "DNE CoS not supported" && return
1047 do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
1048 # do twice in case transaction is committed before unlock, see LU-8200
1050 # remote dir is created on MDT1, which enqueued lock of $tdir on
1052 $LFS mkdir -i 1 $DIR/$tdir/remote.$i
1053 mkdir $DIR/$tdir/local.$i
1055 sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count")
1056 echo "sync_count $sync_count"
1057 [ $sync_count -eq 0 ] && error "Sync-Lock-Cancel not triggered"
1060 do_facet mds1 "lctl set_param -n mdt.*.sync_count=0"
1061 $LFS mkdir -i 1 $DIR/$tdir/remote.3
1062 # during sleep remote mkdir should have been committed and canceled
1063 # remote lock spontaneously, which shouldn't trigger sync
1065 mkdir $DIR/$tdir/local.3
1066 sync_count=$(do_facet mds1 "lctl get_param -n mdt.*MDT0000.sync_count")
1067 echo "sync_count $sync_count"
1068 [ $sync_count -eq 0 ] || error "Sync-Lock-Cancel triggered"
1070 run_test 33c "Cancel cross-MDT lock should trigger Sync-Lock-Cancel"
1072 # arg1 is operations done before CoS, arg2 is the operation that triggers CoS
1076 local nodes=$(comma_list $(mdts_nodes))
1080 # trigger CoS twice in case transaction commit before unlock
1083 do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
1085 commit_nr=$(do_nodes $nodes \
1086 "lctl get_param -n mdt.*.async_commit_count" | calc_sum)
1087 total=$((total + commit_nr));
1092 echo "CoS count $total"
1093 [ $total -gt 0 ] || error "$2 didn't trigger CoS"
1097 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1098 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
1099 skip "DNE CoS not supported" && return
1101 # remote directory create
1102 op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -i 1 $DIR/$tdir/subdir"
1103 # remote directory unlink
1104 op_trigger_cos "$LFS mkdir -i 1 $DIR/$tdir" "rmdir $DIR/$tdir"
1105 # striped directory create
1106 op_trigger_cos "mkdir $DIR/$tdir" "$LFS mkdir -c 2 $DIR/$tdir/subdir"
1107 # striped directory setattr
1108 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; touch $DIR/$tdir" \
1109 "chmod 713 $DIR/$tdir"
1110 # striped directory unlink
1111 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; touch $DIR/$tdir" \
1114 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; \
1115 $LFS mkdir -i 0 $DIR/$tdir/d1; \
1116 $LFS mkdir -i 1 $DIR/$tdir/d2; \
1117 touch $DIR/$tdir/d1/tgt" \
1118 "ln $DIR/$tdir/d1/tgt $DIR/$tdir/d2/src"
1120 op_trigger_cos "$LFS mkdir -c 2 $DIR/$tdir; \
1121 $LFS mkdir -i 0 $DIR/$tdir/d1; \
1122 $LFS mkdir -i 1 $DIR/$tdir/d2; \
1123 touch $DIR/$tdir/d1/src" \
1124 "mv $DIR/$tdir/d1/src $DIR/$tdir/d2/tgt"
1126 op_trigger_cos "$LFS mkdir -i 0 $DIR/$tdir" \
1127 "$LFS migrate -m 1 $DIR/$tdir"
1131 run_test 33d "DNE distributed operation should trigger COS"
1134 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
1135 [ $CLIENTCOUNT -ge 2 ] ||
1136 { skip "Need two or more clients, have $CLIENTCOUNT" &&
1138 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1139 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.63) ] &&
1140 skip "DNE CoS not supported" && return
1142 local client2=${CLIENT2:-$(hostname)}
1146 local nodes=$(comma_list $(mdts_nodes))
1147 do_nodes $nodes "lctl set_param -n mdt.*.async_commit_count=0"
1149 $LFS mkdir -c 2 $DIR/$tdir
1150 mkdir $DIR/$tdir/subdir
1151 echo abc > $DIR/$tdir/$tfile
1152 do_node $client2 echo dfg >> $DIR/$tdir/$tfile
1153 do_node $client2 touch $DIR/$tdir/subdir
1155 local async_commit_count=$(do_nodes $nodes \
1156 "lctl get_param -n mdt.*.async_commit_count" | calc_sum)
1157 [ $async_commit_count -gt 0 ] && error "CoS triggerred"
1161 run_test 33e "DNE local operation shouldn't trigger COS"
1163 # End commit on sharing tests
1165 get_ost_lock_timeouts() {
1166 local nodes=${1:-$(comma_list $(osts_nodes))}
1168 local locks=$(do_nodes $nodes \
1169 "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
1177 do_nodes $(comma_list $(osts_nodes)) \
1178 "lctl set_param -n fail_loc=0 2>/dev/null || true"
1179 for i in $(seq $OSTCOUNT); do
1180 wait_osc_import_ready client ost$i
1185 remote_ost_nodsh && skip "remote OST with nodsh" && return
1189 trap cleanup_34 EXIT RETURN
1190 for OPER in notimeout timeout ; do
1191 rm $DIR1/$tfile 2>/dev/null
1192 lock_in=$(get_ost_lock_timeouts)
1193 if [ $OPER == "timeout" ] ; then
1194 for j in `seq $OSTCOUNT`; do
1195 #define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT 0x511
1196 do_facet ost$j lctl set_param fail_loc=0x511
1198 echo lock should expire
1200 for j in `seq $OSTCOUNT`; do
1201 #define OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT 0x512
1202 do_facet ost$j lctl set_param fail_loc=0x512
1204 echo lock should not expire
1206 echo writing on client1
1207 dd if=/dev/zero of=$DIR1/$tfile count=100 conv=notrunc > /dev/null 2>&1
1209 echo reading on client2
1210 dd of=/dev/null if=$DIR2/$tfile > /dev/null 2>&1
1211 # wait for a lock timeout
1213 lock_out=$(get_ost_lock_timeouts)
1214 if [ $OPER == "timeout" ] ; then
1215 if [ $lock_in == $lock_out ]; then
1216 error "no lock timeout happened"
1221 if [ $lock_in != $lock_out ]; then
1222 error "lock timeout happened"
1230 run_test 34 "no lock timeout under IO"
1232 test_35() { # bug 17645
1235 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1236 awk '/generation/{print $2}')
1238 generation[count]=$g
1242 test_mkdir $MOUNT1/$tdir
1243 cancel_lru_locks mdc
1245 # Let's initiate -EINTR situation by setting fail_loc and take
1246 # write lock on same file from same client. This will not cause
1247 # bl_ast yet as lock is already in local cache.
1248 #define OBD_FAIL_LDLM_INTR_CP_AST 0x317
1249 do_facet client "lctl set_param fail_loc=0x80000317"
1250 local timeout=$(do_facet $SINGLEMDS lctl get_param -n timeout)
1251 let timeout=timeout*3
1253 while test $nr -lt 10; do
1254 log "Race attempt $nr"
1255 local blk1=$(lctl get_param -n ldlm.services.ldlm_cbd.stats |
1256 awk '/ldlm_bl_callback/ { print $2 }')
1257 test "x$blk1" = "x" && blk1=0
1258 createmany -o $MOUNT2/$tdir/a 4000 &
1262 # Let's make conflict and bl_ast
1263 ls -la $MOUNT1/$tdir > /dev/null &
1266 log "Wait for $pid1 $pid2 for $timeout sec..."
1268 kill -9 $pid1 $pid2 > /dev/null 2>&1
1270 local blk2=$(lctl get_param -n ldlm.services.ldlm_cbd.stats |
1271 awk '/ldlm_bl_callback/ { print $2 }')
1272 test "x$blk2" = "x" && blk2=0
1273 test $blk2 -gt $blk1 && break
1274 rm -fr $MOUNT1/$tdir
1275 cancel_lru_locks mdc
1278 do_facet client "lctl set_param fail_loc=0x0"
1279 df -h $MOUNT1 $MOUNT2
1281 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1282 awk '/generation/{print $2}')
1284 if ! test "$g" -eq "${generation[count]}"; then
1285 list=$(lctl list_param mdc.$FSNAME-MDT*-mdc-*.import)
1287 for imp in $list; do
1288 if [ $c = $count ]; then
1293 imp=$(echo "$imp" | awk -F"." '{print $2}')
1294 error "Eviction happened on import $imp"
1299 run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
1301 test_36() { #bug 16417
1306 test_mkdir $DIR1/$tdir
1307 $LFS setstripe -c -1 $DIR1/$tdir
1310 let SIZE_B=SIZE*1024*1024
1311 sync; sleep 2; sync # wait for delete thread
1312 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1313 wait_destroy_complete || error "wait_destroy_complete failed"
1315 while [ $i -le 10 ]; do
1316 lctl mark "start test - cycle ($i)"
1317 local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1318 dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
1319 error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
1320 sync # sync data from client cache
1321 sync_all_data # sync data from server cache (delayed allocation)
1323 local after_dd=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1324 multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
1326 rm -f $DIR1/$tdir/$tfile
1327 kill -USR1 $read_pid
1329 sync; sleep 2; sync # Ensure new statfs
1330 wait_delete_completed
1331 local after=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1332 echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
1334 # this free space! not used
1335 (( $after_dd <= $after)) ||
1336 error "space leaked after_dd:$after_dd > after:$after"
1340 run_test 36 "handle ESTALE/open-unlink correctly"
1342 test_37() { # bug 18695
1343 test_mkdir $DIR1/$tdir
1344 multiop_bg_pause $DIR1/$tdir D_c || return 1
1346 # create large directory (32kB seems enough from e2fsck, ~= 1000 files)
1347 createmany -m $DIR2/$tdir/f 10000
1348 # set mtime/atime backward
1349 touch -t 198001010000 $DIR2/$tdir
1350 kill -USR1 $MULTIPID
1351 nr_files=`lfs find $DIR1/$tdir -type f | wc -l`
1352 [ $nr_files -eq 10000 ] || error "$nr_files != 10000 truncated directory?"
1355 run_test 37 "check i_size is not updated for directory on close (bug 18695) =============="
1357 # this should be set to past
1358 TEST_39_MTIME=`date -d "1 year ago" +%s`
1362 local client1=${CLIENT1:-`hostname`}
1363 local client2=${CLIENT2:-`hostname`}
1365 do_node $client1 "touch $DIR1/$tfile"
1367 do_node $client1 "touch -m -d @$TEST_39_MTIME $DIR1/$tfile"
1368 local mtime1=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1369 [ "$mtime1" = $TEST_39_MTIME ] || \
1370 error "mtime is not set to past: $mtime1, should be $TEST_39_MTIME"
1372 local d1=`do_node $client1 date +%s`
1373 do_node $client1 'echo hello >> '$DIR1/$tfile
1374 local d2=`do_node $client1 date +%s`
1376 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1377 [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] || \
1378 error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
1380 do_node $client1 "mv $DIR1/$tfile $DIR1/$tfile-1"
1382 for (( i=0; i < 2; i++ )) ; do
1383 local mtime3=`do_node $client2 "stat -c %Y $DIR1/$tfile-1"`
1384 [ "$mtime2" = "$mtime3" ] || \
1385 error "mtime ($mtime2) changed (to $mtime3) on rename"
1387 cancel_lru_locks osc
1388 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1391 run_test 39a "test from 11063 =================================="
1394 local client1=${CLIENT1:-`hostname`}
1395 local client2=${CLIENT2:-`hostname`}
1399 local mtime1=`stat -c %Y $DIR1/$tfile`
1400 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1403 touch -m -d @$TEST_39_MTIME $DIR1/$tfile
1405 for (( i=0; i < 2; i++ )) ; do
1406 local mtime3=`stat -c %Y $DIR1/$tfile`
1407 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1409 [ "$mtime3" = "$mtime4" ] || \
1410 error "different mtime on clients: $mtime3, $mtime4"
1411 [ "$mtime3" = $TEST_39_MTIME ] || \
1412 error "lost mtime: $mtime3, should be $TEST_39_MTIME"
1414 cancel_lru_locks osc
1415 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1418 run_test 39b "11063 problem 1 =================================="
1421 local client1=${CLIENT1:-`hostname`}
1422 local client2=${CLIENT2:-`hostname`}
1424 echo hello > $DIR1/$tfile
1426 local mtime1=`stat -c %Y $DIR1/$tfile`
1427 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1428 [ "$mtime1" = "$mtime2" ] || \
1429 error "create: different mtime on clients: $mtime1, $mtime2"
1432 $TRUNCATE $DIR1/$tfile 1
1434 for (( i=0; i < 2; i++ )) ; do
1435 local mtime3=`stat -c %Y $DIR1/$tfile`
1436 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1438 [ "$mtime3" = "$mtime4" ] || \
1439 error "different mtime on clients: $mtime3, $mtime4"
1440 [ "$mtime3" -gt $mtime2 ] || \
1441 error "truncate did not update mtime: $mtime2, $mtime3"
1443 cancel_lru_locks osc
1444 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1447 run_test 39c "check truncate mtime update ======================"
1449 test_39d() { # LU-7310
1451 touch -m -d @$TEST_39_MTIME $DIR1/$tfile
1453 local mtime1=$(stat -c %Y $DIR2/$tfile)
1454 [ "$mtime1" = $TEST_39_MTIME ] ||
1455 error "mtime: $mtime1, should be $TEST_39_MTIME"
1458 # define OBD_FAIL_OSC_NO_GRANT 0x411
1459 $LCTL set_param fail_loc=0x411
1461 local d1=$(date +%s)
1462 echo hello >> $DIR1/$tfile
1463 local d2=$(date +%s)
1465 $LCTL set_param fail_loc=0
1467 cancel_lru_locks $OSC
1469 local mtime2=$(stat -c %Y $DIR2/$tfile)
1470 [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] ||
1471 error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
1473 run_test 39d "sync write should update mtime"
1475 # check that pid exists hence second operation wasn't blocked by first one
1476 # if it is so then there is no conflict, return 0
1477 # else second operation is conflicting with first one, return 1
1478 check_pdo_conflict() {
1481 sleep 1 # to ensure OP1 is finished on client if OP2 is blocked by OP1
1482 if [[ `ps --pid $pid | wc -l` == 1 ]]; then
1492 # test 40: check non-blocking operations
1494 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1495 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1496 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1498 mkdir $DIR1/$tfile &
1501 touch $DIR2/$tfile-2
1502 check_pdo_conflict $PID1 || error "create is blocked"
1503 mkdir $DIR2/$tfile-3
1504 check_pdo_conflict $PID1 || error "mkdir is blocked"
1505 link $DIR2/$tfile-2 $DIR2/$tfile-4
1506 check_pdo_conflict $PID1 || error "link is blocked"
1507 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1508 check_pdo_conflict $PID1 || error "rename is blocked"
1509 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1510 check_pdo_conflict $PID1 || error "getattr is blocked"
1511 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1512 rmdir $DIR2/$tfile-3
1513 check_pdo_conflict $PID1 || error "unlink is blocked"
1515 # all operations above shouldn't wait the first one
1516 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1521 run_test 40a "pdirops: create vs others =============="
1524 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1525 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1526 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1527 touch $DIR1/$tfile &
1531 touch $DIR2/$tfile-2
1532 check_pdo_conflict $PID1 || error "create is blocked"
1533 mkdir $DIR2/$tfile-3
1534 check_pdo_conflict $PID1 || error "mkdir is blocked"
1535 link $DIR2/$tfile-2 $DIR2/$tfile-4
1536 check_pdo_conflict $PID1 || error "link is blocked"
1537 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1538 check_pdo_conflict $PID1 || error "rename is blocked"
1539 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1540 check_pdo_conflict $PID1 || error "getattr is blocked"
1541 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1542 rmdir $DIR2/$tfile-3
1543 check_pdo_conflict $PID1 || error "unlink is blocked"
1544 # all operations above shouldn't wait the first one
1546 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1551 run_test 40b "pdirops: open|create and others =============="
1554 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1556 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1557 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1558 link $DIR1/$tfile $DIR1/$tfile-0 &
1562 touch $DIR2/$tfile-2
1563 check_pdo_conflict $PID1 || error "create is blocked"
1564 mkdir $DIR2/$tfile-3
1565 check_pdo_conflict $PID1 || error "mkdir is blocked"
1566 link $DIR2/$tfile-2 $DIR2/$tfile-4
1567 check_pdo_conflict $PID1 || error "link is blocked"
1568 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1569 check_pdo_conflict $PID1 || error "rename is blocked"
1570 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1571 check_pdo_conflict $PID1 || error "getattr is blocked"
1572 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1573 rmdir $DIR2/$tfile-3
1574 check_pdo_conflict $PID1 || error "unlink is blocked"
1576 # all operations above shouldn't wait the first one
1577 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1582 run_test 40c "pdirops: link and others =============="
1585 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1587 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1588 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1593 touch $DIR2/$tfile-2
1594 check_pdo_conflict $PID1 || error "create is blocked"
1595 mkdir $DIR2/$tfile-3
1596 check_pdo_conflict $PID1 || error "mkdir is blocked"
1597 link $DIR2/$tfile-2 $DIR2/$tfile-4
1598 check_pdo_conflict $PID1 || error "link is blocked"
1599 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1600 check_pdo_conflict $PID1 || error "rename is blocked"
1601 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1602 check_pdo_conflict $PID1 || error "getattr is blocked"
1603 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1604 rmdir $DIR2/$tfile-3
1605 check_pdo_conflict $PID1 || error "unlink is blocked"
1607 # all operations above shouldn't wait the first one
1608 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1612 run_test 40d "pdirops: unlink and others =============="
1615 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1617 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1618 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1619 mv $DIR1/$tfile $DIR1/$tfile-0 &
1623 touch $DIR2/$tfile-2
1624 check_pdo_conflict $PID1 || error "create is blocked"
1625 mkdir $DIR2/$tfile-3
1626 check_pdo_conflict $PID1 || error "mkdir is blocked"
1627 link $DIR2/$tfile-2 $DIR2/$tfile-4
1628 check_pdo_conflict $PID1 || error "link is blocked"
1629 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1630 check_pdo_conflict $PID1 || error "getattr is blocked"
1631 rm $DIR2/$tfile-4 $DIR2/$tfile-2
1632 rmdir $DIR2/$tfile-3
1633 check_pdo_conflict $PID1 || error "unlink is blocked"
1635 # all operations above shouldn't wait the first one
1636 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1641 run_test 40e "pdirops: rename and others =============="
1643 # test 41: create blocking operations
1645 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1646 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1647 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1650 mkdir $DIR2/$tfile && error "mkdir must fail"
1651 check_pdo_conflict $PID1 && { wait $PID1; echo "mkdir isn't blocked"; }
1655 run_test 41a "pdirops: create vs mkdir =============="
1658 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1659 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1660 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1663 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1664 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1668 run_test 41b "pdirops: create vs create =============="
1671 touch $DIR1/$tfile-2
1672 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1673 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1674 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1677 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1678 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1682 run_test 41c "pdirops: create vs link =============="
1685 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1686 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1687 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1690 rm $DIR2/$tfile || error "unlink must succeed"
1691 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1695 run_test 41d "pdirops: create vs unlink =============="
1698 touch $DIR1/$tfile-2
1699 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1700 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1701 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1704 mv $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1705 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1709 run_test 41e "pdirops: create and rename (tgt) =============="
1712 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1713 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1714 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1717 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1718 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1722 run_test 41f "pdirops: create and rename (src) =============="
1725 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1726 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1727 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1730 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1731 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1735 run_test 41g "pdirops: create vs getattr =============="
1738 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1739 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1740 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1743 ls -lia $DIR2/ > /dev/null
1744 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1748 run_test 41h "pdirops: create vs readdir =============="
1750 # test 42: unlink and blocking operations
1752 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1753 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1754 mkdir $DIR1/$tfile &
1757 mkdir $DIR2/$tfile && error "mkdir must fail"
1758 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1762 run_test 42a "pdirops: mkdir vs mkdir =============="
1765 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1766 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1767 mkdir $DIR1/$tfile &
1770 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1771 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1775 run_test 42b "pdirops: mkdir vs create =============="
1778 touch $DIR1/$tfile-2
1779 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1780 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1781 mkdir $DIR1/$tfile &
1784 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1785 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1789 run_test 42c "pdirops: mkdir vs link =============="
1792 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1793 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1794 mkdir $DIR1/$tfile &
1797 rmdir $DIR2/$tfile || error "unlink must succeed"
1798 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1802 run_test 42d "pdirops: mkdir vs unlink =============="
1805 touch $DIR1/$tfile-2
1806 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1807 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1808 mkdir $DIR1/$tfile &
1811 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
1812 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1816 run_test 42e "pdirops: mkdir and rename (tgt) =============="
1819 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1820 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1821 mkdir $DIR1/$tfile &
1824 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1825 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1829 run_test 42f "pdirops: mkdir and rename (src) =============="
1832 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1833 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1834 mkdir $DIR1/$tfile &
1837 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1838 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1842 run_test 42g "pdirops: mkdir vs getattr =============="
1845 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1846 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1847 mkdir $DIR1/$tfile &
1850 ls -lia $DIR2/ > /dev/null
1851 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1855 run_test 42h "pdirops: mkdir vs readdir =============="
1857 # test 43: unlink and blocking operations
1860 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1861 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1865 mkdir $DIR2/$tfile || error "mkdir must succeed"
1866 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1870 run_test 43a "pdirops: unlink vs mkdir =============="
1874 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1875 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1879 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
1880 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1884 run_test 43b "pdirops: unlink vs create =============="
1888 touch $DIR1/$tfile-2
1889 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1890 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1894 link $DIR2/$tfile-2 $DIR2/$tfile || error "link must succeed"
1895 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1899 run_test 43c "pdirops: unlink vs link =============="
1903 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1904 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1908 rm $DIR2/$tfile && error "unlink must fail"
1909 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1913 run_test 43d "pdirops: unlink vs unlink =============="
1917 touch $DIR1/$tfile-2
1918 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1919 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1923 mv -u $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1924 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1928 run_test 43e "pdirops: unlink and rename (tgt) =============="
1932 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1933 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1937 mv $DIR2/$tfile $DIR2/$tfile-2 && error "rename must fail"
1938 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1942 run_test 43f "pdirops: unlink and rename (src) =============="
1946 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1947 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1951 stat $DIR2/$tfile > /dev/null && error "stat must fail"
1952 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1956 run_test 43g "pdirops: unlink vs getattr =============="
1960 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1961 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1965 ls -lia $DIR2/ > /dev/null
1966 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1970 run_test 43h "pdirops: unlink vs readdir =============="
1973 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1975 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1976 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1980 $LFS mkdir -i 1 $DIR2/$tfile || error "remote mkdir must succeed"
1981 check_pdo_conflict $PID1 &&
1982 { wait $PID1; error "remote mkdir isn't blocked"; }
1986 run_test 43i "pdirops: unlink vs remote mkdir"
1988 # test 44: rename tgt and blocking operations
1990 touch $DIR1/$tfile-2
1991 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1992 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1993 mv $DIR1/$tfile-2 $DIR1/$tfile &
1996 mkdir $DIR2/$tfile && error "mkdir must fail"
1997 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2001 run_test 44a "pdirops: rename tgt vs mkdir =============="
2004 touch $DIR1/$tfile-2
2005 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2006 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2007 mv $DIR1/$tfile-2 $DIR1/$tfile &
2010 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2011 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2015 run_test 44b "pdirops: rename tgt vs create =============="
2018 touch $DIR1/$tfile-2
2019 touch $DIR1/$tfile-3
2020 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2021 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2022 mv $DIR1/$tfile-2 $DIR1/$tfile &
2025 link $DIR2/$tfile-3 $DIR2/$tfile && error "link must fail"
2026 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2030 run_test 44c "pdirops: rename tgt vs link =============="
2033 touch $DIR1/$tfile-2
2034 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2035 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2036 mv $DIR1/$tfile-2 $DIR1/$tfile &
2039 rm $DIR2/$tfile || error "unlink must succeed"
2040 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2044 run_test 44d "pdirops: rename tgt vs unlink =============="
2048 touch $DIR1/$tfile-2
2049 touch $DIR1/$tfile-3
2050 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2051 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2052 mv $DIR1/$tfile-2 $DIR1/$tfile &
2055 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2056 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2060 run_test 44e "pdirops: rename tgt and rename (tgt) =============="
2063 touch $DIR1/$tfile-2
2064 touch $DIR1/$tfile-3
2065 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2066 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2067 mv $DIR1/$tfile-2 $DIR1/$tfile &
2070 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
2071 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2075 run_test 44f "pdirops: rename tgt and rename (src) =============="
2078 touch $DIR1/$tfile-2
2079 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2080 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2081 mv $DIR1/$tfile-2 $DIR1/$tfile &
2084 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2085 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2089 run_test 44g "pdirops: rename tgt vs getattr =============="
2092 touch $DIR1/$tfile-2
2093 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2094 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2095 mv $DIR1/$tfile-2 $DIR1/$tfile &
2098 ls -lia $DIR2/ > /dev/null
2099 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
2103 run_test 44h "pdirops: rename tgt vs readdir =============="
2105 # test 44: rename tgt and blocking operations
2107 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2108 touch $DIR1/$tfile-2
2109 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
2110 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
2111 mv $DIR1/$tfile-2 $DIR1/$tfile &
2114 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
2115 check_pdo_conflict $PID1 && { wait $PID1;
2116 error "remote mkdir isn't blocked"; }
2120 run_test 44i "pdirops: rename tgt vs remote mkdir"
2122 # test 45: rename src and blocking operations
2125 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2126 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2127 mv $DIR1/$tfile $DIR1/$tfile-2 &
2130 mkdir $DIR2/$tfile || error "mkdir must succeed"
2131 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2135 run_test 45a "pdirops: rename src vs mkdir =============="
2139 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2140 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2141 mv $DIR1/$tfile $DIR1/$tfile-2 &
2144 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
2145 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2149 run_test 45b "pdirops: rename src vs create =============="
2153 touch $DIR1/$tfile-3
2154 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2155 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2156 mv $DIR1/$tfile $DIR1/$tfile-2 &
2159 link $DIR2/$tfile-3 $DIR2/$tfile || error "link must succeed"
2160 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2164 run_test 45c "pdirops: rename src vs link =============="
2168 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2169 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2170 mv $DIR1/$tfile $DIR1/$tfile-2 &
2173 rm $DIR2/$tfile && error "unlink must fail"
2174 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2178 run_test 45d "pdirops: rename src vs unlink =============="
2182 touch $DIR1/$tfile-3
2183 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2184 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2185 mv $DIR1/$tfile $DIR1/$tfile-2 &
2188 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2189 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2193 run_test 45e "pdirops: rename src and rename (tgt) =============="
2197 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2198 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2199 mv $DIR1/$tfile $DIR1/$tfile-2 &
2202 mv $DIR2/$tfile $DIR2/$tfile-3 && error "rename must fail"
2203 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2207 run_test 45f "pdirops: rename src and rename (src) =============="
2211 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2212 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2213 mv $DIR1/$tfile $DIR1/$tfile-2 &
2216 stat $DIR2/$tfile > /dev/null && error "stat must fail"
2217 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2221 run_test 45g "pdirops: rename src vs getattr =============="
2225 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2226 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2227 mv $DIR1/$tfile $DIR1/$tfile-2 &
2230 ls -lia $DIR2/ > /dev/null
2231 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
2235 run_test 45h "pdirops: unlink vs readdir =============="
2238 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2240 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2241 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2242 mv $DIR1/$tfile $DIR1/$tfile-2 &
2245 $LFS mkdir -i 1 $DIR2/$tfile || error "create remote dir must succeed"
2246 check_pdo_conflict $PID1 && { wait $PID1;
2247 error "create remote dir isn't blocked"; }
2251 run_test 45i "pdirops: rename src vs remote mkdir"
2253 # test 46: link and blocking operations
2255 touch $DIR1/$tfile-2
2256 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2257 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2258 link $DIR1/$tfile-2 $DIR1/$tfile &
2261 mkdir $DIR2/$tfile && error "mkdir must fail"
2262 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2266 run_test 46a "pdirops: link vs mkdir =============="
2269 touch $DIR1/$tfile-2
2270 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2271 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2272 link $DIR1/$tfile-2 $DIR1/$tfile &
2275 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2276 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2280 run_test 46b "pdirops: link vs create =============="
2283 touch $DIR1/$tfile-2
2284 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2285 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2286 link $DIR1/$tfile-2 $DIR1/$tfile &
2289 link $DIR2/$tfile $DIR2/$tfile && error "link must fail"
2290 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2294 run_test 46c "pdirops: link vs link =============="
2297 touch $DIR1/$tfile-2
2298 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2299 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2300 link $DIR1/$tfile-2 $DIR1/$tfile &
2303 rm $DIR2/$tfile || error "unlink must succeed"
2304 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2308 run_test 46d "pdirops: link vs unlink =============="
2311 touch $DIR1/$tfile-2
2312 touch $DIR1/$tfile-3
2313 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2314 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2315 link $DIR1/$tfile-2 $DIR1/$tfile &
2318 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2319 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2323 run_test 46e "pdirops: link and rename (tgt) =============="
2326 touch $DIR1/$tfile-2
2327 touch $DIR1/$tfile-3
2328 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2329 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2330 link $DIR1/$tfile-2 $DIR1/$tfile &
2333 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
2334 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2338 run_test 46f "pdirops: link and rename (src) =============="
2341 touch $DIR1/$tfile-2
2342 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2343 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2344 link $DIR1/$tfile-2 $DIR1/$tfile &
2347 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2348 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2352 run_test 46g "pdirops: link vs getattr =============="
2355 touch $DIR1/$tfile-2
2356 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2357 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2358 link $DIR1/$tfile-2 $DIR1/$tfile &
2361 ls -lia $DIR2/ > /dev/null
2362 check_pdo_conflict $PID1 && { wait $PID1;
2363 error "readdir isn't blocked"; }
2367 run_test 46h "pdirops: link vs readdir =============="
2370 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2371 touch $DIR1/$tfile-2
2372 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2373 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2374 link $DIR1/$tfile-2 $DIR1/$tfile &
2377 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
2378 check_pdo_conflict $PID1 && { wait $PID1;
2379 error "remote mkdir isn't blocked"; }
2383 run_test 46i "pdirops: link vs remote mkdir"
2385 # test 47: remote mkdir and blocking operations
2387 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2388 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2389 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2390 $LFS mkdir -i 1 $DIR1/$tfile &
2393 mkdir $DIR2/$tfile && error "mkdir must fail"
2394 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2398 run_test 47a "pdirops: remote mkdir vs mkdir"
2401 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2402 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2403 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2404 $LFS mkdir -i 1 $DIR1/$tfile &
2407 multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2408 check_pdo_conflict $PID1 && { wait $PID1;
2409 error "create isn't blocked"; }
2413 run_test 47b "pdirops: remote mkdir vs create"
2416 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2417 touch $DIR1/$tfile-2
2418 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2419 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2420 $LFS mkdir -i 1 $DIR1/$tfile &
2423 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
2424 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2428 run_test 47c "pdirops: remote mkdir vs link"
2431 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2432 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2433 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2434 $LFS mkdir -i 1 $DIR1/$tfile &
2437 rmdir $DIR2/$tfile || error "unlink must succeed"
2438 check_pdo_conflict $PID1 && { wait $PID1;
2439 error "unlink isn't blocked"; }
2443 run_test 47d "pdirops: remote mkdir vs unlink"
2446 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2447 touch $DIR1/$tfile-2
2448 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2449 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2450 $LFS mkdir -i 1 $DIR1/$tfile &
2453 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
2454 check_pdo_conflict $PID1 && { wait $PID1;
2455 error "rename isn't blocked"; }
2459 run_test 47e "pdirops: remote mkdir and rename (tgt)"
2462 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2463 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2464 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2465 $LFS mkdir -i 1 $DIR1/$tfile &
2468 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
2469 check_pdo_conflict $PID1 && { wait $PID1;
2470 error "rename isn't blocked"; }
2474 run_test 47f "pdirops: remote mkdir and rename (src)"
2477 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2480 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2481 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2482 $LFS mkdir -i 1 $DIR1/$tfile &
2485 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2486 check_pdo_conflict $PID1 && { wait $PID1;
2487 error "getattr isn't blocked"; }
2491 run_test 47g "pdirops: remote mkdir vs getattr"
2495 dd if=/dev/zero of=$DIR1/$tfile bs=1K count=10
2496 #define OBD_FAIL_OSC_CP_ENQ_RACE 0x410
2497 do_facet client "lctl set_param fail_loc=0x410"
2498 $TRUNCATE $DIR2/$tfile $trunc_size
2499 do_facet client "lctl set_param fail_loc=0x0"
2501 size=`stat -c %s $DIR2/$tfile`
2502 [ $size -eq $trunc_size ] || error "wrong size"
2504 run_test 50 "osc lvb attrs: enqueue vs. CP AST =============="
2508 local origfile=/etc/hosts
2510 filesize=$(stat -c %s $origfile)
2512 # create an empty file
2513 $MCREATE $DIR1/$tfile || error "can't create $DIR1/$tfile"
2514 # cache layout lock on both mount point
2515 stat $DIR1/$tfile > /dev/null || error "stat $DIR1/$tfile failed"
2516 stat $DIR2/$tfile > /dev/null || error "stat $DIR2/$tfile failed"
2518 # open and sleep 2 seconds then read
2519 $MULTIOP $DIR2/$tfile o_2r${filesize}c &
2523 # create the layout of testing file
2524 dd if=$origfile of=$DIR1/$tfile conv=notrunc > /dev/null ||
2525 error "dd $DIR1/$tfile failed"
2527 # MULTIOP proc should be able to read enough bytes and exit
2528 for ((i = 0; i < 6; i++)); do
2530 kill -0 $pid || break
2532 kill -0 $pid 2> /dev/null && error "multiop is still there"
2533 cmp $origfile $DIR2/$tfile || error "$origfile and $DIR2/$tfile differs"
2537 run_test 51a "layout lock: refresh layout should work"
2540 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.59) ]] ||
2541 { skip "Need MDS version at least 2.3.59"; return 0; }
2543 local tmpfile=`mktemp`
2545 # create an empty file
2546 $MCREATE $DIR1/$tfile || error "mcreate $DIR1/$tfile failed"
2548 # delay glimpse so that layout has changed when glimpse finish
2549 #define OBD_FAIL_GLIMPSE_DELAY 0x1404
2550 $LCTL set_param fail_loc=0x1404
2551 stat -c %s $DIR2/$tfile |tee $tmpfile &
2555 # create layout of testing file
2556 dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc >/dev/null ||
2557 error "dd $DIR1/$tfile failed"
2560 local fsize=$(cat $tmpfile)
2562 [ x$fsize = x1024 ] || error "file size is $fsize, should be 1024"
2564 rm -f $DIR1/$tfile $tmpfile
2566 run_test 51b "layout lock: glimpse should be able to restart if layout changed"
2569 [ $OSTCOUNT -ge 2 ] || { skip "needs >= 2 osts"; return; }
2571 # set default layout to have 1 stripe
2573 $LFS setstripe -c 1 $DIR1/$tdir
2575 # create a file with empty layout
2576 $MCREATE $DIR1/$tdir/$tfile ||
2577 error "$MCREATE $DIR1/$tdir/$tfile failed"
2579 #define OBD_FAIL_MDS_LL_BLOCK 0x172
2580 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x172
2582 # change the layout of testing file
2583 echo "Setting layout to have $OSTCOUNT stripes ..."
2584 $LFS setstripe -c $OSTCOUNT $DIR1/$tdir/$tfile &
2588 # write something to the file, it should be blocked on fetching layout
2589 dd if=/dev/zero of=$DIR2/$tdir/$tfile bs=1k count=1 conv=notrunc
2590 local stripe_count=$($LFS getstripe -c $DIR2/$tdir/$tfile)
2593 # lod_qos.c::min_stripe_count() allows setstripe with a default stripe
2594 # count to succeed with only 3/4 of the number of stripes (rounded up),
2595 # so creating striped files does not fail if an OST is offline or full
2596 [ $stripe_count -ge $((OSTCOUNT - $OSTCOUNT / 4)) ] ||
2597 error "bad layout: getstripe -c $stripe_count < $OSTCOUNT * 3/4"
2601 run_test 51c "layout lock: IT_LAYOUT blocked and correct layout can be returned"
2604 dd if=/dev/zero of=/$DIR1/$tfile bs=1M count=1
2605 cancel_lru_locks mdc
2607 # open should grant LAYOUT lock, mmap and read will install pages
2608 $MULTIOP $DIR1/$tfile oO_RDWR:SMR_Uc &
2612 # rss before revoking
2613 local br=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2614 echo "Before revoking layout lock: $br KB mapped"
2616 # cancel layout lock manually
2617 cancel_lru_locks mdc
2619 # rss after revoking
2620 local ar=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2623 wait $PID || error "wait PID $PID failed"
2625 [ $ar -eq 0 ] || error "rss before: $br, after $ar, some pages remained"
2627 run_test 51d "layout lock: losing layout lock should clean up memory map region"
2631 echo "==> rename vs getattr vs setxattr should not deadlock"
2632 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2634 do_facet mds1 $LCTL set_param fail_loc=$1
2636 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2644 setfattr -n user.attr1 -v value1 $DIR2/d1 || error "(2) setfattr failed"
2645 wait $PID1 || error "(3) mv failed"
2646 wait $PID2 || error "(4) stat failed"
2653 echo "==> rename vs getattr vs open vs getattr should not deadlock"
2654 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2656 do_facet mds1 $LCTL set_param fail_loc=$1
2658 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2666 $MULTIOP $DIR2/d1/d2 Oc &
2670 stat $DIR/d1 || error "(2) stat failed"
2672 wait $PID1 || error "(3) mv failed"
2673 wait $PID2 || error "(4) stat failed"
2674 wait $PID3 && error "(5) multiop failed"
2680 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
2681 save_lustre_params client "llite.*.xattr_cache" > $p
2682 lctl set_param llite.*.xattr_cache 1 ||
2683 { skip "xattr cache is not supported"; return 0; }
2685 #define OBD_FAIL_MDS_RENAME 0x153
2686 #define OBD_FAIL_MDS_RENAME2 0x154
2687 test_54_part1 0x80000153 || error 10
2688 test_54_part1 0x80000154 || error 11
2689 test_54_part2 0x80000153 || error 12
2690 test_54_part2 0x80000154 || error 13
2692 restore_lustre_params < $p
2695 run_test 54 "rename locking"
2698 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2700 #define OBD_FAIL_MDS_RENAME4 0x156
2701 do_facet mds1 $LCTL set_param fail_loc=0x80000156
2703 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2708 wait $PID1 && error "(2) mv succeeded"
2712 run_test 55a "rename vs unlink target dir"
2716 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2718 #define OBD_FAIL_MDS_RENAME4 0x156
2719 do_facet mds1 $LCTL set_param fail_loc=0x80000156
2721 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2726 wait $PID1 && error "(2) mv succeeded"
2730 run_test 55b "rename vs unlink source dir"
2734 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2736 #define OBD_FAIL_MDS_RENAME4 0x156
2737 do_facet mds1 $LCTL set_param fail_loc=0x156
2739 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2743 # while rename is sleeping, open and remove d3
2744 $MULTIOP $DIR2/d3 D_c &
2750 # while rename is sleeping 2nd time, close d3
2752 wait $PID2 || error "(3) multiop failed"
2754 wait $PID1 && error "(2) mv succeeded"
2758 run_test 55c "rename vs unlink orphan target dir"
2764 #define OBD_FAIL_MDS_RENAME3 0x155
2765 do_facet mds1 $LCTL set_param fail_loc=0x155
2766 mv $DIR/f1 $DIR/$tdir &
2770 # while rename is sleeping, create $tdir, but as a directory
2771 mkdir -p $DIR2/$tdir || error "(1) mkdir failed"
2773 # link in reverse locking order
2774 ln $DIR2/f1 $DIR2/$tdir/
2776 wait $PID1 && error "(2) mv succeeded"
2779 run_test 55d "rename file vs link"
2782 local MDSVER=$(lustre_build_version $SINGLEMDS)
2783 [ $(version_code $MDSVER) -lt $(version_code 2.3.0) ] &&
2784 skip "MDS version $MDSVER must be >= 2.3.0" && return 0
2787 test_mkdir $DIR1/$tdir
2788 file1=$DIR1/$tdir/file
2789 file2=$DIR2/$tdir/file
2791 echo orig > $file2 || error "Could not create $file2"
2792 version=$($LFS data_version $file1)
2795 echo append >> $file2 || error "Could not append to $file2"
2796 version2=$($LFS data_version $file1)
2797 [ "$version" != "$version2" ] ||
2798 error "append did not change data version: $version"
2801 echo overwrite > $file2 || error "Could not overwrite $file2"
2802 version3=$($LFS data_version $file1)
2803 [ "$version2" != "$version3" ] ||
2804 error "overwrite did not change data version: $version2"
2806 # Truncate before EOF
2807 $TRUNCATE $file2 3 || error "Could not truncate $file2"
2808 version4=$($LFS data_version $file1)
2809 [ "$version3" != "$version4" ] ||
2810 error "truncate did not change data version: $version3"
2812 # Truncate after EOF
2813 $TRUNCATE $file2 123456 || error "Could not truncate $file2"
2814 version5=$($LFS data_version $file1)
2815 [ "$version4" != "$version5" ] ||
2816 error "truncate did not change data version: $version4"
2818 # Chmod do not change version
2819 chmod 400 $file2 || error "Could not chmod 400 $file2"
2820 version6=$($LFS data_version $file1)
2821 [ "$version5" == "$version6" ] ||
2822 error "chmod should not change data version: $version5 != $version6"
2824 # Chown do not change version
2825 chown $RUNAS_ID $file2 || error "Could not chown $RUNAS_ID $file2"
2826 version7=$($LFS data_version $file1)
2827 [ "$version5" == "$version7" ] ||
2828 error "chown should not change data version: $version5 != $version7"
2830 run_test 60 "Verify data_version behaviour"
2833 local test_dir=$tdir/test_dir
2835 mkdir -p $DIR1/$tdir
2836 if [ $MDSCOUNT -ge 2 ]; then
2838 $LFS mkdir -i $MDTIDX $DIR1/$test_dir ||
2839 error "Create remote directory failed"
2841 mkdir -p $DIR1/$test_dir
2843 cd $DIR2/$test_dir || error "cd directory failed"
2844 rm -rf $DIR1/$test_dir || error "unlink directory failed"
2846 cd $DIR2/$tdir || error "exit directory"
2848 run_test 70a "cd directory && rm directory"
2850 test_70b() { # LU-2781
2852 mkdir -p $DIR1/$tdir
2854 touch $DIR1/$tdir/file
2855 for ((i = 0; i < 32; i++)); do
2856 $LFS rm_entry $DIR1/$tdir/non_existent_dir &>/dev/null
2858 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2860 touch $DIR1/$tdir/file
2861 $LFS mkdir -i0 $DIR1/$tdir/test_dir
2862 $LFS rm_entry $DIR1/$tdir/test_dir &>/dev/null
2863 rm -rf $DIR1/$tdir/test_dir ||
2864 error "cannot remove directory after rm_entry"
2865 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2867 run_test 70b "remove files after calling rm_entry"
2870 local server_version=$(lustre_version_code $SINGLEMDS)
2872 [[ $server_version -lt $(version_code 2.1.6) ]] &&
2873 skip "Need MDS version at least 2.1.6" && return
2875 # Patch not applied to 2.2 and 2.3 branches
2876 [[ $server_version -ge $(version_code 2.2.0) ]] &&
2877 [[ $server_version -lt $(version_code 2.4.0) ]] &&
2878 skip "Need MDS version earlier than 2.2.0 or at least 2.4.0" &&
2881 checkfiemap --test ||
2882 { skip "checkfiemap not runnable: $?" && return; }
2883 # write data this way: hole - data - hole - data
2884 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2885 [ "$(facet_fstype ost$(($($LFS getstripe -i $DIR1/$tfile) + 1)))" = \
2887 skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
2888 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2889 GET_STAT="lctl get_param -n ldlm.services.ldlm_cbd.stats"
2891 local can1=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2893 checkfiemap $DIR2/$tfile 81920 ||
2894 error "data is not flushed from client"
2895 local can2=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2898 # common case of "create file, copy file" on a single node
2899 # should not flush data from ost
2900 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2901 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2903 local can3=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2905 checkfiemap $DIR1/$tfile 81920 ||
2907 local can4=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2909 [ $can3 -eq $can4 ] || error $((can2-can1)) "cancel RPC occured."
2911 run_test 71a "correct file map just after write operation is finished"
2914 local server_version=$(lustre_version_code $SINGLEMDS)
2916 [[ $server_version -lt $(version_code 2.1.6) ]] &&
2917 skip "Need MDS version at least 2.1.6" && return
2919 # Patch not applied to 2.2 and 2.3 branches
2920 [[ $server_version -ge $(version_code 2.2.0) ]] &&
2921 [[ $server_version -lt $(version_code 2.4.0) ]] &&
2922 skip "Need MDS version earlier than 2.2.0 or at least 2.4.0" &&
2924 [[ $OSTCOUNT -ge 2 ]] || { skip "needs >= 2 OSTs"; return; }
2926 checkfiemap --test ||
2927 { skip "error $?: checkfiemap failed" && return; }
2929 mkdir -p $DIR1/$tdir
2931 $LFS setstripe -c -1 $DIR1/$tdir || error "setstripe failed"
2932 dd if=/dev/urandom of=$DIR1/$tdir/$tfile bs=40K count=1
2933 [ "$(facet_fstype ost$(($($LFS getstripe -i $DIR1/$tdir/$tfile) + 1)))" = \
2935 skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
2936 checkfiemap $DIR1/$tdir/$tfile 40960 || error "checkfiemap failed"
2938 run_test 71b "check fiemap support for stripecount > 1"
2941 local p="$TMP/sanityN-$TESTNAME.parameters"
2944 save_lustre_params client "llite.*.xattr_cache" > $p
2945 lctl set_param llite.*.xattr_cache 1 ||
2946 { skip "xattr cache is not supported"; return 0; }
2949 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2950 error "setfattr1 failed"
2951 getfattr -n user.attr1 $DIR2/$tfile | grep value1 ||
2952 error "getfattr1 failed"
2953 setfattr -n user.attr1 -v value2 $DIR2/$tfile ||
2954 error "setfattr2 failed"
2955 getfattr -n user.attr1 $DIR1/$tfile | grep value2 ||
2956 error "getfattr2 failed"
2958 # check that trusted.link is consistent
2959 tlink1=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2960 ln $DIR2/$tfile $DIR2/$tfile-2 || error "failed to link"
2961 tlink2=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2962 echo "$tlink1 $tlink2"
2963 [ "$tlink1" = "$tlink2" ] && error "trusted.link should have changed!"
2967 restore_lustre_params < $p
2970 run_test 72 "getxattr/setxattr cache should be consistent between nodes"
2973 local p="$TMP/sanityN-$TESTNAME.parameters"
2974 save_lustre_params client "llite.*.xattr_cache" > $p
2975 lctl set_param llite.*.xattr_cache 1 ||
2976 { skip "xattr cache is not supported"; return 0; }
2979 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2980 error "setfattr1 failed"
2981 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr1 failed"
2982 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr2 failed"
2983 clear_stats llite.*.stats
2984 # PR lock should be cached by now on both clients
2985 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr3 failed"
2986 # 2 hits for getfattr(0)+getfattr(size)
2987 [ $(calc_stats llite.*.stats getxattr_hits) -eq 2 ] ||
2988 error "not cached in $DIR1"
2989 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr4 failed"
2990 # 4 hits for more getfattr(0)+getfattr(size)
2991 [ $(calc_stats llite.*.stats getxattr_hits) -eq 4 ] ||
2992 error "not cached in $DIR2"
2995 restore_lustre_params < $p
2998 run_test 73 "getxattr should not cause xattr lock cancellation"
3001 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.93) ] &&
3002 skip "Need MDS version at least 2.4.93" && return
3004 dd if=/dev/zero of=$DIR1/$tfile-1 bs=1K count=1
3005 dd if=/dev/zero of=$DIR1/$tfile-2 bs=1K count=1
3006 flocks_test 4 $DIR1/$tfile-1 $DIR2/$tfile-2
3008 run_test 74 "flock deadlock: different mounts =============="
3012 $LFS setstripe -c 2 -S 1m -i 0 $DIR1/$tfile
3013 dd if=/dev/zero of=$DIR1/$tfile bs=1M count=2
3014 cancel_lru_locks osc
3016 dd of=$DIR1/$tfile if=/dev/zero bs=1M count=1 seek=1 conv=notrunc
3019 # define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d
3020 $LCTL set_param fail_loc=0x31d
3021 stat -c %s $DIR1/$tfile &
3026 # For bad lock error handler we should ASSERT and got kernel panic here
3028 $LCTL set_param fail_loc=0
3030 run_test 75 "osc: upcall after unuse lock==================="
3033 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
3034 skip "Need MDS version at least 2.5.53" && return
3036 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3037 local fcount=$((MDSCOUNT * 256))
3042 nid=$($LCTL list_nids | sed "s/\./\\\./g")
3048 test_mkdir $DIR/$tdir
3050 # drop all open locks and close any cached "open" files on the client
3051 cancel_lru_locks mdc
3053 local open_fids_cmd="$LCTL get_param -n mdt.*.exports.'$nid'.open_files"
3054 local fid_list=($(do_nodes $(comma_list $(mdts_nodes)) $open_fids_cmd))
3055 local already=${#fid_list[@]}
3056 for (( i = 0; i < $already; i++ )) ; do
3057 log "already open[$i]: $($LFS fid2path $DIR2 ${fid_list[i]})"
3060 echo -n "opening files: "
3061 ulimit -n $((fcount + 50))
3062 for ((i = 0; i < $fcount; i++)); do
3063 touch $DIR/$tdir/f_$i
3064 local fd=$(free_fd ${fd_list[i]})
3065 local open_cmd="exec $fd<$DIR/$tdir/f_$i"
3070 (( $i % 32 == 0 )) && echo -n "."
3074 fid_list=($(do_nodes $(comma_list $(mdts_nodes)) $open_fids_cmd))
3076 # Possible errors in openfiles FID list.
3077 # 1. Missing FIDs. Check 1
3078 # 2. Extra FIDs. Check 1
3079 # 3. Duplicated FID. Check 2
3080 # 4. Invalid FIDs. Check 2
3081 # 5. Valid FID, points to some other file. Check 3
3084 [ ${#fid_list[@]} -ne $((fcount + already)) ] &&
3085 error "${#fid_list[@]} != $fcount (+$already old) open files"
3087 echo -n "closing files: "
3088 for (( fd = 0, fid = 0; fd < $fcount; fd++, fid++ )) ; do
3089 local close_cmd="exec ${fd_list[fd]}<&-"
3091 filename=$($LFS fid2path $DIR2 ${fid_list[fid]})
3093 while [[ ! "$filename" =~ "$DIR2/$tdir/f_" ]]; do
3094 echo "skip old open file $filename"
3096 filename=$($LFS fid2path $DIR2 ${fid_list[fid]})
3100 rm --interactive=no $filename
3102 error "Nonexisting fid ${fid_list[fid]} listed."
3103 (( $fd % 32 == 0 )) && echo -n "."
3108 ls_op=$(ls $DIR2/$tdir | wc -l)
3110 error "Some openfiles are missing in lproc output"
3114 run_test 76 "Verify MDT open_files listing"
3118 local dir=$DIR/$tdir
3121 mkdir $dir || error "mkdir $dir failed"
3122 $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
3125 do_nodes $CLIENTS $myRUNAS \
3126 dd if=/dev/zero of="$dir/nrs_r_\$HOSTNAME" bs=1M count=$n ||
3127 error "dd at 0 on client failed (1)"
3129 do_nodes $CLIENTS $myRUNAS \
3131 for ((i = 0; i < $n; i++)); do
3132 dd if=/dev/zero of=$dir/nrs_w_\$HOSTNAME bs=1M \
3133 seek=\\\$i count=1 conv=notrunc &
3134 pids_w[\\\$i]=\\\$!;
3137 for ((i = 0; i < $n; i++)); do
3138 wait \\\${pids_w[\\\$i]};
3140 [ \\\$newrc -gt \\\$rc_w ] && rc_w=\\\$newrc;
3144 do_nodes $CLIENTS sync;
3145 cancel_lru_locks osc
3147 do_nodes $CLIENTS $myRUNAS \
3149 for ((i = 0; i < $n; i++)); do
3150 dd if=$dir/nrs_r_\$HOSTNAME bs=1M of=/dev/null \
3151 seek=\\\$i count=1 &
3152 pids_r[\\\$i]=\\\$!;
3155 for ((i = 0; i < $n; i++)); do
3156 wait \\\${pids_r[\\\$i]};
3158 [ \\\$newrc -gt \\\$rc_r ] && rc_r=\\\$newrc;
3162 cancel_lru_locks osc
3164 wait $pid_w || error "dd (write) failed (2)"
3165 wait $pid_r || error "dd (read) failed (3)"
3166 rm -rvf $dir || error "rm -rf $dir failed"
3169 test_77a() { #LU-3266
3172 oss=$(comma_list $(osts_nodes))
3173 do_nodes $oss lctl set_param ost.OSS.*.nrs_policies="fifo" ||
3175 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3176 [[ $rc -ne 0 ]] && error "failed to set fifo policy"
3181 run_test 77a "check FIFO NRS policy"
3183 test_77b() { #LU-3266
3186 oss=$(comma_list $(osts_nodes))
3188 do_nodes $oss lctl set_param ost.OSS.*.nrs_policies="crrn" \
3189 ost.OSS.*.nrs_crrn_quantum=1 || rc=$?
3190 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3191 [[ $rc -ne 0 ]] && error "failed to set crrn_quantum to 1"
3193 echo "policy: crr-n, crrn_quantum 1"
3196 do_nodes $oss lctl set_param \
3197 ost.OSS.*.nrs_crrn_quantum=64 || rc=$?
3198 [[ $rc -ne 0 ]] && error "failed to set crrn_quantum to 64"
3200 echo "policy: crr-n, crrn_quantum 64"
3204 do_nodes $oss lctl set_param \
3205 ost.OSS.ost_io.nrs_policies="fifo" || rc=$?
3206 [[ $rc -ne 0 ]] && error "failed to set fifo policy"
3209 run_test 77b "check CRR-N NRS policy"
3214 oss=$(comma_list $(osts_nodes))
3216 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies=$policy \
3217 ost.OSS.*.nrs_"$policy"_quantum=1 \
3218 ost.OSS.*.nrs_"$policy"_offset_type="physical" \
3219 ost.OSS.*.nrs_"$policy"_supported="reads" || return $?
3221 echo "policy: $policy, ${policy}_quantum 1, ${policy}_offset_type " \
3222 "physical, ${policy}_supported reads"
3225 do_nodes $oss lctl set_param \
3226 ost.OSS.*.nrs_${policy}_supported="writes" \
3227 ost.OSS.*.nrs_${policy}_quantum=64 || return $?
3229 echo "policy: $policy, ${policy}_quantum 64, ${policy}_offset_type " \
3230 "physical, ${policy}_supported writes"
3233 do_nodes $oss lctl set_param \
3234 ost.OSS.*.nrs_${policy}_supported="reads_and_writes" \
3235 ost.OSS.*.nrs_${policy}_offset_type="logical" || return $?
3236 echo "policy: $policy, ${policy}_quantum 64, ${policy}_offset_type " \
3237 "logical, ${policy}_supported reads_and_writes"
3241 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo" ||
3246 test_77c() { #LU-3266
3248 orr_trr "orr" || rc=$?
3249 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3250 [[ $rc -ne 0 ]] && error "orr_trr failed rc:$rc"
3253 run_test 77c "check ORR NRS policy"
3255 test_77d() { #LU-3266
3257 orr_trr "trr" || rc=$?
3258 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3259 [[ $rc -ne 0 ]] && error "orr_trr failed rc:$rc"
3262 run_test 77d "check TRR nrs policy"
3269 do_facet $facet lctl set_param \
3270 ost.OSS.ost_io.nrs_tbf_rule="$*"
3272 error "failed to run operate '$*' on TBF rules"
3275 cleanup_tbf_verify()
3279 echo "cleanup_tbf $DIR/$tdir"
3282 wait_delete_completed
3287 local dir=$DIR/$tdir
3288 local client1=${CLIENT1:-$(hostname)}
3291 local np=$(check_cpt_number ost1)
3292 [ $np -gt 0 ] || error "CPU partitions should not be $np."
3293 echo "cpu_npartitions on ost1 is $np"
3295 mkdir $dir || error "mkdir $dir failed"
3296 $LFS setstripe -c 1 -i 0 $dir || error "setstripe to $dir failed"
3299 trap cleanup_tbf_verify EXIT
3300 echo "Limited write rate: $1, read rate: $2"
3301 echo "Verify the write rate is under TBF control"
3302 local start=$SECONDS
3303 do_node $client1 $myRUNAS dd if=/dev/zero of=$dir/tbf \
3304 bs=1M count=100 oflag=direct 2>&1
3305 local runtime=$((SECONDS - start + 1))
3306 local rate=$(bc <<< "scale=6; 100 / $runtime")
3307 echo "Write runtime is $runtime s, speed is $rate IOPS"
3309 # verify the write rate does not exceed TBF rate limit
3310 [ $(bc <<< "$rate < 1.1 * $np * $1") -eq 1 ] ||
3311 error "The write rate ($rate) exceeds 110% of rate limit ($1 * $np)"
3313 cancel_lru_locks osc
3315 echo "Verify the read rate is under TBF control"
3317 do_node $client1 $myRUNAS dd if=$dir/tbf of=/dev/null \
3318 bs=1M count=100 iflag=direct 2>&1
3319 runtime=$((SECONDS - start + 1))
3320 rate=$(bc <<< "scale=6; 100 / $runtime")
3321 echo "Read runtime is $runtime s, speed is $rate IOPS"
3323 # verify the read rate does not exceed TBF rate limit
3324 [ $(bc <<< "$rate < 1.1 * $np * $2") -eq 1 ] ||
3325 error "The read rate ($rate) exceeds 110% of rate limit ($2 * $np)"
3327 cancel_lru_locks osc
3328 cleanup_tbf_verify || error "rm -rf $dir failed"
3334 oss=$(comma_list $(osts_nodes))
3336 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid" ||
3338 [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
3339 [[ $rc -ne 0 ]] && error "failed to set TBF NID policy"
3343 if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
3348 # Only operate rules on ost1 since OSTs might run on the same OSS
3350 tbf_rule_operate ost1 "start\ localhost\ ${idis}{0@lo}\ ${rateis}1000"
3351 local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
3352 local client_nids=$(nids_list $address "\\")
3353 tbf_rule_operate ost1 "start\ clients\ ${idis}{$client_nids}\ ${rateis}100"
3354 tbf_rule_operate ost1 "start\ others\ ${idis}{*.*.*.*@$NETTYPE}\ ${rateis}50"
3358 tbf_rule_operate ost1 "change\ localhost\ ${rateis}1001"
3359 tbf_rule_operate ost1 "change\ clients\ ${rateis}101"
3360 tbf_rule_operate ost1 "change\ others\ ${rateis}51"
3364 tbf_rule_operate ost1 "stop\ localhost"
3365 tbf_rule_operate ost1 "stop\ clients"
3366 tbf_rule_operate ost1 "stop\ others"
3369 # Cleanup the TBF policy
3370 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3371 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3375 run_test 77e "check TBF NID nrs policy"
3380 oss=$(comma_list $(osts_nodes))
3382 do_nodes $oss $LCTL set_param \
3383 ost.OSS.ost_io.nrs_policies="tbf\ jobid" || rc=$?
3384 [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
3385 [[ $rc -ne 0 ]] && error "failed to set TBF JOBID policy"
3387 # Configure jobid_var
3388 local saved_jobid_var=$($LCTL get_param -n jobid_var)
3390 [[ $rc -eq 3 ]] && skip "jobid_var not found" && return
3391 [[ $rc -ne 0 ]] && error "failed to get param jobid_var"
3392 if [ $saved_jobid_var != procname_uid ]; then
3393 set_persistent_param_and_check client \
3394 "jobid_var" "$FSNAME.sys.jobid_var" procname_uid
3399 if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
3404 # Only operate rules on ost1 since OSTs might run on the same OSS
3406 tbf_rule_operate ost1 "start\ runas\ ${idis}{iozone.$RUNAS_ID\ dd.$RUNAS_ID\ tiotest.$RUNAS_ID}\ ${rateis}1000"
3407 tbf_rule_operate ost1 "start\ iozone_runas\ ${idis}{iozone.$RUNAS_ID}\ ${rateis}100"
3408 tbf_rule_operate ost1 "start\ dd_runas\ ${idis}{dd.$RUNAS_ID}\ ${rateis}50"
3409 nrs_write_read "$RUNAS"
3412 tbf_rule_operate ost1 "change\ runas\ ${rateis}1001"
3413 tbf_rule_operate ost1 "change\ iozone_runas\ ${rateis}101"
3414 tbf_rule_operate ost1 "change\ dd_runas\ ${rateis}51"
3415 nrs_write_read "$RUNAS"
3418 tbf_rule_operate ost1 "stop\ runas"
3419 tbf_rule_operate ost1 "stop\ iozone_runas"
3420 tbf_rule_operate ost1 "stop\ dd_runas"
3421 nrs_write_read "$RUNAS"
3423 # Cleanup the TBF policy
3424 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3425 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3426 nrs_write_read "$RUNAS"
3428 local current_jobid_var=$($LCTL get_param -n jobid_var)
3429 [[ $? -ne 0 ]] && error "failed to get param jobid_var"
3430 if [ $saved_jobid_var != $current_jobid_var ]; then
3431 set_persistent_param_and_check client \
3432 "jobid_var" "$FSNAME.sys.jobid_var" $saved_jobid_var
3436 run_test 77f "check TBF JobID nrs policy"
3441 oss=$(comma_list $(osts_nodes))
3443 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid" ||
3445 [[ $rc -eq 3 ]] && skip "no NRS TBF exists" && return
3446 [[ $rc -ne 0 ]] && error "failed to set TBF NID policy"
3448 do_nodes $oss lctl set_param \
3449 ost.OSS.ost_io.nrs_policies="tbf\ jobid" || rc=$?
3450 [[ $rc -ne 0 ]] && error "failed to set TBF JOBID policy"
3454 if [ $(lustre_version_code ost1) -ge $(version_code 2.8.54) ]; then
3459 # Add a rule that only valid for Jobid TBF. If direct change between
3460 # TBF types is not supported, this operation will fail.
3461 tbf_rule_operate ost1 "start\ dd_runas\ ${idis}{dd.$RUNAS_ID}\ ${rateis}50"
3463 # Cleanup the TBF policy
3464 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3465 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3468 run_test 77g "Change TBF type directly"
3471 [ $(lustre_version_code ost1) -ge $(version_code 2.8.55) ] ||
3472 { skip "Need OST version at least 2.8.55"; return 0; }
3474 local old_policy=$(do_facet ost1 \
3475 lctl get_param ost.OSS.ost_io.nrs_policies)
3478 do_facet ost1 lctl set_param \
3479 ost.OSS.ost_io.nrs_policies="abc"
3480 [ $? -eq 0 ] && error "should return error"
3482 do_facet ost1 lctl set_param \
3483 ost.OSS.ost_io.nrs_policies="tbf\ abc"
3484 [ $? -eq 0 ] && error "should return error"
3486 do_facet ost1 lctl set_param \
3487 ost.OSS.ost_io.nrs_policies="tbf\ reg\ abc"
3488 [ $? -eq 0 ] && error "should return error"
3490 do_facet ost1 lctl set_param \
3491 ost.OSS.ost_io.nrs_policies="tbf\ abc\ efg"
3492 [ $? -eq 0 ] && error "should return error"
3494 new_policy=$(do_facet ost1 lctl get_param ost.OSS.ost_io.nrs_policies)
3495 [ $? -eq 0 ] || error "shouldn't LBUG"
3497 [ "$old_policy" = "$new_policy" ] || error "NRS policy should be same"
3501 run_test 77h "Wrong policy name should report error, not LBUG"
3507 local error_message=$3
3509 for rule in $expected; do
3510 rule_number=$((rule_number + 1))
3512 local stop_line=$(($rule_number + 3))
3513 local awk_command="awk 'NR >= 4 && NR <= $stop_line {print \$1}'"
3515 local output=$(do_facet $facet lctl get_param \
3516 ost.OSS.ost_io.nrs_tbf_rule |
3520 if [ "$output" != "$expected" ]; then
3521 error "$error_message, expected '$expected', got '$output'"
3526 [ $(lustre_version_code ost1) -ge $(version_code 2.8.55) ] ||
3527 { skip "Need OST version at least 2.8.55"; return 0; }
3529 for i in $(seq 1 $OSTCOUNT)
3531 do_facet ost"$i" lctl set_param \
3532 ost.OSS.ost_io.nrs_policies="tbf\ jobid"
3534 error "failed to set TBF policy"
3537 tbf_rule_check ost1 "default" "error before inserting any rule"
3539 tbf_rule_operate ost1 "start\ before\ jobid={jobid}\ rate=1000"
3540 tbf_rule_check ost1 "before default" \
3541 "error when inserting rule 'before'"
3543 tbf_rule_operate ost1 "start\ after\ jobid={jobid}\ rate=1000\ rank=default"
3544 tbf_rule_check ost1 "before after default" \
3545 "error when inserting rule 'after'"
3547 tbf_rule_operate ost1 "start\ target\ jobid={jobid}\ rate=1000\ rank=after"
3548 tbf_rule_check ost1 "before target after default" \
3549 "error when inserting rule 'target'"
3551 echo "Move before itself"
3552 tbf_rule_operate ost1 "change\ target\ rank=target"
3553 tbf_rule_check ost1 "before target after default" \
3554 "error when moving before itself"
3556 echo "Move to higher rank"
3557 tbf_rule_operate ost1 "change\ target\ rank=before"
3558 tbf_rule_check ost1 "target before after default" \
3559 "error when moving to higher rank"
3561 echo "Move to lower rank"
3562 tbf_rule_operate ost1 "change\ target\ rank=after"
3563 tbf_rule_check ost1 "before target after default" \
3564 "error when moving to lower rank"
3566 echo "Move before default"
3567 tbf_rule_operate ost1 "change\ target\ rank=default"
3568 tbf_rule_check ost1 "before after target default" \
3569 error "error when moving before default"
3571 # Cleanup the TBF policy
3572 do_nodes $(comma_list $(osts_nodes)) \
3573 $LCTL set_param ost.OSS.ost_io.nrs_policies=fifo
3576 run_test 77i "Change rank of TBF rule"
3581 local ost_version=$(lustre_version_code ost1)
3583 [ $ost_version -ge $(version_code 2.9.53) ] ||
3584 { skip "Need OST version at least 2.9.53"; return 0; }
3585 if [ $ost_version -ge $(version_code 2.8.60) ]; then
3590 do_nodes $(comma_list $(osts_nodes)) \
3591 lctl set_param jobid_var=procname_uid \
3592 ost.OSS.ost_io.nrs_policies="tbf\ opcode" \
3593 ost.OSS.ost_io.nrs_tbf_rule="start\ ost_r\ ${idis}{ost_read}\ ${rateis}5" \
3594 ost.OSS.ost_io.nrs_tbf_rule="start\ ost_w\ ${idis}{ost_write}\ ${rateis}20"
3595 [ $? -ne 0 ] && error "failed to set TBF OPCode policy"
3600 do_nodes $(comma_list $(osts_nodes)) \
3601 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_r" \
3602 ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_w" \
3603 ost.OSS.ost_io.nrs_policies="fifo"
3605 # sleep 3 seconds to wait the tbf policy stop completely,
3606 # or the next test case is possible get -EAGAIN when
3607 # setting the tbf policy
3610 run_test 77j "check TBF-OPCode NRS policy"
3613 local idstr="${1}id"
3614 local policy="${idstr}={$2}"
3615 local rate="rate=$3"
3617 do_nodes $(comma_list $(osts_nodes)) \
3618 lctl set_param jobid_var=procname_uid \
3619 ost.OSS.ost_io.nrs_policies="tbf\ ${idstr}" \
3620 ost.OSS.ost_io.nrs_tbf_rule="start\ ost_${idstr}\ ${policy}\ ${rate}"
3621 [ $? -ne 0 ] && error "failed to set tbf ${idstr} policy"
3623 nrs_write_read "runas $4"
3624 tbf_verify $3 $3 "runas $4"
3626 do_nodes $(comma_list $(osts_nodes)) \
3627 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ost_${idstr}" \
3628 ost.OSS.ost_io.nrs_policies="fifo"
3630 # sleep 3 seconds to wait the tbf policy stop completely,
3631 # or the next test case is possible get -eagain when
3632 # setting the tbf policy
3637 if [ $(lustre_version_code ost1) -lt $(version_code 2.11.50) ]; then
3638 skip "Need OST version at least 2.11.50"
3641 test_id "u" "500" "5" "-u 500"
3642 test_id "g" "500" "5" "-u 500 -g 500"
3644 run_test 77ja "check TBF-UID/GID NRS policy"
3652 for rule in $rule_lists; do
3653 do_nodes $(comma_list $(osts_nodes)) \
3654 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ $rule"
3657 do_nodes $(comma_list $(osts_nodes)) \
3658 lctl set_param ost.OSS.ost_io.nrs_policies="$old_nrs"
3664 [[ $(lustre_version_code ost1) -ge $(version_code 2.9.53) ]] ||
3665 { skip "Need OST version at least 2.9.53"; return 0; }
3667 do_nodes $(comma_list $(osts_nodes)) \
3668 lctl set_param ost.OSS.ost_io.nrs_policies="tbf" \
3669 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_w\ jobid={dd.$RUNAS_ID}\&opcode={ost_write}\ rate=20" \
3670 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_r\ jobid={dd.$RUNAS_ID}\&opcode={ost_read}\ rate=10"
3672 nrs_write_read "$RUNAS"
3673 tbf_verify 20 10 "$RUNAS"
3675 local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
3676 local client_nids=$(nids_list $address "\\")
3677 do_nodes $(comma_list $(osts_nodes)) \
3678 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_w" \
3679 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_r" \
3680 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_w\ nid={0@lo\ $client_nids}\&opcode={ost_write}\ rate=20" \
3681 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_r\ nid={0@lo\ $client_nids}\&opcode={ost_read}\ rate=10"
3686 do_nodes $(comma_list $(osts_nodes)) \
3687 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_w" \
3688 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_r" \
3689 ost.OSS.ost_io.nrs_tbf_rule="start\ ext\ nid={0@lo\ $client_nids}\&jobid={dd.$RUNAS_ID}\ rate=20"
3691 nrs_write_read "$RUNAS"
3692 tbf_verify 20 20 "$RUNAS"
3694 do_nodes $(comma_list $(osts_nodes)) \
3695 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext" \
3696 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ jobid={dd.$RUNAS_ID},opcode={ost_write}\ rate=20" \
3697 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ jobid={dd.$RUNAS_ID},opcode={ost_read}\ rate=10"
3699 nrs_write_read "$RUNAS"
3700 # with parameter "RUNAS", it will match the latest rule
3701 # "ext_b" first, so the limited write rate is 10.
3702 tbf_verify 10 10 "$RUNAS"
3705 trap "cleanup_77k \"ext_a ext_b\" \"fifo\"" EXIT
3707 [[ $(lustre_version_code ost1) -ge $(version_code 2.10.58) ]] ||
3708 { skip "Need OST version at least 2.10.58"; return 0; }
3710 do_nodes $(comma_list $(osts_nodes)) \
3711 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_a" \
3712 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_b" \
3713 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ug\ uid={500}\&gid={1000}\ rate=5"
3714 nrs_write_read "runas -u 500 -g 1000"
3715 tbf_verify 5 5 "runas -u 500 -g 1000"
3717 do_nodes $(comma_list $(osts_nodes)) \
3718 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_ug" \
3719 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_uw\ uid={500}\&opcode={ost_write}\ rate=20" \
3720 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_ur\ uid={500}\&opcode={ost_read}\ rate=10"
3722 nrs_write_read "runas -u 500"
3723 tbf_verify 20 10 "runas -u 500"
3725 do_nodes $(comma_list $(osts_nodes)) \
3726 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_uw" \
3727 ost.OSS.ost_io.nrs_tbf_rule="stop\ ext_ur" \
3728 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_a\ uid={500},opcode={ost_write}\ rate=20" \
3729 ost.OSS.ost_io.nrs_tbf_rule="start\ ext_b\ uid={500},opcode={ost_read}\ rate=10"
3730 nrs_write_read "runas -u 500"
3731 tbf_verify 10 10 "runas -u 500"
3732 tbf_verify 20 10 "runas -u 500"
3733 cleanup_77k "ext_a ext_b" "fifo"
3735 run_test 77k "check TBF policy with NID/JobID/OPCode expression"
3738 [[ $(lustre_version_code ost1) -ge $(version_code 2.10.56) ]] ||
3739 { skip "Need OST version at least 2.10.56"; return 0; }
3741 do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ nid"
3742 do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="tbf"
3744 local output=$(do_facet ost1 lctl get_param \
3745 ost.OSS.ost_io.nrs_policies | \
3746 awk '/name: tbf/ {print;exit}' | \
3747 awk -F ': ' '{print $2}')
3749 if [ "$output" != "tbf" ]; then
3750 error "The generic TBF output is '$output', not 'tbf'"
3753 do_facet ost1 lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3755 run_test 77l "check the output of NRS policies for generic TBF"
3758 if [ $(lustre_version_code ost1) -lt $(version_code 2.9.54) ]; then
3759 skip "Need OST version at least 2.9.54"
3763 local dir=$DIR/$tdir
3765 mkdir $dir || error "mkdir $dir failed"
3766 $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
3769 local nodes=$(comma_list $(osts_nodes))
3770 do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies=delay \
3771 ost.OSS.ost_io.nrs_delay_min=4 \
3772 ost.OSS.ost_io.nrs_delay_max=4 \
3773 ost.OSS.ost_io.nrs_delay_pct=100
3774 [ $? -ne 0 ] && error "Failed to set delay policy"
3776 local start=$SECONDS
3777 do_nodes "${SINGLECLIENT:-$HOSTNAME}" "$RUNAS" \
3778 dd if=/dev/zero of="$dir/nrs_delay_$HOSTNAME" bs=1M count=1 \
3779 oflag=direct conv=fdatasync ||
3780 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3781 error "dd on client failed (1)"; }
3782 local elapsed=$((SECONDS - start))
3784 # NRS delay doesn't do sub-second timing, so a request enqueued at
3785 # 0.9 seconds can be dequeued at 4.0
3786 [ $elapsed -lt 3 ] &&
3787 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3788 error "Single 1M write should take at least 3 seconds"; }
3791 do_nodes "${SINGLECLIENT:-$HOSTNAME}" "$RUNAS" \
3792 dd if=/dev/zero of="$dir/nrs_delay_$HOSTNAME" bs=1M count=10 \
3793 oflag=direct conv=fdatasync ||
3794 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3795 error "dd on client failed (2)"; }
3796 elapsed=$((SECONDS - start))
3798 [ $elapsed -lt 30 ] &&
3799 { do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo";
3800 error "Ten 1M writes should take at least 30 seconds"; }
3802 do_nodes $nodes lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3803 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3807 run_test 77m "check NRS Delay slows write RPC processing"
3809 test_77n() { #LU-10802
3810 if [ $(lustre_version_code ost1) -lt $(version_code 2.10.58) ]; then
3811 skip "Need OST version at least 2.10.58"
3815 # Configure jobid_var
3816 local saved_jobid_var=$($LCTL get_param -n jobid_var)
3817 if [ $saved_jobid_var != procname_uid ]; then
3818 set_persistent_param_and_check client \
3819 "jobid_var" "$FSNAME.sys.jobid_var" procname_uid
3822 do_nodes $(comma_list $(osts_nodes)) \
3823 lctl set_param ost.OSS.ost_io.nrs_policies="tbf\ jobid" \
3824 ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
3825 ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={*.$RUNAS_ID}\ rate=20"
3828 tbf_verify 20 20 "$RUNAS"
3830 do_nodes $(comma_list $(osts_nodes)) \
3831 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
3832 ost.OSS.ost_io.nrs_tbf_rule="start\ dd_runas\ jobid={dd.*}\ rate=20"
3837 do_nodes $(comma_list $(osts_nodes)) \
3838 lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop\ dd_runas" \
3839 ost.OSS.ost_io.nrs_policies="fifo"
3843 local current_jobid_var=$($LCTL get_param -n jobid_var)
3844 if [ $saved_jobid_var != $current_jobid_var ]; then
3845 set_persistent_param_and_check client \
3846 "jobid_var" "$FSNAME.sys.jobid_var" $saved_jobid_var
3849 run_test 77n "check wildcard support for TBF JobID NRS policy"
3851 test_78() { #LU-6673
3854 oss=$(comma_list $(osts_nodes))
3855 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="orr" &
3856 do_nodes $oss lctl set_param ost.OSS.*.nrs_orr_quantum=1
3858 [[ $rc -eq 3 ]] && skip "no NRS exists" && return
3859 # Valid return codes are:
3860 # 0: Tuning succeeded
3861 # ENODEV: Policy is still stopped
3862 # EAGAIN: Policy is being initialized
3863 [ $rc -eq 0 -o $rc -eq 19 -o $rc -eq 11 ] ||
3864 error "Expected set_param to return 0|ENODEV|EAGAIN"
3866 # Cleanup the ORR policy
3867 do_nodes $oss lctl set_param ost.OSS.ost_io.nrs_policies="fifo"
3868 [ $? -ne 0 ] && error "failed to set policy back to fifo"
3871 run_test 78 "Enable policy and specify tunings right away"
3874 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3875 test_mkdir $DIR/$tdir
3877 # Prevent interference from layout intent RPCs due to
3878 # asynchronous writeback. These will be tested in 130c below.
3879 do_nodes ${CLIENTS:-$HOSTNAME} sync
3881 setfattr -n trusted.name1 -v value1 $DIR/$tdir ||
3882 error "setfattr -n trusted.name1=value1 $DIR/$tdir failed"
3884 #define OBD_FAIL_MDS_INTENT_DELAY 0x160
3885 local mdtidx=$($LFS getstripe -m $DIR/$tdir)
3886 local facet=mds$((mdtidx + 1))
3888 set_nodes_failloc $(facet_active_host $facet) 0x80000160
3889 getfattr -n trusted.name1 $DIR/$tdir 2> /dev/null &
3893 #define OBD_FAIL_MDS_GETXATTR_PACK 0x131
3894 set_nodes_failloc $(facet_active_host $facet) 0x80000131
3899 run_test 79 "xattr: intent error"
3902 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3909 mkdir -p $DIR1/$tdir/dir
3910 createmany -o $DIR1/$tdir/dir/f 10 ||
3911 error "create files under remote dir failed $i"
3913 cp /etc/passwd $DIR1/$tdir/$tfile
3915 #migrate open file should fails
3916 multiop_bg_pause $DIR2/$tdir/$tfile O_c || error "open $file failed"
3918 # give multiop a chance to open
3921 $LFS migrate -m $MDTIDX $DIR1/$tdir &&
3922 error "migrate open files should failed with open files"
3926 $LFS migrate -m $MDTIDX $DIR1/$tdir ||
3927 error "migrate remote dir error"
3929 echo "Finish migration, then checking.."
3930 for file in $(find $DIR1/$tdir); do
3931 mdt_index=$($LFS getstripe -m $file)
3932 [ $mdt_index == $MDTIDX ] ||
3933 error "$file is not on MDT${MDTIDX}"
3936 diff /etc/passwd $DIR1/$tdir/$tfile ||
3937 error "file different after migration"
3939 rm -rf $DIR1/$tdir || error "rm dir failed after migration"
3941 run_test 80a "migrate directory when some children is being opened"
3945 kill -9 $migrate_pid
3949 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3950 local migrate_dir1=$DIR1/$tdir/migrate_dir
3951 local migrate_dir2=$DIR2/$tdir/migrate_dir
3952 local migrate_run=$LUSTRE/tests/migrate.sh
3960 trap cleanup_80b EXIT
3961 #prepare migrate directory
3962 mkdir -p $migrate_dir1
3963 for F in {1,2,3,4,5}; do
3964 echo "$F$F$F$F$F" > $migrate_dir1/file$F
3965 echo "$F$F$F$F$F" > $DIR/$tdir/file$F
3968 #migrate the directories among MDTs
3971 mdt_idx=$((RANDOM % MDSCOUNT))
3972 $LFS migrate -m $mdt_idx $migrate_dir1 &>/dev/null ||
3974 [ $rc -ne 0 -o $rc -ne 16 ] || break
3979 echo "start migration thread $migrate_pid"
3980 #Access the files at the same time
3981 start_time=$(date +%s)
3982 echo "accessing the migrating directory for 5 minutes..."
3984 ls $migrate_dir2 > /dev/null || {
3985 echo "read dir fails"
3988 diff -u $DIR2/$tdir/file1 $migrate_dir2/file1 || {
3989 echo "access file1 fails"
3993 cat $migrate_dir2/file2 > $migrate_dir2/file3 || {
3994 echo "access file2/3 fails"
3998 echo "aaaaa" > $migrate_dir2/file4 > /dev/null || {
3999 echo "access file4 fails"
4003 stat $migrate_dir2/file5 > /dev/null || {
4004 echo "stat file5 fails"
4008 touch $migrate_dir2/source_file > /dev/null || rc1=$?
4009 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
4010 echo "touch file failed with $rc1"
4014 if [ -e $migrate_dir2/source_file ]; then
4015 ln $migrate_dir2/source_file $migrate_dir2/link_file \
4016 &>/dev/null || rc1=$?
4017 if [ -e $migrate_dir2/link_file ]; then
4018 rm -rf $migrate_dir2/link_file
4021 mrename $migrate_dir2/source_file \
4022 $migrate_dir2/target_file &>/dev/null || rc1=$?
4023 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
4024 echo "rename failed with $rc1"
4028 if [ -e $migrate_dir2/target_file ]; then
4029 rm -rf $migrate_dir2/target_file &>/dev/null ||
4032 rm -rf $migrate_dir2/source_file &>/dev/null ||
4035 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
4036 echo "unlink failed with $rc1"
4041 end_time=$(date +%s)
4042 duration=$((end_time - start_time))
4043 if [ $((duration % 10)) -eq 0 ]; then
4044 if [ $show_time -eq 1 ]; then
4045 echo "...$duration seconds"
4052 kill -0 $migrate_pid || {
4053 echo "migration stopped 1"
4057 [ $duration -ge 300 ] && break
4060 #check migration are still there
4061 kill -0 $migrate_pid || error "migration stopped 2"
4064 run_test 80b "Accessing directory during migration"
4067 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4071 mkdir -p $DIR1/$tdir
4073 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d0
4074 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d1
4077 touch d0/0 || error "create 0 failed"
4078 mv d0/0 d1/0 || error "rename d0/0 d1/0 failed"
4079 stat d0/0 && error "stat mv filed succeed"
4080 mv $DIR2/$tdir/d1/0 $DIR2/$tdir/d0/0 || error "rename d1/0 d0/0 failed"
4081 stat d0/0 || error "stat failed"
4083 local t=$(ls -ai $DIR1/$tdir/d0 | sort -u | wc -l)
4085 if [ $t -ne 3 ]; then
4086 ls -ai $DIR1/$tdir/d0
4087 error "expect 3 get $t"
4092 run_test 81a "rename and stat under striped directory"
4095 [ $MDSCOUNT -lt 2 ] &&
4096 skip "We need at least 2 MDTs for this test"
4103 $LFS mkdir -c $MDSCOUNT $DIR1/$tdir || error "$LFS mkdir"
4104 createmany -o $DIR1/$tdir/$tfile. $total || error "createmany"
4113 for i in $(seq $total); do
4114 mrename $DIR2/$tdir/$tfile.$i $DIR2/$tdir/$tfile-new.$i \
4118 kill -9 $setattr_pid
4120 run_test 81b "rename under striped directory doesn't deadlock"
4123 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.6.91) ]] ||
4124 { skip "Need MDS version at least 2.6.92"; return 0; }
4126 # Client 1 creates a file.
4127 multiop_bg_pause $DIR1/$tfile O_ac || error "multiop_bg_pause 1"
4129 # Client 2 opens the file.
4130 multiop_bg_pause $DIR2/$tfile o_Ac || error "multiop_bg_pause 2"
4132 # Client 1 makes the file an orphan.
4133 rm $DIR1/$tfile || error "rm"
4134 # Client 2 sets EA "user.multiop".
4136 wait $pid2 || error "multiop 2"
4137 # Client 1 gets EA "user.multiop". This used to fail because the EA
4138 # cache refill would get "trusted.link" from mdd_xattr_list() but
4139 # -ENOENT when trying to get "trusted.link"'s value. See also sanity
4142 wait $pid1 || error "multiop 1"
4144 run_test 82 "fsetxattr and fgetxattr on orphan files"
4147 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4154 $LFS mkdir -i1 -c2 $tdir
4159 echo "start pid $pid1 to create/unlink striped directory"
4161 # Access the directory at the same time
4165 stat $tdir > /dev/null 2>&1
4169 echo "start pid $pid2 to stat striped directory"
4177 run_test 83 "access striped directory while it is being created/unlinked"
4180 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4185 [ "$SLOW" = "yes" ] && duration=600
4186 # Open/Create under striped directory
4190 $LFS mkdir -c$MDSCOUNT $tdir > /dev/null 2>&1
4191 touch $tdir/f{0..3} > /dev/null 2>&1
4195 echo "start pid $pid1 to open/create under striped directory"
4197 # unlink the striped directory at the same time
4201 rm -rf $tdir > /dev/null 2>&1
4205 echo "start pid $pid2 to unlink striped directory"
4214 run_test 90 "open/create and unlink striped directory"
4217 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4222 [ "$SLOW" = "yes" ] && duration=600
4223 # chmod striped directory
4227 $LFS mkdir -c$MDSCOUNT $tdir > /dev/null 2>&1
4228 chmod go+w $tdir > /dev/null 2>&1
4232 echo "start pid $pid1 to chmod striped directory"
4234 # unlink the striped directory at the same time
4238 rm -rf $tdir > /dev/null 2>&1
4242 echo "start pid $pid2 to unlink striped directory"
4251 run_test 91 "chmod and unlink striped directory"
4254 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
4257 local cmd="exec $fd<$DIR1/$tdir"
4258 $LFS setdirstripe -c$MDSCOUNT $DIR1/$tdir || error "mkdir $tdir fails"
4261 trap "eval $cmd" EXIT
4262 cd $DIR1/$tdir || error "cd $DIR1/$tdir fails"
4263 rmdir ../$tdir || error "rmdir ../$tdir fails"
4265 #define OBD_FAIL_LLITE_NO_CHECK_DEAD 0x1408
4266 $LCTL set_param fail_loc=0x1408
4267 mkdir $DIR2/$tdir/dir && error "create dir succeeds"
4268 $LFS setdirstripe -i1 $DIR2/$tdir/remote_dir &&
4269 error "create remote dir succeeds"
4270 $LCTL set_param fail_loc=0
4274 run_test 92 "create remote directory under orphan directory"
4281 mkdir -p $DIR1/$tfile-1/
4282 mkdir -p $DIR2/$tfile-2/
4283 local old_rr=$(do_facet $SINGLEMDS lctl get_param -n \
4284 'lod.lustre-MDT*/qos_threshold_rr' | sed -e 's/%//')
4285 do_facet $SINGLEMDS lctl set_param -n \
4286 'lod.lustre-MDT*/qos_threshold_rr' 100
4287 #define OBD_FAIL_MDS_LOV_CREATE_RACE 0x163
4288 do_facet $SINGLEMDS "lctl set_param fail_loc=0x00000163"
4290 $LFS setstripe -c -1 $DIR1/$tfile-1/file1 &
4293 $LFS setstripe -c -1 $DIR2/$tfile-2/file2 &
4297 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4298 do_facet $SINGLEMDS "lctl set_param -n \
4299 'lod.lustre-MDT*/qos_threshold_rr' $old_rr"
4301 $LFS getstripe $DIR1/$tfile-1/file1
4302 rc1=$($LFS getstripe -q $DIR1/$tfile-1/file1 |
4303 awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
4304 $LFS getstripe $DIR2/$tfile-2/file2
4305 rc2=$($LFS getstripe -q $DIR2/$tfile-2/file2 |
4306 awk '{if (/[0-9]/) print $1 }' | sort | uniq -d | wc -l)
4307 echo "rc1=$rc1 and rc2=$rc2 "
4308 [ $rc1 -eq 0 ] && [ $rc2 -eq 0 ] ||
4309 error "object allocate on same ost detected"
4311 run_test 93 "alloc_rr should not allocate on same ost"
4315 skip "Reserved for glimpse-ahead" && return
4316 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4317 skip "Need MDS version at least 2.10.55" && return
4321 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4323 lctl set_param -n mdc.*.stats=clear
4324 dd if=/dev/zero of=$DIR2/$tdir/dom bs=4096 count=1 || return 1
4326 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #1"
4327 # first stat from server should return size data and save glimpse
4328 local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
4329 [ $gls -eq 0 ] || error "Unexpected $gls glimpse RPCs"
4330 # second stat to check size is NOT cached on client without IO lock
4331 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
4333 local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
4334 [ $gls -ge 1 ] || error "Expect glimpse RPCs but none"
4337 run_test 100a "DoM: glimpse RPCs for stat without IO lock (DoM only file)"
4340 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4341 skip "Need MDS version at least 2.10.55" && return
4345 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4347 lctl set_param -n mdc.*.stats=clear
4348 dd if=/dev/zero of=$DIR2/$tdir/dom bs=4096 count=1 || return 1
4349 cancel_lru_locks mdc
4350 # first stat data from server should have size
4351 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #1"
4352 # second stat to check size is cached on client
4353 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom || error "stat #2"
4355 local gls=$(lctl get_param -n mdc.*.stats | grep -c ldlm_glimpse)
4356 # both stats should cause no glimpse requests
4357 [ $gls == 0 ] || error "Unexpected $gls glimpse RPCs"
4360 run_test 100b "DoM: no glimpse RPC for stat with IO lock (DoM only file)"
4363 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4364 skip "Need MDS version at least 2.10.55" && return
4368 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4370 lctl set_param -n mdc.*.stats=clear
4371 lctl set_param -n osc.*.stats=clear
4372 dd if=/dev/zero of=$DIR2/$tdir/dom bs=2048K count=1 || return 1
4374 # check that size is merged from MDT and OST correctly
4375 $CHECKSTAT -t file -s 2097152 $DIR/$tdir/dom ||
4376 error "Wrong size from stat #1"
4378 local gls=$(lctl get_param -n osc.*.stats | grep -c ldlm_glimpse)
4379 [ $gls -eq 0 ] && error "Expect OST glimpse RPCs but got none"
4383 run_test 100c "DoM: write vs stat without IO lock (combined file)"
4386 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4387 skip "Need MDS version at least 2.10.55" && return
4391 $LFS setstripe -E 1024K -L mdt -E EOF $DIR/$tdir/dom
4394 dd if=/dev/zero of=$DIR2/$tdir/dom bs=2048K count=1 || return 1
4395 lctl set_param -n mdc.*.stats=clear
4396 $TRUNCATE $DIR2/$tdir/dom 4096
4398 # check that reported size is valid after file grows to OST and
4399 # is truncated back to MDT stripe size
4400 $CHECKSTAT -t file -s 4096 $DIR/$tdir/dom ||
4401 error "Wrong size from stat #1"
4403 local gls=$(lctl get_param -n osc.*.stats | grep -c ldlm_glimpse)
4404 [ $gls -eq 0 ] && error "Expect OST glimpse but got none"
4408 run_test 100d "DoM: write+truncate vs stat without IO lock (combined file)"
4411 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4412 skip "Need MDS version at least 2.10.55" && return
4414 $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile
4416 $CHECKSTAT -t file $DIR1/$tfile
4418 local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
4419 sysctl -wq vm.dirty_writeback_centisecs=0
4421 trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
4424 dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 ||
4425 error_noexit "Write fails"
4426 # must discard pages
4427 lctl set_param -n mdc.*.stats=clear
4428 rm $DIR2/$tfile || error "Unlink fails"
4430 local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
4431 [ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
4433 run_test 101a "Discard DoM data on unlink"
4436 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4437 skip "Need MDS version at least 2.10.55" && return
4439 $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile
4440 touch $DIR1/${tfile}_2
4442 $CHECKSTAT -t file $DIR1/$tfile
4444 local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
4445 sysctl -wq vm.dirty_writeback_centisecs=0
4447 trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
4450 dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails"
4451 # must discard pages
4452 lctl set_param -n mdc.*.stats=clear
4453 mv $DIR2/${tfile}_2 $DIR2/$tfile || error "Rename fails"
4455 local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
4456 [ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
4458 run_test 101b "Discard DoM data on rename"
4461 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
4462 skip "Need MDS version at least 2.10.55" && return
4464 $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile
4466 $CHECKSTAT -t file $DIR1/$tfile
4468 local old_wb=$(sysctl -n vm.dirty_writeback_centisecs)
4469 sysctl -wq vm.dirty_writeback_centisecs=0
4471 trap "sysctl -wq vm.dirty_writeback_centisecs=$old_wb" EXIT
4474 dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails"
4475 $MULTIOP $DIR1/$tfile O_c &
4478 lctl set_param -n mdc.*.stats=clear
4479 rm $DIR2/$tfile > /dev/null || error "Unlink fails for opened file"
4480 kill -USR1 $MULTIOP_PID && wait $MULTIOP_PID || error "multiop failure"
4482 local writes=$(lctl get_param -n mdc.*.stats | grep -c ost_write)
4483 [ $writes -eq 0 ] || error "Found WRITE RPC but expect none"
4485 run_test 101c "Discard DoM data on close-unlink"
4487 # test to verify file handle related system calls
4488 # (name_to_handle_at/open_by_handle_at)
4489 # The new system calls are supported in glibc >= 2.14.
4491 # test to verify we can open by handle an unlinked file from > 1 client
4492 # This test opens the file normally on $DIR1, which is on one mount, and then
4493 # opens it by handle on $DIR2, which is on a different mount.
4495 echo "Test file_handle syscalls" > $DIR/$tfile ||
4496 error "write failed"
4497 check_fhandle_syscalls $DIR/$tfile $DIR2 ||
4498 error "check_fhandle_syscalls failed"
4501 run_test 102 "Test open by handle of unlinked file"
4503 log "cleanup: ======================================================"
4505 # kill and wait in each test only guarentee script finish, but command in script
4506 # like 'rm' 'chmod' may still be running, wait for all commands to finish
4507 # otherwise umount below will fail
4508 [ "$(mount | grep $MOUNT2)" ] && wait_update $HOSTNAME "fuser -m $MOUNT2" "" ||
4513 check_and_cleanup_lustre