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
36 # bug number for skipped tests: LU-9795 (all below)
37 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0b 0c 0d 34 45"
38 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 47 58b 58c 71a 85a"
39 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 85b 86 88 89 90"
40 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 93a 100a 100b 120"
45 check_and_setup_lustre
50 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
52 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
53 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
55 do_facet $SINGLEMDS sync
58 test_0a() { # was test_0
59 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
60 replay_barrier $SINGLEMDS
64 run_test 0a "empty replay"
67 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
69 # this test attempts to trigger a race in the precreation code,
70 # and must run before any other objects are created on the filesystem
72 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
73 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
75 run_test 0b "ensure object created after recover exists. (3284)"
78 replay_barrier $SINGLEMDS
81 facet_failover $SINGLEMDS
82 zconf_mount $(hostname) $MOUNT || error "mount fails"
83 client_up || error "post-failover df failed"
84 # file shouldn't exist if replay-barrier works as expected
85 rm $DIR/$tfile && error "File exists and it shouldn't"
88 run_test 0c "check replay-barrier"
91 replay_barrier $SINGLEMDS
93 facet_failover $SINGLEMDS
94 zconf_mount $(hostname) $MOUNT || error "mount fails"
95 client_up || error "post-failover df failed"
97 run_test 0d "expired recovery with no clients"
100 replay_barrier $SINGLEMDS
103 $CHECKSTAT -t file $DIR/$tfile ||
104 error "$CHECKSTAT $DIR/$tfile attribute check failed"
107 run_test 1 "simple create"
110 replay_barrier $SINGLEMDS
113 $CHECKSTAT -t file $DIR/$tfile ||
114 error "$CHECKSTAT $DIR/$tfile attribute check failed"
120 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
121 replay_barrier $SINGLEMDS
124 $CHECKSTAT -t file $DIR/$tfile ||
125 error "$CHECKSTAT $DIR/$tfile attribute check failed"
131 replay_barrier $SINGLEMDS
132 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
134 $CHECKSTAT -t file $DIR/$tfile ||
135 error "$CHECKSTAT $DIR/$tfile check failed"
137 run_test 2c "setstripe replay"
140 [[ $mds1_FSTYPE = "zfs" ]] &&
141 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
142 skip "requires LU-10143 fix on MDS"
143 replay_barrier $SINGLEMDS
144 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
146 $CHECKSTAT -t dir $DIR/$tdir ||
147 error "$CHECKSTAT $DIR/$tdir check failed"
149 run_test 2d "setdirstripe replay"
152 local file=$DIR/$tfile
153 replay_barrier $SINGLEMDS
155 openfile -f O_DIRECTORY $file
157 $CHECKSTAT -t file $file ||
158 error "$CHECKSTAT $file attribute check failed"
161 run_test 3a "replay failed open(O_DIRECTORY)"
164 replay_barrier $SINGLEMDS
165 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
166 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
168 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
170 $CHECKSTAT -t file $DIR/$tfile &&
171 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
174 run_test 3b "replay failed open -ENOMEM"
177 replay_barrier $SINGLEMDS
178 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
179 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
181 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
184 $CHECKSTAT -t file $DIR/$tfile &&
185 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
188 run_test 3c "replay failed open -ENOMEM"
190 test_4a() { # was test_4
191 replay_barrier $SINGLEMDS
192 for i in $(seq 10); do
193 echo "tag-$i" > $DIR/$tfile-$i
196 for i in $(seq 10); do
197 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
200 run_test 4a "|x| 10 open(O_CREAT)s"
203 for i in $(seq 10); do
204 echo "tag-$i" > $DIR/$tfile-$i
206 replay_barrier $SINGLEMDS
209 $CHECKSTAT -t file $DIR/$tfile-* &&
210 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
213 run_test 4b "|x| rm 10 files"
215 # The idea is to get past the first block of precreated files on both
216 # osts, and then replay.
218 replay_barrier $SINGLEMDS
219 for i in $(seq 220); do
220 echo "tag-$i" > $DIR/$tfile-$i
223 for i in $(seq 220); do
224 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
228 # waiting for commitment of removal
230 run_test 5 "|x| 220 open(O_CREAT)"
232 test_6a() { # was test_6
233 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
234 replay_barrier $SINGLEMDS
235 mcreate $DIR/$tdir/$tfile
237 $CHECKSTAT -t dir $DIR/$tdir ||
238 error "$CHECKSTAT $DIR/$tdir attribute check failed"
239 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
240 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
242 # waiting for log process thread
244 run_test 6a "mkdir + contained create"
247 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
248 replay_barrier $SINGLEMDS
251 $CHECKSTAT -t dir $DIR/$tdir &&
252 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
255 run_test 6b "|X| rmdir"
258 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
259 replay_barrier $SINGLEMDS
260 mcreate $DIR/$tdir/$tfile
262 $CHECKSTAT -t dir $DIR/$tdir ||
263 error "$CHECKSTAT $DIR/$tdir attribute check failed"
264 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
265 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
268 run_test 7 "mkdir |X| contained create"
271 replay_barrier $SINGLEMDS
272 multiop_bg_pause $DIR/$tfile mo_c ||
273 error "multiop mknod $DIR/$tfile failed"
277 $CHECKSTAT -t file $DIR/$tfile ||
278 error "$CHECKSTAT $DIR/$tfile attribute check failed"
279 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
280 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
283 run_test 8 "creat open |X| close"
286 replay_barrier $SINGLEMDS
288 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
290 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
292 echo " old_inum == $old_inum, new_inum == $new_inum"
293 if [ $old_inum -eq $new_inum ] ;
295 echo "old_inum and new_inum match"
297 echo " old_inum and new_inum do not match"
298 error "old index($old_inum) does not match new index($new_inum)"
302 run_test 9 "|X| create (same inum/gen)"
305 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
306 replay_barrier $SINGLEMDS
307 mv $DIR/$tfile $DIR/$tfile-2
310 $CHECKSTAT $DIR/$tfile &&
311 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
312 $CHECKSTAT $DIR/$tfile-2 ||
313 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
317 run_test 10 "create |X| rename unlink"
320 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
321 echo "old" > $DIR/$tfile
322 mv $DIR/$tfile $DIR/$tfile-2
323 replay_barrier $SINGLEMDS
324 echo "new" > $DIR/$tfile
326 grep old $DIR/$tfile-2
328 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
329 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
331 run_test 11 "create open write rename |X| create-old-name read"
334 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
335 multiop_bg_pause $DIR/$tfile o_tSc ||
336 error "multiop_bg_pause $DIR/$tfile failed"
339 replay_barrier $SINGLEMDS
340 kill -USR1 $pid || error "multiop $pid not running"
341 wait $pid || error "multiop $pid failed"
344 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
347 run_test 12 "open, unlink |X| close"
349 # 1777 - replay open after committed chmod that would make
350 # a regular open a failure
352 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
353 multiop_bg_pause $DIR/$tfile O_wc ||
354 error "multiop_bg_pause $DIR/$tfile failed"
357 $CHECKSTAT -p 0 $DIR/$tfile ||
358 error "$CHECKSTAT $DIR/$tfile attribute check failed"
359 replay_barrier $SINGLEMDS
361 kill -USR1 $pid || error "multiop $pid not running"
362 wait $pid || error "multiop $pid failed"
364 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
365 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
366 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
369 run_test 13 "open chmod 0 |x| write close"
372 multiop_bg_pause $DIR/$tfile O_tSc ||
373 error "multiop_bg_pause $DIR/$tfile failed"
376 replay_barrier $SINGLEMDS
377 kill -USR1 $pid || error "multiop $pid not running"
378 wait $pid || error "multiop $pid failed"
381 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
384 run_test 14 "open(O_CREAT), unlink |X| close"
387 multiop_bg_pause $DIR/$tfile O_tSc ||
388 error "multiop_bg_pause $DIR/$tfile failed"
391 replay_barrier $SINGLEMDS
392 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
393 kill -USR1 $pid || error "multiop $pid not running"
394 wait $pid || error "multiop $pid failed"
397 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
398 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
401 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
404 replay_barrier $SINGLEMDS
407 mcreate $DIR/$tfile-2
409 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
410 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
411 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
413 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
416 replay_barrier $SINGLEMDS
417 multiop_bg_pause $DIR/$tfile O_c ||
418 error "multiop_bg_pause $DIR/$tfile failed"
421 kill -USR1 $pid || error "multiop $pid not running"
422 wait $pid || error "multiop $pid failed"
423 $CHECKSTAT -t file $DIR/$tfile ||
424 error "$CHECKSTAT $DIR/$tfile attribute check failed"
427 run_test 17 "|X| open(O_CREAT), |replay| close"
430 replay_barrier $SINGLEMDS
431 multiop_bg_pause $DIR/$tfile O_tSc ||
432 error "multiop_bg_pause $DIR/$tfile failed"
435 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
436 echo "pid: $pid will close"
437 kill -USR1 $pid || error "multiop $pid not running"
438 wait $pid || error "multiop $pid failed"
441 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
442 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
443 # this touch frequently fails
444 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
445 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
446 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
449 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
451 # bug 1855 (a simpler form of test_11 above)
453 replay_barrier $SINGLEMDS
455 echo "old" > $DIR/$tfile
456 mv $DIR/$tfile $DIR/$tfile-2
457 grep old $DIR/$tfile-2
459 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
461 run_test 19 "mcreate, open, write, rename "
463 test_20a() { # was test_20
464 replay_barrier $SINGLEMDS
465 multiop_bg_pause $DIR/$tfile O_tSc ||
466 error "multiop_bg_pause $DIR/$tfile failed"
471 kill -USR1 $pid || error "multiop $pid not running"
472 wait $pid || error "multiop $pid failed"
473 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
476 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
478 test_20b() { # bug 10480
479 local wait_timeout=$((TIMEOUT * 4))
480 local extra=$(fs_log_size)
484 $LFS setstripe -i 0 -c 1 $DIR
486 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
488 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
489 while [ ! -e $DIR/$tfile ] ; do
490 usleep 60 # give dd a chance to start
493 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
495 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
497 client_up || client_up || true # reconnect
499 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
501 fail $SINGLEMDS # start orphan recovery
502 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
503 wait_delete_completed $wait_timeout || error "delete did not finish"
507 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
508 log "before $beforeused, after $afterused"
510 (( $beforeused + $extra >= $afterused )) && break
511 n_attempts=$((n_attempts + 1))
512 [ $n_attempts -gt 3 ] &&
513 error "after $afterused > before $beforeused + $extra"
515 wait_zfs_commit $SINGLEMDS 5
520 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
522 test_20c() { # bug 10480
523 multiop_bg_pause $DIR/$tfile Ow_c ||
524 error "multiop_bg_pause $DIR/$tfile failed"
530 client_up || client_up || true # reconnect
532 kill -USR1 $pid || error "multiop $pid not running"
533 wait $pid || error "multiop $pid failed"
534 [ -s $DIR/$tfile ] || error "File was truncated"
538 run_test 20c "check that client eviction does not affect file content"
541 replay_barrier $SINGLEMDS
542 multiop_bg_pause $DIR/$tfile O_tSc ||
543 error "multiop_bg_pause $DIR/$tfile failed"
546 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
549 kill -USR1 $pid || error "multiop $pid not running"
550 wait $pid || error "multiop $pid failed"
551 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
552 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
555 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
558 multiop_bg_pause $DIR/$tfile O_tSc ||
559 error "multiop_bg_pause $DIR/$tfile failed"
562 replay_barrier $SINGLEMDS
566 kill -USR1 $pid || error "multiop $pid not running"
567 wait $pid || error "multiop $pid failed"
568 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
571 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
574 multiop_bg_pause $DIR/$tfile O_tSc ||
575 error "multiop_bg_pause $DIR/$tfile failed"
578 replay_barrier $SINGLEMDS
580 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
583 kill -USR1 $pid || error "multiop $pid not running"
584 wait $pid || error "multiop $pid failed"
585 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
586 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
589 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
592 multiop_bg_pause $DIR/$tfile O_tSc ||
593 error "multiop_bg_pause $DIR/$tfile failed"
596 replay_barrier $SINGLEMDS
599 kill -USR1 $pid || error "multiop $pid not running"
600 wait $pid || error "multiop $pid failed"
601 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
604 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
607 multiop_bg_pause $DIR/$tfile O_tSc ||
608 error "multiop_bg_pause $DIR/$tfile failed"
612 replay_barrier $SINGLEMDS
614 kill -USR1 $pid || error "multiop $pid not running"
615 wait $pid || error "multiop $pid failed"
616 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
619 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
622 replay_barrier $SINGLEMDS
623 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
624 error "multiop_bg_pause $DIR/$tfile-1 failed"
626 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
627 error "multiop_bg_pause $DIR/$tfile-2 failed"
631 kill -USR1 $pid2 || error "second multiop $pid2 not running"
632 wait $pid2 || error "second multiop $pid2 failed"
635 kill -USR1 $pid1 || error "multiop $pid1 not running"
636 wait $pid1 || error "multiop $pid1 failed"
637 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
638 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
641 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
644 replay_barrier $SINGLEMDS
645 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
646 error "multiop_bg_pause $DIR/$tfile-1 failed"
648 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
649 error "multiop_bg_pause $DIR/$tfile-2 failed"
655 kill -USR1 $pid1 || error "multiop $pid1 not running"
656 wait $pid1 || error "multiop $pid1 failed"
657 kill -USR1 $pid2 || error "second multiop $pid2 not running"
658 wait $pid2 || error "second multiop $pid2 failed"
659 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
660 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
663 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
666 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
667 error "multiop_bg_pause $DIR/$tfile-1 failed"
669 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
670 error "multiop_bg_pause $DIR/$tfile-2 failed"
672 replay_barrier $SINGLEMDS
675 kill -USR1 $pid2 || error "second multiop $pid2 not running"
676 wait $pid2 || error "second multiop $pid2 failed"
679 kill -USR1 $pid1 || error "multiop $pid1 not running"
680 wait $pid1 || error "multiop $pid1 failed"
681 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
682 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
685 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
688 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
689 error "multiop_bg_pause $DIR/$tfile-1 failed"
691 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
692 error "multiop_bg_pause $DIR/$tfile-2 failed"
694 replay_barrier $SINGLEMDS
699 kill -USR1 $pid1 || error "multiop $pid1 not running"
700 wait $pid1 || error "multiop $pid1 failed"
701 kill -USR1 $pid2 || error "second multiop $pid2 not running"
702 wait $pid2 || error "second multiop $pid2 failed"
703 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
704 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
707 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
710 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
711 error "multiop_bg_pause $DIR/$tfile-1 failed"
713 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
714 error "multiop_bg_pause $DIR/$tfile-2 failed"
719 replay_barrier $SINGLEMDS
721 kill -USR1 $pid1 || error "multiop $pid1 not running"
722 wait $pid1 || error "multiop $pid1 failed"
723 kill -USR1 $pid2 || error "second multiop $pid2 not running"
724 wait $pid2 || error "second multiop $pid2 failed"
725 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
726 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
729 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
732 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
733 error "multiop_bg_pause $DIR/$tfile-1 failed"
735 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
736 error "multiop_bg_pause $DIR/$tfile-2 failed"
740 replay_barrier $SINGLEMDS
743 kill -USR1 $pid1 || error "multiop $pid1 not running"
744 wait $pid1 || error "multiop $pid1 failed"
745 kill -USR1 $pid2 || error "second multiop $pid2 not running"
746 wait $pid2 || error "second multiop $pid2 failed"
747 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
748 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
751 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
753 # tests for bug 2104; completion without crashing is success. The close is
754 # stale, but we always return 0 for close, so the app never sees it.
756 multiop_bg_pause $DIR/$tfile O_c ||
757 error "multiop_bg_pause $DIR/$tfile failed"
759 multiop_bg_pause $DIR/$tfile O_c ||
760 error "second multiop_bg_pause $DIR/$tfile failed"
763 client_up || client_up || error "client_up failed"
764 kill -USR1 $pid1 || error "multiop $pid1 not running"
765 kill -USR1 $pid2 || error "second multiop $pid2 not running"
766 wait $pid1 || error "multiop $pid1 failed"
767 wait $pid2 || error "second multiop $pid2 failed"
770 run_test 32 "close() notices client eviction; close() after client eviction"
773 createmany -o $DIR/$tfile-%d 10 ||
774 error "createmany create $DIR/$tfile failed"
775 replay_barrier_nosync $SINGLEMDS
776 fail_abort $SINGLEMDS
777 # recreate shouldn't fail
778 createmany -o $DIR/$tfile--%d 10 ||
779 error "createmany recreate $DIR/$tfile failed"
783 run_test 33a "fid seq shouldn't be reused after abort recovery"
786 #define OBD_FAIL_SEQ_ALLOC 0x1311
787 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
789 createmany -o $DIR/$tfile-%d 10
790 replay_barrier_nosync $SINGLEMDS
791 fail_abort $SINGLEMDS
792 # recreate shouldn't fail
793 createmany -o $DIR/$tfile--%d 10 ||
794 error "createmany recreate $DIR/$tfile failed"
798 run_test 33b "test fid seq allocation"
801 multiop_bg_pause $DIR/$tfile O_c ||
802 error "multiop_bg_pause $DIR/$tfile failed"
806 replay_barrier $SINGLEMDS
807 fail_abort $SINGLEMDS
808 kill -USR1 $pid || error "multiop $pid not running"
809 wait $pid || error "multiop $pid failed"
810 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
814 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
816 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
818 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
820 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
821 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
826 # give a chance to remove from MDS
827 fail_abort $SINGLEMDS
828 $CHECKSTAT -t file $DIR/$tfile &&
829 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
832 run_test 35 "test recovery from llog for unlink op"
834 # b=2432 resent cancel after replay uses wrong cookie,
835 # so don't resend cancels
837 replay_barrier $SINGLEMDS
839 checkstat $DIR/$tfile
840 facet_failover $SINGLEMDS
842 if dmesg | grep "unknown lock cookie"; then
843 error "cancel after replay failed"
846 run_test 36 "don't resend cancel"
849 # directory orphans can't be unlinked from PENDING directory
851 rmdir $DIR/$tfile 2>/dev/null
852 multiop_bg_pause $DIR/$tfile dD_c ||
853 error "multiop_bg_pause $DIR/$tfile failed"
857 replay_barrier $SINGLEMDS
858 # clear the dmesg buffer so we only see errors from this recovery
859 do_facet $SINGLEMDS dmesg -c >/dev/null
860 fail_abort $SINGLEMDS
861 kill -USR1 $pid || error "multiop $pid not running"
862 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
863 error "error unlinking files"
864 wait $pid || error "multiop $pid failed"
868 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
871 createmany -o $DIR/$tfile-%d 800 ||
872 error "createmany -o $DIR/$tfile failed"
873 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
874 replay_barrier $SINGLEMDS
876 unlinkmany $DIR/$tfile-%d 400 400 ||
877 error "unlinkmany $DIR/$tfile 400 failed"
879 $CHECKSTAT -t file $DIR/$tfile-* &&
880 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
883 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
885 test_39() { # bug 4176
886 createmany -o $DIR/$tfile-%d 800 ||
887 error "createmany -o $DIR/$tfile failed"
888 replay_barrier $SINGLEMDS
889 unlinkmany $DIR/$tfile-%d 0 400
891 unlinkmany $DIR/$tfile-%d 400 400 ||
892 error "unlinkmany $DIR/$tfile 400 failed"
894 $CHECKSTAT -t file $DIR/$tfile-* &&
895 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
898 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
901 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
906 # always need connection to MDS to verify layout during IO. LU-2628.
907 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
908 skip "layout_lock needs MDS connection for IO" && return 0
910 $LCTL mark multiop $MOUNT/$tfile OS_c
911 multiop $MOUNT/$tfile OS_c &
913 writeme -s $MOUNT/${tfile}-2 &
916 facet_failover $SINGLEMDS
917 #define OBD_FAIL_MDS_CONNECT_NET 0x117
918 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
920 stat1=$(count_ost_writes)
922 stat2=$(count_ost_writes)
923 echo "$stat1, $stat2"
924 if [ $stat1 -lt $stat2 ]; then
925 echo "writes continuing during recovery"
928 echo "writes not continuing during recovery, bug 2477"
931 echo "waiting for writeme $WRITE_PID"
935 echo "waiting for multiop $PID"
936 wait $PID || error "multiop $PID failed"
937 do_facet client munlink $MOUNT/$tfile ||
938 error "munlink $MOUNT/$tfile failed"
939 do_facet client munlink $MOUNT/${tfile}-2 ||
940 error "munlink $MOUNT/$tfile-2 failed"
943 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
946 # make sure that a read to one osc doesn't try to double-unlock its page just
947 # because another osc is invalid. trigger_group_io used to mistakenly return
948 # an error if any oscs were invalid even after having successfully put rpcs
949 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
950 # the page, guarnateeing that the unlock from the RPC completion would
951 # assert on trying to unlock the unlocked page.
953 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
955 local f=$MOUNT/$tfile
956 # make sure the start of the file is ost1
957 $SETSTRIPE -S $((128 * 1024)) -i 0 $f
958 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
959 error "dd on client failed"
961 # fail ost2 and read from ost1
962 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
963 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
964 grep $mdtosc | awk '{print $1}')
965 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
966 lctl get_param -n devices &&
967 error "OST 2 $osc2dev does not exist"
968 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
969 error "deactive device on $SINGLEMDS failed"
970 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
971 error "second dd on client failed"
972 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
973 error "active device on $SINGLEMDS failed"
976 run_test 41 "read from a valid osc while other oscs are invalid"
978 # test MDS recovery after ost failure
980 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
981 createmany -o $DIR/$tfile-%d 800 ||
982 error "createmany -o $DIR/$tfile failed"
984 unlinkmany $DIR/$tfile-%d 0 400
986 lctl set_param debug=-1
989 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
990 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
991 #[ $blocks_after -lt $blocks ] || return 1
992 echo "wait for MDS to timeout and recover"
993 sleep $((TIMEOUT * 2))
995 unlinkmany $DIR/$tfile-%d 400 400 ||
996 error "unlinkmany $DIR/$tfile 400 failed"
997 $CHECKSTAT -t file $DIR/$tfile-* &&
998 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
1001 run_test 42 "recovery after ost failure"
1003 # timeout in MDS/OST recovery RPC will LBUG MDS
1004 test_43() { # bug 2530
1005 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1007 replay_barrier $SINGLEMDS
1009 # OBD_FAIL_OST_CREATE_NET 0x204
1010 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1016 run_test 43 "mds osc import failure during recovery; don't LBUG"
1018 test_44a() { # was test_44
1019 local at_max_saved=0
1021 local mdcdev=$($LCTL dl |
1022 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1023 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
1024 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1025 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1027 # adaptive timeouts slow this way down
1028 if at_is_enabled; then
1029 at_max_saved=$(at_max_get mds)
1033 for i in $(seq 1 10); do
1034 echo "$i of 10 ($(date +%s))"
1035 do_facet $SINGLEMDS \
1036 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1037 #define OBD_FAIL_TGT_CONN_RACE 0x701
1038 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1039 # lctl below may fail, it is valid case
1040 $LCTL --device $mdcdev recover
1043 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1044 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1047 run_test 44a "race in target handle connect"
1050 local mdcdev=$($LCTL dl |
1051 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1052 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1053 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1054 { echo mdcdev=$mdcdev; $LCTL dl;
1055 error "more than one ${FSNAME}-MDT0000-mdc"; }
1057 for i in $(seq 1 10); do
1058 echo "$i of 10 ($(date +%s))"
1059 do_facet $SINGLEMDS \
1060 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1061 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1062 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1063 # lctl below may fail, it is valid case
1064 $LCTL --device $mdcdev recover
1069 run_test 44b "race in target handle connect"
1072 replay_barrier $SINGLEMDS
1073 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1074 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1075 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1076 fail_abort $SINGLEMDS
1077 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1079 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1082 run_test 44c "race in target handle connect"
1084 # Handle failed close
1086 local mdcdev=$($LCTL get_param -n devices |
1087 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1088 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1089 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1090 { echo mdcdev=$mdcdev; $LCTL dl;
1091 error "more than one ${FSNAME}-MDT0000-mdc"; }
1093 $LCTL --device $mdcdev recover ||
1094 error "$LCTL --device $mdcdev recover failed"
1096 multiop_bg_pause $DIR/$tfile O_c ||
1097 error "multiop_bg_pause $DIR/$tfile failed"
1100 # This will cause the CLOSE to fail before even
1101 # allocating a reply buffer
1102 $LCTL --device $mdcdev deactivate ||
1103 error "$LCTL --device $mdcdev deactivate failed"
1106 kill -USR1 $pid || error "multiop $pid not running"
1107 wait $pid || error "multiop $pid failed"
1109 $LCTL --device $mdcdev activate ||
1110 error "$LCTL --device $mdcdev activate failed"
1113 $CHECKSTAT -t file $DIR/$tfile ||
1114 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1117 run_test 45 "Handle failed close"
1121 drop_reply "touch $DIR/$tfile"
1123 # ironically, the previous test, 45, will cause a real forced close,
1124 # so just look for one for this test
1125 dmesg | grep -i "force closing client file handle for $tfile" &&
1126 error "found force closing in dmesg"
1129 run_test 46 "Don't leak file handle after open resend (3325)"
1131 test_47() { # bug 2824
1132 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1134 # create some files to make sure precreate has been done on all
1135 # OSTs. (just in case this test is run independently)
1136 createmany -o $DIR/$tfile 20 ||
1137 error "createmany create $DIR/$tfile failed"
1139 # OBD_FAIL_OST_CREATE_NET 0x204
1141 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1142 client_up || error "client_up failed"
1144 # let the MDS discover the OST failure, attempt to recover, fail
1145 # and recover again.
1146 sleep $((3 * TIMEOUT))
1148 # Without 2824, this createmany would hang
1149 createmany -o $DIR/$tfile 20 ||
1150 error "createmany recraete $DIR/$tfile failed"
1151 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1155 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1158 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1159 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1161 replay_barrier $SINGLEMDS
1162 createmany -o $DIR/$tfile 20 ||
1163 error "createmany -o $DIR/$tfile failed"
1164 # OBD_FAIL_OST_EROFS 0x216
1165 facet_failover $SINGLEMDS
1166 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1167 client_up || error "client_up failed"
1169 # let the MDS discover the OST failure, attempt to recover, fail
1170 # and recover again.
1171 sleep $((3 * TIMEOUT))
1173 createmany -o $DIR/$tfile 20 20 ||
1174 error "createmany recraete $DIR/$tfile failed"
1175 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1178 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1181 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1182 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1183 grep $mdtosc | awk '{print $1}')
1184 [ "$oscdev" ] || error "could not find OSC device on MDS"
1185 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1186 error "OSC device $oscdev recovery failed"
1187 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1188 error "second OSC device $oscdev recovery failed"
1189 # give the mds_lov_sync threads a chance to run
1192 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1194 # b3764 timed out lock replay
1196 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.90) ] &&
1197 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly" &&
1200 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1201 cancel_lru_locks mdc
1203 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1206 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1207 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1208 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1210 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1212 wait $mpid || error "multiop_bg_pause pid failed"
1214 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1215 lctl set_param fail_loc=0x0
1216 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1219 run_test 52 "time out lock replay (3764)"
1221 # bug 3462 - simultaneous MDC requests
1223 [[ $(lctl get_param mdc.*.import |
1224 grep "connect_flags:.*multi_mod_rpc") ]] ||
1225 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1227 cancel_lru_locks mdc # cleanup locks from former test cases
1228 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1229 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1230 multiop $DIR/${tdir}-1/f O_c &
1232 # give multiop a change to open
1235 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1236 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1237 kill -USR1 $close_pid
1238 cancel_lru_locks mdc # force the close
1239 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1241 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1243 # close should still be here
1244 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1246 replay_barrier_nodf $SINGLEMDS
1248 wait $close_pid || error "close_pid $close_pid failed"
1250 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1251 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1252 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1253 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1254 rm -rf $DIR/${tdir}-*
1256 run_test 53a "|X| close request while two MDC requests in flight"
1259 cancel_lru_locks mdc # cleanup locks from former test cases
1261 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1262 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1263 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1264 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1267 #define OBD_FAIL_MDS_REINT_NET 0x107
1268 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1269 mcreate $DIR/${tdir}-2/f &
1273 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1274 kill -USR1 $close_pid
1275 cancel_lru_locks mdc # force the close
1276 wait $close_pid || error "close_pid $close_pid failed"
1277 # open should still be here
1278 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1280 replay_barrier_nodf $SINGLEMDS
1282 wait $open_pid || error "open_pid failed"
1284 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1285 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1286 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1287 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1288 rm -rf $DIR/${tdir}-*
1290 run_test 53b "|X| open request while two MDC requests in flight"
1293 cancel_lru_locks mdc # cleanup locks from former test cases
1295 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1296 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1297 multiop $DIR/${tdir}-1/f O_c &
1300 #define OBD_FAIL_MDS_REINT_NET 0x107
1301 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1302 mcreate $DIR/${tdir}-2/f &
1306 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1307 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1308 kill -USR1 $close_pid
1309 cancel_lru_locks mdc # force the close
1311 #bz20647: make sure all pids exist before failover
1312 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1313 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1314 replay_barrier_nodf $SINGLEMDS
1315 fail_nodf $SINGLEMDS
1316 wait $open_pid || error "open_pid failed"
1318 # close should be gone
1319 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1320 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1322 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1323 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1324 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1325 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1326 rm -rf $DIR/${tdir}-*
1328 run_test 53c "|X| open request and close request while two MDC requests in flight"
1331 [[ $(lctl get_param mdc.*.import |
1332 grep "connect_flags:.*multi_mod_rpc") ]] ||
1333 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1335 cancel_lru_locks mdc # cleanup locks from former test cases
1337 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1338 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1339 multiop $DIR/${tdir}-1/f O_c &
1341 # give multiop a chance to open
1344 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1345 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1346 kill -USR1 $close_pid
1347 cancel_lru_locks mdc # force the close
1348 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1349 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1351 # close should still be here
1352 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1354 wait $close_pid || error "close_pid failed"
1356 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1357 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1358 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1359 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1360 rm -rf $DIR/${tdir}-*
1362 run_test 53d "close reply while two MDC requests in flight"
1365 cancel_lru_locks mdc # cleanup locks from former test cases
1367 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1368 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1369 multiop $DIR/${tdir}-1/f O_c &
1372 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1373 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1374 mcreate $DIR/${tdir}-2/f &
1378 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1379 kill -USR1 $close_pid
1380 cancel_lru_locks mdc # force the close
1381 wait $close_pid || error "close_pid failed"
1382 # open should still be here
1383 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1385 replay_barrier_nodf $SINGLEMDS
1387 wait $open_pid || error "open_pid failed"
1389 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1390 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1391 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1392 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1393 rm -rf $DIR/${tdir}-*
1395 run_test 53e "|X| open reply while two MDC requests in flight"
1398 cancel_lru_locks mdc # cleanup locks from former test cases
1400 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1401 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1402 multiop $DIR/${tdir}-1/f O_c &
1405 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1406 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1407 mcreate $DIR/${tdir}-2/f &
1411 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1412 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1413 kill -USR1 $close_pid
1414 cancel_lru_locks mdc # force the close
1416 #bz20647: make sure all pids are exists before failover
1417 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1418 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1419 replay_barrier_nodf $SINGLEMDS
1420 fail_nodf $SINGLEMDS
1421 wait $open_pid || error "open_pid failed"
1423 # close should be gone
1424 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1425 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1427 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1428 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1429 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1430 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1431 rm -rf $DIR/${tdir}-*
1433 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1436 cancel_lru_locks mdc # cleanup locks from former test cases
1438 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1439 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1440 multiop $DIR/${tdir}-1/f O_c &
1443 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1444 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1445 mcreate $DIR/${tdir}-2/f &
1449 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1450 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1451 kill -USR1 $close_pid
1452 cancel_lru_locks mdc # force the close
1453 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1455 #bz20647: make sure all pids are exists before failover
1456 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1457 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1458 replay_barrier_nodf $SINGLEMDS
1459 fail_nodf $SINGLEMDS
1460 wait $open_pid || error "open_pid failed"
1462 # close should be gone
1463 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1465 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1466 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1467 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1468 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1469 rm -rf $DIR/${tdir}-*
1471 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1474 cancel_lru_locks mdc # cleanup locks from former test cases
1476 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1477 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1478 multiop $DIR/${tdir}-1/f O_c &
1481 #define OBD_FAIL_MDS_REINT_NET 0x107
1482 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1483 mcreate $DIR/${tdir}-2/f &
1487 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1488 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1489 kill -USR1 $close_pid
1490 cancel_lru_locks mdc # force the close
1493 #bz20647: make sure all pids are exists before failover
1494 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1495 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1496 replay_barrier_nodf $SINGLEMDS
1497 fail_nodf $SINGLEMDS
1498 wait $open_pid || error "open_pid failed"
1500 # close should be gone
1501 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1502 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1504 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1505 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1506 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1507 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1508 rm -rf $DIR/${tdir}-*
1510 run_test 53h "open request and close reply while two MDC requests in flight"
1512 #b3761 ASSERTION(hash != 0) failed
1514 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1515 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1517 # give touch a chance to run
1519 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1523 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1525 #b3440 ASSERTION(rec->ur_fid2->id) failed
1527 ln -s foo $DIR/$tfile
1528 replay_barrier $SINGLEMDS
1529 #drop_reply "cat $DIR/$tfile"
1533 run_test 56 "don't replay a symlink open request (3440)"
1535 #recovery one mds-ost setattr from llog
1537 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1538 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1539 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1540 replay_barrier $SINGLEMDS
1542 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1543 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1544 $CHECKSTAT -t file $DIR/$tfile ||
1545 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1546 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1549 run_test 57 "test recovery from llog for setattr op"
1552 zconf_umount $(hostname) $MOUNT2
1556 #recovery many mds-ost setattr from llog
1558 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1559 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1560 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1561 createmany -o $DIR/$tdir/$tfile-%d 2500
1562 replay_barrier $SINGLEMDS
1565 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1566 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1567 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1568 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1569 error "unlinkmany $DIR/$tfile failed"
1572 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1578 trap cleanup_58 EXIT
1580 large_xattr_enabled &&
1581 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1582 # Original extended attribute can be long. Print a small version of
1583 # attribute if an error occurs
1584 local sm_msg=$(printf "%.9s" $orig)
1586 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1587 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1588 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1589 replay_barrier $SINGLEMDS
1590 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1592 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1593 [[ "$new" = "$orig" ]] ||
1594 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1595 rm -f $DIR/$tdir/$tfile
1598 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1600 run_test 58b "test replay of setxattr op"
1602 test_58c() { # bug 16570
1607 trap cleanup_58 EXIT
1609 if large_xattr_enabled; then
1610 local xattr_size=$(max_xattr_size)
1611 orig="$(generate_string $((xattr_size / 2)))"
1612 orig1="$(generate_string $xattr_size)"
1618 # PING_INTERVAL max(obd_timeout / 4, 1U)
1619 sleep $((TIMEOUT / 4))
1621 # Original extended attribute can be long. Print a small version of
1622 # attribute if an error occurs
1623 local sm_msg=$(printf "%.9s" $orig)
1624 local sm_msg1=$(printf "%.9s" $orig1)
1626 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1627 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1628 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1629 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1630 error "drop_request for setfattr failed"
1631 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1632 [[ "$new" = "$orig" ]] ||
1633 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1634 drop_reint_reply "setfattr -n trusted.foo1 \
1635 -v $orig1 $DIR/$tdir/$tfile" ||
1636 error "drop_reint_reply for setfattr failed"
1637 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1638 [[ "$new" = "$orig1" ]] ||
1639 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1640 rm -f $DIR/$tdir/$tfile
1644 run_test 58c "resend/reconstruct setxattr op"
1646 # log_commit_thread vs filter_destroy race used to lead to import use after free
1649 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1651 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1652 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1653 error "createmany create files failed"
1655 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1656 error "unlinkmany $DIR/$tdir/$tfile failed"
1657 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1658 do_facet ost1 "lctl set_param fail_loc=0x507"
1661 do_facet ost1 "lctl set_param fail_loc=0x0"
1665 run_test 59 "test log_commit_thread vs filter_destroy race"
1667 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1668 # bug 12086: should no oops and No ctxt error for this test
1670 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1671 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1672 error "createmany create files failed"
1673 replay_barrier $SINGLEMDS
1674 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1676 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1677 local no_ctxt=$(dmesg | grep "No ctxt")
1678 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1680 run_test 60 "test llog post recovery init vs llog unlink"
1682 #test race llog recovery thread vs llog cleanup
1683 test_61a() { # was test_61
1684 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1686 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1687 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1688 error "createmany create files failed"
1690 unlinkmany $DIR/$tdir/$tfile-%d 800
1691 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1692 set_nodes_failloc "$(osts_nodes)" 0x80000221
1697 set_nodes_failloc "$(osts_nodes)" 0x0
1699 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1700 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1703 run_test 61a "test race llog recovery vs llog cleanup"
1705 #test race mds llog sync vs llog cleanup
1707 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1708 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1709 facet_failover $SINGLEMDS
1712 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1715 run_test 61b "test race mds llog sync vs llog cleanup"
1717 #test race cancel cookie cb vs llog cleanup
1719 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1721 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1722 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1723 set_nodes_failloc "$(osts_nodes)" 0x80000222
1727 set_nodes_failloc "$(osts_nodes)" 0x0
1729 run_test 61c "test race mds llog sync vs llog cleanup"
1731 test_61d() { # bug 16002 # bug 17466 # bug 22137
1732 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1734 do_facet mgs "lctl set_param fail_loc=0x80000605"
1735 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1736 error "mgs start should have failed"
1737 do_facet mgs "lctl set_param fail_loc=0"
1738 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1740 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1742 test_62() { # Bug 15756 - don't mis-drop resent replay
1743 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1744 replay_barrier $SINGLEMDS
1745 createmany -o $DIR/$tdir/$tfile- 25 ||
1746 error "createmany create files failed"
1747 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1748 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1750 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1751 unlinkmany $DIR/$tdir/$tfile- 25 ||
1752 error "unlinkmany $DIR/$tdir/$tfile failed"
1755 run_test 62 "don't mis-drop resent replay"
1757 #Adaptive Timeouts (bug 3055)
1765 echo "Cleaning up AT ..."
1766 if [ -n "$ATOLDBASE" ]; then
1767 local at_history=$($LCTL get_param -n at_history)
1768 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1769 do_facet ost1 "lctl set_param at_history=$at_history" || true
1772 if [ $AT_MAX_SET -ne 0 ]; then
1773 for facet in mds client ost; do
1774 var=AT_MAX_SAVE_${facet}
1775 echo restore AT on $facet to saved value ${!var}
1776 at_max_set ${!var} $facet
1777 at_new=$(at_max_get $facet)
1778 echo Restored AT value on $facet $at_new
1779 [ $at_new -eq ${!var} ] ||
1780 error "AT value not restored SAVED ${!var} NEW $at_new"
1787 local at_max_new=600
1789 # Save at_max original values
1791 if [ $AT_MAX_SET -eq 0 ]; then
1792 # Suppose that all osts have the same at_max
1793 for facet in mds client ost; do
1794 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1798 for facet in mds client ost; do
1799 at_max=$(at_max_get $facet)
1800 if [ $at_max -ne $at_max_new ]; then
1801 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1802 at_max_set $at_max_new $facet
1807 if [ -z "$ATOLDBASE" ]; then
1808 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1809 # speed up the timebase so we can check decreasing AT
1810 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1811 do_facet ost1 "lctl set_param at_history=8" || true
1813 # sleep for a while to cool down, should be > 8s and also allow
1814 # at least one ping to be sent. simply use TIMEOUT to be safe.
1819 test_65a() #bug 3055
1821 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1823 at_start || return 0
1824 $LCTL dk > /dev/null
1826 $LCTL set_param debug="other"
1827 # Slow down a request to the current service time, this is critical
1828 # because previous tests may have caused this value to increase.
1829 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1830 awk '/portal 12/ {print $5}'`
1831 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1833 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1834 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1835 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1836 createmany -o $DIR/$tfile 10 > /dev/null
1837 unlinkmany $DIR/$tfile 10 > /dev/null
1838 # check for log message
1839 $LCTL dk | grep "Early reply #" || error "No early reply"
1841 # client should show REQ_DELAY estimates
1842 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1844 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1846 run_test 65a "AT: verify early replies"
1848 test_65b() #bug 3055
1850 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1852 at_start || return 0
1855 $LCTL set_param debug="other trace"
1856 $LCTL dk > /dev/null
1857 # Slow down a request to the current service time, this is critical
1858 # because previous tests may have caused this value to increase.
1859 $SETSTRIPE --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1860 error "$SETSTRIPE failed for $DIR/$tfile"
1862 multiop $DIR/$tfile Ow1yc
1863 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1864 awk '/portal 6/ {print $5}'`
1865 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1867 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1868 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1869 do_facet ost1 $LCTL set_param fail_loc=0x224
1872 $SETSTRIPE --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1873 error "$SETSTRIPE failed"
1874 # force some real bulk transfer
1875 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1877 do_facet ost1 $LCTL set_param fail_loc=0
1878 # check for log message
1879 $LCTL dk | grep "Early reply #" || error "No early reply"
1881 # client should show REQ_DELAY estimates
1882 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1884 run_test 65b "AT: verify early replies on packed reply / bulk"
1886 test_66a() #bug 3055
1888 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1890 at_start || return 0
1891 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1892 # adjust 5s at a time so no early reply is sent (within deadline)
1893 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1894 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1895 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1896 createmany -o $DIR/$tfile 20 > /dev/null
1897 unlinkmany $DIR/$tfile 20 > /dev/null
1898 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1899 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1900 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1901 createmany -o $DIR/$tfile 20 > /dev/null
1902 unlinkmany $DIR/$tfile 20 > /dev/null
1903 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1904 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1906 createmany -o $DIR/$tfile 20 > /dev/null
1907 unlinkmany $DIR/$tfile 20 > /dev/null
1908 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1909 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1910 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1911 echo "Current MDT timeout $CUR, worst $WORST"
1912 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1914 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1916 test_66b() #bug 3055
1918 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1920 at_start || return 0
1921 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1922 awk '/network/ {print $4}')
1923 $LCTL set_param fail_val=$(($ORIG + 5))
1924 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1925 $LCTL set_param fail_loc=0x50c
1926 touch $DIR/$tfile > /dev/null 2>&1
1927 $LCTL set_param fail_loc=0
1928 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1929 awk '/network/ {print $4}')
1930 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1931 awk '/network/ {print $6}')
1932 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1933 [ $WORST -gt $ORIG ] ||
1934 error "Worst $WORST should be worse than orig $ORIG"
1936 run_test 66b "AT: verify net latency adjusts"
1938 test_67a() #bug 3055
1940 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1942 at_start || return 0
1943 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1944 # sleeping threads may drive values above this
1945 do_facet ost1 "$LCTL set_param fail_val=400"
1946 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1947 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1948 createmany -o $DIR/$tfile 20 > /dev/null
1949 unlinkmany $DIR/$tfile 20 > /dev/null
1950 do_facet ost1 "$LCTL set_param fail_loc=0"
1951 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1952 ATTEMPTS=$(($CONN2 - $CONN1))
1953 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1954 [ $ATTEMPTS -gt 0 ] &&
1955 error_ignore bz13721 "AT should have prevented reconnect"
1958 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1960 test_67b() #bug 3055
1962 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1964 at_start || return 0
1965 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1967 # exhaust precreations on ost1
1968 local OST=$(ostname_from_index 0)
1969 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1970 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1971 osp.$mdtosc.prealloc_last_id)
1972 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1973 osp.$mdtosc.prealloc_next_id)
1975 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1976 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/${OST} || error "$SETSTRIPE failed"
1977 echo "Creating to objid $last_id on ost $OST..."
1978 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1979 do_facet ost1 "$LCTL set_param fail_val=20000"
1980 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1981 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1984 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1986 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1987 ATTEMPTS=$(($CONN2 - $CONN1))
1988 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1989 # do it again; should not timeout
1990 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1991 cp /etc/profile $DIR/$tfile || error "cp failed"
1992 do_facet ost1 "$LCTL set_param fail_loc=0"
1994 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1995 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1996 ATTEMPTS=$(($CONN3 - $CONN2))
1997 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1998 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
2001 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
2003 test_68 () #bug 13813
2005 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
2007 at_start || return 0
2008 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
2009 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
2010 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
2011 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
2012 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2013 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2014 echo $TIMEOUT >> $ldlm_enqueue_min
2015 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2017 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2018 $SETSTRIPE --stripe-index=0 -c 1 $DIR/$tdir ||
2019 error "$SETSTRIPE failed for $DIR/$tdir"
2020 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2021 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2022 $LCTL set_param fail_loc=0x80000312
2023 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2024 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2025 $LCTL set_param fail_loc=0x80000312
2026 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2027 $LCTL set_param fail_loc=0
2029 echo $ENQ_MIN >> $ldlm_enqueue_min
2030 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2034 run_test 68 "AT: verify slowing locks"
2037 # end of AT tests includes above lines
2039 # start multi-client tests
2041 [ -z "$CLIENTS" ] &&
2042 { skip "Need two or more clients." && return; }
2043 [ $CLIENTCOUNT -lt 2 ] &&
2044 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2046 echo "mount clients $CLIENTS ..."
2047 zconf_mount_clients $CLIENTS $MOUNT
2049 local clients=${CLIENTS//,/ }
2050 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2051 for CLIENT in $clients; do
2052 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2053 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2054 error "dd failed on $CLIENT"
2057 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2058 for C in ${CLIENTS//,/ }; do
2059 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2060 of=/dev/null 2>/dev/null ||
2061 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2067 run_test 70a "check multi client t-f"
2069 check_for_process () {
2074 killall_process $clients "$prog" -0
2078 local clients=${CLIENTS:-$HOSTNAME}
2080 zconf_mount_clients $clients $MOUNT
2083 [ "$SLOW" = "no" ] && duration=120
2084 # set duration to 900 because it takes some time to boot node
2085 [ "$FAILURE_MODE" = HARD ] && duration=900
2088 local start_ts=$(date +%s)
2089 local cmd="rundbench 1 -t $duration"
2091 if [ $MDSCOUNT -ge 2 ]; then
2092 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2093 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2095 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2096 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2097 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2098 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2101 #LU-1897 wait for all dbench copies to start
2102 while ! check_for_process $clients dbench; do
2103 elapsed=$(($(date +%s) - start_ts))
2104 if [ $elapsed -gt $duration ]; then
2105 killall_process $clients dbench
2106 error "dbench failed to start on $clients!"
2111 log "Started rundbench load pid=$pid ..."
2113 elapsed=$(($(date +%s) - start_ts))
2114 local num_failovers=0
2116 while [ $elapsed -lt $duration ]; do
2117 if ! check_for_process $clients dbench; then
2118 error_noexit "dbench stopped on some of $clients!"
2119 killall_process $clients dbench
2123 replay_barrier mds$fail_index
2124 sleep 1 # give clients a time to do operations
2125 # Increment the number of failovers
2126 num_failovers=$((num_failovers+1))
2127 log "$TESTNAME fail mds$fail_index $num_failovers times"
2129 elapsed=$(($(date +%s) - start_ts))
2130 if [ $fail_index -ge $MDSCOUNT ]; then
2133 fail_index=$((fail_index+1))
2137 wait $pid || error "rundbench load on $clients failed!"
2139 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2140 # end multi-client tests
2145 local monitor_pid=$3
2147 local start_ts=$(date +%s)
2148 local num_failovers=0
2151 elapsed=$(($(date +%s) - start_ts))
2152 while [ $elapsed -lt $duration ]; do
2153 fail_index=$((RANDOM%max_index+1))
2154 kill -0 $monitor_pid ||
2155 error "$monitor_pid stopped"
2157 replay_barrier mds$fail_index
2159 # Increment the number of failovers
2160 num_failovers=$((num_failovers+1))
2161 log "$TESTNAME fail mds$fail_index $num_failovers times"
2163 elapsed=$(($(date +%s) - start_ts))
2169 rm -f $DIR/replay-single.70c.lck
2174 local clients=${CLIENTS:-$HOSTNAME}
2177 zconf_mount_clients $clients $MOUNT
2180 [ "$SLOW" = "no" ] && duration=180
2181 # set duration to 900 because it takes some time to boot node
2182 [ "$FAILURE_MODE" = HARD ] && duration=600
2185 local start_ts=$(date +%s)
2187 trap cleanup_70c EXIT
2189 while [ ! -e $DIR/replay-single.70c.lck ]; do
2190 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2191 if [ $MDSCOUNT -ge 2 ]; then
2192 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2193 error "set default dirstripe failed"
2195 cd $DIR/$tdir || break
2196 tar cf - /etc | tar xf - || error "tar failed in loop"
2200 echo "Started tar $tar_70c_pid"
2202 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2203 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2205 touch $DIR/replay-single.70c.lck
2206 wait $tar_70c_pid || error "$?: tar failed"
2211 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2215 kill -9 $mkdir_70d_pid
2219 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2220 local clients=${CLIENTS:-$HOSTNAME}
2223 zconf_mount_clients $clients $MOUNT
2226 [ "$SLOW" = "no" ] && duration=180
2227 # set duration to 900 because it takes some time to boot node
2228 [ "$FAILURE_MODE" = HARD ] && duration=900
2233 local start_ts=$(date +%s)
2235 trap cleanup_70d EXIT
2238 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2242 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2247 touch $DIR/$tdir/test/a || {
2251 mkdir $DIR/$tdir/test/b || {
2255 rm -rf $DIR/$tdir/test || {
2261 touch $DIR/$tdir/test1/a || {
2265 mkdir $DIR/$tdir/test1/b || {
2270 rm -rf $DIR/$tdir/test1 || {
2272 ls -lR $DIR/$tdir/test1
2278 echo "Started $mkdir_70d_pid"
2280 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2281 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2286 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2289 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2290 local clients=${CLIENTS:-$HOSTNAME}
2293 lctl set_param debug=+ha
2294 zconf_mount_clients $clients $MOUNT
2297 [ "$SLOW" = "no" ] && duration=180
2298 # set duration to 900 because it takes some time to boot node
2299 [ "$FAILURE_MODE" = HARD ] && duration=900
2302 $LFS mkdir -i0 $DIR/$tdir/test_0
2303 $LFS mkdir -i0 $DIR/$tdir/test_1
2304 touch $DIR/$tdir/test_0/a
2305 touch $DIR/$tdir/test_1/b
2308 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2313 checkstat $DIR/$tdir/test_0/a && {
2314 echo "a still exists"
2318 checkstat $DIR/$tdir/test_1/b || {
2319 echo "b still exists"
2323 touch $DIR/$tdir/test_0/a || {
2324 echo "touch a fails"
2328 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2335 stack_trap "kill -9 $rename_70e_pid" EXIT
2336 echo "Started PID=$rename_70e_pid"
2338 random_fail_mdt 2 $duration $rename_70e_pid
2339 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2341 run_test 70e "rename cross-MDT with random fails"
2343 test_70f_write_and_read(){
2348 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2349 for client in ${CLIENTS//,/ }; do
2350 [ -f $stopflag ] || return
2352 local tgtfile=$DIR/$tdir/$tfile.$client
2353 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2354 of=$tgtfile 2>/dev/null ||
2355 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2356 "of=$tgtfile failed on $client, rc=$?"
2359 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2362 for client in ${CLIENTS//,/ }; do
2363 [ -f $stopflag ] || return
2365 # flush client cache in case test is running on only one client
2366 # do_node $client cancel_lru_locks osc
2367 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2369 tgtfile=$DIR/$tdir/$tfile.$client
2370 local md5=$(do_node $prev_client "md5sum $tgtfile")
2371 [ ${checksum[$index]// */} = ${md5// */} ] ||
2372 error "$tgtfile: checksum doesn't match on $prev_client"
2373 index=$((index + 1))
2383 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2384 $SETSTRIPE -c -1 $DIR/$tdir || error "cannot $SETSTRIPE $DIR/$tdir"
2387 while [ -f $stopflag ]; do
2388 test_70f_write_and_read $srcfile $stopflag
2389 # use direct IO and buffer cache in turns if loop
2390 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2394 test_70f_cleanup() {
2396 rm -f $TMP/$tfile.stop
2397 do_nodes $CLIENTS rm -f $TMP/$tfile
2398 rm -f $DIR/$tdir/$tfile.*
2402 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2403 # { skip "Failover host not defined" && return; }
2404 # [ -z "$CLIENTS" ] &&
2405 # { skip "CLIENTS are not specified." && return; }
2406 # [ $CLIENTCOUNT -lt 2 ] &&
2407 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2409 [[ $(lustre_version_code ost1) -lt $(version_code 2.9.53) ]] &&
2410 skip "Need server version at least 2.9.53" && return
2412 echo "mount clients $CLIENTS ..."
2413 zconf_mount_clients $CLIENTS $MOUNT
2415 local srcfile=$TMP/$tfile
2419 trap test_70f_cleanup EXIT
2420 # create a different source file local to each client node so we can
2421 # detect if the file wasn't written out properly after failover
2422 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2423 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2424 for client in ${CLIENTS//,/ }; do
2425 checksum[$index]=$(do_node $client "md5sum $srcfile")
2426 index=$((index + 1))
2430 [ "$SLOW" = "no" ] && duration=60
2431 # set duration to 900 because it takes some time to boot node
2432 [ "$FAILURE_MODE" = HARD ] && duration=900
2434 local stopflag=$TMP/$tfile.stop
2435 test_70f_loop $srcfile $stopflag &
2439 local num_failovers=0
2440 local start_ts=$SECONDS
2441 while [ $elapsed -lt $duration ]; do
2445 num_failovers=$((num_failovers + 1))
2446 log "$TESTNAME failing OST $num_failovers times"
2449 elapsed=$((SECONDS - start_ts))
2456 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2460 kill -9 $mkdir_71a_pid
2463 random_double_fail_mdt() {
2466 local monitor_pid=$3
2468 local start_ts=$(date +%s)
2469 local num_failovers=0
2473 elapsed=$(($(date +%s) - start_ts))
2474 while [ $elapsed -lt $duration ]; do
2475 fail_index=$((RANDOM%max_index + 1))
2476 if [ $fail_index -eq $max_index ]; then
2479 second_index=$((fail_index + 1))
2481 kill -0 $monitor_pid ||
2482 error "$monitor_pid stopped"
2484 replay_barrier mds$fail_index
2485 replay_barrier mds$second_index
2487 # Increment the number of failovers
2488 num_failovers=$((num_failovers+1))
2489 log "fail mds$fail_index mds$second_index $num_failovers times"
2490 fail mds${fail_index},mds${second_index}
2491 elapsed=$(($(date +%s) - start_ts))
2496 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2497 local clients=${CLIENTS:-$HOSTNAME}
2500 zconf_mount_clients $clients $MOUNT
2503 [ "$SLOW" = "no" ] && duration=180
2504 # set duration to 900 because it takes some time to boot node
2505 [ "$FAILURE_MODE" = HARD ] && duration=900
2510 local start_ts=$(date +%s)
2512 trap cleanup_71a EXIT
2515 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2516 rmdir $DIR/$tdir/test
2520 echo "Started $mkdir_71a_pid"
2522 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2523 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2528 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2531 multiop_bg_pause $DIR/$tfile O_tSc ||
2532 error "multiop_bg_pause $DIR/$tfile failed"
2536 replay_barrier $SINGLEMDS
2537 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2538 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2541 wait $pid || error "multiop pid failed"
2542 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2545 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2548 multiop_bg_pause $DIR/$tfile O_tSc ||
2549 error "multiop_bg_pause $DIR/$tfile failed"
2553 replay_barrier $SINGLEMDS
2554 #define OBD_FAIL_LDLM_REPLY 0x30c
2555 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
2558 wait $pid || error "multiop pid failed"
2559 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2562 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2566 local clients=${CLIENTS:-$HOSTNAME}
2568 zconf_umount_clients $clients $MOUNT
2570 facet_failover $SINGLEMDS
2571 zconf_mount_clients $clients $MOUNT
2573 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2574 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2575 clients_up || error "client evicted: $?"
2578 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2580 remote_dir_check_80() {
2585 diridx=$($LFS getstripe -m $remote_dir) ||
2586 error "$LFS getstripe -m $remote_dir failed"
2587 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2589 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2590 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2591 error "$LFS getstripe -m $remote_dir/f-1 failed"
2592 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2598 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2599 ([ $FAILURE_MODE == "HARD" ] &&
2600 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2601 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2605 local remote_dir=$DIR/$tdir/remote_dir
2607 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2608 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2609 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2610 $LFS mkdir -i $MDTIDX $remote_dir &
2616 wait $CLIENT_PID || error "remote creation failed"
2618 remote_dir_check_80 || error "remote dir check failed"
2619 rm -rf $DIR/$tdir || error "rmdir failed"
2623 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2626 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2627 ([ $FAILURE_MODE == "HARD" ] &&
2628 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2629 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2633 local remote_dir=$DIR/$tdir/remote_dir
2635 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2636 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2637 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2638 $LFS mkdir -i $MDTIDX $remote_dir &
2643 fail mds$((MDTIDX + 1))
2645 wait $CLIENT_PID || error "remote creation failed"
2647 remote_dir_check_80 || error "remote dir check failed"
2648 rm -rf $DIR/$tdir || error "rmdir failed"
2652 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2655 [[ $mds1_FSTYPE = "zfs" ]] &&
2656 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2657 skip "requires LU-10143 fix on MDS"
2658 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2659 ([ $FAILURE_MODE == "HARD" ] &&
2660 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2661 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2665 local remote_dir=$DIR/$tdir/remote_dir
2667 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2668 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2669 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2670 $LFS mkdir -i $MDTIDX $remote_dir &
2676 fail mds$((MDTIDX + 1))
2678 wait $CLIENT_PID || error "remote creation failed"
2680 remote_dir_check_80 || error "remote dir check failed"
2681 rm -rf $DIR/$tdir || error "rmdir failed"
2685 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2688 [[ $mds1_FSTYPE = "zfs" ]] &&
2689 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2690 skip "requires LU-10143 fix on MDS"
2691 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2693 local remote_dir=$DIR/$tdir/remote_dir
2695 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2696 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2697 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2698 $LFS mkdir -i $MDTIDX $remote_dir &
2701 # sleep 3 seconds to make sure MDTs are failed after
2702 # lfs mkdir -i has finished on all of MDTs.
2707 fail mds${MDTIDX},mds$((MDTIDX + 1))
2709 wait $CLIENT_PID || error "remote creation failed"
2711 remote_dir_check_80 || error "remote dir check failed"
2712 rm -rf $DIR/$tdir || error "rmdir failed"
2716 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2719 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2720 ([ $FAILURE_MODE == "HARD" ] &&
2721 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2722 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2726 local remote_dir=$DIR/$tdir/remote_dir
2728 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2729 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2730 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2731 $LFS mkdir -i $MDTIDX $remote_dir &
2734 # sleep 3 seconds to make sure MDTs are failed after
2735 # lfs mkdir -i has finished on all of MDTs.
2741 wait $CLIENT_PID || error "remote creation failed"
2743 remote_dir_check_80 || error "remote dir check failed"
2744 rm -rf $DIR/$tdir || error "rmdir failed"
2748 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2751 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2752 ([ $FAILURE_MODE == "HARD" ] &&
2753 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2754 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2757 local remote_dir=$DIR/$tdir/remote_dir
2759 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2760 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2761 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2762 $LFS mkdir -i $MDTIDX $remote_dir &
2766 fail mds$((MDTIDX + 1))
2768 wait $CLIENT_PID || error "remote creation failed"
2770 remote_dir_check_80 || error "remote dir check failed"
2771 rm -rf $DIR/$tdir || error "rmdir failed"
2775 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2778 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2779 ([ $FAILURE_MODE == "HARD" ] &&
2780 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2781 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2785 local remote_dir=$DIR/$tdir/remote_dir
2787 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2788 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2789 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2790 $LFS mkdir -i $MDTIDX $remote_dir &
2793 # sleep 3 seconds to make sure MDTs are failed after
2794 # lfs mkdir -i has finished on all of MDTs.
2800 fail mds$((MDTIDX + 1))
2802 wait $CLIENT_PID || error "remote creation failed"
2804 remote_dir_check_80 || error "remote dir check failed"
2805 rm -rf $DIR/$tdir || error "rmdir failed"
2809 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2812 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2814 local remote_dir=$DIR/$tdir/remote_dir
2816 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2817 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2818 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2819 $LFS mkdir -i $MDTIDX $remote_dir &
2822 # sleep 3 seconds to make sure MDTs are failed after
2823 # lfs mkdir -i has finished on all of MDTs.
2828 fail mds${MDTIDX},mds$((MDTIDX + 1))
2830 wait $CLIENT_PID || error "remote dir creation failed"
2832 remote_dir_check_80 || error "remote dir check failed"
2833 rm -rf $DIR/$tdir || error "rmdir failed"
2837 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2840 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2841 ([ $FAILURE_MODE == "HARD" ] &&
2842 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2843 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2847 local remote_dir=$DIR/$tdir/remote_dir
2849 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2850 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2852 touch $remote_dir || error "touch $remote_dir failed"
2853 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2854 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2859 fail mds$((MDTIDX + 1))
2861 wait $CLIENT_PID || error "rm remote dir failed"
2863 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2865 rm -rf $DIR/$tdir || error "rmdir failed"
2869 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2872 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2873 ([ $FAILURE_MODE == "HARD" ] &&
2874 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2875 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2878 local remote_dir=$DIR/$tdir/remote_dir
2880 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2881 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2883 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2884 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2891 wait $CLIENT_PID || error "rm remote dir failed"
2893 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2895 rm -rf $DIR/$tdir || error "rmdir failed"
2899 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2902 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2903 ([ $FAILURE_MODE == "HARD" ] &&
2904 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2905 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2909 local remote_dir=$DIR/$tdir/remote_dir
2911 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2912 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2914 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2915 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2922 fail mds$((MDTIDX + 1))
2924 wait $CLIENT_PID || error "rm remote dir failed"
2926 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2928 rm -rf $DIR/$tdir || error "rmdir failed"
2932 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2935 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2937 local remote_dir=$DIR/$tdir/remote_dir
2939 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2940 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2942 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2943 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2949 fail mds${MDTIDX},mds$((MDTIDX + 1))
2951 wait $CLIENT_PID || error "rm remote dir failed"
2953 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2955 rm -rf $DIR/$tdir || error "rmdir failed"
2959 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2962 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2963 ([ $FAILURE_MODE == "HARD" ] &&
2964 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2965 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2969 local remote_dir=$DIR/$tdir/remote_dir
2971 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2972 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2974 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2975 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2978 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2983 wait $CLIENT_PID || error "rm remote dir failed"
2985 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2987 rm -rf $DIR/$tdir || error "rmdir failed"
2991 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2994 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2995 ([ $FAILURE_MODE == "HARD" ] &&
2996 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2997 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3001 local remote_dir=$DIR/$tdir/remote_dir
3003 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3004 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3006 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3007 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3012 fail mds$((MDTIDX + 1))
3014 wait $CLIENT_PID || error "rm remote dir failed"
3016 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3018 rm -rf $DIR/$tdir || error "rmdir failed"
3022 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3025 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3026 ([ $FAILURE_MODE == "HARD" ] &&
3027 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3028 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3032 local remote_dir=$DIR/$tdir/remote_dir
3034 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3035 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3037 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3038 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3045 fail mds$((MDTIDX + 1))
3047 wait $CLIENT_PID || error "rm remote dir failed"
3049 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3051 rm -rf $DIR/$tdir || error "rmdir failed"
3055 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3058 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3060 local remote_dir=$DIR/$tdir/remote_dir
3062 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3063 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3065 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3066 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3072 fail mds${MDTIDX},mds$((MDTIDX + 1))
3074 wait $CLIENT_PID || error "rm remote dir failed"
3076 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3078 rm -rf $DIR/$tdir || error "rmdir failed"
3082 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3085 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3086 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3087 createmany -o $DIR/$tfile- 1 &
3091 client_up || client_up || true # reconnect
3093 run_test 84a "stale open during export disconnect"
3095 test_85a() { #bug 16774
3096 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3098 for i in $(seq 100); do
3099 echo "tag-$i" > $DIR/$tfile-$i
3100 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3103 lov_id=$(lctl dl | grep "clilov")
3104 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3105 count=$(lctl get_param -n \
3106 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3107 echo "before recovery: unused locks count = $count"
3111 count2=$(lctl get_param -n \
3112 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3113 echo "after recovery: unused locks count = $count2"
3115 if [ $count2 -ge $count ]; then
3116 error "unused locks are not canceled"
3119 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3121 test_85b() { #bug 16774
3125 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3127 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3129 for i in $(seq 100); do
3130 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3131 count=32 >/dev/null 2>&1
3134 cancel_lru_locks osc
3136 for i in $(seq 100); do
3137 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3138 count=32 >/dev/null 2>&1
3141 lov_id=$(lctl dl | grep "clilov")
3142 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3143 count=$(lctl get_param -n \
3144 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3145 echo "before recovery: unused locks count = $count"
3146 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3150 count2=$(lctl get_param \
3151 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3152 echo "after recovery: unused locks count = $count2"
3154 if [ $count2 -ge $count ]; then
3155 error "unused locks are not canceled"
3160 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3163 local clients=${CLIENTS:-$HOSTNAME}
3165 zconf_umount_clients $clients $MOUNT
3166 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3167 remount_facet $SINGLEMDS
3168 zconf_mount_clients $clients $MOUNT
3170 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3173 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3176 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
3177 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3178 error "dd to $DIR/$tfile failed"
3179 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3180 cancel_lru_locks osc
3182 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3183 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3184 if [ $cksum != $cksum2 ] ; then
3185 error "New checksum $cksum2 does not match original $cksum"
3188 run_test 87a "write replay"
3191 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3194 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
3195 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3196 error "dd to $DIR/$tfile failed"
3197 sleep 1 # Give it a chance to flush dirty data
3198 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3199 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3200 cancel_lru_locks osc
3202 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3203 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3204 if [ $cksum != $cksum2 ] ; then
3205 error "New checksum $cksum2 does not match original $cksum"
3208 run_test 87b "write replay with changed data (checksum resend)"
3210 test_88() { #bug 17485
3211 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3212 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3214 $SETSTRIPE -i 0 -c 1 $DIR/$tdir || error "$SETSTRIPE"
3217 replay_barrier $SINGLEMDS
3219 # exhaust precreations on ost1
3220 local OST=$(ostname_from_index 0)
3221 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3222 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3223 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3224 echo "before test: last_id = $last_id, next_id = $next_id"
3226 echo "Creating to objid $last_id on ost $OST..."
3227 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3228 error "createmany create files to last_id failed"
3230 #create some files to use some uncommitted objids
3231 last_id=$(($last_id + 1))
3232 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3233 error "createmany create files with uncommitted objids failed"
3235 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3236 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3237 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3239 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3240 # it has to take care about the affected facets, bug20407
3241 local affected_mds1=$(affected_facets mds1)
3242 local affected_ost1=$(affected_facets ost1)
3244 shutdown_facet $SINGLEMDS
3247 reboot_facet $SINGLEMDS
3248 change_active $affected_mds1
3249 wait_for_facet $affected_mds1
3250 mount_facets $affected_mds1 || error "Restart of mds failed"
3253 change_active $affected_ost1
3254 wait_for_facet $affected_ost1
3255 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3259 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3260 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3261 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3263 # create new files, which should use new objids, and ensure the orphan
3264 # cleanup phase for ost1 is completed at the same time
3265 for i in $(seq 8); do
3266 file_id=$(($last_id + 10 + $i))
3267 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3270 # if the objids were not recreated, then "ls" will fail with -ENOENT
3271 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3274 # write into previously created files
3275 for i in $(seq 8); do
3276 file_id=$(($last_id + $i))
3277 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3278 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3281 # compare the content
3282 for i in $(seq 8); do
3283 file_id=$(($last_id + $i))
3284 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3285 error "the content of file is modified!"
3290 run_test 88 "MDS should not assign same objid to different files "
3292 function calc_osc_kbytes_used() {
3293 local kbtotal=$(calc_osc_kbytes kbytestotal)
3294 local kbfree=$(calc_osc_kbytes kbytesfree)
3295 echo $((kbtotal-kbfree))
3299 cancel_lru_locks osc
3300 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3301 rm -f $DIR/$tdir/$tfile
3302 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3303 wait_delete_completed || error "initial wait delete timed out"
3304 local blocks1=$(calc_osc_kbytes_used)
3305 local write_size=$(fs_log_size)
3307 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
3308 [ $write_size -lt 1024 ] && write_size=1024
3309 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3312 facet_failover $SINGLEMDS
3313 rm $DIR/$tdir/$tfile
3316 zconf_mount $(hostname) $MOUNT || error "mount fails"
3317 client_up || error "client_up failed"
3319 # wait for the remounted client to connect to ost1
3320 local target=$(get_osc_import_name client ost1)
3321 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3322 $(max_recovery_time)
3324 wait_mds_ost_sync || error "MDS-OST sync timed out"
3325 wait_delete_completed || error "wait delete timed out"
3326 local blocks2=$(calc_osc_kbytes_used)
3328 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3329 error $((blocks2 - blocks1)) blocks leaked
3331 run_test 89 "no disk space leak on late ost connection"
3338 change_active $facet
3339 wait_for_facet $facet
3340 mount_facet $facet || error "Restart of $facet failed"
3344 test_90() { # bug 19494
3345 local dir=$DIR/$tdir
3346 local ostfail=$(get_random_entry $(get_facets OST))
3348 if [[ $FAILURE_MODE = HARD ]]; then
3349 local affected=$(affected_facets $ostfail);
3350 if [[ "$affected" != $ostfail ]]; then
3351 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
3355 # ensure all OSTs are active to allow allocations
3358 mkdir $dir || error "mkdir $dir failed"
3360 echo "Create the files"
3362 # file "f${index}" striped over 1 OST
3363 # file "all" striped over all OSTs
3365 $LFS setstripe -c $OSTCOUNT $dir/all ||
3366 error "setstripe failed to create $dir/all"
3368 for ((i = 0; i < $OSTCOUNT; i++)); do
3371 $LFS setstripe -i $i -c 1 $f ||
3372 error "$LFS setstripe failed to create $f"
3374 # confirm setstripe actually created stripe on requested OST
3375 local uuid=$(ostuuid_from_index $i)
3377 for file in f$i all; do
3378 local found=$($LFS find --obd $uuid --name $file $dir)
3380 if [[ $dir/$file != $found ]]; then
3381 $LFS getstripe $dir/$file
3382 error "wrong stripe: $file, uuid: $uuid"
3387 # Before failing an OST, get its obd name and index
3388 local varsvc=${ostfail}_svc
3389 local obd=$(do_facet $ostfail lctl get_param \
3390 -n obdfilter.${!varsvc}.uuid)
3391 local index=$(($(facet_number $ostfail) - 1))
3393 echo "Fail $ostfail $obd, display the list of affected files"
3394 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3396 trap "cleanup_90 $ostfail" EXIT INT
3397 echo "General Query: lfs find $dir"
3398 local list=$($LFS find $dir)
3400 for (( i=0; i<$OSTCOUNT; i++ )); do
3401 list_member "$list" $dir/f$i ||
3402 error_noexit "lfs find $dir: no file f$i"
3404 list_member "$list" $dir/all ||
3405 error_noexit "lfs find $dir: no file all"
3407 # focus on the missing OST,
3408 # we expect to see only two files affected: "f$(index)" and "all"
3410 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3411 list=$($LFS find --obd $obd $dir)
3413 for file in all f$index; do
3414 list_member "$list" $dir/$file ||
3415 error_noexit "lfs find does not report the affected $obd for $file"
3418 [[ $(echo $list | wc -w) -eq 2 ]] ||
3419 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3421 echo "Check getstripe: $GETSTRIPE -r --obd $obd"
3422 list=$($GETSTRIPE -r --obd $obd $dir)
3424 for file in all f$index; do
3425 echo "$list" | grep $dir/$file ||
3426 error_noexit "lfs getsripe does not report the affected $obd for $file"
3431 run_test 90 "lfs find identifies the missing striped file segments"
3434 local server_version=$(lustre_version_code $SINGLEMDS)
3435 [[ $server_version -ge $(version_code 2.6.90) ]] ||
3436 [[ $server_version -ge $(version_code 2.5.4) &&
3437 $server_version -lt $(version_code 2.5.50) ]] ||
3438 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
3440 cancel_lru_locks osc
3442 $SETSTRIPE -i 0 -c 1 $DIR/$tfile ||
3443 error "$SETSTRIPE $DIR/$tfile failed"
3444 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3445 error "dd to $DIR/$tfile failed"
3446 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3447 # We need to emulate a state that OST is waiting for other clients
3448 # not completing the recovery. Final ping is queued, but reply will be
3449 # sent on the recovery completion. It is done by sleep before
3450 # processing final pings
3451 do_facet ost1 "$LCTL set_param fail_val=40"
3452 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3455 run_test 93a "replay + reconnect"
3458 local server_version=$(lustre_version_code $SINGLEMDS)
3459 [[ $server_version -ge $(version_code 2.7.90) ]] ||
3460 { skip "Need MDS version 2.7.90+"; return; }
3462 cancel_lru_locks mdc
3464 createmany -o $DIR/$tfile 20 ||
3465 error "createmany -o $DIR/$tfile failed"
3467 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3468 # We need to emulate a state that MDT is waiting for other clients
3469 # not completing the recovery. Final ping is queued, but reply will be
3470 # sent on the recovery completion. It is done by sleep before
3471 # processing final pings
3472 do_facet mds1 "$LCTL set_param fail_val=80"
3473 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3476 run_test 93b "replay + reconnect on mds"
3478 striped_dir_check_100() {
3479 local striped_dir=$DIR/$tdir/striped_dir
3480 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3482 $LFS getdirstripe $striped_dir
3483 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3485 createmany -o $striped_dir/f-%d 20 ||
3486 error "creation failed under striped dir"
3490 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3491 ([ $FAILURE_MODE == "HARD" ] &&
3492 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3493 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3496 local striped_dir=$DIR/$tdir/striped_dir
3499 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3501 #To make sure MDT1 and MDT0 are connected
3502 #otherwise it may create single stripe dir here
3503 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3505 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3506 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3507 $LFS setdirstripe -i0 -c2 $striped_dir &
3510 fail mds$((MDTIDX + 1))
3512 wait $CLIENT_PID || error "striped dir creation failed"
3514 striped_dir_check_100 || error "striped dir check failed"
3515 rm -rf $DIR/$tdir || error "rmdir failed"
3517 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3520 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3521 ([ $FAILURE_MODE == "HARD" ] &&
3522 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3523 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3526 local striped_dir=$DIR/$tdir/striped_dir
3529 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3531 #To make sure MDT1 and MDT0 are connected
3532 #otherwise it may create single stripe dir here
3533 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3535 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3536 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3537 $LFS mkdir -i0 -c2 $striped_dir &
3542 wait $CLIENT_PID || error "striped dir creation failed"
3544 striped_dir_check_100 || error "striped dir check failed"
3545 rm -rf $DIR/$tdir || error "rmdir failed"
3547 run_test 100b "DNE: create striped dir, fail MDT0"
3549 test_101() { #LU-5648
3550 mkdir -p $DIR/$tdir/d1
3551 mkdir -p $DIR/$tdir/d2
3552 touch $DIR/$tdir/file0
3555 replay_barrier $SINGLEMDS
3556 for i in $(seq $num) ; do
3557 echo test$i > $DIR/$tdir/d1/file$i
3560 fail_abort $SINGLEMDS
3561 for i in $(seq $num) ; do
3562 touch $DIR/$tdir/d2/file$i
3563 test -s $DIR/$tdir/d2/file$i &&
3564 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3569 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3578 [[ $(lctl get_param mdc.*.import |
3579 grep "connect_flags:.*multi_mod_rpc") ]] ||
3580 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3582 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3583 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3584 facet="mds$((0x$idx + 1))"
3586 # get current value of max_mod_rcps_in_flight
3587 num=$($LCTL get_param -n \
3588 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3589 # set default value if client does not support multi mod RPCs
3590 [ -z "$num" ] && num=1
3592 echo "creating $num files ..."
3594 for i in $(seq $num); do
3595 touch $DIR/$tdir/file-$i
3598 # drop request on MDT to force resend
3599 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3600 do_facet $facet "$LCTL set_param fail_loc=0x159"
3601 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3602 for i in $(seq $num); do
3603 chmod 0600 $DIR/$tdir/file-$i &
3607 do_facet $facet "$LCTL set_param fail_loc=0"
3608 for pid in $pids; do
3609 wait $pid || error "chmod failed"
3611 echo "done ($(date +%H:%M:%S))"
3613 # check chmod succeed
3614 for i in $(seq $num); do
3615 checkstat -vp 0600 $DIR/$tdir/file-$i
3620 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3629 [[ $(lctl get_param mdc.*.import |
3630 grep "connect_flags:.*multi_mod_rpc") ]] ||
3631 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3633 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3634 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3635 facet="mds$((0x$idx + 1))"
3637 # get current value of max_mod_rcps_in_flight
3638 num=$($LCTL get_param -n \
3639 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3640 # set default value if client does not support multi mod RPCs
3641 [ -z "$num" ] && num=1
3643 echo "creating $num files ..."
3645 for i in $(seq $num); do
3646 touch $DIR/$tdir/file-$i
3649 # drop reply on MDT to force reconstruction
3650 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3651 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3652 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3653 for i in $(seq $num); do
3654 chmod 0600 $DIR/$tdir/file-$i &
3658 do_facet $facet "$LCTL set_param fail_loc=0"
3659 for pid in $pids; do
3660 wait $pid || error "chmod failed"
3662 echo "done ($(date +%H:%M:%S))"
3664 # check chmod succeed
3665 for i in $(seq $num); do
3666 checkstat -vp 0600 $DIR/$tdir/file-$i
3671 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3680 [[ $(lctl get_param mdc.*.import |
3681 grep "connect_flags:.*multi_mod_rpc") ]] ||
3682 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3684 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3685 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3686 facet="mds$((0x$idx + 1))"
3688 # get current value of max_mod_rcps_in_flight
3689 num=$($LCTL get_param -n \
3690 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3691 # set default value if client does not support multi mod RPCs
3692 [ -z "$num" ] && num=1
3694 echo "creating $num files ..."
3696 for i in $(seq $num); do
3697 touch $DIR/$tdir/file-$i
3700 replay_barrier $facet
3703 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3704 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3705 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3706 for i in $(seq $num); do
3707 chmod 0600 $DIR/$tdir/file-$i &
3711 do_facet $facet "$LCTL set_param fail_loc=0"
3716 for pid in $pids; do
3717 wait $pid || error "chmod failed"
3719 echo "done ($(date +%H:%M:%S))"
3721 # check chmod succeed
3722 for i in $(seq $num); do
3723 checkstat -vp 0600 $DIR/$tdir/file-$i
3728 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3737 [[ $(lctl get_param mdc.*.import |
3738 grep "connect_flags:.*multi_mod_rpc") ]] ||
3739 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3741 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3742 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3743 facet="mds$((0x$idx + 1))"
3745 # get current value of max_mod_rcps_in_flight
3746 num=$($LCTL get_param -n \
3747 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3748 # set default value if client does not support multi mod RPCs
3749 [ -z "$num" ] && num=1
3751 echo "creating $num files ..."
3753 for i in $(seq $num); do
3754 touch $DIR/$tdir/file-$i
3758 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3759 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3760 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3761 for i in $(seq $num); do
3762 chmod 0600 $DIR/$tdir/file-$i &
3767 # write MDT transactions to disk
3768 do_facet $facet "sync; sync; sync"
3770 do_facet $facet "$LCTL set_param fail_loc=0"
3775 for pid in $pids; do
3776 wait $pid || error "chmod failed"
3778 echo "done ($(date +%H:%M:%S))"
3780 # check chmod succeed
3781 for i in $(seq $num); do
3782 checkstat -vp 0600 $DIR/$tdir/file-$i
3787 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3790 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3791 local mds_version=$(lustre_version_code $SINGLEMDS)
3792 [[ $mds_version -gt $(version_code 2.8.54) ]] ||
3793 { skip "Need MDS version 2.8.54+"; return; }
3795 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3796 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3799 createmany -o $DIR/$tdir/t- 30 ||
3800 error "create files on remote directory failed"
3802 rm -rf $DIR/$tdir/t-*
3804 #MDS should crash with tr->otr_next_id overflow
3807 run_test 103 "Check otr_next_id overflow"
3810 check_striped_dir_110()
3812 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3813 error "create striped dir failed"
3814 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3815 [ $stripe_count -eq $MDSCOUNT ] ||
3816 error "$stripe_count != 2 after recovery"
3820 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3821 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3822 skip "Need MDS version at least 2.7.56"
3824 ([ $FAILURE_MODE == "HARD" ] &&
3825 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3826 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3831 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3834 check_striped_dir_110 || error "check striped_dir failed"
3835 rm -rf $DIR/$tdir || error "rmdir failed"
3839 run_test 110a "DNE: create striped dir, fail MDT1"
3842 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3843 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3844 skip "Need MDS version at least 2.7.56"
3846 ([ $FAILURE_MODE == "HARD" ] &&
3847 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3848 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3853 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3856 zconf_mount $(hostname) $MOUNT
3857 client_up || return 1
3859 check_striped_dir_110 || error "check striped_dir failed"
3861 rm -rf $DIR/$tdir || error "rmdir failed"
3865 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3868 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3869 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3870 skip "Need MDS version at least 2.7.56"
3872 ([ $FAILURE_MODE == "HARD" ] &&
3873 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3874 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3879 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3882 check_striped_dir_110 || error "check striped_dir failed"
3884 rm -rf $DIR/$tdir || error "rmdir failed"
3888 run_test 110c "DNE: create striped dir, fail MDT2"
3891 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3892 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3893 skip "Need MDS version at least 2.7.56"
3895 ([ $FAILURE_MODE == "HARD" ] &&
3896 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3897 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3902 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3905 zconf_mount $(hostname) $MOUNT
3906 client_up || return 1
3908 check_striped_dir_110 || error "check striped_dir failed"
3910 rm -rf $DIR/$tdir || error "rmdir failed"
3914 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3917 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3918 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3919 skip "Need MDS version at least 2.7.56"
3921 ([ $FAILURE_MODE == "HARD" ] &&
3922 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3923 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3928 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3932 zconf_mount $(hostname) $MOUNT
3933 client_up || return 1
3935 check_striped_dir_110 || error "check striped_dir failed"
3937 rm -rf $DIR/$tdir || error "rmdir failed"
3941 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3944 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3945 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3946 skip "Need MDS version at least 2.7.56"
3948 ([ $FAILURE_MODE == "HARD" ] &&
3949 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3950 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3956 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3959 check_striped_dir_110 || error "check striped_dir failed"
3961 rm -rf $DIR/$tdir || error "rmdir failed"
3965 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3968 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3969 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3970 skip "Need MDS version at least 2.7.56"
3972 ([ $FAILURE_MODE == "HARD" ] &&
3973 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3974 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3979 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3983 zconf_mount $(hostname) $MOUNT
3984 client_up || return 1
3986 check_striped_dir_110 || error "check striped_dir failed"
3988 rm -rf $DIR/$tdir || error "rmdir failed"
3992 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
3995 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3996 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3997 skip "Need MDS version at least 2.7.56"
3999 ([ $FAILURE_MODE == "HARD" ] &&
4000 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4001 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4005 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4007 rm -rf $DIR/$tdir/striped_dir
4010 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4011 error "striped dir still exists"
4014 run_test 111a "DNE: unlink striped dir, fail MDT1"
4017 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4018 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4019 skip "Need MDS version at least 2.7.56"
4021 ([ $FAILURE_MODE == "HARD" ] &&
4022 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4023 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4027 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4029 rm -rf $DIR/$tdir/striped_dir
4032 zconf_mount $(hostname) $MOUNT
4033 client_up || return 1
4035 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4036 error "striped dir still exists"
4039 run_test 111b "DNE: unlink striped dir, fail MDT2"
4042 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4043 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4044 skip "Need MDS version at least 2.7.56"
4046 ([ $FAILURE_MODE == "HARD" ] &&
4047 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4048 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4052 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4054 rm -rf $DIR/$tdir/striped_dir
4058 zconf_mount $(hostname) $MOUNT
4059 client_up || return 1
4060 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4061 error "striped dir still exists"
4064 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4067 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4068 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4069 skip "Need MDS version at least 2.7.56"
4071 ([ $FAILURE_MODE == "HARD" ] &&
4072 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4073 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4077 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4079 rm -rf $DIR/$tdir/striped_dir
4083 zconf_mount $(hostname) $MOUNT
4084 client_up || return 1
4085 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4086 error "striped dir still exists"
4090 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4093 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4094 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4095 skip "Need MDS version at least 2.7.56"
4097 ([ $FAILURE_MODE == "HARD" ] &&
4098 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4099 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4103 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4105 rm -rf $DIR/$tdir/striped_dir
4108 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4109 error "striped dir still exists"
4112 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4115 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4116 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4117 skip "Need MDS version at least 2.7.56"
4119 ([ $FAILURE_MODE == "HARD" ] &&
4120 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4121 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4125 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4127 rm -rf $DIR/$tdir/striped_dir
4130 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4131 error "striped dir still exists"
4134 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4137 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4138 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4139 skip "Need MDS version at least 2.7.56"
4141 ([ $FAILURE_MODE == "HARD" ] &&
4142 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4143 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4147 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4150 rm -rf $DIR/$tdir/striped_dir
4152 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4153 error "striped dir still exists"
4156 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4158 test_112_rename_prepare() {
4159 mkdir -p $DIR/$tdir/src_dir
4160 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4161 error "create remote source failed"
4163 touch $DIR/$tdir/src_dir/src_child/a
4165 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4166 error "create remote target dir failed"
4168 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4169 error "create remote target child failed"
4174 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4175 error "src_child still exists after rename"
4177 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4178 error "missing file(a) after rename"
4182 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4183 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4184 skip "Need MDS version at least 2.7.56"
4186 ([ $FAILURE_MODE == "HARD" ] &&
4187 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4188 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4191 test_112_rename_prepare
4194 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4195 error "rename dir cross MDT failed!"
4199 rm -rf $DIR/$tdir || error "rmdir failed"
4201 run_test 112a "DNE: cross MDT rename, fail MDT1"
4204 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4205 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4206 skip "Need MDS version at least 2.7.56"
4208 ([ $FAILURE_MODE == "HARD" ] &&
4209 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4210 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4213 test_112_rename_prepare
4216 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4217 error "rename dir cross MDT failed!"
4222 rm -rf $DIR/$tdir || error "rmdir failed"
4224 run_test 112b "DNE: cross MDT rename, fail MDT2"
4227 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4228 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4229 skip "Need MDS version at least 2.7.56"
4231 ([ $FAILURE_MODE == "HARD" ] &&
4232 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4233 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4236 test_112_rename_prepare
4239 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4240 error "rename dir cross MDT failed!"
4245 rm -rf $DIR/$tdir || error "rmdir failed"
4247 run_test 112c "DNE: cross MDT rename, fail MDT3"
4250 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4251 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4252 skip "Need MDS version at least 2.7.56"
4254 ([ $FAILURE_MODE == "HARD" ] &&
4255 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4256 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4259 test_112_rename_prepare
4262 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4263 error "rename dir cross MDT failed!"
4268 rm -rf $DIR/$tdir || error "rmdir failed"
4270 run_test 112d "DNE: cross MDT rename, fail MDT4"
4273 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4274 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4275 skip "Need MDS version at least 2.7.56"
4277 ([ $FAILURE_MODE == "HARD" ] &&
4278 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4279 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4282 test_112_rename_prepare
4286 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4287 error "rename dir cross MDT failed!"
4292 rm -rf $DIR/$tdir || error "rmdir failed"
4294 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4297 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4298 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4299 skip "Need MDS version at least 2.7.56"
4301 ([ $FAILURE_MODE == "HARD" ] &&
4302 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4303 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4306 test_112_rename_prepare
4310 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4311 error "rename dir cross MDT failed!"
4316 rm -rf $DIR/$tdir || error "rmdir failed"
4318 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4321 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4322 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4323 skip "Need MDS version at least 2.7.56"
4325 ([ $FAILURE_MODE == "HARD" ] &&
4326 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4327 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4330 test_112_rename_prepare
4334 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4335 error "rename dir cross MDT failed!"
4340 rm -rf $DIR/$tdir || error "rmdir failed"
4342 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4345 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4346 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4347 skip "Need MDS version at least 2.7.56"
4349 ([ $FAILURE_MODE == "HARD" ] &&
4350 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4351 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4354 test_112_rename_prepare
4358 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4359 error "rename dir cross MDT failed!"
4364 rm -rf $DIR/$tdir || error "rmdir failed"
4366 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4369 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4370 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4371 skip "Need MDS version at least 2.7.56"
4373 ([ $FAILURE_MODE == "HARD" ] &&
4374 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4375 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4378 test_112_rename_prepare
4382 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4383 error "rename dir cross MDT failed!"
4388 rm -rf $DIR/$tdir || error "rmdir failed"
4390 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4393 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4394 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4395 skip "Need MDS version at least 2.7.56"
4397 ([ $FAILURE_MODE == "HARD" ] &&
4398 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4399 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4402 test_112_rename_prepare
4406 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4407 error "rename dir cross MDT failed!"
4412 rm -rf $DIR/$tdir || error "rmdir failed"
4414 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4417 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4418 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4419 skip "Need MDS version at least 2.7.56"
4421 ([ $FAILURE_MODE == "HARD" ] &&
4422 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4423 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4426 test_112_rename_prepare
4431 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4432 error "rename dir cross MDT failed!"
4437 rm -rf $DIR/$tdir || error "rmdir failed"
4439 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4442 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4443 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4444 skip "Need MDS version at least 2.7.56"
4446 ([ $FAILURE_MODE == "HARD" ] &&
4447 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4448 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4451 test_112_rename_prepare
4456 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4457 error "rename dir cross MDT failed!"
4462 rm -rf $DIR/$tdir || error "rmdir failed"
4464 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4467 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4468 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4469 skip "Need MDS version at least 2.7.56"
4471 ([ $FAILURE_MODE == "HARD" ] &&
4472 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4473 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4476 test_112_rename_prepare
4481 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4482 error "rename dir cross MDT failed!"
4487 rm -rf $DIR/$tdir || error "rmdir failed"
4489 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4492 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4493 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4494 skip "Need MDS version at least 2.7.56"
4496 ([ $FAILURE_MODE == "HARD" ] &&
4497 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4498 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4501 test_112_rename_prepare
4506 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4507 error "rename dir cross MDT failed!"
4512 rm -rf $DIR/$tdir || error "rmdir failed"
4514 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4517 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4518 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4519 skip "Need MDS version at least 2.7.56"
4521 ([ $FAILURE_MODE == "HARD" ] &&
4522 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4523 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4531 for ((j=0;j<$((MDSCOUNT));j++)); do
4532 fail_index=$((fail_index+1))
4533 index=$((fail_index % MDSCOUNT))
4534 replay_barrier mds$((index + 1))
4535 for ((i=0;i<5;i++)); do
4536 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4537 error "create striped dir $DIR/$tdir/test_$i"
4540 fail mds$((index + 1))
4541 for ((i=0;i<5;i++)); do
4542 checkstat -t dir $DIR/$tdir/test_$i ||
4543 error "$DIR/$tdir/test_$i does not exist!"
4545 rm -rf $DIR/$tdir/test_* ||
4549 run_test 115 "failover for create/unlink striped directory"
4552 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4553 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4554 skip "Do not support large update log before 2.7.55" &&
4556 ([ $FAILURE_MODE == "HARD" ] &&
4557 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4558 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4565 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4566 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4567 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4570 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4571 error "stried_dir does not exists"
4573 run_test 116a "large update log master MDT recovery"
4576 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4577 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4578 skip "Do not support large update log before 2.7.55" &&
4581 ([ $FAILURE_MODE == "HARD" ] &&
4582 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4583 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4590 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4591 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4592 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4595 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4596 error "stried_dir does not exists"
4598 run_test 116b "large update log slave MDT recovery"
4601 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4602 ([ $FAILURE_MODE == "HARD" ] &&
4603 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4604 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4610 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4611 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4614 # Let's set rdonly on all MDTs, so client will send
4615 # replay requests on all MDTs and replay these requests
4616 # at the same time. This test will verify the recovery
4617 # will not be deadlock in this case, LU-7531.
4618 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4619 replay_barrier mds$((index + 1))
4620 if [ -z $mds_indexs ]; then
4621 mds_indexs="${mds_indexs}mds$((index+1))"
4623 mds_indexs="${mds_indexs},mds$((index+1))"
4627 rm -rf $DIR/$tdir/remote_dir
4628 rm -rf $DIR/$tdir/remote_dir_1
4632 rm -rf $DIR/$tdir || error "rmdir failed"
4634 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4637 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4638 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4639 skip "Do not support large update log before 2.7.64" &&
4644 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4645 error "setdirstripe fails"
4646 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4647 error "setdirstripe fails 1"
4648 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4650 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4651 do_facet mds1 "lctl set_param fail_loc=0x1705"
4652 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4653 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4654 do_facet mds1 "lctl set_param fail_loc=0x0"
4657 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4658 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4663 run_test 118 "invalidate osp update will not cause update log corruption"
4666 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4667 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4668 skip "Do not support large update log before 2.7.64" &&
4671 local hard_timeout=$(do_facet mds1 \
4672 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4674 local clients=${CLIENTS:-$HOSTNAME}
4675 local time_min=$(recovery_time_min)
4678 mkdir $DIR/$tdir/tmp
4679 rmdir $DIR/$tdir/tmp
4682 mkdir $DIR/$tdir/dir_1
4683 for ((i = 0; i < 20; i++)); do
4684 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4691 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4692 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4693 #sleep (timeout + 5), so mds will evict the client exports,
4694 #but DNE update recovery will keep going.
4695 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4697 mount_facet mds1 "-o recovery_time_hard=$time_min"
4699 wait_clients_import_state "$clients" mds1 FULL
4701 clients_up || clients_up || error "failover df: $?"
4703 #revert back the hard timeout
4704 do_facet mds1 $LCTL set_param \
4705 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4707 for ((i = 0; i < 20; i++)); do
4708 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4709 [ $stripe_count == 2 ] || {
4710 error "stripe_dir-$i creation replay fails"
4715 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4718 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4719 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4720 skip "Do not support large update log before 2.7.64" &&
4724 replay_barrier_nosync mds1
4725 for ((i = 0; i < 20; i++)); do
4726 mkdir $DIR/$tdir/dir-$i || {
4727 error "create dir-$i fails"
4730 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4731 error "create stripe_dir-$i fails"
4738 for ((i = 0; i < 20; i++)); do
4739 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4740 error "dir-$i still exists"
4743 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4744 error "stripe_dir-$i still exists"
4749 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4752 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4753 skip "Don't support it before 2.11" &&
4756 local at_max_saved=$(at_max_get mds)
4758 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4759 cancel_lru_locks mdc
4761 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4764 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4770 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4771 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4775 wait_clients_import_state "$clients" mds1 FULL
4776 clients_up || clients_up || error "failover df: $?"
4779 wait $mpid || error "multiop_bg_pause pid failed"
4781 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4782 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4783 at_max_set $at_max_saved mds
4786 run_test 121 "lock replay timed out and race"
4789 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4790 skip "Do not support Data-on-MDT before 2.11"
4792 replay_barrier $SINGLEMDS
4793 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4796 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4797 error "Fail to replay DoM file creation"
4799 run_test 130a "DoM file create (setstripe) replay"
4802 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4803 skip "Do not support Data-on-MDT before 2.11"
4806 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4807 replay_barrier $SINGLEMDS
4808 touch $DIR/$tdir/$tfile
4811 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4812 error "Fail to replay DoM file creation"
4814 run_test 130b "DoM file create (inherited) replay"
4817 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4818 skip "Do not support Data-on-MDT before 2.11"
4820 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4821 replay_barrier $SINGLEMDS
4822 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4823 # lock is not canceled and will be replayed
4826 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4827 error "Wrong file content after failover"
4829 run_test 131a "DoM file write lock replay"
4832 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4833 skip "Do not support Data-on-MDT before 2.11"
4835 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4836 replay_barrier $SINGLEMDS
4837 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4838 cancel_lru_locks mdc
4842 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4843 error "Wrong file content after failover"
4845 run_test 131b "DoM file write replay"
4848 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.90) ] &&
4849 skip "Do not support PFL files before 2.10"
4851 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4852 replay_barrier $SINGLEMDS
4853 # write over the first component size cause next component instantiation
4854 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4855 error "dd to $DIR/$tfile failed"
4856 lfs getstripe $DIR/$tfile
4858 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4859 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4860 error "Component #1 was not instantiated"
4864 lfs getstripe $DIR/$tfile
4865 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4866 error "Component #1 instantiation was not replayed"
4867 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4868 if [ $cksum != $cksum2 ] ; then
4869 error_noexit "New cksum $cksum2 does not match original $cksum"
4872 run_test 132a "PFL new component instantiate replay"
4875 check_and_cleanup_lustre