7 # This test needs to be run on the client
10 export MULTIOP=${MULTIOP:-multiop}
11 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
14 . $LUSTRE/tests/test-framework.sh
16 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
18 CHECK_GRANT=${CHECK_GRANT:-"yes"}
19 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
21 require_dsh_mds || exit 0
24 # bug number for skipped tests:
25 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
26 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
28 # time in minutes: 7.5"
29 [ "$SLOW" = "no" ] && EXCEPT_SLOW="44b"
31 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
32 # bug number for skipped test: LU-11388
34 if [ $MDSCOUNT -gt 1 ]; then
35 # bug number for skipped test: LU-10740 LU-11330 LU-9157 LU-11336
36 ALWAYS_EXCEPT+=" 2d 70d 80c 80d"
42 check_and_setup_lustre
47 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
49 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
50 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
52 do_facet $SINGLEMDS sync
55 test_0a() { # was test_0
56 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
57 replay_barrier $SINGLEMDS
61 run_test 0a "empty replay"
64 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
66 # this test attempts to trigger a race in the precreation code,
67 # and must run before any other objects are created on the filesystem
69 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
70 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
72 run_test 0b "ensure object created after recover exists. (3284)"
75 replay_barrier $SINGLEMDS
78 facet_failover $SINGLEMDS
79 zconf_mount $(hostname) $MOUNT || error "mount fails"
80 client_up || error "post-failover df failed"
81 # file shouldn't exist if replay-barrier works as expected
82 rm $DIR/$tfile && error "File exists and it shouldn't"
85 run_test 0c "check replay-barrier"
88 replay_barrier $SINGLEMDS
90 facet_failover $SINGLEMDS
91 zconf_mount $(hostname) $MOUNT || error "mount fails"
92 client_up || error "post-failover df failed"
94 run_test 0d "expired recovery with no clients"
97 replay_barrier $SINGLEMDS
100 $CHECKSTAT -t file $DIR/$tfile ||
101 error "$CHECKSTAT $DIR/$tfile attribute check failed"
104 run_test 1 "simple create"
107 replay_barrier $SINGLEMDS
110 $CHECKSTAT -t file $DIR/$tfile ||
111 error "$CHECKSTAT $DIR/$tfile attribute check failed"
117 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
118 replay_barrier $SINGLEMDS
121 $CHECKSTAT -t file $DIR/$tfile ||
122 error "$CHECKSTAT $DIR/$tfile attribute check failed"
128 replay_barrier $SINGLEMDS
129 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
131 $CHECKSTAT -t file $DIR/$tfile ||
132 error "$CHECKSTAT $DIR/$tfile check failed"
134 run_test 2c "setstripe replay"
137 replay_barrier $SINGLEMDS
138 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
140 $CHECKSTAT -t dir $DIR/$tdir ||
141 error "$CHECKSTAT $DIR/$tdir check failed"
143 run_test 2d "setdirstripe replay"
146 local file=$DIR/$tfile
147 replay_barrier $SINGLEMDS
149 openfile -f O_DIRECTORY $file
151 $CHECKSTAT -t file $file ||
152 error "$CHECKSTAT $file attribute check failed"
155 run_test 3a "replay failed open(O_DIRECTORY)"
158 replay_barrier $SINGLEMDS
159 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
160 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
162 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
164 $CHECKSTAT -t file $DIR/$tfile &&
165 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
168 run_test 3b "replay failed open -ENOMEM"
171 replay_barrier $SINGLEMDS
172 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
173 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
175 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
178 $CHECKSTAT -t file $DIR/$tfile &&
179 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
182 run_test 3c "replay failed open -ENOMEM"
184 test_4a() { # was test_4
185 replay_barrier $SINGLEMDS
186 for i in $(seq 10); do
187 echo "tag-$i" > $DIR/$tfile-$i
190 for i in $(seq 10); do
191 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
194 run_test 4a "|x| 10 open(O_CREAT)s"
197 for i in $(seq 10); do
198 echo "tag-$i" > $DIR/$tfile-$i
200 replay_barrier $SINGLEMDS
203 $CHECKSTAT -t file $DIR/$tfile-* &&
204 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
207 run_test 4b "|x| rm 10 files"
209 # The idea is to get past the first block of precreated files on both
210 # osts, and then replay.
212 replay_barrier $SINGLEMDS
213 for i in $(seq 220); do
214 echo "tag-$i" > $DIR/$tfile-$i
217 for i in $(seq 220); do
218 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
222 # waiting for commitment of removal
224 run_test 5 "|x| 220 open(O_CREAT)"
226 test_6a() { # was test_6
227 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
228 replay_barrier $SINGLEMDS
229 mcreate $DIR/$tdir/$tfile
231 $CHECKSTAT -t dir $DIR/$tdir ||
232 error "$CHECKSTAT $DIR/$tdir attribute check failed"
233 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
234 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
236 # waiting for log process thread
238 run_test 6a "mkdir + contained create"
241 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
242 replay_barrier $SINGLEMDS
245 $CHECKSTAT -t dir $DIR/$tdir &&
246 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
249 run_test 6b "|X| rmdir"
252 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
253 replay_barrier $SINGLEMDS
254 mcreate $DIR/$tdir/$tfile
256 $CHECKSTAT -t dir $DIR/$tdir ||
257 error "$CHECKSTAT $DIR/$tdir attribute check failed"
258 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
259 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
262 run_test 7 "mkdir |X| contained create"
265 replay_barrier $SINGLEMDS
266 multiop_bg_pause $DIR/$tfile mo_c ||
267 error "multiop mknod $DIR/$tfile failed"
271 $CHECKSTAT -t file $DIR/$tfile ||
272 error "$CHECKSTAT $DIR/$tfile attribute check failed"
273 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
274 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
277 run_test 8 "creat open |X| close"
280 replay_barrier $SINGLEMDS
282 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
284 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
286 echo " old_inum == $old_inum, new_inum == $new_inum"
287 if [ $old_inum -eq $new_inum ] ;
289 echo "old_inum and new_inum match"
291 echo " old_inum and new_inum do not match"
292 error "old index($old_inum) does not match new index($new_inum)"
296 run_test 9 "|X| create (same inum/gen)"
299 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
300 replay_barrier $SINGLEMDS
301 mv $DIR/$tfile $DIR/$tfile-2
304 $CHECKSTAT $DIR/$tfile &&
305 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
306 $CHECKSTAT $DIR/$tfile-2 ||
307 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
311 run_test 10 "create |X| rename unlink"
314 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
315 echo "old" > $DIR/$tfile
316 mv $DIR/$tfile $DIR/$tfile-2
317 replay_barrier $SINGLEMDS
318 echo "new" > $DIR/$tfile
320 grep old $DIR/$tfile-2
322 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
323 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
325 run_test 11 "create open write rename |X| create-old-name read"
328 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
329 multiop_bg_pause $DIR/$tfile o_tSc ||
330 error "multiop_bg_pause $DIR/$tfile failed"
333 replay_barrier $SINGLEMDS
334 kill -USR1 $pid || error "multiop $pid not running"
335 wait $pid || error "multiop $pid failed"
338 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
341 run_test 12 "open, unlink |X| close"
343 # 1777 - replay open after committed chmod that would make
344 # a regular open a failure
346 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
347 multiop_bg_pause $DIR/$tfile O_wc ||
348 error "multiop_bg_pause $DIR/$tfile failed"
351 $CHECKSTAT -p 0 $DIR/$tfile ||
352 error "$CHECKSTAT $DIR/$tfile attribute check failed"
353 replay_barrier $SINGLEMDS
355 kill -USR1 $pid || error "multiop $pid not running"
356 wait $pid || error "multiop $pid failed"
358 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
359 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
360 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
363 run_test 13 "open chmod 0 |x| write close"
366 multiop_bg_pause $DIR/$tfile O_tSc ||
367 error "multiop_bg_pause $DIR/$tfile failed"
370 replay_barrier $SINGLEMDS
371 kill -USR1 $pid || error "multiop $pid not running"
372 wait $pid || error "multiop $pid failed"
375 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
378 run_test 14 "open(O_CREAT), unlink |X| close"
381 multiop_bg_pause $DIR/$tfile O_tSc ||
382 error "multiop_bg_pause $DIR/$tfile failed"
385 replay_barrier $SINGLEMDS
386 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
387 kill -USR1 $pid || error "multiop $pid not running"
388 wait $pid || error "multiop $pid failed"
391 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
392 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
395 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
398 replay_barrier $SINGLEMDS
401 mcreate $DIR/$tfile-2
403 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
404 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
405 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
407 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
410 replay_barrier $SINGLEMDS
411 multiop_bg_pause $DIR/$tfile O_c ||
412 error "multiop_bg_pause $DIR/$tfile failed"
415 kill -USR1 $pid || error "multiop $pid not running"
416 wait $pid || error "multiop $pid failed"
417 $CHECKSTAT -t file $DIR/$tfile ||
418 error "$CHECKSTAT $DIR/$tfile attribute check failed"
421 run_test 17 "|X| open(O_CREAT), |replay| close"
424 replay_barrier $SINGLEMDS
425 multiop_bg_pause $DIR/$tfile O_tSc ||
426 error "multiop_bg_pause $DIR/$tfile failed"
429 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
430 echo "pid: $pid will close"
431 kill -USR1 $pid || error "multiop $pid not running"
432 wait $pid || error "multiop $pid failed"
435 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
436 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
437 # this touch frequently fails
438 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
439 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
440 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
443 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
445 # bug 1855 (a simpler form of test_11 above)
447 replay_barrier $SINGLEMDS
449 echo "old" > $DIR/$tfile
450 mv $DIR/$tfile $DIR/$tfile-2
451 grep old $DIR/$tfile-2
453 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
455 run_test 19 "mcreate, open, write, rename "
457 test_20a() { # was test_20
458 replay_barrier $SINGLEMDS
459 multiop_bg_pause $DIR/$tfile O_tSc ||
460 error "multiop_bg_pause $DIR/$tfile failed"
465 kill -USR1 $pid || error "multiop $pid not running"
466 wait $pid || error "multiop $pid failed"
467 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
470 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
472 test_20b() { # bug 10480
473 local wait_timeout=$((TIMEOUT * 4))
474 local extra=$(fs_log_size)
478 $LFS setstripe -i 0 -c 1 $DIR
480 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
482 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
483 while [ ! -e $DIR/$tfile ] ; do
484 usleep 60 # give dd a chance to start
487 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
489 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
491 client_up || client_up || true # reconnect
493 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
495 fail $SINGLEMDS # start orphan recovery
496 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
497 wait_delete_completed $wait_timeout || error "delete did not finish"
501 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
502 log "before $beforeused, after $afterused"
504 (( $beforeused + $extra >= $afterused )) && break
505 n_attempts=$((n_attempts + 1))
506 [ $n_attempts -gt 3 ] &&
507 error "after $afterused > before $beforeused + $extra"
509 wait_zfs_commit $SINGLEMDS 5
514 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
516 test_20c() { # bug 10480
517 multiop_bg_pause $DIR/$tfile Ow_c ||
518 error "multiop_bg_pause $DIR/$tfile failed"
524 client_up || client_up || true # reconnect
526 kill -USR1 $pid || error "multiop $pid not running"
527 wait $pid || error "multiop $pid failed"
528 [ -s $DIR/$tfile ] || error "File was truncated"
532 run_test 20c "check that client eviction does not affect file content"
535 replay_barrier $SINGLEMDS
536 multiop_bg_pause $DIR/$tfile O_tSc ||
537 error "multiop_bg_pause $DIR/$tfile failed"
540 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
543 kill -USR1 $pid || error "multiop $pid not running"
544 wait $pid || error "multiop $pid failed"
545 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
546 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
549 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
552 multiop_bg_pause $DIR/$tfile O_tSc ||
553 error "multiop_bg_pause $DIR/$tfile failed"
556 replay_barrier $SINGLEMDS
560 kill -USR1 $pid || error "multiop $pid not running"
561 wait $pid || error "multiop $pid failed"
562 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
565 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
568 multiop_bg_pause $DIR/$tfile O_tSc ||
569 error "multiop_bg_pause $DIR/$tfile failed"
572 replay_barrier $SINGLEMDS
574 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
577 kill -USR1 $pid || error "multiop $pid not running"
578 wait $pid || error "multiop $pid failed"
579 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
580 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
583 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
586 multiop_bg_pause $DIR/$tfile O_tSc ||
587 error "multiop_bg_pause $DIR/$tfile failed"
590 replay_barrier $SINGLEMDS
593 kill -USR1 $pid || error "multiop $pid not running"
594 wait $pid || error "multiop $pid failed"
595 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
598 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
601 multiop_bg_pause $DIR/$tfile O_tSc ||
602 error "multiop_bg_pause $DIR/$tfile failed"
606 replay_barrier $SINGLEMDS
608 kill -USR1 $pid || error "multiop $pid not running"
609 wait $pid || error "multiop $pid failed"
610 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
613 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
616 replay_barrier $SINGLEMDS
617 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
618 error "multiop_bg_pause $DIR/$tfile-1 failed"
620 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
621 error "multiop_bg_pause $DIR/$tfile-2 failed"
625 kill -USR1 $pid2 || error "second multiop $pid2 not running"
626 wait $pid2 || error "second multiop $pid2 failed"
629 kill -USR1 $pid1 || error "multiop $pid1 not running"
630 wait $pid1 || error "multiop $pid1 failed"
631 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
632 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
635 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
638 replay_barrier $SINGLEMDS
639 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
640 error "multiop_bg_pause $DIR/$tfile-1 failed"
642 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
643 error "multiop_bg_pause $DIR/$tfile-2 failed"
649 kill -USR1 $pid1 || error "multiop $pid1 not running"
650 wait $pid1 || error "multiop $pid1 failed"
651 kill -USR1 $pid2 || error "second multiop $pid2 not running"
652 wait $pid2 || error "second multiop $pid2 failed"
653 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
654 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
657 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
660 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
661 error "multiop_bg_pause $DIR/$tfile-1 failed"
663 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
664 error "multiop_bg_pause $DIR/$tfile-2 failed"
666 replay_barrier $SINGLEMDS
669 kill -USR1 $pid2 || error "second multiop $pid2 not running"
670 wait $pid2 || error "second multiop $pid2 failed"
673 kill -USR1 $pid1 || error "multiop $pid1 not running"
674 wait $pid1 || error "multiop $pid1 failed"
675 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
676 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
679 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
682 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
683 error "multiop_bg_pause $DIR/$tfile-1 failed"
685 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
686 error "multiop_bg_pause $DIR/$tfile-2 failed"
688 replay_barrier $SINGLEMDS
693 kill -USR1 $pid1 || error "multiop $pid1 not running"
694 wait $pid1 || error "multiop $pid1 failed"
695 kill -USR1 $pid2 || error "second multiop $pid2 not running"
696 wait $pid2 || error "second multiop $pid2 failed"
697 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
698 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
701 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
704 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
705 error "multiop_bg_pause $DIR/$tfile-1 failed"
707 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
708 error "multiop_bg_pause $DIR/$tfile-2 failed"
713 replay_barrier $SINGLEMDS
715 kill -USR1 $pid1 || error "multiop $pid1 not running"
716 wait $pid1 || error "multiop $pid1 failed"
717 kill -USR1 $pid2 || error "second multiop $pid2 not running"
718 wait $pid2 || error "second multiop $pid2 failed"
719 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
720 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
723 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
726 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
727 error "multiop_bg_pause $DIR/$tfile-1 failed"
729 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
730 error "multiop_bg_pause $DIR/$tfile-2 failed"
734 replay_barrier $SINGLEMDS
737 kill -USR1 $pid1 || error "multiop $pid1 not running"
738 wait $pid1 || error "multiop $pid1 failed"
739 kill -USR1 $pid2 || error "second multiop $pid2 not running"
740 wait $pid2 || error "second multiop $pid2 failed"
741 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
742 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
745 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
747 # tests for bug 2104; completion without crashing is success. The close is
748 # stale, but we always return 0 for close, so the app never sees it.
750 multiop_bg_pause $DIR/$tfile O_c ||
751 error "multiop_bg_pause $DIR/$tfile failed"
753 multiop_bg_pause $DIR/$tfile O_c ||
754 error "second multiop_bg_pause $DIR/$tfile failed"
757 client_up || client_up || error "client_up failed"
758 kill -USR1 $pid1 || error "multiop $pid1 not running"
759 kill -USR1 $pid2 || error "second multiop $pid2 not running"
760 wait $pid1 || error "multiop $pid1 failed"
761 wait $pid2 || error "second multiop $pid2 failed"
764 run_test 32 "close() notices client eviction; close() after client eviction"
767 createmany -o $DIR/$tfile-%d 10 ||
768 error "createmany create $DIR/$tfile failed"
769 replay_barrier_nosync $SINGLEMDS
770 fail_abort $SINGLEMDS
771 # recreate shouldn't fail
772 createmany -o $DIR/$tfile--%d 10 ||
773 error "createmany recreate $DIR/$tfile failed"
777 run_test 33a "fid seq shouldn't be reused after abort recovery"
780 #define OBD_FAIL_SEQ_ALLOC 0x1311
781 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
783 createmany -o $DIR/$tfile-%d 10
784 replay_barrier_nosync $SINGLEMDS
785 fail_abort $SINGLEMDS
786 # recreate shouldn't fail
787 createmany -o $DIR/$tfile--%d 10 ||
788 error "createmany recreate $DIR/$tfile failed"
792 run_test 33b "test fid seq allocation"
795 multiop_bg_pause $DIR/$tfile O_c ||
796 error "multiop_bg_pause $DIR/$tfile failed"
800 replay_barrier $SINGLEMDS
801 fail_abort $SINGLEMDS
802 kill -USR1 $pid || error "multiop $pid not running"
803 wait $pid || error "multiop $pid failed"
804 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
808 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
810 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
812 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
814 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
815 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
820 # give a chance to remove from MDS
821 fail_abort $SINGLEMDS
822 $CHECKSTAT -t file $DIR/$tfile &&
823 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
826 run_test 35 "test recovery from llog for unlink op"
828 # b=2432 resent cancel after replay uses wrong cookie,
829 # so don't resend cancels
831 replay_barrier $SINGLEMDS
833 checkstat $DIR/$tfile
834 facet_failover $SINGLEMDS
836 if dmesg | grep "unknown lock cookie"; then
837 error "cancel after replay failed"
840 run_test 36 "don't resend cancel"
843 # directory orphans can't be unlinked from PENDING directory
845 rmdir $DIR/$tfile 2>/dev/null
846 multiop_bg_pause $DIR/$tfile dD_c ||
847 error "multiop_bg_pause $DIR/$tfile failed"
851 replay_barrier $SINGLEMDS
852 # clear the dmesg buffer so we only see errors from this recovery
853 do_facet $SINGLEMDS dmesg -c >/dev/null
854 fail_abort $SINGLEMDS
855 kill -USR1 $pid || error "multiop $pid not running"
856 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
857 error "error unlinking files"
858 wait $pid || error "multiop $pid failed"
862 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
865 createmany -o $DIR/$tfile-%d 800 ||
866 error "createmany -o $DIR/$tfile failed"
867 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
868 replay_barrier $SINGLEMDS
870 unlinkmany $DIR/$tfile-%d 400 400 ||
871 error "unlinkmany $DIR/$tfile 400 failed"
873 $CHECKSTAT -t file $DIR/$tfile-* &&
874 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
877 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
879 test_39() { # bug 4176
880 createmany -o $DIR/$tfile-%d 800 ||
881 error "createmany -o $DIR/$tfile failed"
882 replay_barrier $SINGLEMDS
883 unlinkmany $DIR/$tfile-%d 0 400
885 unlinkmany $DIR/$tfile-%d 400 400 ||
886 error "unlinkmany $DIR/$tfile 400 failed"
888 $CHECKSTAT -t file $DIR/$tfile-* &&
889 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
892 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
895 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
900 # always need connection to MDS to verify layout during IO. LU-2628.
901 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
902 skip "layout_lock needs MDS connection for IO" && return 0
904 $LCTL mark multiop $MOUNT/$tfile OS_c
905 multiop $MOUNT/$tfile OS_c &
907 writeme -s $MOUNT/${tfile}-2 &
910 facet_failover $SINGLEMDS
911 #define OBD_FAIL_MDS_CONNECT_NET 0x117
912 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
914 stat1=$(count_ost_writes)
916 stat2=$(count_ost_writes)
917 echo "$stat1, $stat2"
918 if [ $stat1 -lt $stat2 ]; then
919 echo "writes continuing during recovery"
922 echo "writes not continuing during recovery, bug 2477"
925 echo "waiting for writeme $WRITE_PID"
929 echo "waiting for multiop $PID"
930 wait $PID || error "multiop $PID failed"
931 do_facet client munlink $MOUNT/$tfile ||
932 error "munlink $MOUNT/$tfile failed"
933 do_facet client munlink $MOUNT/${tfile}-2 ||
934 error "munlink $MOUNT/$tfile-2 failed"
937 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
940 # make sure that a read to one osc doesn't try to double-unlock its page just
941 # because another osc is invalid. trigger_group_io used to mistakenly return
942 # an error if any oscs were invalid even after having successfully put rpcs
943 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
944 # the page, guarnateeing that the unlock from the RPC completion would
945 # assert on trying to unlock the unlocked page.
947 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
949 local f=$MOUNT/$tfile
950 # make sure the start of the file is ost1
951 $SETSTRIPE -S $((128 * 1024)) -i 0 $f
952 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
953 error "dd on client failed"
955 # fail ost2 and read from ost1
956 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
957 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
958 grep $mdtosc | awk '{print $1}')
959 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
960 lctl get_param -n devices &&
961 error "OST 2 $osc2dev does not exist"
962 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
963 error "deactive device on $SINGLEMDS failed"
964 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
965 error "second dd on client failed"
966 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
967 error "active device on $SINGLEMDS failed"
970 run_test 41 "read from a valid osc while other oscs are invalid"
972 # test MDS recovery after ost failure
974 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
975 createmany -o $DIR/$tfile-%d 800 ||
976 error "createmany -o $DIR/$tfile failed"
978 unlinkmany $DIR/$tfile-%d 0 400
980 lctl set_param debug=-1
983 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
984 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
985 #[ $blocks_after -lt $blocks ] || return 1
986 echo "wait for MDS to timeout and recover"
987 sleep $((TIMEOUT * 2))
989 unlinkmany $DIR/$tfile-%d 400 400 ||
990 error "unlinkmany $DIR/$tfile 400 failed"
991 $CHECKSTAT -t file $DIR/$tfile-* &&
992 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
995 run_test 42 "recovery after ost failure"
997 # timeout in MDS/OST recovery RPC will LBUG MDS
998 test_43() { # bug 2530
999 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1001 replay_barrier $SINGLEMDS
1003 # OBD_FAIL_OST_CREATE_NET 0x204
1004 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1010 run_test 43 "mds osc import failure during recovery; don't LBUG"
1012 test_44a() { # was test_44
1013 local at_max_saved=0
1015 local mdcdev=$($LCTL dl |
1016 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1017 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
1018 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1019 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1021 # adaptive timeouts slow this way down
1022 if at_is_enabled; then
1023 at_max_saved=$(at_max_get mds)
1027 for i in $(seq 1 10); do
1028 echo "$i of 10 ($(date +%s))"
1029 do_facet $SINGLEMDS \
1030 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1031 #define OBD_FAIL_TGT_CONN_RACE 0x701
1032 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1033 # lctl below may fail, it is valid case
1034 $LCTL --device $mdcdev recover
1037 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1038 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1041 run_test 44a "race in target handle connect"
1044 local mdcdev=$($LCTL dl |
1045 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1046 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1047 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1048 { echo mdcdev=$mdcdev; $LCTL dl;
1049 error "more than one ${FSNAME}-MDT0000-mdc"; }
1051 for i in $(seq 1 10); do
1052 echo "$i of 10 ($(date +%s))"
1053 do_facet $SINGLEMDS \
1054 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1055 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1056 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1057 # lctl below may fail, it is valid case
1058 $LCTL --device $mdcdev recover
1063 run_test 44b "race in target handle connect"
1066 replay_barrier $SINGLEMDS
1067 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1068 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1069 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1070 fail_abort $SINGLEMDS
1071 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1073 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1076 run_test 44c "race in target handle connect"
1078 # Handle failed close
1080 local mdcdev=$($LCTL get_param -n devices |
1081 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1082 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1083 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1084 { echo mdcdev=$mdcdev; $LCTL dl;
1085 error "more than one ${FSNAME}-MDT0000-mdc"; }
1087 $LCTL --device $mdcdev recover ||
1088 error "$LCTL --device $mdcdev recover failed"
1090 multiop_bg_pause $DIR/$tfile O_c ||
1091 error "multiop_bg_pause $DIR/$tfile failed"
1094 # This will cause the CLOSE to fail before even
1095 # allocating a reply buffer
1096 $LCTL --device $mdcdev deactivate ||
1097 error "$LCTL --device $mdcdev deactivate failed"
1100 kill -USR1 $pid || error "multiop $pid not running"
1101 wait $pid || error "multiop $pid failed"
1103 $LCTL --device $mdcdev activate ||
1104 error "$LCTL --device $mdcdev activate failed"
1107 $CHECKSTAT -t file $DIR/$tfile ||
1108 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1111 run_test 45 "Handle failed close"
1115 drop_reply "touch $DIR/$tfile"
1117 # ironically, the previous test, 45, will cause a real forced close,
1118 # so just look for one for this test
1119 dmesg | grep -i "force closing client file handle for $tfile" &&
1120 error "found force closing in dmesg"
1123 run_test 46 "Don't leak file handle after open resend (3325)"
1125 test_47() { # bug 2824
1126 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1128 # create some files to make sure precreate has been done on all
1129 # OSTs. (just in case this test is run independently)
1130 createmany -o $DIR/$tfile 20 ||
1131 error "createmany create $DIR/$tfile failed"
1133 # OBD_FAIL_OST_CREATE_NET 0x204
1135 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1136 client_up || error "client_up failed"
1138 # let the MDS discover the OST failure, attempt to recover, fail
1139 # and recover again.
1140 sleep $((3 * TIMEOUT))
1142 # Without 2824, this createmany would hang
1143 createmany -o $DIR/$tfile 20 ||
1144 error "createmany recraete $DIR/$tfile failed"
1145 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1149 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1152 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1153 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1155 replay_barrier $SINGLEMDS
1156 createmany -o $DIR/$tfile 20 ||
1157 error "createmany -o $DIR/$tfile failed"
1158 # OBD_FAIL_OST_EROFS 0x216
1159 facet_failover $SINGLEMDS
1160 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1161 client_up || error "client_up failed"
1163 # let the MDS discover the OST failure, attempt to recover, fail
1164 # and recover again.
1165 sleep $((3 * TIMEOUT))
1167 createmany -o $DIR/$tfile 20 20 ||
1168 error "createmany recraete $DIR/$tfile failed"
1169 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1172 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1175 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1176 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1177 grep $mdtosc | awk '{print $1}')
1178 [ "$oscdev" ] || error "could not find OSC device on MDS"
1179 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1180 error "OSC device $oscdev recovery failed"
1181 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1182 error "second OSC device $oscdev recovery failed"
1183 # give the mds_lov_sync threads a chance to run
1186 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1188 # b3764 timed out lock replay
1190 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.90) ] &&
1191 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly" &&
1194 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1195 cancel_lru_locks mdc
1197 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1200 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1201 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1202 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1204 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1206 wait $mpid || error "multiop_bg_pause pid failed"
1208 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1209 lctl set_param fail_loc=0x0
1210 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1213 run_test 52 "time out lock replay (3764)"
1215 # bug 3462 - simultaneous MDC requests
1217 [[ $(lctl get_param mdc.*.import |
1218 grep "connect_flags:.*multi_mod_rpc") ]] ||
1219 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1221 cancel_lru_locks mdc # cleanup locks from former test cases
1222 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1223 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1224 multiop $DIR/${tdir}-1/f O_c &
1226 # give multiop a change to open
1229 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1230 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1231 kill -USR1 $close_pid
1232 cancel_lru_locks mdc # force the close
1233 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1235 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1237 # close should still be here
1238 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1240 replay_barrier_nodf $SINGLEMDS
1242 wait $close_pid || error "close_pid $close_pid failed"
1244 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1245 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1246 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1247 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1248 rm -rf $DIR/${tdir}-*
1250 run_test 53a "|X| close request while two MDC requests in flight"
1253 cancel_lru_locks mdc # cleanup locks from former test cases
1255 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1256 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1257 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1258 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1261 #define OBD_FAIL_MDS_REINT_NET 0x107
1262 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1263 mcreate $DIR/${tdir}-2/f &
1267 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1268 kill -USR1 $close_pid
1269 cancel_lru_locks mdc # force the close
1270 wait $close_pid || error "close_pid $close_pid failed"
1271 # open should still be here
1272 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1274 replay_barrier_nodf $SINGLEMDS
1276 wait $open_pid || error "open_pid failed"
1278 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1279 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1280 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1281 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1282 rm -rf $DIR/${tdir}-*
1284 run_test 53b "|X| open request while two MDC requests in flight"
1287 cancel_lru_locks mdc # cleanup locks from former test cases
1289 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1290 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1291 multiop $DIR/${tdir}-1/f O_c &
1294 #define OBD_FAIL_MDS_REINT_NET 0x107
1295 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1296 mcreate $DIR/${tdir}-2/f &
1300 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1301 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1302 kill -USR1 $close_pid
1303 cancel_lru_locks mdc # force the close
1305 #bz20647: make sure all pids exist before failover
1306 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1307 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1308 replay_barrier_nodf $SINGLEMDS
1309 fail_nodf $SINGLEMDS
1310 wait $open_pid || error "open_pid failed"
1312 # close should be gone
1313 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1314 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1316 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1317 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1318 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1319 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1320 rm -rf $DIR/${tdir}-*
1322 run_test 53c "|X| open request and close request while two MDC requests in flight"
1325 [[ $(lctl get_param mdc.*.import |
1326 grep "connect_flags:.*multi_mod_rpc") ]] ||
1327 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1329 cancel_lru_locks mdc # cleanup locks from former test cases
1331 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1332 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1333 multiop $DIR/${tdir}-1/f O_c &
1335 # give multiop a chance to open
1338 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1339 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1340 kill -USR1 $close_pid
1341 cancel_lru_locks mdc # force the close
1342 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1343 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1345 # close should still be here
1346 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1348 wait $close_pid || error "close_pid failed"
1350 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1351 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1352 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1353 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1354 rm -rf $DIR/${tdir}-*
1356 run_test 53d "close reply while two MDC requests in flight"
1359 cancel_lru_locks mdc # cleanup locks from former test cases
1361 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1362 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1363 multiop $DIR/${tdir}-1/f O_c &
1366 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1367 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1368 mcreate $DIR/${tdir}-2/f &
1372 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1373 kill -USR1 $close_pid
1374 cancel_lru_locks mdc # force the close
1375 wait $close_pid || error "close_pid failed"
1376 # open should still be here
1377 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1379 replay_barrier_nodf $SINGLEMDS
1381 wait $open_pid || error "open_pid failed"
1383 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1384 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1385 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1386 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1387 rm -rf $DIR/${tdir}-*
1389 run_test 53e "|X| open reply while two MDC requests in flight"
1392 cancel_lru_locks mdc # cleanup locks from former test cases
1394 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1395 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1396 multiop $DIR/${tdir}-1/f O_c &
1399 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1400 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1401 mcreate $DIR/${tdir}-2/f &
1405 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1406 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1407 kill -USR1 $close_pid
1408 cancel_lru_locks mdc # force the close
1410 #bz20647: make sure all pids are exists before failover
1411 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1412 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1413 replay_barrier_nodf $SINGLEMDS
1414 fail_nodf $SINGLEMDS
1415 wait $open_pid || error "open_pid failed"
1417 # close should be gone
1418 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1419 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1421 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1422 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1423 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1424 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1425 rm -rf $DIR/${tdir}-*
1427 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1430 cancel_lru_locks mdc # cleanup locks from former test cases
1432 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1433 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1434 multiop $DIR/${tdir}-1/f O_c &
1437 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1438 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1439 mcreate $DIR/${tdir}-2/f &
1443 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1444 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1445 kill -USR1 $close_pid
1446 cancel_lru_locks mdc # force the close
1447 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1449 #bz20647: make sure all pids are exists before failover
1450 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1451 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1452 replay_barrier_nodf $SINGLEMDS
1453 fail_nodf $SINGLEMDS
1454 wait $open_pid || error "open_pid failed"
1456 # close should be gone
1457 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1459 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1460 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1461 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1462 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1463 rm -rf $DIR/${tdir}-*
1465 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1468 cancel_lru_locks mdc # cleanup locks from former test cases
1470 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1471 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1472 multiop $DIR/${tdir}-1/f O_c &
1475 #define OBD_FAIL_MDS_REINT_NET 0x107
1476 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1477 mcreate $DIR/${tdir}-2/f &
1481 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1482 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1483 kill -USR1 $close_pid
1484 cancel_lru_locks mdc # force the close
1487 #bz20647: make sure all pids are exists before failover
1488 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1489 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1490 replay_barrier_nodf $SINGLEMDS
1491 fail_nodf $SINGLEMDS
1492 wait $open_pid || error "open_pid failed"
1494 # close should be gone
1495 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1496 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1498 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1499 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1500 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1501 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1502 rm -rf $DIR/${tdir}-*
1504 run_test 53h "open request and close reply while two MDC requests in flight"
1506 #b3761 ASSERTION(hash != 0) failed
1508 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1509 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1511 # give touch a chance to run
1513 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1517 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1519 #b3440 ASSERTION(rec->ur_fid2->id) failed
1521 ln -s foo $DIR/$tfile
1522 replay_barrier $SINGLEMDS
1523 #drop_reply "cat $DIR/$tfile"
1527 run_test 56 "don't replay a symlink open request (3440)"
1529 #recovery one mds-ost setattr from llog
1531 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1532 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1533 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1534 replay_barrier $SINGLEMDS
1536 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1537 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1538 $CHECKSTAT -t file $DIR/$tfile ||
1539 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1540 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1543 run_test 57 "test recovery from llog for setattr op"
1546 zconf_umount $(hostname) $MOUNT2
1550 #recovery many mds-ost setattr from llog
1552 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1553 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1554 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1555 createmany -o $DIR/$tdir/$tfile-%d 2500
1556 replay_barrier $SINGLEMDS
1559 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1560 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1561 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1562 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1563 error "unlinkmany $DIR/$tfile failed"
1566 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1572 trap cleanup_58 EXIT
1574 large_xattr_enabled &&
1575 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1576 # Original extended attribute can be long. Print a small version of
1577 # attribute if an error occurs
1578 local sm_msg=$(printf "%.9s" $orig)
1580 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1581 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1582 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1583 replay_barrier $SINGLEMDS
1584 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1586 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1587 [[ "$new" = "$orig" ]] ||
1588 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1589 rm -f $DIR/$tdir/$tfile
1592 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1594 run_test 58b "test replay of setxattr op"
1596 test_58c() { # bug 16570
1601 trap cleanup_58 EXIT
1603 if large_xattr_enabled; then
1604 local xattr_size=$(max_xattr_size)
1605 orig="$(generate_string $((xattr_size / 2)))"
1606 orig1="$(generate_string $xattr_size)"
1612 # PING_INTERVAL max(obd_timeout / 4, 1U)
1613 sleep $((TIMEOUT / 4))
1615 # Original extended attribute can be long. Print a small version of
1616 # attribute if an error occurs
1617 local sm_msg=$(printf "%.9s" $orig)
1618 local sm_msg1=$(printf "%.9s" $orig1)
1620 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1621 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1622 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1623 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1624 error "drop_request for setfattr failed"
1625 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1626 [[ "$new" = "$orig" ]] ||
1627 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1628 drop_reint_reply "setfattr -n trusted.foo1 \
1629 -v $orig1 $DIR/$tdir/$tfile" ||
1630 error "drop_reint_reply for setfattr failed"
1631 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1632 [[ "$new" = "$orig1" ]] ||
1633 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1634 rm -f $DIR/$tdir/$tfile
1638 run_test 58c "resend/reconstruct setxattr op"
1640 # log_commit_thread vs filter_destroy race used to lead to import use after free
1643 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1645 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1646 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1647 error "createmany create files failed"
1649 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1650 error "unlinkmany $DIR/$tdir/$tfile failed"
1651 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1652 do_facet ost1 "lctl set_param fail_loc=0x507"
1655 do_facet ost1 "lctl set_param fail_loc=0x0"
1659 run_test 59 "test log_commit_thread vs filter_destroy race"
1661 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1662 # bug 12086: should no oops and No ctxt error for this test
1664 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1665 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1666 error "createmany create files failed"
1667 replay_barrier $SINGLEMDS
1668 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1670 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1671 local no_ctxt=$(dmesg | grep "No ctxt")
1672 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1674 run_test 60 "test llog post recovery init vs llog unlink"
1676 #test race llog recovery thread vs llog cleanup
1677 test_61a() { # was test_61
1678 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1680 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1681 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1682 error "createmany create files failed"
1684 unlinkmany $DIR/$tdir/$tfile-%d 800
1685 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1686 set_nodes_failloc "$(osts_nodes)" 0x80000221
1691 set_nodes_failloc "$(osts_nodes)" 0x0
1693 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1694 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1697 run_test 61a "test race llog recovery vs llog cleanup"
1699 #test race mds llog sync vs llog cleanup
1701 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1702 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1703 facet_failover $SINGLEMDS
1706 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1709 run_test 61b "test race mds llog sync vs llog cleanup"
1711 #test race cancel cookie cb vs llog cleanup
1713 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1715 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1716 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1717 set_nodes_failloc "$(osts_nodes)" 0x80000222
1721 set_nodes_failloc "$(osts_nodes)" 0x0
1723 run_test 61c "test race mds llog sync vs llog cleanup"
1725 test_61d() { # bug 16002 # bug 17466 # bug 22137
1726 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1728 do_facet mgs "lctl set_param fail_loc=0x80000605"
1729 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1730 error "mgs start should have failed"
1731 do_facet mgs "lctl set_param fail_loc=0"
1732 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1734 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1736 test_62() { # Bug 15756 - don't mis-drop resent replay
1737 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1738 replay_barrier $SINGLEMDS
1739 createmany -o $DIR/$tdir/$tfile- 25 ||
1740 error "createmany create files failed"
1741 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1742 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1744 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1745 unlinkmany $DIR/$tdir/$tfile- 25 ||
1746 error "unlinkmany $DIR/$tdir/$tfile failed"
1749 run_test 62 "don't mis-drop resent replay"
1751 #Adaptive Timeouts (bug 3055)
1759 echo "Cleaning up AT ..."
1760 if [ -n "$ATOLDBASE" ]; then
1761 local at_history=$($LCTL get_param -n at_history)
1762 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1763 do_facet ost1 "lctl set_param at_history=$at_history" || true
1766 if [ $AT_MAX_SET -ne 0 ]; then
1767 for facet in mds client ost; do
1768 var=AT_MAX_SAVE_${facet}
1769 echo restore AT on $facet to saved value ${!var}
1770 at_max_set ${!var} $facet
1771 at_new=$(at_max_get $facet)
1772 echo Restored AT value on $facet $at_new
1773 [ $at_new -eq ${!var} ] ||
1774 error "AT value not restored SAVED ${!var} NEW $at_new"
1781 local at_max_new=600
1783 # Save at_max original values
1785 if [ $AT_MAX_SET -eq 0 ]; then
1786 # Suppose that all osts have the same at_max
1787 for facet in mds client ost; do
1788 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1792 for facet in mds client ost; do
1793 at_max=$(at_max_get $facet)
1794 if [ $at_max -ne $at_max_new ]; then
1795 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1796 at_max_set $at_max_new $facet
1801 if [ -z "$ATOLDBASE" ]; then
1802 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1803 # speed up the timebase so we can check decreasing AT
1804 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1805 do_facet ost1 "lctl set_param at_history=8" || true
1807 # sleep for a while to cool down, should be > 8s and also allow
1808 # at least one ping to be sent. simply use TIMEOUT to be safe.
1813 test_65a() #bug 3055
1815 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1817 at_start || return 0
1818 $LCTL dk > /dev/null
1820 $LCTL set_param debug="other"
1821 # Slow down a request to the current service time, this is critical
1822 # because previous tests may have caused this value to increase.
1823 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1824 awk '/portal 12/ {print $5}'`
1825 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1827 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1828 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1829 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1830 createmany -o $DIR/$tfile 10 > /dev/null
1831 unlinkmany $DIR/$tfile 10 > /dev/null
1832 # check for log message
1833 $LCTL dk | grep "Early reply #" || error "No early reply"
1835 # client should show REQ_DELAY estimates
1836 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1838 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1840 run_test 65a "AT: verify early replies"
1842 test_65b() #bug 3055
1844 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1846 at_start || return 0
1849 $LCTL set_param debug="other trace"
1850 $LCTL dk > /dev/null
1851 # Slow down a request to the current service time, this is critical
1852 # because previous tests may have caused this value to increase.
1853 $SETSTRIPE --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1854 error "$SETSTRIPE failed for $DIR/$tfile"
1856 multiop $DIR/$tfile Ow1yc
1857 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1858 awk '/portal 6/ {print $5}'`
1859 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1861 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1862 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1863 do_facet ost1 $LCTL set_param fail_loc=0x224
1866 $SETSTRIPE --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1867 error "$SETSTRIPE failed"
1868 # force some real bulk transfer
1869 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1871 do_facet ost1 $LCTL set_param fail_loc=0
1872 # check for log message
1873 $LCTL dk | grep "Early reply #" || error "No early reply"
1875 # client should show REQ_DELAY estimates
1876 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1878 run_test 65b "AT: verify early replies on packed reply / bulk"
1880 test_66a() #bug 3055
1882 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1884 at_start || return 0
1885 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1886 # adjust 5s at a time so no early reply is sent (within deadline)
1887 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1888 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1889 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1890 createmany -o $DIR/$tfile 20 > /dev/null
1891 unlinkmany $DIR/$tfile 20 > /dev/null
1892 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1893 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1894 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1895 createmany -o $DIR/$tfile 20 > /dev/null
1896 unlinkmany $DIR/$tfile 20 > /dev/null
1897 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1898 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1900 createmany -o $DIR/$tfile 20 > /dev/null
1901 unlinkmany $DIR/$tfile 20 > /dev/null
1902 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1903 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1904 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1905 echo "Current MDT timeout $CUR, worst $WORST"
1906 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1908 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1910 test_66b() #bug 3055
1912 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1914 at_start || return 0
1915 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1916 awk '/network/ {print $4}')
1917 $LCTL set_param fail_val=$(($ORIG + 5))
1918 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1919 $LCTL set_param fail_loc=0x50c
1920 touch $DIR/$tfile > /dev/null 2>&1
1921 $LCTL set_param fail_loc=0
1922 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1923 awk '/network/ {print $4}')
1924 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1925 awk '/network/ {print $6}')
1926 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1927 [ $WORST -gt $ORIG ] ||
1928 error "Worst $WORST should be worse than orig $ORIG"
1930 run_test 66b "AT: verify net latency adjusts"
1932 test_67a() #bug 3055
1934 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1936 at_start || return 0
1937 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1938 # sleeping threads may drive values above this
1939 do_facet ost1 "$LCTL set_param fail_val=400"
1940 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1941 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1942 createmany -o $DIR/$tfile 20 > /dev/null
1943 unlinkmany $DIR/$tfile 20 > /dev/null
1944 do_facet ost1 "$LCTL set_param fail_loc=0"
1945 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1946 ATTEMPTS=$(($CONN2 - $CONN1))
1947 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1948 [ $ATTEMPTS -gt 0 ] &&
1949 error_ignore bz13721 "AT should have prevented reconnect"
1952 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1954 test_67b() #bug 3055
1956 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1958 at_start || return 0
1959 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1961 # exhaust precreations on ost1
1962 local OST=$(ostname_from_index 0)
1963 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1964 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1965 osc.$mdtosc.prealloc_last_id)
1966 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1967 osc.$mdtosc.prealloc_next_id)
1969 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1970 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/${OST} || error "$SETSTRIPE failed"
1971 echo "Creating to objid $last_id on ost $OST..."
1972 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1973 do_facet ost1 "$LCTL set_param fail_val=20000"
1974 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1975 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1978 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1980 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1981 ATTEMPTS=$(($CONN2 - $CONN1))
1982 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1983 # do it again; should not timeout
1984 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1985 cp /etc/profile $DIR/$tfile || error "cp failed"
1986 do_facet ost1 "$LCTL set_param fail_loc=0"
1988 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1989 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1990 ATTEMPTS=$(($CONN3 - $CONN2))
1991 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1992 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1995 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1997 test_68 () #bug 13813
1999 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
2001 at_start || return 0
2002 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
2003 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
2004 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
2005 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
2006 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2007 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2008 echo $TIMEOUT >> $ldlm_enqueue_min
2009 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2011 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2012 $SETSTRIPE --stripe-index=0 -c 1 $DIR/$tdir ||
2013 error "$SETSTRIPE failed for $DIR/$tdir"
2014 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2015 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2016 $LCTL set_param fail_loc=0x80000312
2017 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2018 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2019 $LCTL set_param fail_loc=0x80000312
2020 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2021 $LCTL set_param fail_loc=0
2023 echo $ENQ_MIN >> $ldlm_enqueue_min
2024 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2028 run_test 68 "AT: verify slowing locks"
2031 # end of AT tests includes above lines
2033 # start multi-client tests
2035 [ -z "$CLIENTS" ] &&
2036 { skip "Need two or more clients." && return; }
2037 [ $CLIENTCOUNT -lt 2 ] &&
2038 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2040 echo "mount clients $CLIENTS ..."
2041 zconf_mount_clients $CLIENTS $MOUNT
2043 local clients=${CLIENTS//,/ }
2044 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2045 for CLIENT in $clients; do
2046 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2047 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2048 error "dd failed on $CLIENT"
2051 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2052 for C in ${CLIENTS//,/ }; do
2053 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2054 of=/dev/null 2>/dev/null ||
2055 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2061 run_test 70a "check multi client t-f"
2063 check_for_process () {
2068 killall_process $clients "$prog" -0
2072 local clients=${CLIENTS:-$HOSTNAME}
2074 zconf_mount_clients $clients $MOUNT
2077 [ "$SLOW" = "no" ] && duration=120
2078 # set duration to 900 because it takes some time to boot node
2079 [ "$FAILURE_MODE" = HARD ] && duration=900
2082 local start_ts=$(date +%s)
2083 local cmd="rundbench 1 -t $duration"
2085 if [ $MDSCOUNT -ge 2 ]; then
2086 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2087 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2089 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2090 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2091 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2092 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2095 #LU-1897 wait for all dbench copies to start
2096 while ! check_for_process $clients dbench; do
2097 elapsed=$(($(date +%s) - start_ts))
2098 if [ $elapsed -gt $duration ]; then
2099 killall_process $clients dbench
2100 error "dbench failed to start on $clients!"
2105 log "Started rundbench load pid=$pid ..."
2107 elapsed=$(($(date +%s) - start_ts))
2108 local num_failovers=0
2110 while [ $elapsed -lt $duration ]; do
2111 if ! check_for_process $clients dbench; then
2112 error_noexit "dbench stopped on some of $clients!"
2113 killall_process $clients dbench
2117 replay_barrier mds$fail_index
2118 sleep 1 # give clients a time to do operations
2119 # Increment the number of failovers
2120 num_failovers=$((num_failovers+1))
2121 log "$TESTNAME fail mds$fail_index $num_failovers times"
2123 elapsed=$(($(date +%s) - start_ts))
2124 if [ $fail_index -ge $MDSCOUNT ]; then
2127 fail_index=$((fail_index+1))
2131 wait $pid || error "rundbench load on $clients failed!"
2133 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2134 # end multi-client tests
2139 local monitor_pid=$3
2141 local start_ts=$(date +%s)
2142 local num_failovers=0
2145 elapsed=$(($(date +%s) - start_ts))
2146 while [ $elapsed -lt $duration ]; do
2147 fail_index=$((RANDOM%max_index+1))
2148 kill -0 $monitor_pid ||
2149 error "$monitor_pid stopped"
2151 replay_barrier mds$fail_index
2153 # Increment the number of failovers
2154 num_failovers=$((num_failovers+1))
2155 log "$TESTNAME fail mds$fail_index $num_failovers times"
2157 elapsed=$(($(date +%s) - start_ts))
2163 rm -f $DIR/replay-single.70c.lck
2168 local clients=${CLIENTS:-$HOSTNAME}
2171 zconf_mount_clients $clients $MOUNT
2174 [ "$SLOW" = "no" ] && duration=180
2175 # set duration to 900 because it takes some time to boot node
2176 [ "$FAILURE_MODE" = HARD ] && duration=600
2179 local start_ts=$(date +%s)
2181 trap cleanup_70c EXIT
2183 while [ ! -e $DIR/replay-single.70c.lck ]; do
2184 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2185 if [ $MDSCOUNT -ge 2 ]; then
2186 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2187 error "set default dirstripe failed"
2189 cd $DIR/$tdir || break
2190 tar cf - /etc | tar xf - || error "tar failed in loop"
2194 echo "Started tar $tar_70c_pid"
2196 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2197 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2199 touch $DIR/replay-single.70c.lck
2200 wait $tar_70c_pid || error "$?: tar failed"
2205 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2209 kill -9 $mkdir_70d_pid
2213 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2214 local clients=${CLIENTS:-$HOSTNAME}
2217 zconf_mount_clients $clients $MOUNT
2220 [ "$SLOW" = "no" ] && duration=180
2221 # set duration to 900 because it takes some time to boot node
2222 [ "$FAILURE_MODE" = HARD ] && duration=900
2227 local start_ts=$(date +%s)
2229 trap cleanup_70d EXIT
2232 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2236 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2241 touch $DIR/$tdir/test/a || {
2245 mkdir $DIR/$tdir/test/b || {
2249 rm -rf $DIR/$tdir/test || {
2255 touch $DIR/$tdir/test1/a || {
2259 mkdir $DIR/$tdir/test1/b || {
2264 rm -rf $DIR/$tdir/test1 || {
2266 ls -lR $DIR/$tdir/test1
2272 echo "Started $mkdir_70d_pid"
2274 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2275 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2280 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2283 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2284 local clients=${CLIENTS:-$HOSTNAME}
2287 lctl set_param debug=+ha
2288 zconf_mount_clients $clients $MOUNT
2291 [ "$SLOW" = "no" ] && duration=180
2292 # set duration to 900 because it takes some time to boot node
2293 [ "$FAILURE_MODE" = HARD ] && duration=900
2296 $LFS mkdir -i0 $DIR/$tdir/test_0
2297 $LFS mkdir -i0 $DIR/$tdir/test_1
2298 touch $DIR/$tdir/test_0/a
2299 touch $DIR/$tdir/test_1/b
2302 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2307 checkstat $DIR/$tdir/test_0/a && {
2308 echo "a still exists"
2312 checkstat $DIR/$tdir/test_1/b || {
2313 echo "b still exists"
2317 touch $DIR/$tdir/test_0/a || {
2318 echo "touch a fails"
2322 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2329 stack_trap "kill -9 $rename_70e_pid" EXIT
2330 echo "Started PID=$rename_70e_pid"
2332 random_fail_mdt 2 $duration $rename_70e_pid
2333 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2335 run_test 70e "rename cross-MDT with random fails"
2337 test_70f_write_and_read(){
2342 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2343 for client in ${CLIENTS//,/ }; do
2344 [ -f $stopflag ] || return
2346 local tgtfile=$DIR/$tdir/$tfile.$client
2347 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2348 of=$tgtfile 2>/dev/null ||
2349 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2350 "of=$tgtfile failed on $client, rc=$?"
2353 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2356 for client in ${CLIENTS//,/ }; do
2357 [ -f $stopflag ] || return
2359 # flush client cache in case test is running on only one client
2360 # do_node $client cancel_lru_locks osc
2361 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2363 tgtfile=$DIR/$tdir/$tfile.$client
2364 local md5=$(do_node $prev_client "md5sum $tgtfile")
2365 [ ${checksum[$index]// */} = ${md5// */} ] ||
2366 error "$tgtfile: checksum doesn't match on $prev_client"
2367 index=$((index + 1))
2377 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2378 $SETSTRIPE -c -1 $DIR/$tdir || error "cannot $SETSTRIPE $DIR/$tdir"
2381 while [ -f $stopflag ]; do
2382 test_70f_write_and_read $srcfile $stopflag
2383 # use direct IO and buffer cache in turns if loop
2384 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2388 test_70f_cleanup() {
2390 rm -f $TMP/$tfile.stop
2391 do_nodes $CLIENTS rm -f $TMP/$tfile
2392 rm -f $DIR/$tdir/$tfile.*
2396 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2397 # { skip "Failover host not defined" && return; }
2398 # [ -z "$CLIENTS" ] &&
2399 # { skip "CLIENTS are not specified." && return; }
2400 # [ $CLIENTCOUNT -lt 2 ] &&
2401 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2403 [[ $(lustre_version_code ost1) -lt $(version_code 2.9.53) ]] &&
2404 skip "Need server version at least 2.9.53" && return
2406 echo "mount clients $CLIENTS ..."
2407 zconf_mount_clients $CLIENTS $MOUNT
2409 local srcfile=$TMP/$tfile
2413 trap test_70f_cleanup EXIT
2414 # create a different source file local to each client node so we can
2415 # detect if the file wasn't written out properly after failover
2416 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2417 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2418 for client in ${CLIENTS//,/ }; do
2419 checksum[$index]=$(do_node $client "md5sum $srcfile")
2420 index=$((index + 1))
2424 [ "$SLOW" = "no" ] && duration=60
2425 # set duration to 900 because it takes some time to boot node
2426 [ "$FAILURE_MODE" = HARD ] && duration=900
2428 local stopflag=$TMP/$tfile.stop
2429 test_70f_loop $srcfile $stopflag &
2433 local num_failovers=0
2434 local start_ts=$SECONDS
2435 while [ $elapsed -lt $duration ]; do
2439 num_failovers=$((num_failovers + 1))
2440 log "$TESTNAME failing OST $num_failovers times"
2443 elapsed=$((SECONDS - start_ts))
2450 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2454 kill -9 $mkdir_71a_pid
2457 random_double_fail_mdt() {
2460 local monitor_pid=$3
2462 local start_ts=$(date +%s)
2463 local num_failovers=0
2467 elapsed=$(($(date +%s) - start_ts))
2468 while [ $elapsed -lt $duration ]; do
2469 fail_index=$((RANDOM%max_index + 1))
2470 if [ $fail_index -eq $max_index ]; then
2473 second_index=$((fail_index + 1))
2475 kill -0 $monitor_pid ||
2476 error "$monitor_pid stopped"
2478 replay_barrier mds$fail_index
2479 replay_barrier mds$second_index
2481 # Increment the number of failovers
2482 num_failovers=$((num_failovers+1))
2483 log "fail mds$fail_index mds$second_index $num_failovers times"
2484 fail mds${fail_index},mds${second_index}
2485 elapsed=$(($(date +%s) - start_ts))
2490 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2491 local clients=${CLIENTS:-$HOSTNAME}
2494 zconf_mount_clients $clients $MOUNT
2497 [ "$SLOW" = "no" ] && duration=180
2498 # set duration to 900 because it takes some time to boot node
2499 [ "$FAILURE_MODE" = HARD ] && duration=900
2504 local start_ts=$(date +%s)
2506 trap cleanup_71a EXIT
2509 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2510 rmdir $DIR/$tdir/test
2514 echo "Started $mkdir_71a_pid"
2516 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2517 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2522 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2525 multiop_bg_pause $DIR/$tfile O_tSc ||
2526 error "multiop_bg_pause $DIR/$tfile failed"
2530 replay_barrier $SINGLEMDS
2531 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2532 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2535 wait $pid || error "multiop pid failed"
2536 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2539 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2542 multiop_bg_pause $DIR/$tfile O_tSc ||
2543 error "multiop_bg_pause $DIR/$tfile failed"
2547 replay_barrier $SINGLEMDS
2548 #define OBD_FAIL_LDLM_REPLY 0x30c
2549 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
2552 wait $pid || error "multiop pid failed"
2553 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2556 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2560 local clients=${CLIENTS:-$HOSTNAME}
2562 zconf_umount_clients $clients $MOUNT
2564 facet_failover $SINGLEMDS
2565 zconf_mount_clients $clients $MOUNT
2567 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2568 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2569 clients_up || error "client evicted: $?"
2572 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2574 remote_dir_check_80() {
2579 diridx=$($LFS getstripe -m $remote_dir) ||
2580 error "$LFS getstripe -m $remote_dir failed"
2581 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2583 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2584 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2585 error "$LFS getstripe -m $remote_dir/f-1 failed"
2586 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2592 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2593 ([ $FAILURE_MODE == "HARD" ] &&
2594 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2595 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2599 local remote_dir=$DIR/$tdir/remote_dir
2601 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2602 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2603 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2604 $LFS mkdir -i $MDTIDX $remote_dir &
2610 wait $CLIENT_PID || error "remote creation failed"
2612 remote_dir_check_80 || error "remote dir check failed"
2613 rm -rf $DIR/$tdir || error "rmdir failed"
2617 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2620 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2621 ([ $FAILURE_MODE == "HARD" ] &&
2622 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2623 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2627 local remote_dir=$DIR/$tdir/remote_dir
2629 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2630 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2631 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2632 $LFS mkdir -i $MDTIDX $remote_dir &
2637 fail mds$((MDTIDX + 1))
2639 wait $CLIENT_PID || error "remote creation failed"
2641 remote_dir_check_80 || error "remote dir check failed"
2642 rm -rf $DIR/$tdir || error "rmdir failed"
2646 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2649 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2650 ([ $FAILURE_MODE == "HARD" ] &&
2651 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2652 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2656 local remote_dir=$DIR/$tdir/remote_dir
2658 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2659 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2660 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2661 $LFS mkdir -i $MDTIDX $remote_dir &
2667 fail mds$((MDTIDX + 1))
2669 wait $CLIENT_PID || error "remote creation failed"
2671 remote_dir_check_80 || error "remote dir check failed"
2672 rm -rf $DIR/$tdir || error "rmdir failed"
2676 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2679 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2681 local remote_dir=$DIR/$tdir/remote_dir
2683 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2684 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2685 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2686 $LFS mkdir -i $MDTIDX $remote_dir &
2689 # sleep 3 seconds to make sure MDTs are failed after
2690 # lfs mkdir -i has finished on all of MDTs.
2695 fail mds${MDTIDX},mds$((MDTIDX + 1))
2697 wait $CLIENT_PID || error "remote creation failed"
2699 remote_dir_check_80 || error "remote dir check failed"
2700 rm -rf $DIR/$tdir || error "rmdir failed"
2704 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2707 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2708 ([ $FAILURE_MODE == "HARD" ] &&
2709 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2710 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2714 local remote_dir=$DIR/$tdir/remote_dir
2716 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2717 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2718 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2719 $LFS mkdir -i $MDTIDX $remote_dir &
2722 # sleep 3 seconds to make sure MDTs are failed after
2723 # lfs mkdir -i has finished on all of MDTs.
2729 wait $CLIENT_PID || error "remote creation failed"
2731 remote_dir_check_80 || error "remote dir check failed"
2732 rm -rf $DIR/$tdir || error "rmdir failed"
2736 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2739 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2740 ([ $FAILURE_MODE == "HARD" ] &&
2741 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2742 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2745 local remote_dir=$DIR/$tdir/remote_dir
2747 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2748 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2749 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2750 $LFS mkdir -i $MDTIDX $remote_dir &
2754 fail mds$((MDTIDX + 1))
2756 wait $CLIENT_PID || error "remote creation failed"
2758 remote_dir_check_80 || error "remote dir check failed"
2759 rm -rf $DIR/$tdir || error "rmdir failed"
2763 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2766 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2767 ([ $FAILURE_MODE == "HARD" ] &&
2768 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2769 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2773 local remote_dir=$DIR/$tdir/remote_dir
2775 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2776 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2777 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2778 $LFS mkdir -i $MDTIDX $remote_dir &
2781 # sleep 3 seconds to make sure MDTs are failed after
2782 # lfs mkdir -i has finished on all of MDTs.
2788 fail mds$((MDTIDX + 1))
2790 wait $CLIENT_PID || error "remote creation failed"
2792 remote_dir_check_80 || error "remote dir check failed"
2793 rm -rf $DIR/$tdir || error "rmdir failed"
2797 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2800 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2802 local remote_dir=$DIR/$tdir/remote_dir
2804 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2805 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2806 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2807 $LFS mkdir -i $MDTIDX $remote_dir &
2810 # sleep 3 seconds to make sure MDTs are failed after
2811 # lfs mkdir -i has finished on all of MDTs.
2816 fail mds${MDTIDX},mds$((MDTIDX + 1))
2818 wait $CLIENT_PID || error "remote dir creation failed"
2820 remote_dir_check_80 || error "remote dir check failed"
2821 rm -rf $DIR/$tdir || error "rmdir failed"
2825 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2828 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2829 ([ $FAILURE_MODE == "HARD" ] &&
2830 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2831 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2835 local remote_dir=$DIR/$tdir/remote_dir
2837 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2838 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2840 touch $remote_dir || error "touch $remote_dir failed"
2841 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2842 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2847 fail mds$((MDTIDX + 1))
2849 wait $CLIENT_PID || error "rm remote dir failed"
2851 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2853 rm -rf $DIR/$tdir || error "rmdir failed"
2857 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2860 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2861 ([ $FAILURE_MODE == "HARD" ] &&
2862 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2863 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2866 local remote_dir=$DIR/$tdir/remote_dir
2868 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2869 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2871 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2872 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2879 wait $CLIENT_PID || error "rm remote dir failed"
2881 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2883 rm -rf $DIR/$tdir || error "rmdir failed"
2887 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2890 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2891 ([ $FAILURE_MODE == "HARD" ] &&
2892 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2893 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2897 local remote_dir=$DIR/$tdir/remote_dir
2899 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2900 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2902 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2903 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2910 fail mds$((MDTIDX + 1))
2912 wait $CLIENT_PID || error "rm remote dir failed"
2914 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2916 rm -rf $DIR/$tdir || error "rmdir failed"
2920 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2923 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2925 local remote_dir=$DIR/$tdir/remote_dir
2927 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2928 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2930 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2931 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2937 fail mds${MDTIDX},mds$((MDTIDX + 1))
2939 wait $CLIENT_PID || error "rm remote dir failed"
2941 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2943 rm -rf $DIR/$tdir || error "rmdir failed"
2947 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2950 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2951 ([ $FAILURE_MODE == "HARD" ] &&
2952 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2953 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2957 local remote_dir=$DIR/$tdir/remote_dir
2959 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2960 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2962 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2963 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2966 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2971 wait $CLIENT_PID || error "rm remote dir failed"
2973 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2975 rm -rf $DIR/$tdir || error "rmdir failed"
2979 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2982 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2983 ([ $FAILURE_MODE == "HARD" ] &&
2984 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2985 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2989 local remote_dir=$DIR/$tdir/remote_dir
2991 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2992 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2994 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2995 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3000 fail mds$((MDTIDX + 1))
3002 wait $CLIENT_PID || error "rm remote dir failed"
3004 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3006 rm -rf $DIR/$tdir || error "rmdir failed"
3010 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3013 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3014 ([ $FAILURE_MODE == "HARD" ] &&
3015 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3016 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3020 local remote_dir=$DIR/$tdir/remote_dir
3022 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3023 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3025 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3026 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3033 fail mds$((MDTIDX + 1))
3035 wait $CLIENT_PID || error "rm remote dir failed"
3037 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3039 rm -rf $DIR/$tdir || error "rmdir failed"
3043 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3046 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3048 local remote_dir=$DIR/$tdir/remote_dir
3050 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3051 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3053 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3054 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3060 fail mds${MDTIDX},mds$((MDTIDX + 1))
3062 wait $CLIENT_PID || error "rm remote dir failed"
3064 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3066 rm -rf $DIR/$tdir || error "rmdir failed"
3070 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3073 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3074 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3075 createmany -o $DIR/$tfile- 1 &
3079 client_up || client_up || true # reconnect
3081 run_test 84a "stale open during export disconnect"
3083 test_85a() { #bug 16774
3084 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3086 for i in $(seq 100); do
3087 echo "tag-$i" > $DIR/$tfile-$i
3088 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3091 lov_id=$(lctl dl | grep "clilov")
3092 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3093 count=$(lctl get_param -n \
3094 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3095 echo "before recovery: unused locks count = $count"
3099 count2=$(lctl get_param -n \
3100 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3101 echo "after recovery: unused locks count = $count2"
3103 if [ $count2 -ge $count ]; then
3104 error "unused locks are not canceled"
3107 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3109 test_85b() { #bug 16774
3110 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3112 if ! combined_mgs_mds ; then
3116 create_pool $FSNAME.$TESTNAME ||
3117 error "unable to create pool $TESTNAME"
3118 do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $FSNAME-OST0000 ||
3119 error "unable to add pool $TESTNAME"
3121 $SETSTRIPE -c 1 -p $FSNAME.$TESTNAME $DIR
3123 for i in $(seq 100); do
3124 dd if=/dev/urandom of=$DIR/$tfile-$i bs=4096 \
3125 count=32 >/dev/null 2>&1
3128 cancel_lru_locks osc
3130 for i in $(seq 100); do
3131 dd if=$DIR/$tfile-$i of=/dev/null bs=4096 \
3132 count=32 >/dev/null 2>&1
3135 lov_id=$(lctl dl | grep "clilov")
3136 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3137 count=$(lctl get_param -n \
3138 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3139 echo "before recovery: unused locks count = $count"
3140 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3144 count2=$(lctl get_param \
3145 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3146 echo "after recovery: unused locks count = $count2"
3148 do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $FSNAME-OST0000 ||
3149 error "unable to remove pool $TESTNAME"
3150 do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME ||
3151 error "unable to destroy the pool $TESTNAME"
3153 if ! combined_mgs_mds ; then
3157 if [ $count2 -ge $count ]; then
3158 error "unused locks are not canceled"
3161 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3164 local clients=${CLIENTS:-$HOSTNAME}
3166 zconf_umount_clients $clients $MOUNT
3167 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3168 remount_facet $SINGLEMDS
3169 zconf_mount_clients $clients $MOUNT
3171 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3174 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3177 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
3178 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3179 error "dd to $DIR/$tfile failed"
3180 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3181 cancel_lru_locks osc
3183 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3184 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3185 if [ $cksum != $cksum2 ] ; then
3186 error "New checksum $cksum2 does not match original $cksum"
3189 run_test 87a "write replay"
3192 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3195 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
3196 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3197 error "dd to $DIR/$tfile failed"
3198 sleep 1 # Give it a chance to flush dirty data
3199 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3200 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3201 cancel_lru_locks osc
3203 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3204 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3205 if [ $cksum != $cksum2 ] ; then
3206 error "New checksum $cksum2 does not match original $cksum"
3209 run_test 87b "write replay with changed data (checksum resend)"
3211 test_88() { #bug 17485
3212 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3213 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3215 $SETSTRIPE -i 0 -c 1 $DIR/$tdir || error "$SETSTRIPE"
3218 replay_barrier $SINGLEMDS
3220 # exhaust precreations on ost1
3221 local OST=$(ostname_from_index 0)
3222 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3223 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
3224 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
3225 echo "before test: last_id = $last_id, next_id = $next_id"
3227 echo "Creating to objid $last_id on ost $OST..."
3228 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3229 error "createmany create files to last_id failed"
3231 #create some files to use some uncommitted objids
3232 last_id=$(($last_id + 1))
3233 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3234 error "createmany create files with uncommitted objids failed"
3236 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
3237 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
3238 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3240 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3241 # it has to take care about the affected facets, bug20407
3242 local affected_mds1=$(affected_facets mds1)
3243 local affected_ost1=$(affected_facets ost1)
3245 shutdown_facet $SINGLEMDS
3248 reboot_facet $SINGLEMDS
3249 change_active $affected_mds1
3250 wait_for_facet $affected_mds1
3251 mount_facets $affected_mds1 || error "Restart of mds failed"
3254 change_active $affected_ost1
3255 wait_for_facet $affected_ost1
3256 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3260 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
3261 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
3262 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3264 # create new files, which should use new objids, and ensure the orphan
3265 # cleanup phase for ost1 is completed at the same time
3266 for i in $(seq 8); do
3267 file_id=$(($last_id + 10 + $i))
3268 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3271 # if the objids were not recreated, then "ls" will fail with -ENOENT
3272 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3275 # write into previously created files
3276 for i in $(seq 8); do
3277 file_id=$(($last_id + $i))
3278 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3279 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3282 # compare the content
3283 for i in $(seq 8); do
3284 file_id=$(($last_id + $i))
3285 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3286 error "the content of file is modified!"
3291 run_test 88 "MDS should not assign same objid to different files "
3293 function calc_osc_kbytes_used() {
3294 local kbtotal=$(calc_osc_kbytes kbytestotal)
3295 local kbfree=$(calc_osc_kbytes kbytesfree)
3296 echo $((kbtotal-kbfree))
3300 cancel_lru_locks osc
3301 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3302 rm -f $DIR/$tdir/$tfile
3303 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3304 wait_delete_completed || error "initial wait delete timed out"
3305 local blocks1=$(calc_osc_kbytes_used)
3306 local write_size=$(fs_log_size)
3308 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
3309 [ $write_size -lt 1024 ] && write_size=1024
3310 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3313 facet_failover $SINGLEMDS
3314 rm $DIR/$tdir/$tfile
3317 zconf_mount $(hostname) $MOUNT || error "mount fails"
3318 client_up || error "client_up failed"
3320 # wait for the remounted client to connect to ost1
3321 local target=$(get_osc_import_name client ost1)
3322 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3323 $(max_recovery_time)
3325 wait_mds_ost_sync || error "MDS-OST sync timed out"
3326 wait_delete_completed || error "wait delete timed out"
3327 local blocks2=$(calc_osc_kbytes_used)
3329 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3330 error $((blocks2 - blocks1)) blocks leaked
3332 run_test 89 "no disk space leak on late ost connection"
3339 change_active $facet
3340 wait_for_facet $facet
3341 mount_facet $facet || error "Restart of $facet failed"
3345 test_90() { # bug 19494
3346 local dir=$DIR/$tdir
3347 local ostfail=$(get_random_entry $(get_facets OST))
3349 if [[ $FAILURE_MODE = HARD ]]; then
3350 local affected=$(affected_facets $ostfail);
3351 if [[ "$affected" != $ostfail ]]; then
3352 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
3356 # ensure all OSTs are active to allow allocations
3359 mkdir $dir || error "mkdir $dir failed"
3361 echo "Create the files"
3363 # file "f${index}" striped over 1 OST
3364 # file "all" striped over all OSTs
3366 $LFS setstripe -c $OSTCOUNT $dir/all ||
3367 error "setstripe failed to create $dir/all"
3369 for ((i = 0; i < $OSTCOUNT; i++)); do
3372 $LFS setstripe -i $i -c 1 $f ||
3373 error "$LFS setstripe failed to create $f"
3375 # confirm setstripe actually created stripe on requested OST
3376 local uuid=$(ostuuid_from_index $i)
3378 for file in f$i all; do
3379 local found=$($LFS find --obd $uuid --name $file $dir)
3381 if [[ $dir/$file != $found ]]; then
3382 $LFS getstripe $dir/$file
3383 error "wrong stripe: $file, uuid: $uuid"
3388 # Before failing an OST, get its obd name and index
3389 local varsvc=${ostfail}_svc
3390 local obd=$(do_facet $ostfail lctl get_param \
3391 -n obdfilter.${!varsvc}.uuid)
3392 local index=$(($(facet_number $ostfail) - 1))
3394 echo "Fail $ostfail $obd, display the list of affected files"
3395 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3397 trap "cleanup_90 $ostfail" EXIT INT
3398 echo "General Query: lfs find $dir"
3399 local list=$($LFS find $dir)
3401 for (( i=0; i<$OSTCOUNT; i++ )); do
3402 list_member "$list" $dir/f$i ||
3403 error_noexit "lfs find $dir: no file f$i"
3405 list_member "$list" $dir/all ||
3406 error_noexit "lfs find $dir: no file all"
3408 # focus on the missing OST,
3409 # we expect to see only two files affected: "f$(index)" and "all"
3411 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3412 list=$($LFS find --obd $obd $dir)
3414 for file in all f$index; do
3415 list_member "$list" $dir/$file ||
3416 error_noexit "lfs find does not report the affected $obd for $file"
3419 [[ $(echo $list | wc -w) -eq 2 ]] ||
3420 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3422 echo "Check getstripe: $GETSTRIPE -r --obd $obd"
3423 list=$($GETSTRIPE -r --obd $obd $dir)
3425 for file in all f$index; do
3426 echo "$list" | grep $dir/$file ||
3427 error_noexit "lfs getsripe does not report the affected $obd for $file"
3432 run_test 90 "lfs find identifies the missing striped file segments"
3435 local server_version=$(lustre_version_code $SINGLEMDS)
3436 [[ $server_version -ge $(version_code 2.6.90) ]] ||
3437 [[ $server_version -ge $(version_code 2.5.4) &&
3438 $server_version -lt $(version_code 2.5.50) ]] ||
3439 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
3441 cancel_lru_locks osc
3443 $SETSTRIPE -i 0 -c 1 $DIR/$tfile ||
3444 error "$SETSTRIPE $DIR/$tfile failed"
3445 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3446 error "dd to $DIR/$tfile failed"
3447 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3448 # We need to emulate a state that OST is waiting for other clients
3449 # not completing the recovery. Final ping is queued, but reply will be
3450 # sent on the recovery completion. It is done by sleep before
3451 # processing final pings
3452 do_facet ost1 "$LCTL set_param fail_val=40"
3453 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3456 run_test 93a "replay + reconnect"
3459 local server_version=$(lustre_version_code $SINGLEMDS)
3460 [[ $server_version -ge $(version_code 2.7.90) ]] ||
3461 { skip "Need MDS version 2.7.90+"; return; }
3463 cancel_lru_locks mdc
3465 createmany -o $DIR/$tfile 20 ||
3466 error "createmany -o $DIR/$tfile failed"
3468 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3469 # We need to emulate a state that MDT is waiting for other clients
3470 # not completing the recovery. Final ping is queued, but reply will be
3471 # sent on the recovery completion. It is done by sleep before
3472 # processing final pings
3473 do_facet mds1 "$LCTL set_param fail_val=80"
3474 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3477 run_test 93b "replay + reconnect on mds"
3479 striped_dir_check_100() {
3480 local striped_dir=$DIR/$tdir/striped_dir
3481 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3483 $LFS getdirstripe $striped_dir
3484 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3486 createmany -o $striped_dir/f-%d 20 ||
3487 error "creation failed under striped dir"
3491 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3492 ([ $FAILURE_MODE == "HARD" ] &&
3493 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3494 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3497 local striped_dir=$DIR/$tdir/striped_dir
3500 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3502 #To make sure MDT1 and MDT0 are connected
3503 #otherwise it may create single stripe dir here
3504 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3506 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3507 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3508 $LFS setdirstripe -i0 -c2 $striped_dir &
3511 fail mds$((MDTIDX + 1))
3513 wait $CLIENT_PID || error "striped dir creation failed"
3515 striped_dir_check_100 || error "striped dir check failed"
3516 rm -rf $DIR/$tdir || error "rmdir failed"
3518 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3521 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3522 ([ $FAILURE_MODE == "HARD" ] &&
3523 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3524 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3527 local striped_dir=$DIR/$tdir/striped_dir
3530 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3532 #To make sure MDT1 and MDT0 are connected
3533 #otherwise it may create single stripe dir here
3534 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3536 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3537 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3538 $LFS mkdir -i0 -c2 $striped_dir &
3543 wait $CLIENT_PID || error "striped dir creation failed"
3545 striped_dir_check_100 || error "striped dir check failed"
3546 rm -rf $DIR/$tdir || error "rmdir failed"
3548 run_test 100b "DNE: create striped dir, fail MDT0"
3550 test_101() { #LU-5648
3551 mkdir -p $DIR/$tdir/d1
3552 mkdir -p $DIR/$tdir/d2
3553 touch $DIR/$tdir/file0
3556 replay_barrier $SINGLEMDS
3557 for i in $(seq $num) ; do
3558 echo test$i > $DIR/$tdir/d1/file$i
3561 fail_abort $SINGLEMDS
3562 for i in $(seq $num) ; do
3563 touch $DIR/$tdir/d2/file$i
3564 test -s $DIR/$tdir/d2/file$i &&
3565 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3570 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3579 [[ $(lctl get_param mdc.*.import |
3580 grep "connect_flags:.*multi_mod_rpc") ]] ||
3581 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3583 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3584 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3585 facet="mds$((0x$idx + 1))"
3587 # get current value of max_mod_rcps_in_flight
3588 num=$($LCTL get_param -n \
3589 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3590 # set default value if client does not support multi mod RPCs
3591 [ -z "$num" ] && num=1
3593 echo "creating $num files ..."
3595 for i in $(seq $num); do
3596 touch $DIR/$tdir/file-$i
3599 # drop request on MDT to force resend
3600 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3601 do_facet $facet "$LCTL set_param fail_loc=0x159"
3602 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3603 for i in $(seq $num); do
3604 chmod 0600 $DIR/$tdir/file-$i &
3608 do_facet $facet "$LCTL set_param fail_loc=0"
3609 for pid in $pids; do
3610 wait $pid || error "chmod failed"
3612 echo "done ($(date +%H:%M:%S))"
3614 # check chmod succeed
3615 for i in $(seq $num); do
3616 checkstat -vp 0600 $DIR/$tdir/file-$i
3621 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3630 [[ $(lctl get_param mdc.*.import |
3631 grep "connect_flags:.*multi_mod_rpc") ]] ||
3632 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3634 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3635 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3636 facet="mds$((0x$idx + 1))"
3638 # get current value of max_mod_rcps_in_flight
3639 num=$($LCTL get_param -n \
3640 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3641 # set default value if client does not support multi mod RPCs
3642 [ -z "$num" ] && num=1
3644 echo "creating $num files ..."
3646 for i in $(seq $num); do
3647 touch $DIR/$tdir/file-$i
3650 # drop reply on MDT to force reconstruction
3651 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3652 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3653 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3654 for i in $(seq $num); do
3655 chmod 0600 $DIR/$tdir/file-$i &
3659 do_facet $facet "$LCTL set_param fail_loc=0"
3660 for pid in $pids; do
3661 wait $pid || error "chmod failed"
3663 echo "done ($(date +%H:%M:%S))"
3665 # check chmod succeed
3666 for i in $(seq $num); do
3667 checkstat -vp 0600 $DIR/$tdir/file-$i
3672 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3681 [[ $(lctl get_param mdc.*.import |
3682 grep "connect_flags:.*multi_mod_rpc") ]] ||
3683 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3685 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3686 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3687 facet="mds$((0x$idx + 1))"
3689 # get current value of max_mod_rcps_in_flight
3690 num=$($LCTL get_param -n \
3691 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3692 # set default value if client does not support multi mod RPCs
3693 [ -z "$num" ] && num=1
3695 echo "creating $num files ..."
3697 for i in $(seq $num); do
3698 touch $DIR/$tdir/file-$i
3701 replay_barrier $facet
3704 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3705 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3706 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3707 for i in $(seq $num); do
3708 chmod 0600 $DIR/$tdir/file-$i &
3712 do_facet $facet "$LCTL set_param fail_loc=0"
3717 for pid in $pids; do
3718 wait $pid || error "chmod failed"
3720 echo "done ($(date +%H:%M:%S))"
3722 # check chmod succeed
3723 for i in $(seq $num); do
3724 checkstat -vp 0600 $DIR/$tdir/file-$i
3729 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3738 [[ $(lctl get_param mdc.*.import |
3739 grep "connect_flags:.*multi_mod_rpc") ]] ||
3740 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3742 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3743 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3744 facet="mds$((0x$idx + 1))"
3746 # get current value of max_mod_rcps_in_flight
3747 num=$($LCTL get_param -n \
3748 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3749 # set default value if client does not support multi mod RPCs
3750 [ -z "$num" ] && num=1
3752 echo "creating $num files ..."
3754 for i in $(seq $num); do
3755 touch $DIR/$tdir/file-$i
3759 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3760 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3761 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3762 for i in $(seq $num); do
3763 chmod 0600 $DIR/$tdir/file-$i &
3768 # write MDT transactions to disk
3769 do_facet $facet "sync; sync; sync"
3771 do_facet $facet "$LCTL set_param fail_loc=0"
3776 for pid in $pids; do
3777 wait $pid || error "chmod failed"
3779 echo "done ($(date +%H:%M:%S))"
3781 # check chmod succeed
3782 for i in $(seq $num); do
3783 checkstat -vp 0600 $DIR/$tdir/file-$i
3788 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3791 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3792 local mds_version=$(lustre_version_code $SINGLEMDS)
3793 [[ $mds_version -gt $(version_code 2.8.54) ]] ||
3794 { skip "Need MDS version 2.8.54+"; return; }
3796 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3797 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3800 createmany -o $DIR/$tdir/t- 30 ||
3801 error "create files on remote directory failed"
3803 rm -rf $DIR/$tdir/t-*
3805 #MDS should crash with tr->otr_next_id overflow
3808 run_test 103 "Check otr_next_id overflow"
3811 check_striped_dir_110()
3813 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3814 error "create striped dir failed"
3815 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3816 [ $stripe_count -eq $MDSCOUNT ] ||
3817 error "$stripe_count != 2 after recovery"
3821 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3822 ([ $FAILURE_MODE == "HARD" ] &&
3823 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3824 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3829 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3832 check_striped_dir_110 || error "check striped_dir failed"
3833 rm -rf $DIR/$tdir || error "rmdir failed"
3837 run_test 110a "DNE: create striped dir, fail MDT1"
3840 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3841 ([ $FAILURE_MODE == "HARD" ] &&
3842 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3843 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3848 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3851 zconf_mount $(hostname) $MOUNT
3852 client_up || return 1
3854 check_striped_dir_110 || error "check striped_dir failed"
3856 rm -rf $DIR/$tdir || error "rmdir failed"
3860 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3863 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3864 ([ $FAILURE_MODE == "HARD" ] &&
3865 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3866 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3871 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3874 check_striped_dir_110 || error "check striped_dir failed"
3876 rm -rf $DIR/$tdir || error "rmdir failed"
3880 run_test 110c "DNE: create striped dir, fail MDT2"
3883 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3884 ([ $FAILURE_MODE == "HARD" ] &&
3885 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3886 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3891 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3894 zconf_mount $(hostname) $MOUNT
3895 client_up || return 1
3897 check_striped_dir_110 || error "check striped_dir failed"
3899 rm -rf $DIR/$tdir || error "rmdir failed"
3903 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3906 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3907 ([ $FAILURE_MODE == "HARD" ] &&
3908 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3909 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3914 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3918 zconf_mount $(hostname) $MOUNT
3919 client_up || return 1
3921 check_striped_dir_110 || error "check striped_dir failed"
3923 rm -rf $DIR/$tdir || error "rmdir failed"
3927 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3930 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3931 ([ $FAILURE_MODE == "HARD" ] &&
3932 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3933 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3939 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3942 check_striped_dir_110 || error "check striped_dir failed"
3944 rm -rf $DIR/$tdir || error "rmdir failed"
3948 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3951 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3952 ([ $FAILURE_MODE == "HARD" ] &&
3953 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3954 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3959 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3963 zconf_mount $(hostname) $MOUNT
3964 client_up || return 1
3966 check_striped_dir_110 || error "check striped_dir failed"
3968 rm -rf $DIR/$tdir || error "rmdir failed"
3972 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
3975 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3976 ([ $FAILURE_MODE == "HARD" ] &&
3977 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3978 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3982 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3984 rm -rf $DIR/$tdir/striped_dir
3987 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3988 error "striped dir still exists"
3991 run_test 111a "DNE: unlink striped dir, fail MDT1"
3994 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3995 ([ $FAILURE_MODE == "HARD" ] &&
3996 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3997 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4001 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4003 rm -rf $DIR/$tdir/striped_dir
4006 zconf_mount $(hostname) $MOUNT
4007 client_up || return 1
4009 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4010 error "striped dir still exists"
4013 run_test 111b "DNE: unlink striped dir, fail MDT2"
4016 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4017 ([ $FAILURE_MODE == "HARD" ] &&
4018 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4019 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4023 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4025 rm -rf $DIR/$tdir/striped_dir
4029 zconf_mount $(hostname) $MOUNT
4030 client_up || return 1
4031 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4032 error "striped dir still exists"
4035 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4038 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4039 ([ $FAILURE_MODE == "HARD" ] &&
4040 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4041 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4045 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4047 rm -rf $DIR/$tdir/striped_dir
4051 zconf_mount $(hostname) $MOUNT
4052 client_up || return 1
4053 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4054 error "striped dir still exists"
4058 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4061 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4062 ([ $FAILURE_MODE == "HARD" ] &&
4063 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4064 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4068 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4070 rm -rf $DIR/$tdir/striped_dir
4073 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4074 error "striped dir still exists"
4077 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4080 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4081 ([ $FAILURE_MODE == "HARD" ] &&
4082 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4083 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4087 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4089 rm -rf $DIR/$tdir/striped_dir
4092 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4093 error "striped dir still exists"
4096 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4099 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4100 ([ $FAILURE_MODE == "HARD" ] &&
4101 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4102 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4106 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4109 rm -rf $DIR/$tdir/striped_dir
4111 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4112 error "striped dir still exists"
4115 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4117 test_112_rename_prepare() {
4118 mkdir -p $DIR/$tdir/src_dir
4119 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4120 error "create remote source failed"
4122 touch $DIR/$tdir/src_dir/src_child/a
4124 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4125 error "create remote target dir failed"
4127 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4128 error "create remote target child failed"
4133 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4134 error "src_child still exists after rename"
4136 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4137 error "missing file(a) after rename"
4141 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4142 ([ $FAILURE_MODE == "HARD" ] &&
4143 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4144 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4147 test_112_rename_prepare
4150 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4151 error "rename dir cross MDT failed!"
4155 rm -rf $DIR/$tdir || error "rmdir failed"
4157 run_test 112a "DNE: cross MDT rename, fail MDT1"
4160 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4161 ([ $FAILURE_MODE == "HARD" ] &&
4162 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4163 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4166 test_112_rename_prepare
4169 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4170 error "rename dir cross MDT failed!"
4175 rm -rf $DIR/$tdir || error "rmdir failed"
4177 run_test 112b "DNE: cross MDT rename, fail MDT2"
4180 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4181 ([ $FAILURE_MODE == "HARD" ] &&
4182 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4183 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4186 test_112_rename_prepare
4189 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4190 error "rename dir cross MDT failed!"
4195 rm -rf $DIR/$tdir || error "rmdir failed"
4197 run_test 112c "DNE: cross MDT rename, fail MDT3"
4200 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4201 ([ $FAILURE_MODE == "HARD" ] &&
4202 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4203 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4206 test_112_rename_prepare
4209 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4210 error "rename dir cross MDT failed!"
4215 rm -rf $DIR/$tdir || error "rmdir failed"
4217 run_test 112d "DNE: cross MDT rename, fail MDT4"
4220 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4221 ([ $FAILURE_MODE == "HARD" ] &&
4222 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4223 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4226 test_112_rename_prepare
4230 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4231 error "rename dir cross MDT failed!"
4236 rm -rf $DIR/$tdir || error "rmdir failed"
4238 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4241 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4242 ([ $FAILURE_MODE == "HARD" ] &&
4243 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4244 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4247 test_112_rename_prepare
4251 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4252 error "rename dir cross MDT failed!"
4257 rm -rf $DIR/$tdir || error "rmdir failed"
4259 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4262 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4263 ([ $FAILURE_MODE == "HARD" ] &&
4264 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4265 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4268 test_112_rename_prepare
4272 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4273 error "rename dir cross MDT failed!"
4278 rm -rf $DIR/$tdir || error "rmdir failed"
4280 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4283 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4284 ([ $FAILURE_MODE == "HARD" ] &&
4285 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4286 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4289 test_112_rename_prepare
4293 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4294 error "rename dir cross MDT failed!"
4299 rm -rf $DIR/$tdir || error "rmdir failed"
4301 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4304 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4305 ([ $FAILURE_MODE == "HARD" ] &&
4306 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4307 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4310 test_112_rename_prepare
4314 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4315 error "rename dir cross MDT failed!"
4320 rm -rf $DIR/$tdir || error "rmdir failed"
4322 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4325 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4326 ([ $FAILURE_MODE == "HARD" ] &&
4327 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4328 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4331 test_112_rename_prepare
4335 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4336 error "rename dir cross MDT failed!"
4341 rm -rf $DIR/$tdir || error "rmdir failed"
4343 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4346 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4347 ([ $FAILURE_MODE == "HARD" ] &&
4348 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4349 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4352 test_112_rename_prepare
4357 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4358 error "rename dir cross MDT failed!"
4363 rm -rf $DIR/$tdir || error "rmdir failed"
4365 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4368 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4369 ([ $FAILURE_MODE == "HARD" ] &&
4370 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4371 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4374 test_112_rename_prepare
4379 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4380 error "rename dir cross MDT failed!"
4385 rm -rf $DIR/$tdir || error "rmdir failed"
4387 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4390 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4391 ([ $FAILURE_MODE == "HARD" ] &&
4392 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4393 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4396 test_112_rename_prepare
4401 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4402 error "rename dir cross MDT failed!"
4407 rm -rf $DIR/$tdir || error "rmdir failed"
4409 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4412 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4413 ([ $FAILURE_MODE == "HARD" ] &&
4414 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4415 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4418 test_112_rename_prepare
4423 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4424 error "rename dir cross MDT failed!"
4429 rm -rf $DIR/$tdir || error "rmdir failed"
4431 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4434 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4435 ([ $FAILURE_MODE == "HARD" ] &&
4436 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4437 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4445 for ((j=0;j<$((MDSCOUNT));j++)); do
4446 fail_index=$((fail_index+1))
4447 index=$((fail_index % MDSCOUNT))
4448 replay_barrier mds$((index + 1))
4449 for ((i=0;i<5;i++)); do
4450 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4451 error "create striped dir $DIR/$tdir/test_$i"
4454 fail mds$((index + 1))
4455 for ((i=0;i<5;i++)); do
4456 checkstat -t dir $DIR/$tdir/test_$i ||
4457 error "$DIR/$tdir/test_$i does not exist!"
4459 rm -rf $DIR/$tdir/test_* ||
4463 run_test 115 "failover for create/unlink striped directory"
4466 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4467 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4468 skip "Do not support large update log before 2.7.55" &&
4470 ([ $FAILURE_MODE == "HARD" ] &&
4471 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4472 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4479 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4480 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4481 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4484 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4485 error "stried_dir does not exists"
4487 run_test 116a "large update log master MDT recovery"
4490 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4491 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4492 skip "Do not support large update log before 2.7.55" &&
4495 ([ $FAILURE_MODE == "HARD" ] &&
4496 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4497 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4504 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4505 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4506 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4509 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4510 error "stried_dir does not exists"
4512 run_test 116b "large update log slave MDT recovery"
4515 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4516 ([ $FAILURE_MODE == "HARD" ] &&
4517 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4518 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4524 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4525 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4528 # Let's set rdonly on all MDTs, so client will send
4529 # replay requests on all MDTs and replay these requests
4530 # at the same time. This test will verify the recovery
4531 # will not be deadlock in this case, LU-7531.
4532 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4533 replay_barrier mds$((index + 1))
4534 if [ -z $mds_indexs ]; then
4535 mds_indexs="${mds_indexs}mds$((index+1))"
4537 mds_indexs="${mds_indexs},mds$((index+1))"
4541 rm -rf $DIR/$tdir/remote_dir
4542 rm -rf $DIR/$tdir/remote_dir_1
4546 rm -rf $DIR/$tdir || error "rmdir failed"
4548 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4551 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4552 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4553 skip "Do not support large update log before 2.7.64" &&
4558 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4559 error "setdirstripe fails"
4560 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4561 error "setdirstripe fails 1"
4562 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4564 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4565 do_facet mds1 "lctl set_param fail_loc=0x1705"
4566 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4567 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4568 do_facet mds1 "lctl set_param fail_loc=0x0"
4571 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4572 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4577 run_test 118 "invalidate osp update will not cause update log corruption"
4580 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4581 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4582 skip "Do not support large update log before 2.7.64" &&
4585 local hard_timeout=$(do_facet mds1 \
4586 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4588 local clients=${CLIENTS:-$HOSTNAME}
4589 local time_min=$(recovery_time_min)
4592 mkdir $DIR/$tdir/tmp
4593 rmdir $DIR/$tdir/tmp
4596 mkdir $DIR/$tdir/dir_1
4597 for ((i = 0; i < 20; i++)); do
4598 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4605 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4606 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4607 #sleep (timeout + 5), so mds will evict the client exports,
4608 #but DNE update recovery will keep going.
4609 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4611 mount_facet mds1 "-o recovery_time_hard=$time_min"
4613 wait_clients_import_state "$clients" mds1 FULL
4615 clients_up || clients_up || error "failover df: $?"
4617 #revert back the hard timeout
4618 do_facet mds1 $LCTL set_param \
4619 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4621 for ((i = 0; i < 20; i++)); do
4622 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4623 [ $stripe_count == 2 ] || {
4624 error "stripe_dir-$i creation replay fails"
4629 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4632 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4633 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4634 skip "Do not support large update log before 2.7.64" &&
4638 replay_barrier_nosync mds1
4639 for ((i = 0; i < 20; i++)); do
4640 mkdir $DIR/$tdir/dir-$i || {
4641 error "create dir-$i fails"
4644 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4645 error "create stripe_dir-$i fails"
4652 for ((i = 0; i < 20; i++)); do
4653 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4654 error "dir-$i still exists"
4657 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4658 error "stripe_dir-$i still exists"
4663 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4666 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4667 skip "Don't support it before 2.11" &&
4670 local at_max_saved=$(at_max_get mds)
4672 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4673 cancel_lru_locks mdc
4675 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4678 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4684 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4685 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4689 wait_clients_import_state "$clients" mds1 FULL
4690 clients_up || clients_up || error "failover df: $?"
4693 wait $mpid || error "multiop_bg_pause pid failed"
4695 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4696 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4697 at_max_set $at_max_saved mds
4700 run_test 121 "lock replay timed out and race"
4703 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4704 skip "Do not support Data-on-MDT before 2.11"
4706 replay_barrier $SINGLEMDS
4707 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4710 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4711 error "Fail to replay DoM file creation"
4713 run_test 130a "DoM file create (setstripe) replay"
4716 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4717 skip "Do not support Data-on-MDT before 2.11"
4720 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4721 replay_barrier $SINGLEMDS
4722 touch $DIR/$tdir/$tfile
4725 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4726 error "Fail to replay DoM file creation"
4728 run_test 130b "DoM file create (inherited) replay"
4731 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4732 skip "Do not support Data-on-MDT before 2.11"
4734 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4735 replay_barrier $SINGLEMDS
4736 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4737 # lock is not canceled and will be replayed
4740 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4741 error "Wrong file content after failover"
4743 run_test 131a "DoM file write lock replay"
4746 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4747 skip "Do not support Data-on-MDT before 2.11"
4749 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4750 replay_barrier $SINGLEMDS
4751 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4752 cancel_lru_locks mdc
4756 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4757 error "Wrong file content after failover"
4759 run_test 131b "DoM file write replay"
4762 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.90) ] &&
4763 skip "Do not support PFL files before 2.10"
4765 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4766 replay_barrier $SINGLEMDS
4767 # write over the first component size cause next component instantiation
4768 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4769 error "dd to $DIR/$tfile failed"
4770 lfs getstripe $DIR/$tfile
4772 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4773 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4774 error "Component #1 was not instantiated"
4778 lfs getstripe $DIR/$tfile
4779 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4780 error "Component #1 instantiation was not replayed"
4781 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4782 if [ $cksum != $cksum2 ] ; then
4783 error_noexit "New cksum $cksum2 does not match original $cksum"
4786 run_test 132a "PFL new component instantiate replay"
4789 check_and_cleanup_lustre