6 # bug number for skipped test: 3192 LU-1205 15528/3811 9977 15528/11549 18080
7 ALWAYS_EXCEPT=" 14b 18c 19 28 29 35 $SANITYN_EXCEPT"
9 ALWAYS_EXCEPT="78 $SANITYN_EXCEPT"
10 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
13 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
16 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
17 OPENFILE=${OPENFILE:-openfile}
18 OPENUNLINK=${OPENUNLINK:-openunlink}
19 export MULTIOP=${MULTIOP:-multiop}
20 export TMP=${TMP:-/tmp}
21 MOUNT_2=${MOUNT_2:-"yes"}
22 CHECK_GRANT=${CHECK_GRANT:-"yes"}
23 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
27 export NAME=${NAME:-local}
29 LUSTRE=${LUSTRE:-`dirname $0`/..}
30 . $LUSTRE/tests/test-framework.sh
34 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
37 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
38 # bug number for skipped test: LU-2189 LU-2776
39 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 36 51a"
40 # LU-2829 / LU-2887 - make allowances for ZFS slowness
41 TEST33_NFILES=${TEST33_NFILES:-1000}
44 [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
51 check_and_setup_lustre
53 LOVNAME=$($LCTL get_param -n llite.*.lov.common_name | tail -n 1)
54 OSTCOUNT=$($LCTL get_param -n lov.$LOVNAME.numobd)
57 rm -rf $DIR1/[df][0-9]* $DIR1/lnk $DIR/[df].${TESTSUITE}*
59 SAMPLE_FILE=$TMP/$(basename $0 .sh).junk
60 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1
62 # $RUNAS_ID may get set incorrectly somewhere else
63 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
65 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
74 [ -f $DIR2/f1 ] || error
76 run_test 1a "check create on 2 mtpt's =========================="
80 $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
83 run_test 1b "check attribute updates on 2 mtpt's ==============="
86 $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
88 run_test 1c "check after remount attribute updates on 2 mtpt's ="
92 $CHECKSTAT -a $DIR1/f1 || error
94 run_test 1d "unlink on one mountpoint removes file on other ===="
100 $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
102 run_test 2a "check cached attribute updates on 2 mtpt's ========"
108 $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
110 run_test 2b "check cached attribute updates on 2 mtpt's ========"
112 # NEED TO SAVE ROOT DIR MODE
115 $CHECKSTAT -t dir -p 0777 $DIR2 || error
117 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
121 $CHECKSTAT -t dir -p 0755 $DIR2 || error
123 run_test 2d "check cached attribute updates on 2 mtpt's root ==="
130 $RUNAS dd if=/dev/zero of=$DIR2/$tfile count=1 || error
132 run_test 2e "check chmod on root is propagated to others"
135 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
137 local remote_dir=$tdir/remote_dir
140 $LFS mkdir -i $MDTIDX $DIR1/$remote_dir ||
141 error "Create remote directory failed"
143 touch $DIR1/$remote_dir/$tfile ||
144 error "Create file under remote directory failed"
145 chmod 777 $DIR1/$remote_dir/$tfile ||
146 error "Chmod file under remote directory failed"
148 $CHECKSTAT -t file -p 0777 $DIR2/$remote_dir/$tfile ||
149 error "Check attr of file under remote directory failed"
151 chown $RUNAS_ID:$RUNAS_GID $DIR1/$remote_dir/$tfile ||
152 error "Chown file under remote directory failed"
154 $CHECKSTAT -u \#$RUNAS_ID -g \#$RUNAS_GID $DIR2/$remote_dir/$tfile ||
155 error "Check owner of file under remote directory failed"
157 cd $DIR2/$remote_dir || error "enter remote dir"
158 rm -rf $DIR1/$remote_dir/$tfile ||
159 error "Unlink remote directory failed"
161 $CHECKSTAT -t file $DIR2/$remote_dir/$tfile &&
162 error "unlink file still exists!"
164 cd $DIR2/$tdir || error "exit remote dir"
165 rm -rf $DIR1/$tdir || error "unlink directory failed"
167 run_test 2f "check attr/owner updates on DNE with 2 mtpt's"
170 dd if=/dev/zero of=$DIR1/$tfile oflag=sync bs=1M count=2
172 local block1=$(stat $DIR1/$tfile | awk '/Blocks/ {print $4} ')
174 local block2=$(stat $DIR2/$tfile | awk '/Blocks/ {print $4} ')
175 echo "$DIR1/$tfile has $block1 blocks"
176 echo "$DIR2/$tfile has $block2 blocks"
177 [ $block1 -eq $block2 ] || error
179 run_test 2g "check blocks update on sync write"
182 local target="this/is/good"
183 ln -s $target $DIR1/$tfile || error "ln -s $target $DIR1/$tfile failed"
184 [ "$(ls -l $DIR2/$tfile | sed -e 's/.* -> //')" = "$target" ] ||
185 error "link $DIR2/$tfile not as expected"
187 run_test 3 "symlink on one mtpt, readlink on another ==========="
190 multifstat $DIR1/f4 $DIR2/f4
192 run_test 4 "fstat validation on multiple mount points =========="
196 $TRUNCATE $DIR2/f5 100
197 $CHECKSTAT -t file -s 100 $DIR1/f5 || error
200 run_test 5 "create a file on one mount, truncate it on the other"
203 openunlink $DIR1/$tfile $DIR2/$tfile || \
204 error "openunlink $DIR1/$tfile $DIR2/$tfile"
206 run_test 6 "remove of open file on other node =================="
210 opendirunlink $DIR1/$dir $DIR2/$dir || \
211 error "opendirunlink $DIR1/$dir $DIR2/$dir"
213 run_test 7 "remove of open directory on other node ============="
216 opendevunlink $DIR1/$tfile $DIR2/$tfile || \
217 error "opendevunlink $DIR1/$tfile $DIR2/$tfile"
219 run_test 8 "remove of open special file on other node =========="
225 for C in a b c d e f g h i j k l; do
226 dir=`eval echo \\$DIR$MTPT`
227 echo -n $C >> $dir/f9
228 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
230 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
231 error "`od -a $DIR1/f9` != abcdefghijkl"
233 run_test 9 "append of file with sub-page size on multiple mounts"
240 for C in a b c d e f g h i j k l; do
241 dir=`eval echo \\$DIR$MTPT`
242 echo -n $C | dd of=$dir/f10 bs=1 seek=$OFFSET count=1
243 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
244 OFFSET=`expr $OFFSET + 1`
246 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
247 error "`od -a $DIR1/f10` != abcdefghijkl"
249 run_test 10a "write of file with sub-page size on multiple mounts "
253 yes "R" | head -c 4000 >$TMP/f10b-seed
254 dd if=$TMP/f10b-seed of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
256 $TRUNCATE $DIR1/f10b 4096 || error "truncate 4096"
258 dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
260 # create a test file locally to compare
261 dd if=$TMP/f10b-seed of=$TMP/f10b bs=3k count=1 || error "dd random"
262 $TRUNCATE $TMP/f10b 4096 || error "truncate 4096"
263 cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
264 rm $TMP/f10b $TMP/f10b-lustre $TMP/f10b-seed
266 run_test 10b "write of file with sub-page size on multiple mounts "
270 multiop_bg_pause $DIR1/d11/f O_c || return 1
272 cp -p /bin/ls $DIR1/d11/f
276 wait $MULTIPID || error
277 [ $RC -eq 0 ] && error || true
279 run_test 11 "execution of file opened for write should return error ===="
282 DIR=$DIR DIR2=$DIR2 sh lockorder.sh
284 run_test 12 "test lock ordering (link, stat, unlink) ==========="
286 test_13() { # bug 2451 - directory coherency
287 test_mkdir $DIR1/d13 || error
288 cd $DIR1/d13 || error
290 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
292 rm -f $DIR2/d13/f13 || error
293 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
294 # need to run it twice
295 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
297 rm -f $DIR2/d13/f13 || error
298 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (2)" || true
300 run_test 13 "test directory page revocation ===================="
303 test_mkdir -p $DIR1/$tdir
304 cp -p /bin/ls $DIR1/$tdir/$tfile
305 multiop_bg_pause $DIR1/$tdir/$tfile Ow_c || return 1
308 $DIR2/$tdir/$tfile && error || true
310 wait $MULTIPID || return 2
312 run_test 14 "execution of file open for write returns -ETXTBSY ="
315 test_mkdir -p $DIR1/d14
316 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
317 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
319 $MULTIOP $DIR2/d14/multiop Oc && error "expected error, got success"
320 kill -USR1 $MULTIOP_PID || return 2
321 wait $MULTIOP_PID || return 3
322 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
324 run_test 14a "open(RDWR) of executing file returns -ETXTBSY ===="
326 test_14b() { # bug 3192, 7040
327 test_mkdir -p $DIR1/d14
328 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
329 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
331 $TRUNCATE $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \
332 error "expected truncate error, got success"
333 kill -USR1 $MULTIOP_PID || return 2
334 wait $MULTIOP_PID || return 3
335 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
336 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
338 run_test 14b "truncate of executing file returns -ETXTBSY ======"
340 test_14c() { # bug 3430, 7040
341 test_mkdir -p $DIR1/d14
342 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
343 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
345 cp /etc/hosts $DIR2/d14/multiop && error "expected error, got success"
346 kill -USR1 $MULTIOP_PID || return 2
347 wait $MULTIOP_PID || return 3
348 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
349 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
351 run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
353 test_14d() { # bug 10921
354 test_mkdir -p $DIR1/d14
355 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
356 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
359 chmod 600 $DIR1/d14/multiop || error "chmod failed"
360 kill -USR1 $MULTIOP_PID || return 2
361 wait $MULTIOP_PID || return 3
362 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
363 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
365 run_test 14d "chmod of executing file is still possible ========"
367 test_15() { # bug 974 - ENOSPC
369 sh oos2.sh $MOUNT1 $MOUNT2
370 wait_delete_completed
371 grant_error=`dmesg | grep "> available"`
372 [ -z "$grant_error" ] || error "$grant_error"
374 run_test 15 "test out-of-space with multiple writers ==========="
377 # The FSXNUM reduction for ZFS is needed until ORI-487 is fixed.
378 # We don't want to skip it entirely, but ZFS is VERY slow and cannot
379 # pass a 2500 operation dual-mount run within the time limit.
380 if [ "$(facet_fstype ost1)" = "zfs" ]; then
381 FSXNUM=$((COUNT / 5))
383 elif [ "$SLOW" = "yes" ]; then
384 FSXNUM=$((COUNT * 5))
392 local file1=$DIR1/$tfile
393 local file2=$DIR2/$tfile
395 # to allocate grant because it may run out due to test_15.
396 lfs setstripe -c -1 $file1
397 dd if=/dev/zero of=$file1 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
398 dd if=/dev/zero of=$file2 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
401 lfs setstripe -c -1 $file1 # b=10919
402 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2
404 run_test 16 "$FSXNUM iterations of dual-mount fsx"
406 test_17() { # bug 3513, 3667
407 remote_ost_nodsh && skip "remote OST with nodsh" && return
409 lfs setstripe $DIR1/$tfile -i 0 -c 1
410 cp $SAMPLE_FILE $DIR1/$tfile
411 cancel_lru_locks osc > /dev/null
412 #define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a
413 do_facet ost1 lctl set_param fail_loc=0x8000030a
414 ls -ls $DIR1/$tfile | awk '{ print $1,$6 }' > $DIR1/$tfile-1 & \
415 ls -ls $DIR2/$tfile | awk '{ print $1,$6 }' > $DIR2/$tfile-2
417 diff -u $DIR1/$tfile-1 $DIR2/$tfile-2 || error "files are different"
419 run_test 17 "resource creation/LVB creation race ==============="
422 # turn e.g. ALWAYS_EXCEPT="18c" into "-e 3"
425 for idx in {a..z}; do
426 local ptr=EXCEPT_ALWAYS_18$idx
427 [ x${!ptr} = xtrue ] || continue
429 excepts="$excepts -e $(($(printf %d \'$idx)-96))"
432 $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2 $excepts
435 run_test 18 "mmap sanity check ================================="
437 test_19() { # bug3811
438 local node=$(facet_active_host ost1)
440 # check whether obdfilter is cache capable at all
441 if ! get_osd_param $node '' read_cache_enable >/dev/null; then
442 echo "not cache-capable obdfilter"
446 local MAX=$(get_osd_param $node '' readcache_max_filesize | \
448 set_osd_param $node '' readcache_max_filesize 4096
449 dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
450 local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
451 cp $TMP/$tfile $DIR1/$tfile
452 for i in `seq 1 20`; do
453 [ $((i % 5)) -eq 0 ] && log "$testname loop $i"
454 cancel_lru_locks osc > /dev/null
455 cksum $DIR1/$tfile | cut -d" " -f 1,2 > $TMP/sum1 & \
456 cksum $DIR2/$tfile | cut -d" " -f 1,2 > $TMP/sum2
458 [ "$(cat $TMP/sum1)" = "$SUM" ] || \
459 error "$DIR1/$tfile $(cat $TMP/sum1) != $SUM"
460 [ "$(cat $TMP/sum2)" = "$SUM" ] || \
461 error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
463 set_osd_param $node '' readcache_max_filesize $MAX
466 run_test 19 "test concurrent uncached read races ==============="
471 CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
472 $MULTIOP $DIR1/f20 Ow8190c
473 $MULTIOP $DIR2/f20 Oz8194w8190c
474 $MULTIOP $DIR1/f20 Oz0r8190c
476 CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
478 error $CNTD" page left in cache after lock cancel" || true
480 run_test 20 "test extra readahead page left in cache ===="
487 test_21() { # Bug 5907
488 test_mkdir $DIR1/$tdir
489 mount /etc $DIR1/$tdir --bind || error "mount failed" # Poor man's mount.
491 rmdir -v $DIR1/$tdir && error "Removed mounted directory"
492 rmdir -v $DIR2/$tdir && echo "Removed mounted directory from another mountpoint, needs to be fixed"
493 test -d $DIR1/$tdir || error "Mounted directory disappeared"
495 test -d $DIR2/$tdir || test -d $DIR1/$tdir && error "Removed dir still visible after umount"
498 run_test 21 " Try to remove mountpoint on another dir ===="
500 test_23() { # Bug 5972
501 local at_diff=$(do_facet $SINGLEMDS \
502 $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -n1)
503 echo "atime should be updated while another read" > $DIR1/$tfile
505 # clear the lock(mode: LCK_PW) gotten from creating operation
509 sleep $((at_diff + 1))
511 echo "starting reads"
512 multiop_bg_pause $DIR1/$tfile or20_c || return 1
513 # with SOM and opencache enabled, we need to close a file and cancel
514 # open lock to get atime propogated to MDS
515 kill -USR1 $! || return 2
518 time2=$(stat -c "%X" $DIR/$tfile)
519 echo "new atime is $time2"
521 [ $time2 -gt $time1 ] || error "atime was not updated"
522 rm -f $DIR1/$tfile || error "rm -f $DIR1/$tfile failed"
525 run_test 23 " others should see updated atime while another read===="
529 lfs df || error "lfs df failed"
530 lfs df -ih || error "lfs df -ih failed"
531 lfs df -h $DIR1 || error "lfs df -h $DIR1 failed"
532 lfs df -i $DIR2 || error "lfs df -i $DIR2 failed"
533 lfs df $DIR1/$tfile || error "lfs df $DIR1/$tfile failed"
534 lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
536 OSC=`lctl dl | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1`
537 # OSC=`lctl dl | awk '/-osc-/ {print $4}' | head -n 1`
538 lctl --device %$OSC deactivate
539 lfs df -i || error "lfs df -i with deactivated OSC failed"
540 lctl --device %$OSC activate
541 lfs df || error "lfs df with reactivated OSC failed"
543 run_test 24a "lfs df [-ih] [path] test ========================="
547 fsnum=$(lfs_df | grep -c "summary")
548 [ $fsnum -eq 2 ] || error "lfs df shows $fsnum != 2 filesystems."
550 run_test 24b "lfs df should show both filesystems ==============="
553 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
555 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
558 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
559 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
561 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
562 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
563 error "setfacl $DIR2/$tdir #1"
564 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
565 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
566 error "setfacl $DIR2/$tdir #2"
567 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
568 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
569 error "setfacl $DIR2/$tdir #3"
570 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
571 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
572 error "setfacl $DIR2/$tdir #4"
573 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
577 run_test 25a "change ACL on one mountpoint be seen on another ==="
580 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
582 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
584 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
587 $LFS mkdir -i 1 $DIR1/$tdir
588 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
589 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
591 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
592 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
593 error "setfacl $DIR2/$tdir #1"
594 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
595 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
596 error "setfacl $DIR2/$tdir #2"
597 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
598 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
599 error "setfacl $DIR2/$tdir #3"
600 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
601 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
602 error "setfacl $DIR2/$tdir #4"
603 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
607 run_test 25b "change ACL under remote dir on one mountpoint be seen on another"
610 utime $DIR1/f26a -s $DIR2/f26a || error
612 run_test 26a "allow mtime to get older"
617 echo "aaa" >> $DIR1/$tfile
619 chmod a+x $DIR2/$tfile
620 mt1=`stat -c %Y $DIR1/$tfile`
621 mt2=`stat -c %Y $DIR2/$tfile`
623 if [ x"$mt1" != x"$mt2" ]; then
624 error "not equal mtime, client1: "$mt1", client2: "$mt2"."
627 run_test 26b "sync mtime between ost and mds"
632 dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
637 dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
642 dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
644 lctl set_param -n ldlm.dump_namespaces ""
645 wait $DD1_PID $DD2_PID
646 [ $? -ne 0 ] && lctl dk $TMP/debug || true
648 run_test 27 "align non-overlapping extent locks from request ==="
650 test_28() { # bug 9977
651 ECHO_UUID="ECHO_osc1_UUID"
652 tOST=$($LCTL dl | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -n1)
654 $LFS setstripe $DIR1/$tfile -S 1048576 -i 0 -c 2
655 tOBJID=`$LFS getstripe $DIR1/$tfile | awk '$1 == 1 {print $2}'`
656 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
660 attach echo_client ECHO_osc1 $ECHO_UUID
664 tECHOID=`$LCTL dl | grep $ECHO_UUID | awk '{ print $1 }'`
665 $LCTL --device $tECHOID destroy "${tOBJID}:0"
673 # reading of 1st stripe should pass
674 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error
675 # reading of 2nd stripe should fail (this stripe was destroyed)
676 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 && error
678 # now, recreating test file
679 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2 || error
680 # reading of 1st stripe should pass
681 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error
682 # reading of 2nd stripe should pass
683 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 || error
685 run_test 28 "read/write/truncate file with lost stripes"
687 test_29() { # bug 10999
689 #define OBD_FAIL_LDLM_GLIMPSE 0x30f
690 lctl set_param fail_loc=0x8000030f
693 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1
696 #bug 11549 - permanently turn test off in b1_5
697 run_test 29 "lock put race between glimpse and enqueue ========="
699 test_30() { #bug #11110, LU-2523
700 test_mkdir -p $DIR1/$tdir
701 cp -f /bin/bash $DIR1/$tdir/bash
702 /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash;
703 cp /bin/bash $DIR2/$tdir' &
704 $DIR1/$tdir/bash -c 'sleep 2;
705 openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?'
710 run_test 30 "recreate file race"
713 test_mkdir -p $DIR1/$tdir || error "Creating dir $DIR1/$tdir"
714 local writes=$(LANG=C dd if=/dev/zero of=$DIR/$tdir/$tfile \
715 count=1 2>&1 | awk 'BEGIN { FS="+" } /out/ {print $1}')
716 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
717 lctl set_param fail_loc=0x314
718 local reads=$(LANG=C dd if=$DIR2/$tdir/$tfile of=/dev/null 2>&1 |
719 awk 'BEGIN { FS="+" } /in/ {print $1}')
720 [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
722 run_test 31a "voluntary cancel / blocking ast race=============="
725 remote_ost || { skip "local OST" && return 0; }
726 remote_ost_nodsh && skip "remote OST w/o dsh" && return 0
728 # make sure there is no local locks due to destroy
729 wait_mds_ost_sync || error "wait_mds_ost_sync()"
730 wait_delete_completed || error "wait_delete_completed()"
732 test_mkdir -p $DIR1/$tdir || error "Creating dir $DIR1/$tdir"
733 lfs setstripe $DIR/$tdir/$tfile -i 0 -c 1
734 cp /etc/hosts $DIR/$tdir/$tfile
735 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
736 lctl set_param fail_loc=0x314
737 #define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316
738 do_facet ost1 lctl set_param fail_loc=0x316
740 cat $DIR2/$tdir/$tfile > /dev/null 2>&1
741 lctl set_param fail_loc=0
742 do_facet ost1 lctl set_param fail_loc=0
743 # cleanup: reconnect the client back
746 run_test 31b "voluntary OST cancel / blocking ast race=============="
748 # enable/disable lockless truncate feature, depending on the arg 0/1
749 enable_lockless_truncate() {
750 lctl set_param -n osc.*.lockless_truncate $1
753 test_32a() { # bug 11270
754 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
755 save_lustre_params client "osc.*.lockless_truncate" > $p
757 enable_lockless_truncate 1
759 lfs setstripe -c -1 $DIR1/$tfile
760 dd if=/dev/zero of=$DIR1/$tfile count=$OSTCOUNT bs=$STRIPE_BYTES > \
764 log "checking cached lockless truncate"
765 $TRUNCATE $DIR1/$tfile 8000000
766 $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
767 [ $(calc_osc_stats lockless_truncate) -ne 0 ] ||
768 error "cached truncate isn't lockless"
770 log "checking not cached lockless truncate"
771 $TRUNCATE $DIR2/$tfile 5000000
772 $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
773 [ $(calc_osc_stats lockless_truncate) -ne 0 ] ||
774 error "not cached truncate isn't lockless"
776 log "disabled lockless truncate"
777 enable_lockless_truncate 0
779 $TRUNCATE $DIR2/$tfile 3000000
780 $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
781 [ $(calc_osc_stats lockless_truncate) -eq 0 ] ||
782 error "lockless truncate disabling failed"
784 # restore lockless_truncate default values
785 restore_lustre_params < $p
788 run_test 32a "lockless truncate"
790 test_32b() { # bug 11270
791 remote_ost_nodsh && skip "remote OST with nodsh" && return
794 local facets=$(get_facets OST)
795 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
797 save_lustre_params client "osc.*.contention_seconds" > $p
798 save_lustre_params $facets \
799 "ldlm.namespaces.filter-*.max_nolock_bytes" >> $p
800 save_lustre_params $facets \
801 "ldlm.namespaces.filter-*.contended_locks" >> $p
802 save_lustre_params $facets \
803 "ldlm.namespaces.filter-*.contention_seconds" >> $p
806 # agressive lockless i/o settings
807 for node in $(osts_nodes); do
808 do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 2000000; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 0; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 60'
810 lctl set_param -n osc.*.contention_seconds 60
811 for i in $(seq 5); do
812 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
813 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
815 [ $(calc_osc_stats lockless_write_bytes) -ne 0 ] || error "lockless i/o was not triggered"
816 # disable lockless i/o (it is disabled by default)
817 for node in $(osts_nodes); do
818 do_node $node 'lctl set_param -n ldlm.namespaces.filter-*.max_nolock_bytes 0; lctl set_param -n ldlm.namespaces.filter-*.contended_locks 32; lctl set_param -n ldlm.namespaces.filter-*.contention_seconds 0'
820 # set contention_seconds to 0 at client too, otherwise Lustre still
821 # remembers lock contention
822 lctl set_param -n osc.*.contention_seconds 0
824 for i in $(seq 1); do
825 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
826 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
828 [ $(calc_osc_stats lockless_write_bytes) -eq 0 ] ||
829 error "lockless i/o works when disabled"
831 restore_lustre_params <$p
834 run_test 32b "lockless i/o"
838 local mdts=$(get_facets MDS)
843 for mds in ${mdts//,/ }; do
845 dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
846 xargs readlink -f" ))
847 val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
850 stat=$(( stat + val))
855 # commit on sharing tests
857 remote_mds_nodsh && skip "remote MDS with nodsh" && return
859 [ -z "$CLIENTS" ] && skip "Need two or more clients, have $CLIENTS" && return 0
860 [ $CLIENTCOUNT -lt 2 ] &&
861 skip "Need two or more clients, have $CLIENTCOUNT" && return 0
863 local nfiles=${TEST33_NFILES:-10000}
864 local param_file=$TMP/$tfile-params
865 local fstype=$(facet_fstype $SINGLEMDS)
867 save_lustre_params $(get_facets MDS) \
868 "mdt.*.commit_on_sharing" > $param_file
876 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
880 do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
882 [ $fstype = ldiskfs ] && jbdold=$(print_jbd_stat)
883 echo "=== START createmany old: $jbdold transaction"
884 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")
885 [ $fstype = ldiskfs ] && jbdnew=$(print_jbd_stat)
886 [ $fstype = ldiskfs ] && jbd=$(( jbdnew - jbdold ))
887 echo "=== END createmany new: $jbdnew transaction : $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
888 [ $fstype = ldiskfs ] && avgjbd=$(( avgjbd + jbd ))
889 avgtime=$(( avgtime + elapsed ))
891 eval cos${COS}_jbd=$((avgjbd / 3))
892 eval cos${COS}_time=$((avgtime / 3))
895 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
896 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
897 [ "$cos0_jbd" != 0 ] && echo "COS=1 vs COS=0 jbd: $((((cos1_jbd/cos0_jbd - 1)) * 100 )) %"
898 [ "$cos0_time" != 0 ] && echo "COS=1 vs COS=0 time: $((((cos1_time/cos0_time - 1)) * 100 )) %"
900 restore_lustre_params < $param_file
904 run_test 33a "commit on sharing, cross crete/delete, 2 clients, benchmark"
906 # commit on sharing tests
908 remote_mds_nodsh && skip "remote MDS with nodsh" && return
910 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
911 [ $CLIENTCOUNT -ge 2 ] ||
912 { skip "Need two or more clients, have $CLIENTCOUNT" &&
914 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
916 local nfiles=${TEST33_NFILES:-10000}
917 local param_file=$TMP/$tfile-params
919 save_lustre_params $(get_facets MDS) \
920 "mdt.*.commit_on_sharing" > $param_file
929 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
933 do_node $CLIENT1 "$LFS mkdir -i $MDTIDX -p \
934 $DIR1/$tdir-\\\$(hostname)-$i"
936 jbdold=$(print_jbd_stat)
937 echo "=== START createmany old: $jbdold transaction"
938 local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2\
939 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- \
940 -r $DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > \
942 jbdnew=$(print_jbd_stat)
943 jbd=$(( jbdnew - jbdold ))
944 echo "=== END createmany new: $jbdnew transaction : \
945 $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
946 avgjbd=$(( avgjbd + jbd ))
947 avgtime=$(( avgtime + elapsed ))
949 eval cos${COS}_jbd=$((avgjbd / 3))
950 eval cos${COS}_time=$((avgtime / 3))
953 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
954 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
955 [ "$cos0_jbd" != 0 ] &&
956 echo "COS=1 vs COS=0 jbd: $(((cos1_jbd/cos0_jbd - 1) * 100)) %"
957 [ "$cos0_time" != 0 ] &&
958 echo "COS=1 vs COS=0 time: $(((cos1_time/cos0_time - 1) * 100)) %"
960 restore_lustre_params < $param_file
964 run_test 33b "COS: cross create/delete, 2 clients, benchmark under remote dir"
966 # End commit on sharing tests
968 get_ost_lock_timeouts() {
969 local nodes=${1:-$(comma_list $(osts_nodes))}
971 local locks=$(do_nodes $nodes \
972 "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
980 do_nodes $(comma_list $(osts_nodes)) \
981 "lctl set_param -n fail_loc=0 2>/dev/null || true"
982 for i in $(seq $OSTCOUNT); do
983 wait_osc_import_state client ost$i FULL
988 remote_ost_nodsh && skip "remote OST with nodsh" && return
992 trap cleanup_34 EXIT RETURN
993 for OPER in notimeout timeout ; do
994 rm $DIR1/$tfile 2>/dev/null
995 lock_in=$(get_ost_lock_timeouts)
996 if [ $OPER == "timeout" ] ; then
997 for j in `seq $OSTCOUNT`; do
998 #define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT 0x511
999 do_facet ost$j lctl set_param fail_loc=0x511
1001 echo lock should expire
1003 for j in `seq $OSTCOUNT`; do
1004 #define OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT 0x512
1005 do_facet ost$j lctl set_param fail_loc=0x512
1007 echo lock should not expire
1009 echo writing on client1
1010 dd if=/dev/zero of=$DIR1/$tfile count=100 conv=notrunc > /dev/null 2>&1
1012 echo reading on client2
1013 dd of=/dev/null if=$DIR2/$tfile > /dev/null 2>&1
1014 # wait for a lock timeout
1016 lock_out=$(get_ost_lock_timeouts)
1017 if [ $OPER == "timeout" ] ; then
1018 if [ $lock_in == $lock_out ]; then
1019 error "no lock timeout happened"
1024 if [ $lock_in != $lock_out ]; then
1025 error "lock timeout happened"
1033 run_test 34 "no lock timeout under IO"
1035 test_35() { # bug 17645
1038 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1039 awk '/generation/{print $2}')
1041 generation[count]=$g
1045 test_mkdir -p $MOUNT1/$tfile
1046 cancel_lru_locks mdc
1048 # Let's initiate -EINTR situation by setting fail_loc and take
1049 # write lock on same file from same client. This will not cause
1050 # bl_ast yet as lock is already in local cache.
1051 #define OBD_FAIL_LDLM_INTR_CP_AST 0x317
1052 do_facet client "lctl set_param fail_loc=0x80000317"
1053 local timeout=`do_facet $SINGLEMDS lctl get_param -n timeout`
1054 let timeout=timeout*3
1056 while test $nr -lt 10; do
1057 log "Race attempt $nr"
1058 local blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
1059 test "x$blk1" = "x" && blk1=0
1060 createmany -o $MOUNT2/$tfile/a 4000 &
1064 # Let's make conflict and bl_ast
1065 ls -la $MOUNT1/$tfile > /dev/null &
1068 log "Wait for $pid1 $pid2 for $timeout sec..."
1070 kill -9 $pid1 $pid2 > /dev/null 2>&1
1072 local blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
1073 test "x$blk2" = "x" && blk2=0
1074 test $blk2 -gt $blk1 && break
1075 rm -fr $MOUNT1/$tfile/*
1076 cancel_lru_locks mdc
1079 do_facet client "lctl set_param fail_loc=0x0"
1080 df -h $MOUNT1 $MOUNT2
1082 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1083 awk '/generation/{print $2}')
1085 if ! test "$g" -eq "${generation[count]}"; then
1086 list=$(lctl list_param mdc.$FSNAME-MDT*-mdc-*.import)
1088 for imp in $list; do
1089 if [ $c = $count ]; then
1094 imp=$(echo "$imp" | awk -F"." '{print $2}')
1095 error "Eviction happened on import $imp"
1100 run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
1102 test_36() { #bug 16417
1107 test_mkdir -p $DIR1/$tdir
1108 $LFS setstripe -c -1 $DIR1/$tdir
1111 let SIZE_B=SIZE*1024*1024
1112 sync; sleep 5; sync # wait for delete thread
1114 while [ $i -le 10 ]; do
1115 lctl mark "start test"
1116 local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1117 dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
1118 error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
1119 sync # sync data from client cache
1120 sync_all_data # sync data from server cache (delayed allocation)
1122 local after_dd=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1123 multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
1125 rm -f $DIR1/$tdir/$tfile
1126 kill -USR1 $read_pid
1128 wait_delete_completed
1129 local after=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1130 echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
1132 # this free space! not used
1133 (( $after_dd <= $after)) ||
1134 error "space leaked after_dd:$after_dd > after:$after"
1138 run_test 36 "handle ESTALE/open-unlink correctly"
1140 test_37() { # bug 18695
1141 test_mkdir -p $DIR1/$tdir
1142 multiop_bg_pause $DIR1/$tdir D_c || return 1
1144 # create large directory (32kB seems enough from e2fsck, ~= 1000 files)
1145 createmany -m $DIR2/$tdir/f 10000
1146 # set mtime/atime backward
1147 touch -t 198001010000 $DIR2/$tdir
1148 kill -USR1 $MULTIPID
1149 nr_files=`lfs find $DIR1/$tdir -type f | wc -l`
1150 [ $nr_files -eq 10000 ] || error "$nr_files != 10000 truncated directory?"
1153 run_test 37 "check i_size is not updated for directory on close (bug 18695) =============="
1155 # this should be set to past
1156 TEST_39_MTIME=`date -d "1 year ago" +%s`
1160 local client1=${CLIENT1:-`hostname`}
1161 local client2=${CLIENT2:-`hostname`}
1163 do_node $client1 "touch $DIR1/$tfile"
1165 do_node $client1 "touch -m -d @$TEST_39_MTIME $DIR1/$tfile"
1166 local mtime1=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1167 [ "$mtime1" = $TEST_39_MTIME ] || \
1168 error "mtime is not set to past: $mtime1, should be $TEST_39_MTIME"
1170 local d1=`do_node $client1 date +%s`
1171 do_node $client1 'echo hello >> '$DIR1/$tfile
1172 local d2=`do_node $client1 date +%s`
1174 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1175 [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] || \
1176 error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
1178 do_node $client1 "mv $DIR1/$tfile $DIR1/$tfile-1"
1180 for (( i=0; i < 2; i++ )) ; do
1181 local mtime3=`do_node $client2 "stat -c %Y $DIR1/$tfile-1"`
1182 [ "$mtime2" = "$mtime3" ] || \
1183 error "mtime ($mtime2) changed (to $mtime3) on rename"
1185 cancel_lru_locks osc
1186 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1189 run_test 39a "test from 11063 =================================="
1192 local client1=${CLIENT1:-`hostname`}
1193 local client2=${CLIENT2:-`hostname`}
1197 local mtime1=`stat -c %Y $DIR1/$tfile`
1198 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1201 touch -m -d @$TEST_39_MTIME $DIR1/$tfile
1203 for (( i=0; i < 2; i++ )) ; do
1204 local mtime3=`stat -c %Y $DIR1/$tfile`
1205 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1207 [ "$mtime3" = "$mtime4" ] || \
1208 error "different mtime on clients: $mtime3, $mtime4"
1209 [ "$mtime3" = $TEST_39_MTIME ] || \
1210 error "lost mtime: $mtime3, should be $TEST_39_MTIME"
1212 cancel_lru_locks osc
1213 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1216 run_test 39b "11063 problem 1 =================================="
1219 local client1=${CLIENT1:-`hostname`}
1220 local client2=${CLIENT2:-`hostname`}
1222 echo hello > $DIR1/$tfile
1224 local mtime1=`stat -c %Y $DIR1/$tfile`
1225 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1226 [ "$mtime1" = "$mtime2" ] || \
1227 error "create: different mtime on clients: $mtime1, $mtime2"
1230 $TRUNCATE $DIR1/$tfile 1
1232 for (( i=0; i < 2; i++ )) ; do
1233 local mtime3=`stat -c %Y $DIR1/$tfile`
1234 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1236 [ "$mtime3" = "$mtime4" ] || \
1237 error "different mtime on clients: $mtime3, $mtime4"
1238 [ "$mtime3" -gt $mtime2 ] || \
1239 error "truncate did not update mtime: $mtime2, $mtime3"
1241 cancel_lru_locks osc
1242 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1245 run_test 39c "check truncate mtime update ======================"
1247 # check that pid exists hence second operation wasn't blocked by first one
1248 # if it is so then there is no conflict, return 0
1249 # else second operation is conflicting with first one, return 1
1250 check_pdo_conflict() {
1253 sleep 1 # to ensure OP1 is finished on client if OP2 is blocked by OP1
1254 if [[ `ps --pid $pid | wc -l` == 1 ]]; then
1264 # test 40: check non-blocking operations
1266 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1267 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1268 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1270 mkdir $DIR1/$tfile &
1273 touch $DIR2/$tfile-2
1274 check_pdo_conflict $PID1 || error "create is blocked"
1275 mkdir $DIR2/$tfile-3
1276 check_pdo_conflict $PID1 || error "mkdir is blocked"
1277 link $DIR2/$tfile-2 $DIR2/$tfile-4
1278 check_pdo_conflict $PID1 || error "link is blocked"
1279 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1280 check_pdo_conflict $PID1 || error "rename is blocked"
1281 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1282 check_pdo_conflict $PID1 || error "getattr is blocked"
1283 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1284 rmdir $DIR2/$tfile-3
1285 check_pdo_conflict $PID1 || error "unlink is blocked"
1287 # all operations above shouldn't wait the first one
1288 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1293 run_test 40a "pdirops: create vs others =============="
1296 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1297 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1298 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1299 touch $DIR1/$tfile &
1303 touch $DIR2/$tfile-2
1304 check_pdo_conflict $PID1 || error "create is blocked"
1305 mkdir $DIR2/$tfile-3
1306 check_pdo_conflict $PID1 || error "mkdir is blocked"
1307 link $DIR2/$tfile-2 $DIR2/$tfile-4
1308 check_pdo_conflict $PID1 || error "link is blocked"
1309 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1310 check_pdo_conflict $PID1 || error "rename is blocked"
1311 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1312 check_pdo_conflict $PID1 || error "getattr is blocked"
1313 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1314 rmdir $DIR2/$tfile-3
1315 check_pdo_conflict $PID1 || error "unlink is blocked"
1316 # all operations above shouldn't wait the first one
1318 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1323 run_test 40b "pdirops: open|create and others =============="
1326 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1328 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1329 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1330 link $DIR1/$tfile $DIR1/$tfile-0 &
1334 touch $DIR2/$tfile-2
1335 check_pdo_conflict $PID1 || error "create is blocked"
1336 mkdir $DIR2/$tfile-3
1337 check_pdo_conflict $PID1 || error "mkdir is blocked"
1338 link $DIR2/$tfile-2 $DIR2/$tfile-4
1339 check_pdo_conflict $PID1 || error "link is blocked"
1340 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1341 check_pdo_conflict $PID1 || error "rename is blocked"
1342 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1343 check_pdo_conflict $PID1 || error "getattr is blocked"
1344 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1345 rmdir $DIR2/$tfile-3
1346 check_pdo_conflict $PID1 || error "unlink is blocked"
1348 # all operations above shouldn't wait the first one
1349 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1354 run_test 40c "pdirops: link and others =============="
1357 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1359 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1360 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1365 touch $DIR2/$tfile-2
1366 check_pdo_conflict $PID1 || error "create is blocked"
1367 mkdir $DIR2/$tfile-3
1368 check_pdo_conflict $PID1 || error "mkdir is blocked"
1369 link $DIR2/$tfile-2 $DIR2/$tfile-4
1370 check_pdo_conflict $PID1 || error "link is blocked"
1371 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1372 check_pdo_conflict $PID1 || error "rename is blocked"
1373 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1374 check_pdo_conflict $PID1 || error "getattr is blocked"
1375 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1376 rmdir $DIR2/$tfile-3
1377 check_pdo_conflict $PID1 || error "unlink is blocked"
1379 # all operations above shouldn't wait the first one
1380 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1384 run_test 40d "pdirops: unlink and others =============="
1387 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1389 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1390 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1391 mv $DIR1/$tfile $DIR1/$tfile-0 &
1395 touch $DIR2/$tfile-2
1396 check_pdo_conflict $PID1 || error "create is blocked"
1397 mkdir $DIR2/$tfile-3
1398 check_pdo_conflict $PID1 || error "mkdir is blocked"
1399 link $DIR2/$tfile-2 $DIR2/$tfile-4
1400 check_pdo_conflict $PID1 || error "link is blocked"
1401 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1402 check_pdo_conflict $PID1 || error "getattr is blocked"
1403 rm $DIR2/$tfile-4 $DIR2/$tfile-2
1404 rmdir $DIR2/$tfile-3
1405 check_pdo_conflict $PID1 || error "unlink is blocked"
1407 # all operations above shouldn't wait the first one
1408 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1413 run_test 40e "pdirops: rename and others =============="
1415 # test 41: create blocking operations
1417 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1418 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1419 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1422 mkdir $DIR2/$tfile && error "mkdir must fail"
1423 check_pdo_conflict $PID1 && { wait $PID1; echo "mkdir isn't blocked"; }
1427 run_test 41a "pdirops: create vs mkdir =============="
1430 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1431 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1432 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1435 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1436 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1440 run_test 41b "pdirops: create vs create =============="
1443 touch $DIR1/$tfile-2
1444 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1445 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1446 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1449 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1450 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1454 run_test 41c "pdirops: create vs link =============="
1457 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1458 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1459 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1462 rm $DIR2/$tfile || error "unlink must succeed"
1463 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1467 run_test 41d "pdirops: create vs unlink =============="
1470 touch $DIR1/$tfile-2
1471 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1472 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1473 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1476 mv $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1477 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1481 run_test 41e "pdirops: create and rename (tgt) =============="
1484 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1485 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1486 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1489 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1490 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1494 run_test 41f "pdirops: create and rename (src) =============="
1497 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1498 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1499 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1502 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1503 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1507 run_test 41g "pdirops: create vs getattr =============="
1510 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1511 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1512 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1515 ls -lia $DIR2/ > /dev/null
1516 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1520 run_test 41h "pdirops: create vs readdir =============="
1522 # test 42: unlink and blocking operations
1524 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1525 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1526 mkdir $DIR1/$tfile &
1529 mkdir $DIR2/$tfile && error "mkdir must fail"
1530 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1534 run_test 42a "pdirops: mkdir vs mkdir =============="
1537 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1538 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1539 mkdir $DIR1/$tfile &
1542 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1543 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1547 run_test 42b "pdirops: mkdir vs create =============="
1550 touch $DIR1/$tfile-2
1551 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1552 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1553 mkdir $DIR1/$tfile &
1556 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1557 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1561 run_test 42c "pdirops: mkdir vs link =============="
1564 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1565 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1566 mkdir $DIR1/$tfile &
1569 rmdir $DIR2/$tfile || error "unlink must succeed"
1570 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1574 run_test 42d "pdirops: mkdir vs unlink =============="
1577 touch $DIR1/$tfile-2
1578 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1579 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1580 mkdir $DIR1/$tfile &
1583 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
1584 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1588 run_test 42e "pdirops: mkdir and rename (tgt) =============="
1591 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1592 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1593 mkdir $DIR1/$tfile &
1596 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1597 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1601 run_test 42f "pdirops: mkdir and rename (src) =============="
1604 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1605 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1606 mkdir $DIR1/$tfile &
1609 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1610 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1614 run_test 42g "pdirops: mkdir vs getattr =============="
1617 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1618 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1619 mkdir $DIR1/$tfile &
1622 ls -lia $DIR2/ > /dev/null
1623 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1627 run_test 42h "pdirops: mkdir vs readdir =============="
1629 # test 43: unlink and blocking operations
1632 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1633 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1637 mkdir $DIR2/$tfile || error "mkdir must succeed"
1638 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1642 run_test 43a "pdirops: unlink vs mkdir =============="
1646 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1647 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1651 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
1652 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1656 run_test 43b "pdirops: unlink vs create =============="
1660 touch $DIR1/$tfile-2
1661 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1662 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1666 link $DIR2/$tfile-2 $DIR2/$tfile || error "link must succeed"
1667 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1671 run_test 43c "pdirops: unlink vs link =============="
1675 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1676 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1680 rm $DIR2/$tfile && error "unlink must fail"
1681 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1685 run_test 43d "pdirops: unlink vs unlink =============="
1689 touch $DIR1/$tfile-2
1690 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1691 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1695 mv -u $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1696 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1700 run_test 43e "pdirops: unlink and rename (tgt) =============="
1704 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1705 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1709 mv $DIR2/$tfile $DIR2/$tfile-2 && error "rename must fail"
1710 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1714 run_test 43f "pdirops: unlink and rename (src) =============="
1718 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1719 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1723 stat $DIR2/$tfile > /dev/null && error "stat must fail"
1724 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1728 run_test 43g "pdirops: unlink vs getattr =============="
1732 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1733 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1737 ls -lia $DIR2/ > /dev/null
1738 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1742 run_test 43h "pdirops: unlink vs readdir =============="
1745 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1747 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1748 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1752 $LFS mkdir -i 1 $DIR2/$tfile || error "remote mkdir must succeed"
1753 check_pdo_conflict $PID1 &&
1754 { wait $PID1; error "remote mkdir isn't blocked"; }
1758 run_test 43i "pdirops: unlink vs remote mkdir"
1760 # test 44: rename tgt and blocking operations
1762 touch $DIR1/$tfile-2
1763 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1764 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1765 mv $DIR1/$tfile-2 $DIR1/$tfile &
1768 mkdir $DIR2/$tfile && error "mkdir must fail"
1769 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1773 run_test 44a "pdirops: rename tgt vs mkdir =============="
1776 touch $DIR1/$tfile-2
1777 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1778 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1779 mv $DIR1/$tfile-2 $DIR1/$tfile &
1782 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1783 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1787 run_test 44b "pdirops: rename tgt vs create =============="
1790 touch $DIR1/$tfile-2
1791 touch $DIR1/$tfile-3
1792 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1793 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1794 mv $DIR1/$tfile-2 $DIR1/$tfile &
1797 link $DIR2/$tfile-3 $DIR2/$tfile && error "link must fail"
1798 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1802 run_test 44c "pdirops: rename tgt vs link =============="
1805 touch $DIR1/$tfile-2
1806 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1807 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1808 mv $DIR1/$tfile-2 $DIR1/$tfile &
1811 rm $DIR2/$tfile || error "unlink must succeed"
1812 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1816 run_test 44d "pdirops: rename tgt vs unlink =============="
1820 touch $DIR1/$tfile-2
1821 touch $DIR1/$tfile-3
1822 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1823 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1824 mv $DIR1/$tfile-2 $DIR1/$tfile &
1827 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
1828 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1832 run_test 44e "pdirops: rename tgt and rename (tgt) =============="
1835 touch $DIR1/$tfile-2
1836 touch $DIR1/$tfile-3
1837 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1838 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1839 mv $DIR1/$tfile-2 $DIR1/$tfile &
1842 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
1843 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1847 run_test 44f "pdirops: rename tgt and rename (src) =============="
1850 touch $DIR1/$tfile-2
1851 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1852 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1853 mv $DIR1/$tfile-2 $DIR1/$tfile &
1856 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1857 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1861 run_test 44g "pdirops: rename tgt vs getattr =============="
1864 touch $DIR1/$tfile-2
1865 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1866 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1867 mv $DIR1/$tfile-2 $DIR1/$tfile &
1870 ls -lia $DIR2/ > /dev/null
1871 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1875 run_test 44h "pdirops: rename tgt vs readdir =============="
1877 # test 44: rename tgt and blocking operations
1879 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1880 touch $DIR1/$tfile-2
1881 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1882 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1883 mv $DIR1/$tfile-2 $DIR1/$tfile &
1886 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
1887 check_pdo_conflict $PID1 && { wait $PID1;
1888 error "remote mkdir isn't blocked"; }
1892 run_test 44i "pdirops: rename tgt vs remote mkdir"
1894 # test 45: rename src and blocking operations
1897 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1898 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1899 mv $DIR1/$tfile $DIR1/$tfile-2 &
1902 mkdir $DIR2/$tfile || error "mkdir must succeed"
1903 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1907 run_test 45a "pdirops: rename src vs mkdir =============="
1911 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1912 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1913 mv $DIR1/$tfile $DIR1/$tfile-2 &
1916 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
1917 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1921 run_test 45b "pdirops: rename src vs create =============="
1925 touch $DIR1/$tfile-3
1926 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1927 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1928 mv $DIR1/$tfile $DIR1/$tfile-2 &
1931 link $DIR2/$tfile-3 $DIR2/$tfile || error "link must succeed"
1932 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1936 run_test 45c "pdirops: rename src vs link =============="
1940 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1941 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1942 mv $DIR1/$tfile $DIR1/$tfile-2 &
1945 rm $DIR2/$tfile && error "unlink must fail"
1946 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1950 run_test 45d "pdirops: rename src vs unlink =============="
1954 touch $DIR1/$tfile-3
1955 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1956 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1957 mv $DIR1/$tfile $DIR1/$tfile-2 &
1960 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
1961 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1965 run_test 45e "pdirops: rename src and rename (tgt) =============="
1969 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1970 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1971 mv $DIR1/$tfile $DIR1/$tfile-2 &
1974 mv $DIR2/$tfile $DIR2/$tfile-3 && error "rename must fail"
1975 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1979 run_test 45f "pdirops: rename src and rename (src) =============="
1983 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1984 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1985 mv $DIR1/$tfile $DIR1/$tfile-2 &
1988 stat $DIR2/$tfile > /dev/null && error "stat must fail"
1989 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1993 run_test 45g "pdirops: rename src vs getattr =============="
1997 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1998 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1999 mv $DIR1/$tfile $DIR1/$tfile-2 &
2002 ls -lia $DIR2/ > /dev/null
2003 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
2007 run_test 45h "pdirops: unlink vs readdir =============="
2010 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2012 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2013 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2014 mv $DIR1/$tfile $DIR1/$tfile-2 &
2017 $LFS mkdir -i 1 $DIR2/$tfile || error "create remote dir must succeed"
2018 check_pdo_conflict $PID1 && { wait $PID1;
2019 error "create remote dir isn't blocked"; }
2023 run_test 45i "pdirops: rename src vs remote mkdir"
2025 # test 46: link and blocking operations
2027 touch $DIR1/$tfile-2
2028 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2029 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2030 link $DIR1/$tfile-2 $DIR1/$tfile &
2033 mkdir $DIR2/$tfile && error "mkdir must fail"
2034 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2038 run_test 46a "pdirops: link vs mkdir =============="
2041 touch $DIR1/$tfile-2
2042 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2043 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2044 link $DIR1/$tfile-2 $DIR1/$tfile &
2047 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2048 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2052 run_test 46b "pdirops: link vs create =============="
2055 touch $DIR1/$tfile-2
2056 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2057 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2058 link $DIR1/$tfile-2 $DIR1/$tfile &
2061 link $DIR2/$tfile $DIR2/$tfile && error "link must fail"
2062 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2066 run_test 46c "pdirops: link vs link =============="
2069 touch $DIR1/$tfile-2
2070 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2071 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2072 link $DIR1/$tfile-2 $DIR1/$tfile &
2075 rm $DIR2/$tfile || error "unlink must succeed"
2076 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2080 run_test 46d "pdirops: link vs unlink =============="
2083 touch $DIR1/$tfile-2
2084 touch $DIR1/$tfile-3
2085 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2086 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2087 link $DIR1/$tfile-2 $DIR1/$tfile &
2090 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2091 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2095 run_test 46e "pdirops: link and rename (tgt) =============="
2098 touch $DIR1/$tfile-2
2099 touch $DIR1/$tfile-3
2100 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2101 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2102 link $DIR1/$tfile-2 $DIR1/$tfile &
2105 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
2106 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2110 run_test 46f "pdirops: link and rename (src) =============="
2113 touch $DIR1/$tfile-2
2114 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2115 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2116 link $DIR1/$tfile-2 $DIR1/$tfile &
2119 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2120 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2124 run_test 46g "pdirops: link vs getattr =============="
2127 touch $DIR1/$tfile-2
2128 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2129 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2130 link $DIR1/$tfile-2 $DIR1/$tfile &
2133 ls -lia $DIR2/ > /dev/null
2134 check_pdo_conflict $PID1 && { wait $PID1;
2135 error "readdir isn't blocked"; }
2139 run_test 46h "pdirops: link vs readdir =============="
2142 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2143 touch $DIR1/$tfile-2
2144 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2145 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2146 link $DIR1/$tfile-2 $DIR1/$tfile &
2149 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
2150 check_pdo_conflict $PID1 && { wait $PID1;
2151 error "remote mkdir isn't blocked"; }
2155 run_test 46i "pdirops: link vs remote mkdir"
2157 # test 47: remote mkdir and blocking operations
2159 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2160 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2161 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2162 $LFS mkdir -i 1 $DIR1/$tfile &
2165 mkdir $DIR2/$tfile && error "mkdir must fail"
2166 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2170 run_test 47a "pdirops: remote mkdir vs mkdir"
2173 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2174 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2175 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2176 $LFS mkdir -i 1 $DIR1/$tfile &
2179 multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2180 check_pdo_conflict $PID1 && { wait $PID1;
2181 error "create isn't blocked"; }
2185 run_test 47b "pdirops: remote mkdir vs create"
2188 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2189 touch $DIR1/$tfile-2
2190 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2191 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2192 $LFS mkdir -i 1 $DIR1/$tfile &
2195 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
2196 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2200 run_test 47c "pdirops: remote mkdir vs link"
2203 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2204 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2205 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2206 $LFS mkdir -i 1 $DIR1/$tfile &
2209 rmdir $DIR2/$tfile || error "unlink must succeed"
2210 check_pdo_conflict $PID1 && { wait $PID1;
2211 error "unlink isn't blocked"; }
2215 run_test 47d "pdirops: remote mkdir vs unlink"
2218 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2219 touch $DIR1/$tfile-2
2220 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2221 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2222 $LFS mkdir -i 1 $DIR1/$tfile &
2225 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
2226 check_pdo_conflict $PID1 && { wait $PID1;
2227 error "rename isn't blocked"; }
2231 run_test 47e "pdirops: remote mkdir and rename (tgt)"
2234 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2235 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2236 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2237 $LFS mkdir -i 1 $DIR1/$tfile &
2240 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
2241 check_pdo_conflict $PID1 && { wait $PID1;
2242 error "rename isn't blocked"; }
2246 run_test 47f "pdirops: remote mkdir and rename (src)"
2249 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2250 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2251 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2252 $LFS mkdir -i 1 $DIR1/$tfile &
2255 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2256 check_pdo_conflict $PID1 && { wait $PID1;
2257 error "getattr isn't blocked"; }
2261 run_test 47g "pdirops: remote mkdir vs getattr"
2265 dd if=/dev/zero of=$DIR1/$tfile bs=1K count=10
2266 #define OBD_FAIL_OSC_CP_ENQ_RACE 0x410
2267 do_facet client "lctl set_param fail_loc=0x410"
2268 $TRUNCATE $DIR2/$tfile $trunc_size
2269 do_facet client "lctl set_param fail_loc=0x0"
2271 size=`stat -c %s $DIR2/$tfile`
2272 [ $size -eq $trunc_size ] || error "wrong size"
2274 run_test 50 "osc lvb attrs: enqueue vs. CP AST =============="
2278 local origfile=/etc/hosts
2280 filesize=`stat -c %s $origfile`
2282 # create an empty file
2283 $MCREATE $DIR1/$tfile
2284 # cache layout lock on both mount point
2285 stat $DIR1/$tfile > /dev/null
2286 stat $DIR2/$tfile > /dev/null
2288 # open and sleep 2 seconds then read
2289 $MULTIOP $DIR2/$tfile o_2r${filesize}c &
2293 # create the layout of testing file
2294 dd if=$origfile of=$DIR1/$tfile conv=notrunc > /dev/null
2296 # MULTIOP proc should be able to read enough bytes and exit
2298 kill -0 $pid && error "multiop is still there"
2299 cmp $origfile $DIR2/$tfile || error "$MCREATE and $DIR2/$tfile differs"
2303 run_test 51a "layout lock: refresh layout should work"
2306 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.59) ]] ||
2307 { skip "Need MDS version at least 2.3.59"; return 0; }
2309 local tmpfile=`mktemp`
2311 # create an empty file
2312 $MCREATE $DIR1/$tfile
2314 # delay glimpse so that layout has changed when glimpse finish
2315 #define OBD_FAIL_GLIMPSE_DELAY 0x1404
2316 $LCTL set_param fail_loc=0x1404
2317 stat -c %s $DIR2/$tfile |tee $tmpfile &
2321 # create layout of testing file
2322 dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc > /dev/null
2325 local fsize=`cat $tmpfile`
2327 [ x$fsize = x1024 ] || error "file size is $fsize, should be 1024"
2329 rm -f $DIR1/$tfile $tmpfile
2331 run_test 51b "layout lock: glimpse should be able to restart if layout changed"
2334 [ $OSTCOUNT -ge 2 ] || { skip "need at least 2 osts"; return; }
2336 # set default layout to have 1 stripe
2337 mkdir -p $DIR1/$tdir
2338 $LFS setstripe -c 1 $DIR1/$tdir
2340 # create a file with empty layout
2341 $MCREATE $DIR1/$tdir/$tfile
2343 #define OBD_FAIL_MDS_LL_BLOCK 0x172
2344 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x172
2346 # change the layout of testing file
2347 echo "Setting layout to have $OSTCOUNT stripes ..."
2348 $LFS setstripe -c $OSTCOUNT $DIR1/$tdir/$tfile &
2352 # write something to the file, it should be blocked on fetching layout
2353 dd if=/dev/zero of=$DIR2/$tdir/$tfile bs=1k count=1 conv=notrunc
2354 local cnt=$($LFS getstripe -c $DIR2/$tdir/$tfile)
2355 [ $cnt -eq $OSTCOUNT ] || error "have $cnt stripes, expected $OSTCOUNT"
2359 run_test 51c "layout lock: IT_LAYOUT blocked and correct layout can be returned"
2362 dd if=/dev/zero of=/$DIR1/$tfile bs=1M count=1
2363 cancel_lru_locks mdc
2365 # open should grant LAYOUT lock, mmap and read will install pages
2366 $MULTIOP $DIR1/$tfile oO_RDWR:SMR_Uc &
2370 # rss before revoking
2371 local br=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2372 echo "Before revoking layout lock: $br KB mapped"
2374 # delete the file will revoke layout lock
2377 # rss after revoking
2378 local ar=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2383 [ $ar -eq 0 ] || error "rss before: $br, after $ar, some pages remained"
2385 run_test 51d "layout lock: losing layout lock should clean up memory map region"
2389 echo "==> rename vs getattr vs setxattr should not deadlock"
2390 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2392 do_facet mds $LCTL set_param fail_loc=$1
2394 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2402 setfattr -n user.attr1 -v value1 $DIR2/d1 || error "(2) setfattr failed"
2403 wait $PID1 || error "(3) mv failed"
2404 wait $PID2 || error "(4) stat failed"
2411 echo "==> rename vs getattr vs open vs getattr should not deadlock"
2412 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2414 do_facet mds $LCTL set_param fail_loc=$1
2416 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2424 $MULTIOP $DIR2/d1/d2 Oc &
2428 stat $DIR/d1 || error "(2) stat failed"
2430 wait $PID1 || error "(3) mv failed"
2431 wait $PID2 || error "(4) stat failed"
2432 wait $PID3 && error "(5) multiop failed"
2438 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
2439 save_lustre_params client "llite.*.xattr_cache" > $p
2440 lctl set_param llite.*.xattr_cache 1 ||
2441 { skip "xattr cache is not supported"; return 0; }
2443 #define OBD_FAIL_MDS_RENAME 0x153
2444 #define OBD_FAIL_MDS_RENAME2 0x154
2445 test_54_part1 0x80000153 || error 10
2446 test_54_part1 0x80000154 || error 11
2447 test_54_part2 0x80000153 || error 12
2448 test_54_part2 0x80000154 || error 13
2450 restore_lustre_params < $p
2453 run_test 54 "rename locking"
2456 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2458 #define OBD_FAIL_MDS_RENAME4 0x156
2459 do_facet mds $LCTL set_param fail_loc=0x80000156
2461 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2466 wait $PID1 && error "(2) mv succeeded"
2470 run_test 55a "rename vs unlink target dir"
2474 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2476 #define OBD_FAIL_MDS_RENAME4 0x156
2477 do_facet mds $LCTL set_param fail_loc=0x80000156
2479 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2484 wait $PID1 && error "(2) mv succeeded"
2488 run_test 55b "rename vs unlink source dir"
2492 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2494 #define OBD_FAIL_MDS_RENAME4 0x156
2495 do_facet mds $LCTL set_param fail_loc=0x156
2497 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2501 # while rename is sleeping, open and remove d3
2502 $MULTIOP $DIR2/d3 D_c &
2508 # while rename is sleeping 2nd time, close d3
2510 wait $PID2 || error "(3) multiop failed"
2512 wait $PID1 && error "(2) mv succeeded"
2516 run_test 55c "rename vs unlink orphan target dir"
2522 #define OBD_FAIL_MDS_RENAME3 0x155
2523 do_facet mds $LCTL set_param fail_loc=0x155
2524 mv $DIR/f1 $DIR/$tdir &
2528 # while rename is sleeping, create $tdir, but as a directory
2529 mkdir -p $DIR2/$tdir || error "(1) mkdir failed"
2531 # link in reverse locking order
2532 ln $DIR2/f1 $DIR2/$tdir/
2534 wait $PID1 && error "(2) mv succeeded"
2537 run_test 55d "rename file vs link"
2540 local MDSVER=$(lustre_build_version $SINGLEMDS)
2541 [ $(version_code $MDSVER) -lt $(version_code 2.3.0) ] &&
2542 skip "MDS version $MDSVER must be >= 2.3.0" && return 0
2545 test_mkdir -p $DIR1/$tdir
2546 file1=$DIR1/$tdir/file
2547 file2=$DIR2/$tdir/file
2549 echo orig > $file2 || error "Could not create $file2"
2550 version=$($LFS data_version $file1)
2553 echo append >> $file2 || error "Could not append to $file2"
2554 version2=$($LFS data_version $file1)
2555 [ "$version" != "$version2" ] ||
2556 error "append did not change data version: $version"
2559 echo overwrite > $file2 || error "Could not overwrite $file2"
2560 version3=$($LFS data_version $file1)
2561 [ "$version2" != "$version3" ] ||
2562 error "overwrite did not change data version: $version2"
2564 # Truncate before EOF
2565 $TRUNCATE $file2 3 || error "Could not truncate $file2"
2566 version4=$($LFS data_version $file1)
2567 [ "$version3" != "$version4" ] ||
2568 error "truncate did not change data version: $version3"
2570 # Truncate after EOF
2571 $TRUNCATE $file2 123456 || error "Could not truncate $file2"
2572 version5=$($LFS data_version $file1)
2573 [ "$version4" != "$version5" ] ||
2574 error "truncate did not change data version: $version4"
2576 # Chmod do not change version
2577 chmod 400 $file2 || error "Could not chmod 400 $file2"
2578 version6=$($LFS data_version $file1)
2579 [ "$version5" == "$version6" ] ||
2580 error "chmod should not change data version: $version5 != $version6"
2582 # Chown do not change version
2583 chown $RUNAS_ID $file2 || error "Could not chown $RUNAS_ID $file2"
2584 version7=$($LFS data_version $file1)
2585 [ "$version5" == "$version7" ] ||
2586 error "chown should not change data version: $version5 != $version7"
2588 run_test 60 "Verify data_version behaviour"
2591 local test_dir=$tdir/test_dir
2593 mkdir -p $DIR1/$tdir
2594 if [ $MDSCOUNT -ge 2 ]; then
2596 $LFS mkdir -i $MDTIDX $DIR1/$test_dir ||
2597 error "Create remote directory failed"
2599 mkdir -p $DIR1/$test_dir
2601 cd $DIR2/$test_dir || error "cd directory failed"
2602 rm -rf $DIR1/$test_dir || error "unlink directory failed"
2604 cd $DIR2/$tdir || error "exit directory"
2606 run_test 70a "cd directory && rm directory"
2608 test_70b() { # LU-2781
2610 mkdir -p $DIR1/$tdir
2612 touch $DIR1/$tdir/file
2613 for ((i = 0; i < 32; i++)); do
2614 $LFS rm_entry $DIR1/$tdir/non_existent_dir &>/dev/null
2616 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2618 touch $DIR1/$tdir/file
2619 $LFS mkdir -i0 $DIR1/$tdir/test_dir
2620 $LFS rm_entry $DIR1/$tdir/test_dir &>/dev/null
2621 rm -rf $DIR1/$tdir/test_dir ||
2622 error "cannot remove directory after rm_entry"
2623 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2625 run_test 70b "remove files after calling rm_entry"
2628 local server_version=$(lustre_version_code $SINGLEMDS)
2630 [[ $server_version -lt $(version_code 2.1.6) ]] &&
2631 skip "Need MDS version at least 2.1.6" && return
2633 # Patch not applied to 2.2 and 2.3 branches
2634 [[ $server_version -ge $(version_code 2.2.0) ]] &&
2635 [[ $server_version -lt $(version_code 2.4.0) ]] &&
2636 skip "Need MDS version at least 2.4.0" && return
2638 checkfiemap --test ||
2639 { skip "checkfiemap not runnable: $?" && return; }
2640 # write data this way: hole - data - hole - data
2641 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2642 [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR1/$tfile) + 1)))" = \
2644 skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
2645 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2646 GET_STAT="lctl get_param -n ldlm.services.ldlm_cbd.stats"
2648 local can1=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2650 checkfiemap $DIR2/$tfile 81920 ||
2651 error "data is not flushed from client"
2652 local can2=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2655 # common case of "create file, copy file" on a single node
2656 # should not flush data from ost
2657 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2658 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2660 local can3=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2662 checkfiemap $DIR1/$tfile 81920 ||
2664 local can4=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2666 [ $can3 -eq $can4 ] || error $((can2-can1)) "cancel RPC occured."
2668 run_test 71 "correct file map just after write operation is finished"
2671 local p="$TMP/sanityN-$TESTNAME.parameters"
2674 save_lustre_params client "llite.*.xattr_cache" > $p
2675 lctl set_param llite.*.xattr_cache 1 ||
2676 { skip "xattr cache is not supported"; return 0; }
2679 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2680 error "setfattr1 failed"
2681 getfattr -n user.attr1 $DIR2/$tfile | grep value1 ||
2682 error "getfattr1 failed"
2683 setfattr -n user.attr1 -v value2 $DIR2/$tfile ||
2684 error "setfattr2 failed"
2685 getfattr -n user.attr1 $DIR1/$tfile | grep value2 ||
2686 error "getfattr2 failed"
2688 # check that trusted.link is consistent
2689 tlink1=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2690 ln $DIR2/$tfile $DIR2/$tfile-2 || error "failed to link"
2691 tlink2=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2692 echo "$tlink1 $tlink2"
2693 [ "$tlink1" = "$tlink2" ] && error "trusted.link should have changed!"
2697 restore_lustre_params < $p
2700 run_test 72 "getxattr/setxattr cache should be consistent between nodes"
2703 local p="$TMP/sanityN-$TESTNAME.parameters"
2704 save_lustre_params client "llite.*.xattr_cache" > $p
2705 lctl set_param llite.*.xattr_cache 1 ||
2706 { skip "xattr cache is not supported"; return 0; }
2709 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2710 error "setfattr1 failed"
2711 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr1 failed"
2712 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr2 failed"
2714 # PR lock should be cached by now on both clients
2715 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr3 failed"
2716 # 2 hits for getfattr(0)+getfattr(size)
2717 [ $(calc_llite_stats getxattr_hits) -eq 2 ] || error "not cached in $DIR1"
2718 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr4 failed"
2719 # 4 hits for more getfattr(0)+getfattr(size)
2720 [ $(calc_llite_stats getxattr_hits) -eq 4 ] || error "not cached in $DIR2"
2723 restore_lustre_params < $p
2726 run_test 73 "getxattr should not cause xattr lock cancellation"
2729 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.93) ] &&
2730 skip "Need MDS version at least 2.4.93" && return
2732 dd if=/dev/zero of=$DIR1/$tfile-1 bs=1K count=1
2733 dd if=/dev/zero of=$DIR1/$tfile-2 bs=1K count=1
2734 flocks_test 4 $DIR1/$tfile-1 $DIR2/$tfile-2
2736 run_test 74 "flock deadlock: different mounts =============="
2740 $LFS setstripe -c 2 -S 1m -i 0 $DIR1/$tfile
2741 dd if=/dev/zero of=$DIR1/$tfile bs=1M count=2
2742 cancel_lru_locks osc
2744 dd of=$DIR1/$tfile if=/dev/zero bs=1M count=1 seek=1 conv=notrunc
2747 # define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d
2748 $LCTL set_param fail_loc=0x31d
2749 stat -c %s $DIR1/$tfile &
2754 # For bad lock error handler we should ASSERT and got kernel panic here
2756 $LCTL set_param fail_loc=0
2758 run_test 75 "osc: upcall after unuse lock==================="
2761 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
2762 skip "Need MDS version at least 2.5.53" && return
2764 remote_mds_nodsh && skip "remote MDS with nodsh" && return
2770 nid=$($LCTL list_nids | sed "s/\./\\\./g")
2776 test_mkdir -p $DIR/$tdir
2778 # drop all open locks and close any cached "open" files on the client
2779 cancel_lru_locks mdc
2781 echo -n "open files "
2783 for ((i = 0; i < $fcount; i++)); do
2784 touch $DIR/$tdir/f_$i
2786 local cmd="exec $fd<$DIR/$tdir/f_$i"
2793 local get_open_fids="$LCTL get_param -n mdt.*.exports.'$nid'.open_files"
2794 local fid_list=($(do_nodes $(comma_list $(mdts_nodes)) $get_open_fids))
2796 # Possible errors in openfiles FID list.
2797 # 1. Missing FIDs. Check 1
2798 # 2. Extra FIDs. Check 1
2799 # 3. Duplicated FID. Check 2
2800 # 4. Invalid FIDs. Check 2
2801 # 5. Valid FID, points to some other file. Check 3
2804 [ ${#fid_list[@]} -ne $fcount ] &&
2805 error "${#fid_list[@]} != $fcount open files"
2807 for (( i = 0; i < $fcount; i++ )) ; do
2808 cmd="exec ${fd_list[i]}</dev/null"
2810 filename=$($LFS fid2path $DIR2 ${fid_list[i]})
2813 rm --interactive=no $filename
2815 error "Nonexisting fid ${fid_list[i]} listed."
2819 ls_op=$(ls $DIR2/$tdir | wc -l)
2821 error "Some openfiles are missing in lproc output"
2825 run_test 76 "Verify open file for 2048 files"
2829 local dir=$DIR/$tdir
2832 mkdir $dir || error "mkdir $dir failed"
2833 $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
2836 do_nodes $CLIENTS $myRUNAS dd if=/dev/zero of="$dir/nrs_r_$HOSTNAME"\
2837 bs=1M count=$n > /dev/null 2>&1
2839 for ((i = 0; i < $n; i++)); do
2840 do_nodes $CLIENTS $myRUNAS dd if=/dev/zero\
2841 of="$dir/nrs_w_$HOSTNAME" bs=1M seek=$i count=1\
2845 do_nodes $CLIENTS sync;
2846 cancel_lru_locks osc
2848 for ((i = 0; i < $n; i++)); do
2849 do_nodes $CLIENTS $myRUNAS dd if="$dir/nrs_w_$HOSTNAME"\
2850 of=/dev/zero bs=1M seek=$i count=1 > /dev/null 2>&1 &
2853 cancel_lru_locks osc
2855 for ((i = 0; i < $n; i++)); do
2859 rm -rf $dir || error "rm -rf $dir failed"
2862 test_77a() { #LU-3266
2863 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_policies="fifo"
2868 run_test 77a "check FIFO NRS policy"
2871 test_77b() { #LU-3266
2872 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_policies="crrn"
2873 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_crrn_quantum=1
2875 echo "policy: crr-n, crrn_quantum 1"
2878 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_crrn_quantum=64
2880 echo "policy: crr-n, crrn_quantum 64"
2885 run_test 77b "check CRR-N NRS policy"
2890 for i in $(seq 1 $OSTCOUNT)
2892 do_facet ost"$i" lctl set_param \
2893 ost.OSS.ost_io.nrs_policies=$policy
2894 do_facet ost"$i" lctl set_param \
2895 ost.OSS.*.nrs_"$policy"_quantum=1
2896 do_facet ost"$i" lctl set_param \
2897 ost.OSS.*.nrs_"$policy"_offset_type="physical"
2898 do_facet ost"$i" lctl set_param \
2899 ost.OSS.*.nrs_"$policy"_supported="reads"
2902 echo "policy: $policy, ${policy}_quantum 1, ${policy}_offset_type \
2903 physical, ${policy}_supported reads"
2906 for i in $(seq 1 $OSTCOUNT)
2908 do_facet ost"$i" lctl set_param \
2909 ost.OSS.*.nrs_${policy}_supported="writes"
2910 do_facet ost"$i" lctl set_param \
2911 ost.OSS.*.nrs_${policy}_quantum=64
2913 echo "policy: $policy, ${policy}_quantum 64, \
2914 ${policy}_offset_type physical, ${policy}_supported writes"
2917 for i in $(seq 1 $OSTCOUNT)
2919 do_facet ost"$i" lctl set_param \
2920 ost.OSS.*.nrs_${policy}_supported="reads_and_writes"
2921 do_facet ost"$i" lctl set_param \
2922 ost.OSS.*.nrs_${policy}_offset_type="logical"
2924 echo "policy: $policy, ${policy}_quantum 64, \
2925 ${policy}_offset_type logical, ${policy}_supported reads_and_writes"
2931 test_77c() { #LU-3266
2935 run_test 77c "check ORR NRS policy"
2937 test_77d() { #LU-3266
2941 run_test 77d "check TRR nrs policy"
2948 do_facet $facet lctl set_param \
2949 ost.OSS.ost_io.nrs_tbf_rule="$@"
2951 error "failed to operate on TBF rules"
2955 for i in $(seq 1 $OSTCOUNT)
2957 do_facet ost"$i" lctl set_param \
2958 ost.OSS.ost_io.nrs_policies="tbf\ nid"
2960 error "failed to set TBF policy"
2963 # Only operate rules on ost0 since OSTs might run on the same OSS
2965 tbf_rule_operate ost0 "start\ localhost\ {0@lo}\ 1000"
2966 local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
2967 local client_nids=$(nids_list $address "\\")
2968 tbf_rule_operate ost0 "start\ clients\ {$client_nids}\ 100"
2969 tbf_rule_operate ost0 "start\ others\ {*.*.*.*@$NETTYPE}\ 50"
2973 tbf_rule_operate ost0 "change\ localhost\ 1001"
2974 tbf_rule_operate ost0 "change\ clients\ 101"
2975 tbf_rule_operate ost0 "change\ others\ 51"
2979 tbf_rule_operate ost0 "stop\ localhost"
2980 tbf_rule_operate ost0 "stop\ clients"
2981 tbf_rule_operate ost0 "stop\ others"
2984 # Cleanup the TBF policy
2985 for i in $(seq 1 $OSTCOUNT)
2987 do_facet ost"$i" lctl set_param \
2988 ost.OSS.ost_io.nrs_policies="fifo"
2990 error "failed to set policy back to fifo"
2995 run_test 77e "check TBF NID nrs policy"
2998 # Configure jobid_var
2999 local saved_jobid_var=$($LCTL get_param -n jobid_var)
3000 if [ $saved_jobid_var != procname_uid ]; then
3001 set_conf_param_and_check client \
3002 "$LCTL get_param -n jobid_var" \
3003 "$FSNAME.sys.jobid_var" procname_uid
3006 for i in $(seq 1 $OSTCOUNT)
3008 do_facet ost"$i" lctl set_param \
3009 ost.OSS.ost_io.nrs_policies="tbf\ jobid"
3011 error "failed to set TBF policy"
3014 # Only operate rules on ost0 since OSTs might run on the same OSS
3016 tbf_rule_operate ost0 "start\ runas\ {iozone.$RUNAS_ID\ dd.$RUNAS_ID\ tiotest.$RUNAS_ID}\ 1000"
3017 tbf_rule_operate ost0 "start\ iozone_runas\ {iozone.$RUNAS_ID}\ 100"
3018 tbf_rule_operate ost0 "start\ dd_runas\ {dd.$RUNAS_ID}\ 50"
3019 nrs_write_read "$RUNAS"
3022 tbf_rule_operate ost0 "change\ runas\ 1001"
3023 tbf_rule_operate ost0 "change\ iozone_runas\ 101"
3024 tbf_rule_operate ost0 "change\ dd_runas\ 51"
3025 nrs_write_read "$RUNAS"
3028 tbf_rule_operate ost0 "stop\ runas"
3029 tbf_rule_operate ost0 "stop\ iozone_runas"
3030 tbf_rule_operate ost0 "stop\ dd_runas"
3031 nrs_write_read "$RUNAS"
3033 # Cleanup the TBF policy
3034 for i in $(seq 1 $OSTCOUNT)
3036 do_facet ost"$i" lctl set_param \
3037 ost.OSS.ost_io.nrs_policies="fifo"
3039 error "failed to set policy back to fifo"
3041 nrs_write_read "$RUNAS"
3043 local current_jobid_var=$($LCTL get_param -n jobid_var)
3044 if [ $saved_jobid_var != $current_jobid_var ]; then
3045 set_conf_param_and_check client \
3046 "$LCTL get_param -n jobid_var" \
3047 "$FSNAME.sys.jobid_var" $saved_jobid_var
3051 run_test 77f "check TBF JobID nrs policy"
3054 for i in $(seq 1 $OSTCOUNT)
3056 do_facet ost"$i" lctl set_param \
3057 ost.OSS.ost_io.nrs_policies="tbf\ nid"
3059 error "failed to set TBF policy"
3062 for i in $(seq 1 $OSTCOUNT)
3064 do_facet ost"$i" lctl set_param \
3065 ost.OSS.ost_io.nrs_policies="tbf\ jobid"
3067 error "failed to set TBF policy"
3070 # Add a rule that only valid for Jobid TBF. If direct change between
3071 # TBF types is not supported, this operation will fail.
3072 tbf_rule_operate ost0 "start\ dd_runas\ {dd.$RUNAS_ID}\ 50"
3074 # Cleanup the TBF policy
3075 for i in $(seq 1 $OSTCOUNT)
3077 do_facet ost"$i" lctl set_param \
3078 ost.OSS.ost_io.nrs_policies="fifo"
3080 error "failed to set policy back to fifo"
3084 run_test 77g "Change TBF type directly"
3086 test_78() { #LU-6673
3089 for i in $(seq 1 $OSTCOUNT)
3091 do_facet ost"$i" lctl set_param \
3092 ost.OSS.ost_io.nrs_policies="orr" &
3093 do_facet ost"$i" lctl set_param \
3094 ost.OSS.*.nrs_orr_quantum=1
3096 [ $rc -eq 0 -o $rc -eq 11 ] ||
3097 error "Expected set_param to return 0 or EAGAIN"
3100 # Cleanup the ORR policy
3101 for i in $(seq 1 $OSTCOUNT)
3103 do_facet ost"$i" lctl set_param \
3104 ost.OSS.ost_io.nrs_policies="fifo"
3106 error "failed to set policy back to fifo"
3110 run_test 78 "Enable policy and specify tunings right away"
3113 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3120 mkdir -p $DIR1/$tdir/dir
3121 createmany -o $DIR1/$tdir/dir/f 10 ||
3122 error "create files under remote dir failed $i"
3124 cp /etc/passwd $DIR1/$tdir/$tfile
3126 #migrate open file should fails
3127 multiop_bg_pause $DIR2/$tdir/$tfile O_c || error "open $file failed"
3129 # give multiop a chance to open
3132 $LFS migrate -m $MDTIDX $DIR1/$tdir &&
3133 error "migrate open files should failed with open files"
3137 $LFS migrate -m $MDTIDX $DIR1/$tdir ||
3138 error "migrate remote dir error"
3140 echo "Finish migration, then checking.."
3141 for file in $(find $DIR1/$tdir); do
3142 mdt_index=$($LFS getstripe -M $file)
3143 [ $mdt_index == $MDTIDX ] ||
3144 error "$file is not on MDT${MDTIDX}"
3147 diff /etc/passwd $DIR1/$tdir/$tfile ||
3148 error "file different after migration"
3150 rm -rf $DIR1/$tdir || error "rm dir failed after migration"
3152 run_test 80a "migrate directory when some children is being opened"
3156 kill -9 $migrate_pid
3160 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3161 local migrate_dir1=$DIR1/$tdir/migrate_dir
3162 local migrate_dir2=$DIR2/$tdir/migrate_dir
3163 local migrate_run=$LUSTRE/tests/migrate.sh
3171 trap cleanup_80b EXIT
3172 #prepare migrate directory
3173 mkdir -p $migrate_dir1
3174 for F in {1,2,3,4,5}; do
3175 echo "$F$F$F$F$F" > $migrate_dir1/file$F
3176 echo "$F$F$F$F$F" > $DIR/$tdir/file$F
3179 #migrate the directories among MDTs
3182 mdt_idx=$((RANDOM % MDSCOUNT))
3183 $LFS migrate -m $mdt_idx $migrate_dir1 2&>/dev/null ||
3185 [ $rc -ne 0 -o $rc -ne 16 ] || break
3190 echo "start migration thread $migrate_pid"
3191 #Access the files at the same time
3192 start_time=$(date +%s)
3193 echo "accessing the migrating directory for 5 minutes..."
3195 ls $migrate_dir2 > /dev/null || {
3196 echo "read dir fails"
3199 diff -u $DIR2/$tdir/file1 $migrate_dir2/file1 || {
3200 echo "access file1 fails"
3204 cat $migrate_dir2/file2 > $migrate_dir2/file3 || {
3205 echo "access file2/3 fails"
3209 echo "aaaaa" > $migrate_dir2/file4 > /dev/null || {
3210 echo "access file4 fails"
3214 stat $migrate_dir2/file5 > /dev/null || {
3215 echo "stat file5 fails"
3219 touch $migrate_dir2/source_file > /dev/null || rc1=$?
3220 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
3221 echo "touch file failed with $rc1"
3225 if [ -e $migrate_dir2/source_file ]; then
3226 ln $migrate_dir2/source_file $migrate_dir2/link_file \
3227 2&>/dev/null || rc1=$?
3228 if [ -e $migrate_dir2/link_file ]; then
3229 rm -rf $migrate_dir2/link_file
3232 mrename $migrate_dir2/source_file \
3233 $migrate_dir2/target_file 2&>/dev/null || rc1=$?
3234 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
3235 echo "rename failed with $rc1"
3239 if [ -e $migrate_dir2/target_file ]; then
3240 rm -rf $migrate_dir2/target_file 2&>/dev/null ||
3243 rm -rf $migrate_dir2/source_file 2&>/dev/null ||
3246 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
3247 echo "unlink failed with $rc1"
3252 end_time=$(date +%s)
3253 duration=$((end_time - start_time))
3254 if [ $((duration % 10)) -eq 0 ]; then
3255 if [ $show_time -eq 1 ]; then
3256 echo "...$duration seconds"
3263 kill -0 $migrate_pid || {
3264 echo "migration stopped 1"
3268 [ $duration -ge 300 ] && break
3271 #check migration are still there
3272 kill -0 $migrate_pid || error "migration stopped 2"
3275 run_test 80b "Accessing directory during migration"
3278 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3282 mkdir -p $DIR1/$tdir
3284 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d0
3285 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d1
3288 touch d0/0 || error "create 0 failed"
3289 mv d0/0 d1/0 || error "rename d0/0 d1/0 failed"
3290 stat d0/0 && error "stat mv filed succeed"
3291 mv $DIR2/$tdir/d1/0 $DIR2/$tdir/d0/0 || "rename d1/0 d0/0 failed"
3292 stat d0/0 || error "stat failed"
3294 local t=$(ls -ai $DIR1/$tdir/d0 | sort -u | wc -l)
3296 if [ $t -ne 3 ]; then
3297 ls -ai $DIR1/$tdir/d0
3298 error "expect 3 get $t"
3303 run_test 81 "rename and stat under striped directory"
3306 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.6.91) ]] ||
3307 { skip "Need MDS version at least 2.6.92"; return 0; }
3309 # Client 1 creates a file.
3310 multiop_bg_pause $DIR1/$tfile O_ac || error "multiop_bg_pause 1"
3312 # Client 2 opens the file.
3313 multiop_bg_pause $DIR2/$tfile o_Ac || error "multiop_bg_pause 2"
3315 # Client 1 makes the file an orphan.
3316 rm $DIR1/$tfile || error "rm"
3317 # Client 2 sets EA "user.multiop".
3319 wait $pid2 || error "multiop 2"
3320 # Client 1 gets EA "user.multiop". This used to fail because the EA
3321 # cache refill would get "trusted.link" from mdd_xattr_list() but
3322 # -ENOENT when trying to get "trusted.link"'s value. See also sanity
3325 wait $pid1 || error "multiop 1"
3327 run_test 82 "fsetxattr and fgetxattr on orphan files"
3330 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3337 $LFS mkdir -i1 -c2 $tdir
3342 echo "start pid $pid1 to create/unlink striped directory"
3344 # Access the directory at the same time
3348 stat $tdir > /dev/null 2>&1
3352 echo "start pid $pid2 to stat striped directory"
3360 run_test 83 "access striped directory while it is being created/unlinked"
3362 log "cleanup: ======================================================"
3364 [ "$(mount | grep $MOUNT2)" ] && umount $MOUNT2
3368 check_and_cleanup_lustre