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"
8 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
11 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
14 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
15 OPENFILE=${OPENFILE:-openfile}
16 OPENUNLINK=${OPENUNLINK:-openunlink}
17 export MULTIOP=${MULTIOP:-multiop}
18 export TMP=${TMP:-/tmp}
19 MOUNT_2=${MOUNT_2:-"yes"}
20 CHECK_GRANT=${CHECK_GRANT:-"yes"}
21 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
25 export NAME=${NAME:-local}
27 LUSTRE=${LUSTRE:-`dirname $0`/..}
28 . $LUSTRE/tests/test-framework.sh
32 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
35 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
36 # bug number for skipped test: LU-2189 LU-2776
37 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 36 51a"
38 # LU-2829 / LU-2887 - make allowances for ZFS slowness
39 TEST33_NFILES=${TEST33_NFILES:-1000}
42 [ "$SLOW" = "no" ] && EXCEPT_SLOW="33a"
49 check_and_setup_lustre
52 rm -rf $DIR1/[df][0-9]* $DIR1/lnk $DIR/[df].${TESTSUITE}*
54 SAMPLE_FILE=$TMP/$(basename $0 .sh).junk
55 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=1
57 # $RUNAS_ID may get set incorrectly somewhere else
58 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] && error "\$RUNAS_ID set to 0, but \$UID is also 0!"
60 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
69 [ -f $DIR2/f1 ] || error
71 run_test 1a "check create on 2 mtpt's =========================="
75 $CHECKSTAT -t file -p 0777 $DIR1/f1 || error
78 run_test 1b "check attribute updates on 2 mtpt's ==============="
81 $CHECKSTAT -t file -p 0666 $DIR1/f1 || error
83 run_test 1c "check after remount attribute updates on 2 mtpt's ="
87 $CHECKSTAT -a $DIR1/f1 || error
89 run_test 1d "unlink on one mountpoint removes file on other ===="
95 $CHECKSTAT -t file -p 0777 $DIR1/f2a || error
97 run_test 2a "check cached attribute updates on 2 mtpt's ========"
103 $CHECKSTAT -t file -p 0777 $DIR2/f2b || error
105 run_test 2b "check cached attribute updates on 2 mtpt's ========"
107 # NEED TO SAVE ROOT DIR MODE
110 $CHECKSTAT -t dir -p 0777 $DIR2 || error
112 run_test 2c "check cached attribute updates on 2 mtpt's root ==="
116 $CHECKSTAT -t dir -p 0755 $DIR2 || error
118 run_test 2d "check cached attribute updates on 2 mtpt's root ==="
125 $RUNAS dd if=/dev/zero of=$DIR2/$tfile count=1 || error
127 run_test 2e "check chmod on root is propagated to others"
130 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
132 local remote_dir=$tdir/remote_dir
135 $LFS mkdir -i $MDTIDX $DIR1/$remote_dir ||
136 error "Create remote directory failed"
138 touch $DIR1/$remote_dir/$tfile ||
139 error "Create file under remote directory failed"
140 chmod 777 $DIR1/$remote_dir/$tfile ||
141 error "Chmod file under remote directory failed"
143 $CHECKSTAT -t file -p 0777 $DIR2/$remote_dir/$tfile ||
144 error "Check attr of file under remote directory failed"
146 chown $RUNAS_ID:$RUNAS_GID $DIR1/$remote_dir/$tfile ||
147 error "Chown file under remote directory failed"
149 $CHECKSTAT -u \#$RUNAS_ID -g \#$RUNAS_GID $DIR2/$remote_dir/$tfile ||
150 error "Check owner of file under remote directory failed"
152 cd $DIR2/$remote_dir || error "enter remote dir"
153 rm -rf $DIR1/$remote_dir/$tfile ||
154 error "Unlink remote directory failed"
156 $CHECKSTAT -t file $DIR2/$remote_dir/$tfile &&
157 error "unlink file still exists!"
159 cd $DIR2/$tdir || error "exit remote dir"
160 rm -rf $DIR1/$tdir || error "unlink directory failed"
162 run_test 2f "check attr/owner updates on DNE with 2 mtpt's"
165 dd if=/dev/zero of=$DIR1/$tfile oflag=sync bs=1M count=2
167 local block1=$(stat $DIR1/$tfile | awk '/Blocks/ {print $4} ')
169 local block2=$(stat $DIR2/$tfile | awk '/Blocks/ {print $4} ')
170 echo "$DIR1/$tfile has $block1 blocks"
171 echo "$DIR2/$tfile has $block2 blocks"
172 [ $block1 -eq $block2 ] || error
174 run_test 2g "check blocks update on sync write"
177 local target="this/is/good"
178 ln -s $target $DIR1/$tfile || error "ln -s $target $DIR1/$tfile failed"
179 [ "$(ls -l $DIR2/$tfile | sed -e 's/.* -> //')" = "$target" ] ||
180 error "link $DIR2/$tfile not as expected"
182 run_test 3 "symlink on one mtpt, readlink on another ==========="
185 multifstat $DIR1/f4 $DIR2/f4
187 run_test 4 "fstat validation on multiple mount points =========="
191 $TRUNCATE $DIR2/f5 100
192 $CHECKSTAT -t file -s 100 $DIR1/f5 || error
195 run_test 5 "create a file on one mount, truncate it on the other"
198 openunlink $DIR1/$tfile $DIR2/$tfile || \
199 error "openunlink $DIR1/$tfile $DIR2/$tfile"
201 run_test 6 "remove of open file on other node =================="
205 opendirunlink $DIR1/$dir $DIR2/$dir || \
206 error "opendirunlink $DIR1/$dir $DIR2/$dir"
208 run_test 7 "remove of open directory on other node ============="
211 opendevunlink $DIR1/$tfile $DIR2/$tfile || \
212 error "opendevunlink $DIR1/$tfile $DIR2/$tfile"
214 run_test 8 "remove of open special file on other node =========="
220 for C in a b c d e f g h i j k l; do
221 dir=`eval echo \\$DIR$MTPT`
222 echo -n $C >> $dir/f9
223 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
225 [ "`cat $DIR1/f9`" = "abcdefghijkl" ] || \
226 error "`od -a $DIR1/f9` != abcdefghijkl"
228 run_test 9 "append of file with sub-page size on multiple mounts"
235 for C in a b c d e f g h i j k l; do
236 dir=`eval echo \\$DIR$MTPT`
237 echo -n $C | dd of=$dir/f10 bs=1 seek=$OFFSET count=1
238 [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
239 OFFSET=`expr $OFFSET + 1`
241 [ "`cat $DIR1/f10`" = "abcdefghijkl" ] || \
242 error "`od -a $DIR1/f10` != abcdefghijkl"
244 run_test 10a "write of file with sub-page size on multiple mounts "
248 yes "R" | head -c 4000 >$TMP/f10b-seed
249 dd if=$TMP/f10b-seed of=$DIR1/f10b bs=3k count=1 || error "dd $DIR1"
251 $TRUNCATE $DIR1/f10b 4096 || error "truncate 4096"
253 dd if=$DIR2/f10b of=$TMP/f10b-lustre bs=4k count=1 || error "dd $DIR2"
255 # create a test file locally to compare
256 dd if=$TMP/f10b-seed of=$TMP/f10b bs=3k count=1 || error "dd random"
257 $TRUNCATE $TMP/f10b 4096 || error "truncate 4096"
258 cmp $TMP/f10b $TMP/f10b-lustre || error "file miscompare"
259 rm $TMP/f10b $TMP/f10b-lustre $TMP/f10b-seed
261 run_test 10b "write of file with sub-page size on multiple mounts "
265 multiop_bg_pause $DIR1/d11/f O_c || return 1
267 cp -p /bin/ls $DIR1/d11/f
271 wait $MULTIPID || error
272 [ $RC -eq 0 ] && error || true
274 run_test 11 "execution of file opened for write should return error ===="
277 DIR=$DIR DIR2=$DIR2 sh lockorder.sh
279 run_test 12 "test lock ordering (link, stat, unlink) ==========="
281 test_13() { # bug 2451 - directory coherency
282 test_mkdir $DIR1/d13 || error
283 cd $DIR1/d13 || error
285 ( touch $DIR1/d13/f13 ) # needs to be a separate shell
287 rm -f $DIR2/d13/f13 || error
288 ls 2>&1 | grep f13 && error "f13 shouldn't return an error (1)" || true
289 # need to run it twice
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 (2)" || true
295 run_test 13 "test directory page revocation ===================="
298 test_mkdir -p $DIR1/$tdir
299 cp -p /bin/ls $DIR1/$tdir/$tfile
300 multiop_bg_pause $DIR1/$tdir/$tfile Ow_c || return 1
303 $DIR2/$tdir/$tfile && error || true
305 wait $MULTIPID || return 2
307 run_test 14 "execution of file open for write returns -ETXTBSY ="
310 test_mkdir -p $DIR1/d14
311 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
312 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
314 $MULTIOP $DIR2/d14/multiop Oc && error "expected error, got success"
315 kill -USR1 $MULTIOP_PID || return 2
316 wait $MULTIOP_PID || return 3
317 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
319 run_test 14a "open(RDWR) of executing file returns -ETXTBSY ===="
321 test_14b() { # bug 3192, 7040
322 test_mkdir -p $DIR1/d14
323 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
324 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
326 $TRUNCATE $DIR2/d14/multiop 0 && kill -9 $MULTIOP_PID && \
327 error "expected truncate error, got success"
328 kill -USR1 $MULTIOP_PID || return 2
329 wait $MULTIOP_PID || return 3
330 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
331 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
333 run_test 14b "truncate of executing file returns -ETXTBSY ======"
335 test_14c() { # bug 3430, 7040
336 test_mkdir -p $DIR1/d14
337 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
338 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
340 cp /etc/hosts $DIR2/d14/multiop && error "expected error, got success"
341 kill -USR1 $MULTIOP_PID || return 2
342 wait $MULTIOP_PID || return 3
343 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
344 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
346 run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY =="
348 test_14d() { # bug 10921
349 test_mkdir -p $DIR1/d14
350 cp -p `which multiop` $DIR1/d14/multiop || error "cp failed"
351 MULTIOP_PROG=$DIR1/d14/multiop multiop_bg_pause $TMP/test14.junk O_c || return 1
354 chmod 600 $DIR1/d14/multiop || error "chmod failed"
355 kill -USR1 $MULTIOP_PID || return 2
356 wait $MULTIOP_PID || return 3
357 cmp `which multiop` $DIR1/d14/multiop || error "binary changed"
358 rm $TMP/test14.junk $DIR1/d14/multiop || error "removing multiop"
360 run_test 14d "chmod of executing file is still possible ========"
362 test_15() { # bug 974 - ENOSPC
364 sh oos2.sh $MOUNT1 $MOUNT2
365 wait_delete_completed
366 grant_error=`dmesg | grep "> available"`
367 [ -z "$grant_error" ] || error "$grant_error"
369 run_test 15 "test out-of-space with multiple writers ==========="
372 # The FSXNUM reduction for ZFS is needed until ORI-487 is fixed.
373 # We don't want to skip it entirely, but ZFS is VERY slow and cannot
374 # pass a 2500 operation dual-mount run within the time limit.
375 if [ "$(facet_fstype ost1)" = "zfs" ]; then
376 FSXNUM=$((COUNT / 5))
378 elif [ "$SLOW" = "yes" ]; then
379 FSXNUM=$((COUNT * 5))
387 local file1=$DIR1/$tfile
388 local file2=$DIR2/$tfile
390 # to allocate grant because it may run out due to test_15.
391 lfs setstripe -c -1 $file1
392 dd if=/dev/zero of=$file1 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
393 dd if=/dev/zero of=$file2 bs=$STRIPE_BYTES count=$OSTCOUNT oflag=sync
396 lfs setstripe -c -1 $file1 # b=10919
397 fsx -c 50 -p $FSXP -N $FSXNUM -l $((SIZE * 256)) -S 0 $file1 $file2
399 run_test 16 "$FSXNUM iterations of dual-mount fsx"
401 test_17() { # bug 3513, 3667
402 remote_ost_nodsh && skip "remote OST with nodsh" && return
404 lfs setstripe $DIR1/$tfile -i 0 -c 1
405 cp $SAMPLE_FILE $DIR1/$tfile
406 cancel_lru_locks osc > /dev/null
407 #define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a
408 do_facet ost1 lctl set_param fail_loc=0x8000030a
409 ls -ls $DIR1/$tfile | awk '{ print $1,$6 }' > $DIR1/$tfile-1 & \
410 ls -ls $DIR2/$tfile | awk '{ print $1,$6 }' > $DIR2/$tfile-2
412 diff -u $DIR1/$tfile-1 $DIR2/$tfile-2 || error "files are different"
414 run_test 17 "resource creation/LVB creation race ==============="
417 # turn e.g. ALWAYS_EXCEPT="18c" into "-e 3"
420 for idx in {a..z}; do
421 local ptr=EXCEPT_ALWAYS_18$idx
422 [ x${!ptr} = xtrue ] || continue
424 excepts="$excepts -e $(($(printf %d \'$idx)-96))"
427 $LUSTRE/tests/mmap_sanity -d $MOUNT1 -m $MOUNT2 $excepts
430 run_test 18 "mmap sanity check ================================="
432 test_19() { # bug3811
433 local node=$(facet_active_host ost1)
435 # check whether obdfilter is cache capable at all
436 if ! get_osd_param $node '' read_cache_enable >/dev/null; then
437 echo "not cache-capable obdfilter"
441 local MAX=$(get_osd_param $node '' readcache_max_filesize | \
443 set_osd_param $node '' readcache_max_filesize 4096
444 dd if=/dev/urandom of=$TMP/$tfile bs=512k count=32
445 local SUM=$(cksum $TMP/$tfile | cut -d" " -f 1,2)
446 cp $TMP/$tfile $DIR1/$tfile
447 for i in `seq 1 20`; do
448 [ $((i % 5)) -eq 0 ] && log "$testname loop $i"
449 cancel_lru_locks osc > /dev/null
450 cksum $DIR1/$tfile | cut -d" " -f 1,2 > $TMP/sum1 & \
451 cksum $DIR2/$tfile | cut -d" " -f 1,2 > $TMP/sum2
453 [ "$(cat $TMP/sum1)" = "$SUM" ] || \
454 error "$DIR1/$tfile $(cat $TMP/sum1) != $SUM"
455 [ "$(cat $TMP/sum2)" = "$SUM" ] || \
456 error "$DIR2/$tfile $(cat $TMP/sum2) != $SUM"
458 set_osd_param $node '' readcache_max_filesize $MAX
461 run_test 19 "test concurrent uncached read races ==============="
466 CNT=$((`lctl get_param -n llite.*.dump_page_cache | wc -l`))
467 $MULTIOP $DIR1/f20 Ow8190c
468 $MULTIOP $DIR2/f20 Oz8194w8190c
469 $MULTIOP $DIR1/f20 Oz0r8190c
471 CNTD=$((`lctl get_param -n llite.*.dump_page_cache | wc -l` - $CNT))
473 error $CNTD" page left in cache after lock cancel" || true
475 run_test 20 "test extra readahead page left in cache ===="
482 test_21() { # Bug 5907
483 test_mkdir $DIR1/$tdir
484 mount /etc $DIR1/$tdir --bind || error "mount failed" # Poor man's mount.
486 rmdir -v $DIR1/$tdir && error "Removed mounted directory"
487 rmdir -v $DIR2/$tdir && echo "Removed mounted directory from another mountpoint, needs to be fixed"
488 test -d $DIR1/$tdir || error "Mounted directory disappeared"
490 test -d $DIR2/$tdir || test -d $DIR1/$tdir && error "Removed dir still visible after umount"
493 run_test 21 " Try to remove mountpoint on another dir ===="
495 test_23() { # Bug 5972
496 local at_diff=$(do_facet $SINGLEMDS \
497 $LCTL get_param -n mdd.*MDT0000*.atime_diff | head -n1)
498 echo "atime should be updated while another read" > $DIR1/$tfile
500 # clear the lock(mode: LCK_PW) gotten from creating operation
504 sleep $((at_diff + 1))
506 echo "starting reads"
507 multiop_bg_pause $DIR1/$tfile or20_c || return 1
508 # with SOM and opencache enabled, we need to close a file and cancel
509 # open lock to get atime propogated to MDS
510 kill -USR1 $! || return 2
513 time2=$(stat -c "%X" $DIR/$tfile)
514 echo "new atime is $time2"
516 [ $time2 -gt $time1 ] || error "atime was not updated"
517 rm -f $DIR1/$tfile || error "rm -f $DIR1/$tfile failed"
520 run_test 23 " others should see updated atime while another read===="
524 lfs df || error "lfs df failed"
525 lfs df -ih || error "lfs df -ih failed"
526 lfs df -h $DIR1 || error "lfs df -h $DIR1 failed"
527 lfs df -i $DIR2 || error "lfs df -i $DIR2 failed"
528 lfs df $DIR1/$tfile || error "lfs df $DIR1/$tfile failed"
529 lfs df -ih $DIR2/$tfile || error "lfs df -ih $DIR2/$tfile failed"
531 OSC=`lctl dl | awk '/-osc-|OSC.*MNT/ {print $4}' | head -n 1`
532 # OSC=`lctl dl | awk '/-osc-/ {print $4}' | head -n 1`
533 lctl --device %$OSC deactivate
534 lfs df -i || error "lfs df -i with deactivated OSC failed"
535 lctl --device %$OSC activate
536 lfs df || error "lfs df with reactivated OSC failed"
538 run_test 24a "lfs df [-ih] [path] test ========================="
542 fsnum=$(lfs_df | grep -c "summary")
543 [ $fsnum -eq 2 ] || error "lfs df shows $fsnum != 2 filesystems."
545 run_test 24b "lfs df should show both filesystems ==============="
548 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
550 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
553 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
554 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
556 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
557 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
558 error "setfacl $DIR2/$tdir #1"
559 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
560 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
561 error "setfacl $DIR2/$tdir #2"
562 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
563 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
564 error "setfacl $DIR2/$tdir #3"
565 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
566 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
567 error "setfacl $DIR2/$tdir #4"
568 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
572 run_test 25a "change ACL on one mountpoint be seen on another ==="
575 local acl=$(lctl get_param -n mdc.*MDT0000-mdc-*.connect_flags |
577 [ "$acl" -lt 1 ] && skip "must have acl, skipping" && return
579 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
582 $LFS mkdir -i 1 $DIR1/$tdir
583 touch $DIR1/$tdir/f1 || error "touch $DIR1/$tdir/f1"
584 chmod 0755 $DIR1/$tdir/f1 || error "chmod 0755 $DIR1/$tdir/f1"
586 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #1"
587 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
588 error "setfacl $DIR2/$tdir #1"
589 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #2"
590 setfacl -m u:$RUNAS_ID:r-x -m g:$RUNAS_GID:r-x $DIR1/$tdir ||
591 error "setfacl $DIR2/$tdir #2"
592 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #3"
593 setfacl -m u:$RUNAS_ID:--- -m g:$RUNAS_GID:--- $DIR1/$tdir ||
594 error "setfacl $DIR2/$tdir #3"
595 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 && error "checkstat $DIR2/$tdir/f1 #4"
596 setfacl -x u:$RUNAS_ID: -x g:$RUNAS_GID: $DIR1/$tdir ||
597 error "setfacl $DIR2/$tdir #4"
598 $RUNAS $CHECKSTAT $DIR2/$tdir/f1 || error "checkstat $DIR2/$tdir/f1 #5"
602 run_test 25b "change ACL under remote dir on one mountpoint be seen on another"
605 utime $DIR1/f26a -s $DIR2/f26a || error
607 run_test 26a "allow mtime to get older"
612 echo "aaa" >> $DIR1/$tfile
614 chmod a+x $DIR2/$tfile
615 mt1=`stat -c %Y $DIR1/$tfile`
616 mt2=`stat -c %Y $DIR2/$tfile`
618 if [ x"$mt1" != x"$mt2" ]; then
619 error "not equal mtime, client1: "$mt1", client2: "$mt2"."
622 run_test 26b "sync mtime between ost and mds"
627 dd if=/dev/zero of=$DIR2/$tfile bs=$((4096+4))k conv=notrunc count=4 seek=3 &
632 dd if=/dev/zero of=$DIR1/$tfile bs=$((16384-1024))k conv=notrunc count=1 seek=4 &
637 dd if=/dev/zero of=$DIR1/$tfile bs=8k conv=notrunc count=1 seek=0
639 lctl set_param -n ldlm.dump_namespaces ""
640 wait $DD1_PID $DD2_PID
641 [ $? -ne 0 ] && lctl dk $TMP/debug || true
643 run_test 27 "align non-overlapping extent locks from request ==="
645 test_28() { # bug 9977
646 ECHO_UUID="ECHO_osc1_UUID"
647 tOST=$($LCTL dl | awk '/-osc-|OSC.*MNT/ { print $4 }' | head -n1)
649 $LFS setstripe $DIR1/$tfile -S 1048576 -i 0 -c 2
650 tOBJID=`$LFS getstripe $DIR1/$tfile | awk '$1 == 1 {print $2}'`
651 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2
655 attach echo_client ECHO_osc1 $ECHO_UUID
659 tECHOID=`$LCTL dl | grep $ECHO_UUID | awk '{ print $1 }'`
660 $LCTL --device $tECHOID destroy "${tOBJID}:0"
668 # reading of 1st stripe should pass
669 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error
670 # reading of 2nd stripe should fail (this stripe was destroyed)
671 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 && error
673 # now, recreating test file
674 dd if=/dev/zero of=$DIR1/$tfile bs=1024k count=2 || error
675 # reading of 1st stripe should pass
676 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 || error
677 # reading of 2nd stripe should pass
678 dd if=$DIR2/$tfile of=/dev/null bs=1024k count=1 skip=1 || error
680 run_test 28 "read/write/truncate file with lost stripes"
682 test_29() { # bug 10999
684 #define OBD_FAIL_LDLM_GLIMPSE 0x30f
685 lctl set_param fail_loc=0x8000030f
688 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1
691 #bug 11549 - permanently turn test off in b1_5
692 run_test 29 "lock put race between glimpse and enqueue ========="
694 test_30() { #bug #11110, LU-2523
695 test_mkdir -p $DIR1/$tdir
696 cp -f /bin/bash $DIR1/$tdir/bash
697 /bin/sh -c 'sleep 1; rm -f $DIR2/$tdir/bash;
698 cp /bin/bash $DIR2/$tdir' &
699 $DIR1/$tdir/bash -c 'sleep 2;
700 openfile -f O_RDONLY /proc/$$/exe >& /dev/null; echo $?'
705 run_test 30 "recreate file race"
708 test_mkdir -p $DIR1/$tdir || error "Creating dir $DIR1/$tdir"
709 local writes=$(LANG=C dd if=/dev/zero of=$DIR/$tdir/$tfile \
710 count=1 2>&1 | awk 'BEGIN { FS="+" } /out/ {print $1}')
711 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
712 lctl set_param fail_loc=0x314
713 local reads=$(LANG=C dd if=$DIR2/$tdir/$tfile of=/dev/null 2>&1 |
714 awk 'BEGIN { FS="+" } /in/ {print $1}')
715 [ $reads -eq $writes ] || error "read" $reads "blocks, must be" $writes
717 run_test 31a "voluntary cancel / blocking ast race=============="
720 remote_ost || { skip "local OST" && return 0; }
721 remote_ost_nodsh && skip "remote OST w/o dsh" && return 0
723 # make sure there is no local locks due to destroy
724 wait_mds_ost_sync || error "wait_mds_ost_sync()"
725 wait_delete_completed || error "wait_delete_completed()"
727 test_mkdir -p $DIR1/$tdir || error "Creating dir $DIR1/$tdir"
728 lfs setstripe $DIR/$tdir/$tfile -i 0 -c 1
729 cp /etc/hosts $DIR/$tdir/$tfile
730 #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE 0x314
731 lctl set_param fail_loc=0x314
732 #define OBD_FAIL_LDLM_OST_FAIL_RACE 0x316
733 do_facet ost1 lctl set_param fail_loc=0x316
735 cat $DIR2/$tdir/$tfile > /dev/null 2>&1
736 lctl set_param fail_loc=0
737 do_facet ost1 lctl set_param fail_loc=0
738 # cleanup: reconnect the client back
741 run_test 31b "voluntary OST cancel / blocking ast race=============="
743 # enable/disable lockless truncate feature, depending on the arg 0/1
744 enable_lockless_truncate() {
745 lctl set_param -n osc.*.lockless_truncate $1
748 test_32a() { # bug 11270
749 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
750 save_lustre_params client "osc.*.lockless_truncate" > $p
752 enable_lockless_truncate 1
754 lfs setstripe -c -1 $DIR1/$tfile
755 dd if=/dev/zero of=$DIR1/$tfile count=$OSTCOUNT bs=$STRIPE_BYTES > \
759 log "checking cached lockless truncate"
760 $TRUNCATE $DIR1/$tfile 8000000
761 $CHECKSTAT -s 8000000 $DIR2/$tfile || error "wrong file size"
762 [ $(calc_osc_stats lockless_truncate) -ne 0 ] ||
763 error "cached truncate isn't lockless"
765 log "checking not cached lockless truncate"
766 $TRUNCATE $DIR2/$tfile 5000000
767 $CHECKSTAT -s 5000000 $DIR1/$tfile || error "wrong file size"
768 [ $(calc_osc_stats lockless_truncate) -ne 0 ] ||
769 error "not cached truncate isn't lockless"
771 log "disabled lockless truncate"
772 enable_lockless_truncate 0
774 $TRUNCATE $DIR2/$tfile 3000000
775 $CHECKSTAT -s 3000000 $DIR1/$tfile || error "wrong file size"
776 [ $(calc_osc_stats lockless_truncate) -eq 0 ] ||
777 error "lockless truncate disabling failed"
779 # restore lockless_truncate default values
780 restore_lustre_params < $p
783 run_test 32a "lockless truncate"
785 test_32b() { # bug 11270
786 remote_ost_nodsh && skip "remote OST with nodsh" && return
789 local facets=$(get_facets OST)
790 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
792 save_lustre_params client "osc.*.contention_seconds" > $p
793 save_lustre_params $facets \
794 "ldlm.namespaces.filter-*.max_nolock_bytes" >> $p
795 save_lustre_params $facets \
796 "ldlm.namespaces.filter-*.contended_locks" >> $p
797 save_lustre_params $facets \
798 "ldlm.namespaces.filter-*.contention_seconds" >> $p
801 # agressive lockless i/o settings
802 for node in $(osts_nodes); do
803 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'
805 lctl set_param -n osc.*.contention_seconds 60
806 for i in $(seq 5); do
807 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
808 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
810 [ $(calc_osc_stats lockless_write_bytes) -ne 0 ] || error "lockless i/o was not triggered"
811 # disable lockless i/o (it is disabled by default)
812 for node in $(osts_nodes); do
813 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'
815 # set contention_seconds to 0 at client too, otherwise Lustre still
816 # remembers lock contention
817 lctl set_param -n osc.*.contention_seconds 0
819 for i in $(seq 1); do
820 dd if=/dev/zero of=$DIR1/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
821 dd if=/dev/zero of=$DIR2/$tfile bs=4k count=1 conv=notrunc > /dev/null 2>&1
823 [ $(calc_osc_stats lockless_write_bytes) -eq 0 ] ||
824 error "lockless i/o works when disabled"
826 restore_lustre_params <$p
829 run_test 32b "lockless i/o"
833 local mdts=$(get_facets MDS)
838 for mds in ${mdts//,/ }; do
840 dev=$(basename $(do_facet $mds "lctl get_param -n osd*.${!varsvc}.mntdev|\
841 xargs readlink -f" ))
842 val=$(do_facet $mds "cat /proc/fs/jbd*/${dev}{,:*,-*}/info 2>/dev/null |
845 stat=$(( stat + val))
850 # commit on sharing tests
852 remote_mds_nodsh && skip "remote MDS with nodsh" && return
854 [ -z "$CLIENTS" ] && skip "Need two or more clients, have $CLIENTS" && return 0
855 [ $CLIENTCOUNT -lt 2 ] &&
856 skip "Need two or more clients, have $CLIENTCOUNT" && return 0
858 local nfiles=${TEST33_NFILES:-10000}
859 local param_file=$TMP/$tfile-params
860 local fstype=$(facet_fstype $SINGLEMDS)
862 save_lustre_params $(get_facets MDS) \
863 "mdt.*.commit_on_sharing" > $param_file
871 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
875 do_nodes $CLIENT1,$CLIENT2 "mkdir -p $DIR1/$tdir-\\\$(hostname)-$i"
877 [ $fstype = ldiskfs ] && jbdold=$(print_jbd_stat)
878 echo "=== START createmany old: $jbdold transaction"
879 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")
880 [ $fstype = ldiskfs ] && jbdnew=$(print_jbd_stat)
881 [ $fstype = ldiskfs ] && jbd=$(( jbdnew - jbdold ))
882 echo "=== END createmany new: $jbdnew transaction : $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
883 [ $fstype = ldiskfs ] && avgjbd=$(( avgjbd + jbd ))
884 avgtime=$(( avgtime + elapsed ))
886 eval cos${COS}_jbd=$((avgjbd / 3))
887 eval cos${COS}_time=$((avgtime / 3))
890 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
891 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
892 [ "$cos0_jbd" != 0 ] && echo "COS=1 vs COS=0 jbd: $((((cos1_jbd/cos0_jbd - 1)) * 100 )) %"
893 [ "$cos0_time" != 0 ] && echo "COS=1 vs COS=0 time: $((((cos1_time/cos0_time - 1)) * 100 )) %"
895 restore_lustre_params < $param_file
899 run_test 33a "commit on sharing, cross crete/delete, 2 clients, benchmark"
901 # commit on sharing tests
903 remote_mds_nodsh && skip "remote MDS with nodsh" && return
905 [ -n "$CLIENTS" ] || { skip "Need two or more clients" && return 0; }
906 [ $CLIENTCOUNT -ge 2 ] ||
907 { skip "Need two or more clients, have $CLIENTCOUNT" &&
909 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
911 local nfiles=${TEST33_NFILES:-10000}
912 local param_file=$TMP/$tfile-params
914 save_lustre_params $(get_facets MDS) \
915 "mdt.*.commit_on_sharing" > $param_file
924 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=$COS
928 do_node $CLIENT1 "$LFS mkdir -i $MDTIDX -p \
929 $DIR1/$tdir-\\\$(hostname)-$i"
931 jbdold=$(print_jbd_stat)
932 echo "=== START createmany old: $jbdold transaction"
933 local elapsed=$(do_and_time "do_nodes $CLIENT1,$CLIENT2\
934 createmany -o $DIR1/$tdir-\\\$(hostname)-$i/f- \
935 -r $DIR2/$tdir-\\\$(hostname)-$i/f- $nfiles > \
937 jbdnew=$(print_jbd_stat)
938 jbd=$(( jbdnew - jbdold ))
939 echo "=== END createmany new: $jbdnew transaction : \
940 $jbd transactions nfiles $nfiles time $elapsed COS=$COS"
941 avgjbd=$(( avgjbd + jbd ))
942 avgtime=$(( avgtime + elapsed ))
944 eval cos${COS}_jbd=$((avgjbd / 3))
945 eval cos${COS}_time=$((avgtime / 3))
948 echo "COS=0 transactions (avg): $cos0_jbd time (avg): $cos0_time"
949 echo "COS=1 transactions (avg): $cos1_jbd time (avg): $cos1_time"
950 [ "$cos0_jbd" != 0 ] &&
951 echo "COS=1 vs COS=0 jbd: $(((cos1_jbd/cos0_jbd - 1) * 100)) %"
952 [ "$cos0_time" != 0 ] &&
953 echo "COS=1 vs COS=0 time: $(((cos1_time/cos0_time - 1) * 100)) %"
955 restore_lustre_params < $param_file
959 run_test 33b "COS: cross create/delete, 2 clients, benchmark under remote dir"
961 # End commit on sharing tests
963 get_ost_lock_timeouts() {
964 local nodes=${1:-$(comma_list $(osts_nodes))}
966 local locks=$(do_nodes $nodes \
967 "lctl get_param -n ldlm.namespaces.filter-*.lock_timeouts" | calc_sum)
975 do_nodes $(comma_list $(osts_nodes)) \
976 "lctl set_param -n fail_loc=0 2>/dev/null || true"
977 for i in $(seq $OSTCOUNT); do
978 wait_osc_import_state client ost$i FULL
983 remote_ost_nodsh && skip "remote OST with nodsh" && return
987 trap cleanup_34 EXIT RETURN
988 for OPER in notimeout timeout ; do
989 rm $DIR1/$tfile 2>/dev/null
990 lock_in=$(get_ost_lock_timeouts)
991 if [ $OPER == "timeout" ] ; then
992 for j in `seq $OSTCOUNT`; do
993 #define OBD_FAIL_PTLRPC_HPREQ_TIMEOUT 0x511
994 do_facet ost$j lctl set_param fail_loc=0x511
996 echo lock should expire
998 for j in `seq $OSTCOUNT`; do
999 #define OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT 0x512
1000 do_facet ost$j lctl set_param fail_loc=0x512
1002 echo lock should not expire
1004 echo writing on client1
1005 dd if=/dev/zero of=$DIR1/$tfile count=100 conv=notrunc > /dev/null 2>&1
1007 echo reading on client2
1008 dd of=/dev/null if=$DIR2/$tfile > /dev/null 2>&1
1009 # wait for a lock timeout
1011 lock_out=$(get_ost_lock_timeouts)
1012 if [ $OPER == "timeout" ] ; then
1013 if [ $lock_in == $lock_out ]; then
1014 error "no lock timeout happened"
1019 if [ $lock_in != $lock_out ]; then
1020 error "lock timeout happened"
1028 run_test 34 "no lock timeout under IO"
1030 test_35() { # bug 17645
1033 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1034 awk '/generation/{print $2}')
1036 generation[count]=$g
1040 test_mkdir -p $MOUNT1/$tfile
1041 cancel_lru_locks mdc
1043 # Let's initiate -EINTR situation by setting fail_loc and take
1044 # write lock on same file from same client. This will not cause
1045 # bl_ast yet as lock is already in local cache.
1046 #define OBD_FAIL_LDLM_INTR_CP_AST 0x317
1047 do_facet client "lctl set_param fail_loc=0x80000317"
1048 local timeout=`do_facet $SINGLEMDS lctl get_param -n timeout`
1049 let timeout=timeout*3
1051 while test $nr -lt 10; do
1052 log "Race attempt $nr"
1053 local blk1=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
1054 test "x$blk1" = "x" && blk1=0
1055 createmany -o $MOUNT2/$tfile/a 4000 &
1059 # Let's make conflict and bl_ast
1060 ls -la $MOUNT1/$tfile > /dev/null &
1063 log "Wait for $pid1 $pid2 for $timeout sec..."
1065 kill -9 $pid1 $pid2 > /dev/null 2>&1
1067 local blk2=`lctl get_param -n ldlm.services.ldlm_cbd.stats | awk '/ldlm_bl_callback/ {print $2}'`
1068 test "x$blk2" = "x" && blk2=0
1069 test $blk2 -gt $blk1 && break
1070 rm -fr $MOUNT1/$tfile/*
1071 cancel_lru_locks mdc
1074 do_facet client "lctl set_param fail_loc=0x0"
1075 df -h $MOUNT1 $MOUNT2
1077 gen=$(lctl get_param mdc.$FSNAME-MDT*-mdc-*.import | grep generation |
1078 awk '/generation/{print $2}')
1080 if ! test "$g" -eq "${generation[count]}"; then
1081 list=$(lctl list_param mdc.$FSNAME-MDT*-mdc-*.import)
1083 for imp in $list; do
1084 if [ $c = $count ]; then
1089 imp=$(echo "$imp" | awk -F"." '{print $2}')
1090 error "Eviction happened on import $imp"
1095 run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client"
1097 test_36() { #bug 16417
1102 test_mkdir -p $DIR1/$tdir
1103 $LFS setstripe -c -1 $DIR1/$tdir
1106 let SIZE_B=SIZE*1024*1024
1107 sync; sleep 5; sync # wait for delete thread
1109 while [ $i -le 10 ]; do
1110 lctl mark "start test"
1111 local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1112 dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
1113 error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
1114 sync # sync data from client cache
1115 sync_all_data # sync data from server cache (delayed allocation)
1117 local after_dd=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1118 multiop_bg_pause $DIR2/$tdir/$tfile O_r${SIZE_B}c || return 3
1120 rm -f $DIR1/$tdir/$tfile
1121 kill -USR1 $read_pid
1123 wait_delete_completed
1124 local after=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
1125 echo "*** cycle($i) *** before($before) after_dd($after_dd)" \
1127 # this free space! not used
1128 (( $after_dd <= $after)) ||
1129 error "space leaked after_dd:$after_dd > after:$after"
1133 run_test 36 "handle ESTALE/open-unlink correctly"
1135 test_37() { # bug 18695
1136 test_mkdir -p $DIR1/$tdir
1137 multiop_bg_pause $DIR1/$tdir D_c || return 1
1139 # create large directory (32kB seems enough from e2fsck, ~= 1000 files)
1140 createmany -m $DIR2/$tdir/f 10000
1141 # set mtime/atime backward
1142 touch -t 198001010000 $DIR2/$tdir
1143 kill -USR1 $MULTIPID
1144 nr_files=`lfs find $DIR1/$tdir -type f | wc -l`
1145 [ $nr_files -eq 10000 ] || error "$nr_files != 10000 truncated directory?"
1148 run_test 37 "check i_size is not updated for directory on close (bug 18695) =============="
1150 # this should be set to past
1151 TEST_39_MTIME=`date -d "1 year ago" +%s`
1155 local client1=${CLIENT1:-`hostname`}
1156 local client2=${CLIENT2:-`hostname`}
1158 do_node $client1 "touch $DIR1/$tfile"
1160 do_node $client1 "touch -m -d @$TEST_39_MTIME $DIR1/$tfile"
1161 local mtime1=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1162 [ "$mtime1" = $TEST_39_MTIME ] || \
1163 error "mtime is not set to past: $mtime1, should be $TEST_39_MTIME"
1165 local d1=`do_node $client1 date +%s`
1166 do_node $client1 'echo hello >> '$DIR1/$tfile
1167 local d2=`do_node $client1 date +%s`
1169 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1170 [ "$mtime2" -ge "$d1" ] && [ "$mtime2" -le "$d2" ] || \
1171 error "mtime is not updated on write: $d1 <= $mtime2 <= $d2"
1173 do_node $client1 "mv $DIR1/$tfile $DIR1/$tfile-1"
1175 for (( i=0; i < 2; i++ )) ; do
1176 local mtime3=`do_node $client2 "stat -c %Y $DIR1/$tfile-1"`
1177 [ "$mtime2" = "$mtime3" ] || \
1178 error "mtime ($mtime2) changed (to $mtime3) on rename"
1180 cancel_lru_locks osc
1181 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1184 run_test 39a "test from 11063 =================================="
1187 local client1=${CLIENT1:-`hostname`}
1188 local client2=${CLIENT2:-`hostname`}
1192 local mtime1=`stat -c %Y $DIR1/$tfile`
1193 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1196 touch -m -d @$TEST_39_MTIME $DIR1/$tfile
1198 for (( i=0; i < 2; i++ )) ; do
1199 local mtime3=`stat -c %Y $DIR1/$tfile`
1200 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1202 [ "$mtime3" = "$mtime4" ] || \
1203 error "different mtime on clients: $mtime3, $mtime4"
1204 [ "$mtime3" = $TEST_39_MTIME ] || \
1205 error "lost mtime: $mtime3, should be $TEST_39_MTIME"
1207 cancel_lru_locks osc
1208 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1211 run_test 39b "11063 problem 1 =================================="
1214 local client1=${CLIENT1:-`hostname`}
1215 local client2=${CLIENT2:-`hostname`}
1217 echo hello > $DIR1/$tfile
1219 local mtime1=`stat -c %Y $DIR1/$tfile`
1220 local mtime2=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1221 [ "$mtime1" = "$mtime2" ] || \
1222 error "create: different mtime on clients: $mtime1, $mtime2"
1225 $TRUNCATE $DIR1/$tfile 1
1227 for (( i=0; i < 2; i++ )) ; do
1228 local mtime3=`stat -c %Y $DIR1/$tfile`
1229 local mtime4=`do_node $client2 "stat -c %Y $DIR1/$tfile"`
1231 [ "$mtime3" = "$mtime4" ] || \
1232 error "different mtime on clients: $mtime3, $mtime4"
1233 [ "$mtime3" -gt $mtime2 ] || \
1234 error "truncate did not update mtime: $mtime2, $mtime3"
1236 cancel_lru_locks osc
1237 if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
1240 run_test 39c "check truncate mtime update ======================"
1242 # check that pid exists hence second operation wasn't blocked by first one
1243 # if it is so then there is no conflict, return 0
1244 # else second operation is conflicting with first one, return 1
1245 check_pdo_conflict() {
1248 sleep 1 # to ensure OP1 is finished on client if OP2 is blocked by OP1
1249 if [[ `ps --pid $pid | wc -l` == 1 ]]; then
1259 # test 40: check non-blocking operations
1261 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1262 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1263 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1265 mkdir $DIR1/$tfile &
1268 touch $DIR2/$tfile-2
1269 check_pdo_conflict $PID1 || error "create is blocked"
1270 mkdir $DIR2/$tfile-3
1271 check_pdo_conflict $PID1 || error "mkdir is blocked"
1272 link $DIR2/$tfile-2 $DIR2/$tfile-4
1273 check_pdo_conflict $PID1 || error "link is blocked"
1274 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1275 check_pdo_conflict $PID1 || error "rename is blocked"
1276 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1277 check_pdo_conflict $PID1 || error "getattr is blocked"
1278 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1279 rmdir $DIR2/$tfile-3
1280 check_pdo_conflict $PID1 || error "unlink is blocked"
1282 # all operations above shouldn't wait the first one
1283 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1288 run_test 40a "pdirops: create vs others =============="
1291 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1292 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1293 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1294 touch $DIR1/$tfile &
1298 touch $DIR2/$tfile-2
1299 check_pdo_conflict $PID1 || error "create is blocked"
1300 mkdir $DIR2/$tfile-3
1301 check_pdo_conflict $PID1 || error "mkdir is blocked"
1302 link $DIR2/$tfile-2 $DIR2/$tfile-4
1303 check_pdo_conflict $PID1 || error "link is blocked"
1304 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1305 check_pdo_conflict $PID1 || error "rename is blocked"
1306 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1307 check_pdo_conflict $PID1 || error "getattr is blocked"
1308 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1309 rmdir $DIR2/$tfile-3
1310 check_pdo_conflict $PID1 || error "unlink is blocked"
1311 # all operations above shouldn't wait the first one
1313 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1318 run_test 40b "pdirops: open|create and others =============="
1321 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1323 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1324 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1325 link $DIR1/$tfile $DIR1/$tfile-0 &
1329 touch $DIR2/$tfile-2
1330 check_pdo_conflict $PID1 || error "create is blocked"
1331 mkdir $DIR2/$tfile-3
1332 check_pdo_conflict $PID1 || error "mkdir is blocked"
1333 link $DIR2/$tfile-2 $DIR2/$tfile-4
1334 check_pdo_conflict $PID1 || error "link is blocked"
1335 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1336 check_pdo_conflict $PID1 || error "rename is blocked"
1337 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1338 check_pdo_conflict $PID1 || error "getattr is blocked"
1339 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1340 rmdir $DIR2/$tfile-3
1341 check_pdo_conflict $PID1 || error "unlink is blocked"
1343 # all operations above shouldn't wait the first one
1344 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1349 run_test 40c "pdirops: link and others =============="
1352 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1354 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1355 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1360 touch $DIR2/$tfile-2
1361 check_pdo_conflict $PID1 || error "create is blocked"
1362 mkdir $DIR2/$tfile-3
1363 check_pdo_conflict $PID1 || error "mkdir is blocked"
1364 link $DIR2/$tfile-2 $DIR2/$tfile-4
1365 check_pdo_conflict $PID1 || error "link is blocked"
1366 mv $DIR2/$tfile-2 $DIR2/$tfile-5
1367 check_pdo_conflict $PID1 || error "rename is blocked"
1368 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1369 check_pdo_conflict $PID1 || error "getattr is blocked"
1370 rm $DIR2/$tfile-4 $DIR2/$tfile-5
1371 rmdir $DIR2/$tfile-3
1372 check_pdo_conflict $PID1 || error "unlink is blocked"
1374 # all operations above shouldn't wait the first one
1375 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1379 run_test 40d "pdirops: unlink and others =============="
1382 remote_mds_nodsh && skip "remote MDS with nodsh" && return
1384 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1385 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1386 mv $DIR1/$tfile $DIR1/$tfile-0 &
1390 touch $DIR2/$tfile-2
1391 check_pdo_conflict $PID1 || error "create is blocked"
1392 mkdir $DIR2/$tfile-3
1393 check_pdo_conflict $PID1 || error "mkdir is blocked"
1394 link $DIR2/$tfile-2 $DIR2/$tfile-4
1395 check_pdo_conflict $PID1 || error "link is blocked"
1396 stat $DIR2/$tfile-3 $DIR2/$tfile-4 > /dev/null
1397 check_pdo_conflict $PID1 || error "getattr is blocked"
1398 rm $DIR2/$tfile-4 $DIR2/$tfile-2
1399 rmdir $DIR2/$tfile-3
1400 check_pdo_conflict $PID1 || error "unlink is blocked"
1402 # all operations above shouldn't wait the first one
1403 check_pdo_conflict $PID1 || error "parallel operation is blocked"
1408 run_test 40e "pdirops: rename and others =============="
1410 # test 41: create blocking operations
1412 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1413 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1414 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1417 mkdir $DIR2/$tfile && error "mkdir must fail"
1418 check_pdo_conflict $PID1 && { wait $PID1; echo "mkdir isn't blocked"; }
1422 run_test 41a "pdirops: create vs mkdir =============="
1425 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1426 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1427 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1430 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1431 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1435 run_test 41b "pdirops: create vs create =============="
1438 touch $DIR1/$tfile-2
1439 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1440 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1441 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1444 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1445 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1449 run_test 41c "pdirops: create vs link =============="
1452 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1453 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1454 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1457 rm $DIR2/$tfile || error "unlink must succeed"
1458 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1462 run_test 41d "pdirops: create vs unlink =============="
1465 touch $DIR1/$tfile-2
1466 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1467 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1468 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1471 mv $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1472 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1476 run_test 41e "pdirops: create and rename (tgt) =============="
1479 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1480 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1481 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1484 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1485 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1489 run_test 41f "pdirops: create and rename (src) =============="
1492 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1493 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1494 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1497 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1498 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1502 run_test 41g "pdirops: create vs getattr =============="
1505 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1506 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1507 $MULTIOP $DIR1/$tfile oO_CREAT:O_RDWR:c &
1510 ls -lia $DIR2/ > /dev/null
1511 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1515 run_test 41h "pdirops: create vs readdir =============="
1517 # test 42: unlink and blocking operations
1519 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1520 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1521 mkdir $DIR1/$tfile &
1524 mkdir $DIR2/$tfile && error "mkdir must fail"
1525 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1529 run_test 42a "pdirops: mkdir vs mkdir =============="
1532 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1533 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1534 mkdir $DIR1/$tfile &
1537 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1538 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1542 run_test 42b "pdirops: mkdir vs create =============="
1545 touch $DIR1/$tfile-2
1546 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1547 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1548 mkdir $DIR1/$tfile &
1551 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
1552 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1556 run_test 42c "pdirops: mkdir vs link =============="
1559 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1560 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1561 mkdir $DIR1/$tfile &
1564 rmdir $DIR2/$tfile || error "unlink must succeed"
1565 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1569 run_test 42d "pdirops: mkdir vs unlink =============="
1572 touch $DIR1/$tfile-2
1573 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1574 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1575 mkdir $DIR1/$tfile &
1578 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
1579 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1583 run_test 42e "pdirops: mkdir and rename (tgt) =============="
1586 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1587 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1588 mkdir $DIR1/$tfile &
1591 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
1592 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1596 run_test 42f "pdirops: mkdir and rename (src) =============="
1599 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1600 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1601 mkdir $DIR1/$tfile &
1604 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1605 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1609 run_test 42g "pdirops: mkdir vs getattr =============="
1612 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1613 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1614 mkdir $DIR1/$tfile &
1617 ls -lia $DIR2/ > /dev/null
1618 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1622 run_test 42h "pdirops: mkdir vs readdir =============="
1624 # test 43: unlink and blocking operations
1627 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1628 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1632 mkdir $DIR2/$tfile || error "mkdir must succeed"
1633 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1637 run_test 43a "pdirops: unlink vs mkdir =============="
1641 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1642 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1646 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
1647 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1651 run_test 43b "pdirops: unlink vs create =============="
1655 touch $DIR1/$tfile-2
1656 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1657 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1661 link $DIR2/$tfile-2 $DIR2/$tfile || error "link must succeed"
1662 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1666 run_test 43c "pdirops: unlink vs link =============="
1670 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1671 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1675 rm $DIR2/$tfile && error "unlink must fail"
1676 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1680 run_test 43d "pdirops: unlink vs unlink =============="
1684 touch $DIR1/$tfile-2
1685 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1686 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1690 mv -u $DIR2/$tfile-2 $DIR2/$tfile || error "rename must succeed"
1691 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1695 run_test 43e "pdirops: unlink and rename (tgt) =============="
1699 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1700 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1704 mv $DIR2/$tfile $DIR2/$tfile-2 && error "rename must fail"
1705 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1709 run_test 43f "pdirops: unlink and rename (src) =============="
1713 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1714 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1718 stat $DIR2/$tfile > /dev/null && error "stat must fail"
1719 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1723 run_test 43g "pdirops: unlink vs getattr =============="
1727 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1728 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1732 ls -lia $DIR2/ > /dev/null
1733 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1737 run_test 43h "pdirops: unlink vs readdir =============="
1740 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1742 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1743 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1747 $LFS mkdir -i 1 $DIR2/$tfile || error "remote mkdir must succeed"
1748 check_pdo_conflict $PID1 &&
1749 { wait $PID1; error "remote mkdir isn't blocked"; }
1753 run_test 43i "pdirops: unlink vs remote mkdir"
1755 # test 44: rename tgt and blocking operations
1757 touch $DIR1/$tfile-2
1758 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1759 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1760 mv $DIR1/$tfile-2 $DIR1/$tfile &
1763 mkdir $DIR2/$tfile && error "mkdir must fail"
1764 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1768 run_test 44a "pdirops: rename tgt vs mkdir =============="
1771 touch $DIR1/$tfile-2
1772 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1773 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1774 mv $DIR1/$tfile-2 $DIR1/$tfile &
1777 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
1778 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1782 run_test 44b "pdirops: rename tgt vs create =============="
1785 touch $DIR1/$tfile-2
1786 touch $DIR1/$tfile-3
1787 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1788 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1789 mv $DIR1/$tfile-2 $DIR1/$tfile &
1792 link $DIR2/$tfile-3 $DIR2/$tfile && error "link must fail"
1793 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1797 run_test 44c "pdirops: rename tgt vs link =============="
1800 touch $DIR1/$tfile-2
1801 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1802 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1803 mv $DIR1/$tfile-2 $DIR1/$tfile &
1806 rm $DIR2/$tfile || error "unlink must succeed"
1807 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1811 run_test 44d "pdirops: rename tgt vs unlink =============="
1815 touch $DIR1/$tfile-2
1816 touch $DIR1/$tfile-3
1817 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1818 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1819 mv $DIR1/$tfile-2 $DIR1/$tfile &
1822 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
1823 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1827 run_test 44e "pdirops: rename tgt and rename (tgt) =============="
1830 touch $DIR1/$tfile-2
1831 touch $DIR1/$tfile-3
1832 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1833 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1834 mv $DIR1/$tfile-2 $DIR1/$tfile &
1837 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
1838 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1842 run_test 44f "pdirops: rename tgt and rename (src) =============="
1845 touch $DIR1/$tfile-2
1846 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1847 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1848 mv $DIR1/$tfile-2 $DIR1/$tfile &
1851 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
1852 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1856 run_test 44g "pdirops: rename tgt vs getattr =============="
1859 touch $DIR1/$tfile-2
1860 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1861 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1862 mv $DIR1/$tfile-2 $DIR1/$tfile &
1865 ls -lia $DIR2/ > /dev/null
1866 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
1870 run_test 44h "pdirops: rename tgt vs readdir =============="
1872 # test 44: rename tgt and blocking operations
1874 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1875 touch $DIR1/$tfile-2
1876 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK2 0x146
1877 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000146
1878 mv $DIR1/$tfile-2 $DIR1/$tfile &
1881 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
1882 check_pdo_conflict $PID1 && { wait $PID1;
1883 error "remote mkdir isn't blocked"; }
1887 run_test 44i "pdirops: rename tgt vs remote mkdir"
1889 # test 45: rename src and blocking operations
1892 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1893 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1894 mv $DIR1/$tfile $DIR1/$tfile-2 &
1897 mkdir $DIR2/$tfile || error "mkdir must succeed"
1898 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
1902 run_test 45a "pdirops: rename src vs mkdir =============="
1906 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1907 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1908 mv $DIR1/$tfile $DIR1/$tfile-2 &
1911 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c || error "create must succeed"
1912 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
1916 run_test 45b "pdirops: rename src vs create =============="
1920 touch $DIR1/$tfile-3
1921 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1922 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1923 mv $DIR1/$tfile $DIR1/$tfile-2 &
1926 link $DIR2/$tfile-3 $DIR2/$tfile || error "link must succeed"
1927 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
1931 run_test 45c "pdirops: rename src vs link =============="
1935 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1936 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1937 mv $DIR1/$tfile $DIR1/$tfile-2 &
1940 rm $DIR2/$tfile && error "unlink must fail"
1941 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
1945 run_test 45d "pdirops: rename src vs unlink =============="
1949 touch $DIR1/$tfile-3
1950 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1951 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1952 mv $DIR1/$tfile $DIR1/$tfile-2 &
1955 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
1956 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1960 run_test 45e "pdirops: rename src and rename (tgt) =============="
1964 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1965 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1966 mv $DIR1/$tfile $DIR1/$tfile-2 &
1969 mv $DIR2/$tfile $DIR2/$tfile-3 && error "rename must fail"
1970 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
1974 run_test 45f "pdirops: rename src and rename (src) =============="
1978 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1979 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1980 mv $DIR1/$tfile $DIR1/$tfile-2 &
1983 stat $DIR2/$tfile > /dev/null && error "stat must fail"
1984 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
1988 run_test 45g "pdirops: rename src vs getattr =============="
1992 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
1993 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
1994 mv $DIR1/$tfile $DIR1/$tfile-2 &
1997 ls -lia $DIR2/ > /dev/null
1998 check_pdo_conflict $PID1 && { wait $PID1; error "readdir isn't blocked"; }
2002 run_test 45h "pdirops: unlink vs readdir =============="
2005 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2007 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2008 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2009 mv $DIR1/$tfile $DIR1/$tfile-2 &
2012 $LFS mkdir -i 1 $DIR2/$tfile || error "create remote dir must succeed"
2013 check_pdo_conflict $PID1 && { wait $PID1;
2014 error "create remote dir isn't blocked"; }
2018 run_test 45i "pdirops: rename src vs remote mkdir"
2020 # test 46: link and blocking operations
2022 touch $DIR1/$tfile-2
2023 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2024 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2025 link $DIR1/$tfile-2 $DIR1/$tfile &
2028 mkdir $DIR2/$tfile && error "mkdir must fail"
2029 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2033 run_test 46a "pdirops: link vs mkdir =============="
2036 touch $DIR1/$tfile-2
2037 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2038 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2039 link $DIR1/$tfile-2 $DIR1/$tfile &
2042 $MULTIOP $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2043 check_pdo_conflict $PID1 && { wait $PID1; error "create isn't blocked"; }
2047 run_test 46b "pdirops: link vs create =============="
2050 touch $DIR1/$tfile-2
2051 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2052 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2053 link $DIR1/$tfile-2 $DIR1/$tfile &
2056 link $DIR2/$tfile $DIR2/$tfile && error "link must fail"
2057 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2061 run_test 46c "pdirops: link vs link =============="
2064 touch $DIR1/$tfile-2
2065 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2066 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2067 link $DIR1/$tfile-2 $DIR1/$tfile &
2070 rm $DIR2/$tfile || error "unlink must succeed"
2071 check_pdo_conflict $PID1 && { wait $PID1; error "unlink isn't blocked"; }
2075 run_test 46d "pdirops: link vs unlink =============="
2078 touch $DIR1/$tfile-2
2079 touch $DIR1/$tfile-3
2080 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2081 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2082 link $DIR1/$tfile-2 $DIR1/$tfile &
2085 mv $DIR2/$tfile-3 $DIR2/$tfile || error "rename must succeed"
2086 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2090 run_test 46e "pdirops: link and rename (tgt) =============="
2093 touch $DIR1/$tfile-2
2094 touch $DIR1/$tfile-3
2095 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2096 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2097 link $DIR1/$tfile-2 $DIR1/$tfile &
2100 mv $DIR2/$tfile $DIR2/$tfile-3 || error "rename must succeed"
2101 check_pdo_conflict $PID1 && { wait $PID1; error "rename isn't blocked"; }
2105 run_test 46f "pdirops: link and rename (src) =============="
2108 touch $DIR1/$tfile-2
2109 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2110 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2111 link $DIR1/$tfile-2 $DIR1/$tfile &
2114 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2115 check_pdo_conflict $PID1 && { wait $PID1; error "getattr isn't blocked"; }
2119 run_test 46g "pdirops: link vs getattr =============="
2122 touch $DIR1/$tfile-2
2123 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2124 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2125 link $DIR1/$tfile-2 $DIR1/$tfile &
2128 ls -lia $DIR2/ > /dev/null
2129 check_pdo_conflict $PID1 && { wait $PID1;
2130 error "readdir isn't blocked"; }
2134 run_test 46h "pdirops: link vs readdir =============="
2137 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2138 touch $DIR1/$tfile-2
2139 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2140 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2141 link $DIR1/$tfile-2 $DIR1/$tfile &
2144 $LFS mkdir -i 1 $DIR2/$tfile && error "remote mkdir must fail"
2145 check_pdo_conflict $PID1 && { wait $PID1;
2146 error "remote mkdir isn't blocked"; }
2150 run_test 46i "pdirops: link vs remote mkdir"
2152 # test 47: remote mkdir and blocking operations
2154 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2155 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2156 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2157 $LFS mkdir -i 1 $DIR1/$tfile &
2160 mkdir $DIR2/$tfile && error "mkdir must fail"
2161 check_pdo_conflict $PID1 && { wait $PID1; error "mkdir isn't blocked"; }
2165 run_test 47a "pdirops: remote mkdir vs mkdir"
2168 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2169 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2170 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2171 $LFS mkdir -i 1 $DIR1/$tfile &
2174 multiop $DIR2/$tfile oO_CREAT:O_EXCL:c && error "create must fail"
2175 check_pdo_conflict $PID1 && { wait $PID1;
2176 error "create isn't blocked"; }
2180 run_test 47b "pdirops: remote mkdir vs create"
2183 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2184 touch $DIR1/$tfile-2
2185 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2186 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2187 $LFS mkdir -i 1 $DIR1/$tfile &
2190 link $DIR2/$tfile-2 $DIR2/$tfile && error "link must fail"
2191 check_pdo_conflict $PID1 && { wait $PID1; error "link isn't blocked"; }
2195 run_test 47c "pdirops: remote mkdir vs link"
2198 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2199 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2200 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2201 $LFS mkdir -i 1 $DIR1/$tfile &
2204 rmdir $DIR2/$tfile || error "unlink must succeed"
2205 check_pdo_conflict $PID1 && { wait $PID1;
2206 error "unlink isn't blocked"; }
2210 run_test 47d "pdirops: remote mkdir vs unlink"
2213 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2214 touch $DIR1/$tfile-2
2215 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2216 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2217 $LFS mkdir -i 1 $DIR1/$tfile &
2220 mv -T $DIR2/$tfile-2 $DIR2/$tfile && error "rename must fail"
2221 check_pdo_conflict $PID1 && { wait $PID1;
2222 error "rename isn't blocked"; }
2226 run_test 47e "pdirops: remote mkdir and rename (tgt)"
2229 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2230 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2231 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2232 $LFS mkdir -i 1 $DIR1/$tfile &
2235 mv $DIR2/$tfile $DIR2/$tfile-2 || error "rename must succeed"
2236 check_pdo_conflict $PID1 && { wait $PID1;
2237 error "rename isn't blocked"; }
2241 run_test 47f "pdirops: remote mkdir and rename (src)"
2244 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
2245 #define OBD_FAIL_ONCE|OBD_FAIL_MDS_PDO_LOCK 0x145
2246 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000145
2247 $LFS mkdir -i 1 $DIR1/$tfile &
2250 stat $DIR2/$tfile > /dev/null || error "stat must succeed"
2251 check_pdo_conflict $PID1 && { wait $PID1;
2252 error "getattr isn't blocked"; }
2256 run_test 47g "pdirops: remote mkdir vs getattr"
2260 dd if=/dev/zero of=$DIR1/$tfile bs=1K count=10
2261 #define OBD_FAIL_OSC_CP_ENQ_RACE 0x410
2262 do_facet client "lctl set_param fail_loc=0x410"
2263 $TRUNCATE $DIR2/$tfile $trunc_size
2264 do_facet client "lctl set_param fail_loc=0x0"
2266 size=`stat -c %s $DIR2/$tfile`
2267 [ $size -eq $trunc_size ] || error "wrong size"
2269 run_test 50 "osc lvb attrs: enqueue vs. CP AST =============="
2273 local origfile=/etc/hosts
2275 filesize=`stat -c %s $origfile`
2277 # create an empty file
2278 $MCREATE $DIR1/$tfile
2279 # cache layout lock on both mount point
2280 stat $DIR1/$tfile > /dev/null
2281 stat $DIR2/$tfile > /dev/null
2283 # open and sleep 2 seconds then read
2284 $MULTIOP $DIR2/$tfile o_2r${filesize}c &
2288 # create the layout of testing file
2289 dd if=$origfile of=$DIR1/$tfile conv=notrunc > /dev/null
2291 # MULTIOP proc should be able to read enough bytes and exit
2293 kill -0 $pid && error "multiop is still there"
2294 cmp $origfile $DIR2/$tfile || error "$MCREATE and $DIR2/$tfile differs"
2298 run_test 51a "layout lock: refresh layout should work"
2301 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.59) ]] ||
2302 { skip "Need MDS version at least 2.3.59"; return 0; }
2304 local tmpfile=`mktemp`
2306 # create an empty file
2307 $MCREATE $DIR1/$tfile
2309 # delay glimpse so that layout has changed when glimpse finish
2310 #define OBD_FAIL_GLIMPSE_DELAY 0x1404
2311 $LCTL set_param fail_loc=0x1404
2312 stat -c %s $DIR2/$tfile |tee $tmpfile &
2316 # create layout of testing file
2317 dd if=/dev/zero of=$DIR1/$tfile bs=1k count=1 conv=notrunc > /dev/null
2320 local fsize=`cat $tmpfile`
2322 [ x$fsize = x1024 ] || error "file size is $fsize, should be 1024"
2324 rm -f $DIR1/$tfile $tmpfile
2326 run_test 51b "layout lock: glimpse should be able to restart if layout changed"
2329 [ $OSTCOUNT -ge 2 ] || { skip "need at least 2 osts"; return; }
2331 # set default layout to have 1 stripe
2332 mkdir -p $DIR1/$tdir
2333 $LFS setstripe -c 1 $DIR1/$tdir
2335 # create a file with empty layout
2336 $MCREATE $DIR1/$tdir/$tfile
2338 #define OBD_FAIL_MDS_LL_BLOCK 0x172
2339 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x172
2341 # change the layout of testing file
2342 echo "Setting layout to have $OSTCOUNT stripes ..."
2343 $LFS setstripe -c $OSTCOUNT $DIR1/$tdir/$tfile &
2347 # write something to the file, it should be blocked on fetching layout
2348 dd if=/dev/zero of=$DIR2/$tdir/$tfile bs=1k count=1 conv=notrunc
2349 local cnt=$($LFS getstripe -c $DIR2/$tdir/$tfile)
2350 [ $cnt -eq $OSTCOUNT ] || error "have $cnt stripes, expected $OSTCOUNT"
2354 run_test 51c "layout lock: IT_LAYOUT blocked and correct layout can be returned"
2357 dd if=/dev/zero of=/$DIR1/$tfile bs=1M count=1
2358 cancel_lru_locks mdc
2360 # open should grant LAYOUT lock, mmap and read will install pages
2361 $MULTIOP $DIR1/$tfile oO_RDWR:SMR_Uc &
2365 # rss before revoking
2366 local br=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2367 echo "Before revoking layout lock: $br KB mapped"
2369 # delete the file will revoke layout lock
2372 # rss after revoking
2373 local ar=$(grep -A 10 $tfile /proc/$PID/smaps | awk '/^Rss/{print $2}')
2378 [ $ar -eq 0 ] || error "rss before: $br, after $ar, some pages remained"
2380 run_test 51d "layout lock: losing layout lock should clean up memory map region"
2384 echo "==> rename vs getattr vs setxattr should not deadlock"
2385 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2387 do_facet mds $LCTL set_param fail_loc=$1
2389 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2397 setfattr -n user.attr1 -v value1 $DIR2/d1 || error "(2) setfattr failed"
2398 wait $PID1 || error "(3) mv failed"
2399 wait $PID2 || error "(4) stat failed"
2406 echo "==> rename vs getattr vs open vs getattr should not deadlock"
2407 mkdir -p $DIR/d1/d2/d3 || error "(1) mkdir failed"
2409 do_facet mds $LCTL set_param fail_loc=$1
2411 mv -T $DIR/d1/d2/d3 $DIR/d1/d3 &
2419 $MULTIOP $DIR2/d1/d2 Oc &
2423 stat $DIR/d1 || error "(2) stat failed"
2425 wait $PID1 || error "(3) mv failed"
2426 wait $PID2 || error "(4) stat failed"
2427 wait $PID3 && error "(5) multiop failed"
2433 local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
2434 save_lustre_params client "llite.*.xattr_cache" > $p
2435 lctl set_param llite.*.xattr_cache 1 ||
2436 { skip "xattr cache is not supported"; return 0; }
2438 #define OBD_FAIL_MDS_RENAME 0x153
2439 #define OBD_FAIL_MDS_RENAME2 0x154
2440 test_54_part1 0x80000153 || error 10
2441 test_54_part1 0x80000154 || error 11
2442 test_54_part2 0x80000153 || error 12
2443 test_54_part2 0x80000154 || error 13
2445 restore_lustre_params < $p
2448 run_test 54 "rename locking"
2451 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2453 #define OBD_FAIL_MDS_RENAME4 0x156
2454 do_facet mds $LCTL set_param fail_loc=0x80000156
2456 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2461 wait $PID1 && error "(2) mv succeeded"
2465 run_test 55a "rename vs unlink target dir"
2469 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2471 #define OBD_FAIL_MDS_RENAME4 0x156
2472 do_facet mds $LCTL set_param fail_loc=0x80000156
2474 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2479 wait $PID1 && error "(2) mv succeeded"
2483 run_test 55b "rename vs unlink source dir"
2487 mkdir -p $DIR/d1/d2 $DIR/d3 || error "(1) mkdir failed"
2489 #define OBD_FAIL_MDS_RENAME4 0x156
2490 do_facet mds $LCTL set_param fail_loc=0x156
2492 mv -T $DIR/d1/d2 $DIR/d3/d2 &
2496 # while rename is sleeping, open and remove d3
2497 $MULTIOP $DIR2/d3 D_c &
2503 # while rename is sleeping 2nd time, close d3
2505 wait $PID2 || error "(3) multiop failed"
2507 wait $PID1 && error "(2) mv succeeded"
2511 run_test 55c "rename vs unlink orphan target dir"
2517 #define OBD_FAIL_MDS_RENAME3 0x155
2518 do_facet mds $LCTL set_param fail_loc=0x155
2519 mv $DIR/f1 $DIR/$tdir &
2523 # while rename is sleeping, create $tdir, but as a directory
2524 mkdir -p $DIR2/$tdir || error "(1) mkdir failed"
2526 # link in reverse locking order
2527 ln $DIR2/f1 $DIR2/$tdir/
2529 wait $PID1 && error "(2) mv succeeded"
2532 run_test 55d "rename file vs link"
2535 local MDSVER=$(lustre_build_version $SINGLEMDS)
2536 [ $(version_code $MDSVER) -lt $(version_code 2.3.0) ] &&
2537 skip "MDS version $MDSVER must be >= 2.3.0" && return 0
2540 test_mkdir -p $DIR1/$tdir
2541 file1=$DIR1/$tdir/file
2542 file2=$DIR2/$tdir/file
2544 echo orig > $file2 || error "Could not create $file2"
2545 version=$($LFS data_version $file1)
2548 echo append >> $file2 || error "Could not append to $file2"
2549 version2=$($LFS data_version $file1)
2550 [ "$version" != "$version2" ] ||
2551 error "append did not change data version: $version"
2554 echo overwrite > $file2 || error "Could not overwrite $file2"
2555 version3=$($LFS data_version $file1)
2556 [ "$version2" != "$version3" ] ||
2557 error "overwrite did not change data version: $version2"
2559 # Truncate before EOF
2560 $TRUNCATE $file2 3 || error "Could not truncate $file2"
2561 version4=$($LFS data_version $file1)
2562 [ "$version3" != "$version4" ] ||
2563 error "truncate did not change data version: $version3"
2565 # Truncate after EOF
2566 $TRUNCATE $file2 123456 || error "Could not truncate $file2"
2567 version5=$($LFS data_version $file1)
2568 [ "$version4" != "$version5" ] ||
2569 error "truncate did not change data version: $version4"
2571 # Chmod do not change version
2572 chmod 400 $file2 || error "Could not chmod 400 $file2"
2573 version6=$($LFS data_version $file1)
2574 [ "$version5" == "$version6" ] ||
2575 error "chmod should not change data version: $version5 != $version6"
2577 # Chown do not change version
2578 chown $RUNAS_ID $file2 || error "Could not chown $RUNAS_ID $file2"
2579 version7=$($LFS data_version $file1)
2580 [ "$version5" == "$version7" ] ||
2581 error "chown should not change data version: $version5 != $version7"
2583 run_test 60 "Verify data_version behaviour"
2586 local test_dir=$tdir/test_dir
2588 mkdir -p $DIR1/$tdir
2589 if [ $MDSCOUNT -ge 2 ]; then
2591 $LFS mkdir -i $MDTIDX $DIR1/$test_dir ||
2592 error "Create remote directory failed"
2594 mkdir -p $DIR1/$test_dir
2596 cd $DIR2/$test_dir || error "cd directory failed"
2597 rm -rf $DIR1/$test_dir || error "unlink directory failed"
2599 cd $DIR2/$tdir || error "exit directory"
2601 run_test 70a "cd directory && rm directory"
2603 test_70b() { # LU-2781
2605 mkdir -p $DIR1/$tdir
2607 touch $DIR1/$tdir/file
2608 for ((i = 0; i < 32; i++)); do
2609 $LFS rm_entry $DIR1/$tdir/non_existent_dir &>/dev/null
2611 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2613 touch $DIR1/$tdir/file
2614 $LFS mkdir -i0 $DIR1/$tdir/test_dir
2615 $LFS rm_entry $DIR1/$tdir/test_dir &>/dev/null
2616 rm -rf $DIR1/$tdir/test_dir ||
2617 error "cannot remove directory after rm_entry"
2618 rm $DIR1/$tdir/file || error "cannot remove file after rm_entry"
2620 run_test 70b "remove files after calling rm_entry"
2623 local server_version=$(lustre_version_code $SINGLEMDS)
2625 [[ $server_version -lt $(version_code 2.1.6) ]] &&
2626 skip "Need MDS version at least 2.1.6" && return
2628 # Patch not applied to 2.2 and 2.3 branches
2629 [[ $server_version -ge $(version_code 2.2.0) ]] &&
2630 [[ $server_version -lt $(version_code 2.4.0) ]] &&
2631 skip "Need MDS version at least 2.4.0" && return
2633 checkfiemap --test ||
2634 { skip "checkfiemap not runnable: $?" && return; }
2635 # write data this way: hole - data - hole - data
2636 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2637 [ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR1/$tfile) + 1)))" = \
2639 skip "ORI-366/LU-1941: FIEMAP unimplemented on ZFS" && return 0
2640 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2641 GET_STAT="lctl get_param -n ldlm.services.ldlm_cbd.stats"
2643 local can1=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2645 checkfiemap $DIR2/$tfile 81920 ||
2646 error "data is not flushed from client"
2647 local can2=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2650 # common case of "create file, copy file" on a single node
2651 # should not flush data from ost
2652 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=1 count=1
2653 dd if=/dev/urandom of=$DIR1/$tfile bs=40K seek=3 count=1
2655 local can3=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2657 checkfiemap $DIR1/$tfile 81920 ||
2659 local can4=$($GET_STAT | awk '/ldlm_bl_callback/ {print $2}')
2661 [ $can3 -eq $can4 ] || error $((can2-can1)) "cancel RPC occured."
2663 run_test 71 "correct file map just after write operation is finished"
2666 local p="$TMP/sanityN-$TESTNAME.parameters"
2669 save_lustre_params client "llite.*.xattr_cache" > $p
2670 lctl set_param llite.*.xattr_cache 1 ||
2671 { skip "xattr cache is not supported"; return 0; }
2674 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2675 error "setfattr1 failed"
2676 getfattr -n user.attr1 $DIR2/$tfile | grep value1 ||
2677 error "getfattr1 failed"
2678 setfattr -n user.attr1 -v value2 $DIR2/$tfile ||
2679 error "setfattr2 failed"
2680 getfattr -n user.attr1 $DIR1/$tfile | grep value2 ||
2681 error "getfattr2 failed"
2683 # check that trusted.link is consistent
2684 tlink1=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2685 ln $DIR2/$tfile $DIR2/$tfile-2 || error "failed to link"
2686 tlink2=$(getfattr -n trusted.link $DIR1/$tfile | md5sum)
2687 echo "$tlink1 $tlink2"
2688 [ "$tlink1" = "$tlink2" ] && error "trusted.link should have changed!"
2692 restore_lustre_params < $p
2695 run_test 72 "getxattr/setxattr cache should be consistent between nodes"
2698 local p="$TMP/sanityN-$TESTNAME.parameters"
2699 save_lustre_params client "llite.*.xattr_cache" > $p
2700 lctl set_param llite.*.xattr_cache 1 ||
2701 { skip "xattr cache is not supported"; return 0; }
2704 setfattr -n user.attr1 -v value1 $DIR1/$tfile ||
2705 error "setfattr1 failed"
2706 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr1 failed"
2707 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr2 failed"
2709 # PR lock should be cached by now on both clients
2710 getfattr -n user.attr1 $DIR1/$tfile || error "getfattr3 failed"
2711 # 2 hits for getfattr(0)+getfattr(size)
2712 [ $(calc_llite_stats getxattr_hits) -eq 2 ] || error "not cached in $DIR1"
2713 getfattr -n user.attr1 $DIR2/$tfile || error "getfattr4 failed"
2714 # 4 hits for more getfattr(0)+getfattr(size)
2715 [ $(calc_llite_stats getxattr_hits) -eq 4 ] || error "not cached in $DIR2"
2718 restore_lustre_params < $p
2721 run_test 73 "getxattr should not cause xattr lock cancellation"
2724 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.93) ] &&
2725 skip "Need MDS version at least 2.4.93" && return
2727 dd if=/dev/zero of=$DIR1/$tfile-1 bs=1K count=1
2728 dd if=/dev/zero of=$DIR1/$tfile-2 bs=1K count=1
2729 flocks_test 4 $DIR1/$tfile-1 $DIR2/$tfile-2
2731 run_test 74 "flock deadlock: different mounts =============="
2735 $LFS setstripe -c 2 -S 1m -i 0 $DIR1/$tfile
2736 dd if=/dev/zero of=$DIR1/$tfile bs=1M count=2
2737 cancel_lru_locks osc
2739 dd of=$DIR1/$tfile if=/dev/zero bs=1M count=1 seek=1 conv=notrunc
2742 # define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d
2743 $LCTL set_param fail_loc=0x31d
2744 stat -c %s $DIR1/$tfile &
2749 # For bad lock error handler we should ASSERT and got kernel panic here
2751 $LCTL set_param fail_loc=0
2753 run_test 75 "osc: upcall after unuse lock==================="
2756 [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
2757 skip "Need MDS version at least 2.5.53" && return
2759 remote_mds_nodsh && skip "remote MDS with nodsh" && return
2765 nid=$($LCTL list_nids | sed "s/\./\\\./g")
2771 test_mkdir -p $DIR/$tdir
2773 # drop all open locks and close any cached "open" files on the client
2774 cancel_lru_locks mdc
2776 echo -n "open files "
2778 for ((i = 0; i < $fcount; i++)); do
2779 touch $DIR/$tdir/f_$i
2781 local cmd="exec $fd<$DIR/$tdir/f_$i"
2788 local get_open_fids="$LCTL get_param -n mdt.*.exports.'$nid'.open_files"
2789 local fid_list=($(do_nodes $(comma_list $(mdts_nodes)) $get_open_fids))
2791 # Possible errors in openfiles FID list.
2792 # 1. Missing FIDs. Check 1
2793 # 2. Extra FIDs. Check 1
2794 # 3. Duplicated FID. Check 2
2795 # 4. Invalid FIDs. Check 2
2796 # 5. Valid FID, points to some other file. Check 3
2799 [ ${#fid_list[@]} -ne $fcount ] &&
2800 error "${#fid_list[@]} != $fcount open files"
2802 for (( i = 0; i < $fcount; i++ )) ; do
2803 cmd="exec ${fd_list[i]}</dev/null"
2805 filename=$($LFS fid2path $DIR2 ${fid_list[i]})
2808 rm --interactive=no $filename
2810 error "Nonexisting fid ${fid_list[i]} listed."
2814 ls_op=$(ls $DIR2/$tdir | wc -l)
2816 error "Some openfiles are missing in lproc output"
2820 run_test 76 "Verify open file for 2048 files"
2824 local dir=$DIR/$tdir
2827 mkdir $dir || error "mkdir $dir failed"
2828 $LFS setstripe -c $OSTCOUNT $dir || error "setstripe to $dir failed"
2831 do_nodes $CLIENTS $myRUNAS dd if=/dev/zero of="$dir/nrs_r_$HOSTNAME"\
2832 bs=1M count=$n > /dev/null 2>&1
2834 for ((i = 0; i < $n; i++)); do
2835 do_nodes $CLIENTS $myRUNAS dd if=/dev/zero\
2836 of="$dir/nrs_w_$HOSTNAME" bs=1M seek=$i count=1\
2840 do_nodes $CLIENTS sync;
2841 cancel_lru_locks osc
2843 for ((i = 0; i < $n; i++)); do
2844 do_nodes $CLIENTS $myRUNAS dd if="$dir/nrs_w_$HOSTNAME"\
2845 of=/dev/zero bs=1M seek=$i count=1 > /dev/null 2>&1 &
2848 cancel_lru_locks osc
2850 for ((i = 0; i < $n; i++)); do
2854 rm -rf $dir || error "rm -rf $dir failed"
2857 test_77a() { #LU-3266
2858 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_policies="fifo"
2863 run_test 77a "check FIFO NRS policy"
2866 test_77b() { #LU-3266
2867 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_policies="crrn"
2868 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_crrn_quantum=1
2870 echo "policy: crr-n, crrn_quantum 1"
2873 do_facet $SINGLEMDS lctl set_param ost.OSS.*.nrs_crrn_quantum=64
2875 echo "policy: crr-n, crrn_quantum 64"
2880 run_test 77b "check CRR-N NRS policy"
2885 for i in $(seq 1 $OSTCOUNT)
2887 do_facet ost"$i" lctl set_param \
2888 ost.OSS.ost_io.nrs_policies=$policy
2889 do_facet ost"$i" lctl set_param \
2890 ost.OSS.*.nrs_"$policy"_quantum=1
2891 do_facet ost"$i" lctl set_param \
2892 ost.OSS.*.nrs_"$policy"_offset_type="physical"
2893 do_facet ost"$i" lctl set_param \
2894 ost.OSS.*.nrs_"$policy"_supported="reads"
2897 echo "policy: $policy, ${policy}_quantum 1, ${policy}_offset_type \
2898 physical, ${policy}_supported reads"
2901 for i in $(seq 1 $OSTCOUNT)
2903 do_facet ost"$i" lctl set_param \
2904 ost.OSS.*.nrs_${policy}_supported="writes"
2905 do_facet ost"$i" lctl set_param \
2906 ost.OSS.*.nrs_${policy}_quantum=64
2908 echo "policy: $policy, ${policy}_quantum 64, \
2909 ${policy}_offset_type physical, ${policy}_supported writes"
2912 for i in $(seq 1 $OSTCOUNT)
2914 do_facet ost"$i" lctl set_param \
2915 ost.OSS.*.nrs_${policy}_supported="reads_and_writes"
2916 do_facet ost"$i" lctl set_param \
2917 ost.OSS.*.nrs_${policy}_offset_type="logical"
2919 echo "policy: $policy, ${policy}_quantum 64, \
2920 ${policy}_offset_type logical, ${policy}_supported reads_and_writes"
2926 test_77c() { #LU-3266
2930 run_test 77c "check ORR NRS policy"
2932 test_77d() { #LU-3266
2936 run_test 77d "check TRR nrs policy"
2943 do_facet $facet lctl set_param \
2944 ost.OSS.ost_io.nrs_tbf_rule="$@"
2946 error "failed to operate on TBF rules"
2950 for i in $(seq 1 $OSTCOUNT)
2952 do_facet ost"$i" lctl set_param \
2953 ost.OSS.ost_io.nrs_policies="tbf\ nid"
2955 error "failed to set TBF policy"
2958 # Only operate rules on ost1 since OSTs might run on the same OSS
2960 tbf_rule_operate ost1 "start\ localhost\ {0@lo}\ 1000"
2961 local address=$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")
2962 local client_nids=$(nids_list $address "\\")
2963 tbf_rule_operate ost1 "start\ clients\ {$client_nids}\ 100"
2964 tbf_rule_operate ost1 "start\ others\ {*.*.*.*@$NETTYPE}\ 50"
2968 tbf_rule_operate ost1 "change\ localhost\ 1001"
2969 tbf_rule_operate ost1 "change\ clients\ 101"
2970 tbf_rule_operate ost1 "change\ others\ 51"
2974 tbf_rule_operate ost1 "stop\ localhost"
2975 tbf_rule_operate ost1 "stop\ clients"
2976 tbf_rule_operate ost1 "stop\ others"
2979 # Cleanup the TBF policy
2980 for i in $(seq 1 $OSTCOUNT)
2982 do_facet ost"$i" lctl set_param \
2983 ost.OSS.ost_io.nrs_policies="fifo"
2985 error "failed to set policy back to fifo"
2990 run_test 77e "check TBF NID nrs policy"
2993 # Configure jobid_var
2994 local saved_jobid_var=$($LCTL get_param -n jobid_var)
2995 if [ $saved_jobid_var != procname_uid ]; then
2996 set_conf_param_and_check client \
2997 "$LCTL get_param -n jobid_var" \
2998 "$FSNAME.sys.jobid_var" procname_uid
3001 for i in $(seq 1 $OSTCOUNT)
3003 do_facet ost"$i" lctl set_param \
3004 ost.OSS.ost_io.nrs_policies="tbf\ jobid"
3006 error "failed to set TBF policy"
3009 # Only operate rules on ost1 since OSTs might run on the same OSS
3011 tbf_rule_operate ost1 "start\ runas\ {iozone.$RUNAS_ID\ dd.$RUNAS_ID\ tiotest.$RUNAS_ID}\ 1000"
3012 tbf_rule_operate ost1 "start\ iozone_runas\ {iozone.$RUNAS_ID}\ 100"
3013 tbf_rule_operate ost1 "start\ dd_runas\ {dd.$RUNAS_ID}\ 50"
3014 nrs_write_read "$RUNAS"
3017 tbf_rule_operate ost1 "change\ runas\ 1001"
3018 tbf_rule_operate ost1 "change\ iozone_runas\ 101"
3019 tbf_rule_operate ost1 "change\ dd_runas\ 51"
3020 nrs_write_read "$RUNAS"
3023 tbf_rule_operate ost1 "stop\ runas"
3024 tbf_rule_operate ost1 "stop\ iozone_runas"
3025 tbf_rule_operate ost1 "stop\ dd_runas"
3026 nrs_write_read "$RUNAS"
3028 # Cleanup the TBF policy
3029 for i in $(seq 1 $OSTCOUNT)
3031 do_facet ost"$i" lctl set_param \
3032 ost.OSS.ost_io.nrs_policies="fifo"
3034 error "failed to set policy back to fifo"
3036 nrs_write_read "$RUNAS"
3038 local current_jobid_var=$($LCTL get_param -n jobid_var)
3039 if [ $saved_jobid_var != $current_jobid_var ]; then
3040 set_conf_param_and_check client \
3041 "$LCTL get_param -n jobid_var" \
3042 "$FSNAME.sys.jobid_var" $saved_jobid_var
3046 run_test 77f "check TBF JobID nrs policy"
3049 for i in $(seq 1 $OSTCOUNT)
3051 do_facet ost"$i" lctl set_param \
3052 ost.OSS.ost_io.nrs_policies="tbf\ nid"
3054 error "failed to set TBF policy"
3057 for i in $(seq 1 $OSTCOUNT)
3059 do_facet ost"$i" lctl set_param \
3060 ost.OSS.ost_io.nrs_policies="tbf\ jobid"
3062 error "failed to set TBF policy"
3065 # Add a rule that only valid for Jobid TBF. If direct change between
3066 # TBF types is not supported, this operation will fail.
3067 tbf_rule_operate ost1 "start\ dd_runas\ {dd.$RUNAS_ID}\ 50"
3069 # Cleanup the TBF policy
3070 for i in $(seq 1 $OSTCOUNT)
3072 do_facet ost"$i" lctl set_param \
3073 ost.OSS.ost_io.nrs_policies="fifo"
3075 error "failed to set policy back to fifo"
3079 run_test 77g "Change TBF type directly"
3081 test_78() { #LU-6673
3084 for i in $(seq 1 $OSTCOUNT)
3086 do_facet ost"$i" lctl set_param \
3087 ost.OSS.ost_io.nrs_policies="orr" &
3088 do_facet ost"$i" lctl set_param \
3089 ost.OSS.*.nrs_orr_quantum=1
3091 # Valid return codes are:
3092 # 0: Tuning succeeded
3093 # ENODEV: Policy is still stopped
3094 # EAGAIN: Policy is being initialized
3095 [ $rc -eq 0 -o $rc -eq 19 -o $rc -eq 11 ] ||
3096 error "Expected set_param to return 0|ENODEV|EAGAIN"
3099 # Cleanup the ORR policy
3100 for i in $(seq 1 $OSTCOUNT)
3102 do_facet ost"$i" lctl set_param \
3103 ost.OSS.ost_io.nrs_policies="fifo"
3105 error "failed to set policy back to fifo"
3109 run_test 78 "Enable policy and specify tunings right away"
3112 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3119 mkdir -p $DIR1/$tdir/dir
3120 createmany -o $DIR1/$tdir/dir/f 10 ||
3121 error "create files under remote dir failed $i"
3123 cp /etc/passwd $DIR1/$tdir/$tfile
3125 #migrate open file should fails
3126 multiop_bg_pause $DIR2/$tdir/$tfile O_c || error "open $file failed"
3128 # give multiop a chance to open
3131 $LFS migrate -m $MDTIDX $DIR1/$tdir &&
3132 error "migrate open files should failed with open files"
3136 $LFS migrate -m $MDTIDX $DIR1/$tdir ||
3137 error "migrate remote dir error"
3139 echo "Finish migration, then checking.."
3140 for file in $(find $DIR1/$tdir); do
3141 mdt_index=$($LFS getstripe -M $file)
3142 [ $mdt_index == $MDTIDX ] ||
3143 error "$file is not on MDT${MDTIDX}"
3146 diff /etc/passwd $DIR1/$tdir/$tfile ||
3147 error "file different after migration"
3149 rm -rf $DIR1/$tdir || error "rm dir failed after migration"
3151 run_test 80a "migrate directory when some children is being opened"
3155 kill -9 $migrate_pid
3159 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3160 local migrate_dir1=$DIR1/$tdir/migrate_dir
3161 local migrate_dir2=$DIR2/$tdir/migrate_dir
3162 local migrate_run=$LUSTRE/tests/migrate.sh
3170 trap cleanup_80b EXIT
3171 #prepare migrate directory
3172 mkdir -p $migrate_dir1
3173 for F in {1,2,3,4,5}; do
3174 echo "$F$F$F$F$F" > $migrate_dir1/file$F
3175 echo "$F$F$F$F$F" > $DIR/$tdir/file$F
3178 #migrate the directories among MDTs
3181 mdt_idx=$((RANDOM % MDSCOUNT))
3182 $LFS migrate -m $mdt_idx $migrate_dir1 2&>/dev/null ||
3184 [ $rc -ne 0 -o $rc -ne 16 ] || break
3189 echo "start migration thread $migrate_pid"
3190 #Access the files at the same time
3191 start_time=$(date +%s)
3192 echo "accessing the migrating directory for 5 minutes..."
3194 ls $migrate_dir2 > /dev/null || {
3195 echo "read dir fails"
3198 diff -u $DIR2/$tdir/file1 $migrate_dir2/file1 || {
3199 echo "access file1 fails"
3203 cat $migrate_dir2/file2 > $migrate_dir2/file3 || {
3204 echo "access file2/3 fails"
3208 echo "aaaaa" > $migrate_dir2/file4 > /dev/null || {
3209 echo "access file4 fails"
3213 stat $migrate_dir2/file5 > /dev/null || {
3214 echo "stat file5 fails"
3218 touch $migrate_dir2/source_file > /dev/null || rc1=$?
3219 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
3220 echo "touch file failed with $rc1"
3224 if [ -e $migrate_dir2/source_file ]; then
3225 ln $migrate_dir2/source_file $migrate_dir2/link_file \
3226 2&>/dev/null || rc1=$?
3227 if [ -e $migrate_dir2/link_file ]; then
3228 rm -rf $migrate_dir2/link_file
3231 mrename $migrate_dir2/source_file \
3232 $migrate_dir2/target_file 2&>/dev/null || rc1=$?
3233 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
3234 echo "rename failed with $rc1"
3238 if [ -e $migrate_dir2/target_file ]; then
3239 rm -rf $migrate_dir2/target_file 2&>/dev/null ||
3242 rm -rf $migrate_dir2/source_file 2&>/dev/null ||
3245 [ $rc1 -ne 0 -o $rc1 -ne 1 ] || {
3246 echo "unlink failed with $rc1"
3251 end_time=$(date +%s)
3252 duration=$((end_time - start_time))
3253 if [ $((duration % 10)) -eq 0 ]; then
3254 if [ $show_time -eq 1 ]; then
3255 echo "...$duration seconds"
3262 kill -0 $migrate_pid || {
3263 echo "migration stopped 1"
3267 [ $duration -ge 300 ] && break
3270 #check migration are still there
3271 kill -0 $migrate_pid || error "migration stopped 2"
3274 run_test 80b "Accessing directory during migration"
3277 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3281 mkdir -p $DIR1/$tdir
3283 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d0
3284 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR1/$tdir/d1
3287 touch d0/0 || error "create 0 failed"
3288 mv d0/0 d1/0 || error "rename d0/0 d1/0 failed"
3289 stat d0/0 && error "stat mv filed succeed"
3290 mv $DIR2/$tdir/d1/0 $DIR2/$tdir/d0/0 || "rename d1/0 d0/0 failed"
3291 stat d0/0 || error "stat failed"
3293 local t=$(ls -ai $DIR1/$tdir/d0 | sort -u | wc -l)
3295 if [ $t -ne 3 ]; then
3296 ls -ai $DIR1/$tdir/d0
3297 error "expect 3 get $t"
3302 run_test 81 "rename and stat under striped directory"
3305 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.6.91) ]] ||
3306 { skip "Need MDS version at least 2.6.92"; return 0; }
3308 # Client 1 creates a file.
3309 multiop_bg_pause $DIR1/$tfile O_ac || error "multiop_bg_pause 1"
3311 # Client 2 opens the file.
3312 multiop_bg_pause $DIR2/$tfile o_Ac || error "multiop_bg_pause 2"
3314 # Client 1 makes the file an orphan.
3315 rm $DIR1/$tfile || error "rm"
3316 # Client 2 sets EA "user.multiop".
3318 wait $pid2 || error "multiop 2"
3319 # Client 1 gets EA "user.multiop". This used to fail because the EA
3320 # cache refill would get "trusted.link" from mdd_xattr_list() but
3321 # -ENOENT when trying to get "trusted.link"'s value. See also sanity
3324 wait $pid1 || error "multiop 1"
3326 run_test 82 "fsetxattr and fgetxattr on orphan files"
3329 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3336 $LFS mkdir -i1 -c2 $tdir
3341 echo "start pid $pid1 to create/unlink striped directory"
3343 # Access the directory at the same time
3347 stat $tdir > /dev/null 2>&1
3351 echo "start pid $pid2 to stat striped directory"
3359 run_test 83 "access striped directory while it is being created/unlinked"
3362 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3367 [ "$SLOW" = "yes" ] && duration=600
3368 # Open/Create under striped directory
3372 $LFS mkdir -c$MDSCOUNT $tdir > /dev/null 2>&1
3373 touch $tdir/f{0..3} > /dev/null 2>&1
3377 echo "start pid $pid1 to open/create under striped directory"
3379 # unlink the striped directory at the same time
3383 rm -rf $tdir > /dev/null 2>&1
3387 echo "start pid $pid2 to unlink striped directory"
3396 run_test 90 "open/create and unlink striped directory"
3399 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
3404 [ "$SLOW" = "yes" ] && duration=600
3405 # chmod striped directory
3409 $LFS mkdir -c$MDSCOUNT $tdir > /dev/null 2>&1
3410 chmod go+w $tdir > /dev/null 2>&1
3414 echo "start pid $pid1 to chmod striped directory"
3416 # unlink the striped directory at the same time
3420 rm -rf $tdir > /dev/null 2>&1
3424 echo "start pid $pid2 to unlink striped directory"
3433 run_test 91 "chmod and unlink striped directory"
3435 log "cleanup: ======================================================"
3437 [ "$(mount | grep $MOUNT2)" ] && umount $MOUNT2
3441 check_and_cleanup_lustre