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:
26 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT 61d"
27 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
29 case "$(lsb_release -sr)" in # only disable tests for el7
30 7*) # bug number: LU-6455-----
31 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 28"
36 [ "$SLOW" = "no" ] && EXCEPT_SLOW="44b"
38 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
39 # bug number for skipped test: LU-1867 LU-3127
40 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 89 73b"
44 check_and_setup_lustre
49 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
51 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
52 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
54 do_facet $SINGLEMDS sync
57 test_0a() { # was test_0
58 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
59 replay_barrier $SINGLEMDS
63 run_test 0a "empty replay"
66 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
68 # this test attempts to trigger a race in the precreation code,
69 # and must run before any other objects are created on the filesystem
71 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
72 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
74 run_test 0b "ensure object created after recover exists. (3284)"
77 replay_barrier $SINGLEMDS
80 facet_failover $SINGLEMDS
81 zconf_mount $(hostname) $MOUNT || error "mount fails"
82 client_up || error "post-failover df failed"
83 # file shouldn't exist if replay-barrier works as expected
84 rm $DIR/$tfile && error "File exists and it shouldn't"
87 run_test 0c "check replay-barrier"
90 replay_barrier $SINGLEMDS
92 facet_failover $SINGLEMDS
93 zconf_mount $(hostname) $MOUNT || error "mount fails"
94 client_up || error "post-failover df failed"
96 run_test 0d "expired recovery with no clients"
99 replay_barrier $SINGLEMDS
102 $CHECKSTAT -t file $DIR/$tfile ||
103 error "$CHECKSTAT $DIR/$tfile attribute check failed"
106 run_test 1 "simple create"
109 replay_barrier $SINGLEMDS
112 $CHECKSTAT -t file $DIR/$tfile ||
113 error "$CHECKSTAT $DIR/$tfile attribute check failed"
119 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
120 replay_barrier $SINGLEMDS
123 $CHECKSTAT -t file $DIR/$tfile ||
124 error "$CHECKSTAT $DIR/$tfile attribute check failed"
130 local file=$DIR/$tfile
131 replay_barrier $SINGLEMDS
133 openfile -f O_DIRECTORY $file
135 $CHECKSTAT -t file $file ||
136 error "$CHECKSTAT $file attribute check failed"
139 run_test 3a "replay failed open(O_DIRECTORY)"
142 replay_barrier $SINGLEMDS
143 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
144 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
146 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
148 $CHECKSTAT -t file $DIR/$tfile &&
149 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
152 run_test 3b "replay failed open -ENOMEM"
155 replay_barrier $SINGLEMDS
156 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
157 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
159 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
162 $CHECKSTAT -t file $DIR/$tfile &&
163 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
166 run_test 3c "replay failed open -ENOMEM"
168 test_4a() { # was test_4
169 replay_barrier $SINGLEMDS
170 for i in $(seq 10); do
171 echo "tag-$i" > $DIR/$tfile-$i
174 for i in $(seq 10); do
175 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
178 run_test 4a "|x| 10 open(O_CREAT)s"
181 for i in $(seq 10); do
182 echo "tag-$i" > $DIR/$tfile-$i
184 replay_barrier $SINGLEMDS
187 $CHECKSTAT -t file $DIR/$tfile-* &&
188 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
191 run_test 4b "|x| rm 10 files"
193 # The idea is to get past the first block of precreated files on both
194 # osts, and then replay.
196 replay_barrier $SINGLEMDS
197 for i in $(seq 220); do
198 echo "tag-$i" > $DIR/$tfile-$i
201 for i in $(seq 220); do
202 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
206 # waiting for commitment of removal
208 run_test 5 "|x| 220 open(O_CREAT)"
210 test_6a() { # was test_6
211 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
212 replay_barrier $SINGLEMDS
213 mcreate $DIR/$tdir/$tfile
215 $CHECKSTAT -t dir $DIR/$tdir ||
216 error "$CHECKSTAT $DIR/$tdir attribute check failed"
217 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
218 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
220 # waiting for log process thread
222 run_test 6a "mkdir + contained create"
225 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
226 replay_barrier $SINGLEMDS
229 $CHECKSTAT -t dir $DIR/$tdir &&
230 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
233 run_test 6b "|X| rmdir"
236 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
237 replay_barrier $SINGLEMDS
238 mcreate $DIR/$tdir/$tfile
240 $CHECKSTAT -t dir $DIR/$tdir ||
241 error "$CHECKSTAT $DIR/$tdir attribute check failed"
242 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
243 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
246 run_test 7 "mkdir |X| contained create"
249 replay_barrier $SINGLEMDS
250 multiop_bg_pause $DIR/$tfile mo_c ||
251 error "multiop mknod $DIR/$tfile failed"
255 $CHECKSTAT -t file $DIR/$tfile ||
256 error "$CHECKSTAT $DIR/$tfile attribute check failed"
257 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
258 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
261 run_test 8 "creat open |X| close"
264 replay_barrier $SINGLEMDS
266 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
268 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
270 echo " old_inum == $old_inum, new_inum == $new_inum"
271 if [ $old_inum -eq $new_inum ] ;
273 echo "old_inum and new_inum match"
275 echo " old_inum and new_inum do not match"
276 error "old index($old_inum) does not match new index($new_inum)"
280 run_test 9 "|X| create (same inum/gen)"
283 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
284 replay_barrier $SINGLEMDS
285 mv $DIR/$tfile $DIR/$tfile-2
288 $CHECKSTAT $DIR/$tfile &&
289 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
290 $CHECKSTAT $DIR/$tfile-2 ||
291 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
295 run_test 10 "create |X| rename unlink"
298 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
299 echo "old" > $DIR/$tfile
300 mv $DIR/$tfile $DIR/$tfile-2
301 replay_barrier $SINGLEMDS
302 echo "new" > $DIR/$tfile
304 grep old $DIR/$tfile-2
306 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
307 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
309 run_test 11 "create open write rename |X| create-old-name read"
312 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
313 multiop_bg_pause $DIR/$tfile o_tSc ||
314 error "multiop_bg_pause $DIR/$tfile failed"
317 replay_barrier $SINGLEMDS
318 kill -USR1 $pid || error "multiop $pid not running"
319 wait $pid || error "multiop $pid failed"
322 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
325 run_test 12 "open, unlink |X| close"
327 # 1777 - replay open after committed chmod that would make
328 # a regular open a failure
330 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
331 multiop_bg_pause $DIR/$tfile O_wc ||
332 error "multiop_bg_pause $DIR/$tfile failed"
335 $CHECKSTAT -p 0 $DIR/$tfile ||
336 error "$CHECKSTAT $DIR/$tfile attribute check failed"
337 replay_barrier $SINGLEMDS
339 kill -USR1 $pid || error "multiop $pid not running"
340 wait $pid || error "multiop $pid failed"
342 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
343 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
344 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
347 run_test 13 "open chmod 0 |x| write close"
350 multiop_bg_pause $DIR/$tfile O_tSc ||
351 error "multiop_bg_pause $DIR/$tfile failed"
354 replay_barrier $SINGLEMDS
355 kill -USR1 $pid || error "multiop $pid not running"
356 wait $pid || error "multiop $pid failed"
359 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
362 run_test 14 "open(O_CREAT), unlink |X| close"
365 multiop_bg_pause $DIR/$tfile O_tSc ||
366 error "multiop_bg_pause $DIR/$tfile failed"
369 replay_barrier $SINGLEMDS
370 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
371 kill -USR1 $pid || error "multiop $pid not running"
372 wait $pid || error "multiop $pid failed"
375 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
376 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
379 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
382 replay_barrier $SINGLEMDS
385 mcreate $DIR/$tfile-2
387 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
388 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
389 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
391 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
394 replay_barrier $SINGLEMDS
395 multiop_bg_pause $DIR/$tfile O_c ||
396 error "multiop_bg_pause $DIR/$tfile failed"
399 kill -USR1 $pid || error "multiop $pid not running"
400 wait $pid || error "multiop $pid failed"
401 $CHECKSTAT -t file $DIR/$tfile ||
402 error "$CHECKSTAT $DIR/$tfile attribute check failed"
405 run_test 17 "|X| open(O_CREAT), |replay| close"
408 replay_barrier $SINGLEMDS
409 multiop_bg_pause $DIR/$tfile O_tSc ||
410 error "multiop_bg_pause $DIR/$tfile failed"
413 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
414 echo "pid: $pid will close"
415 kill -USR1 $pid || error "multiop $pid not running"
416 wait $pid || error "multiop $pid failed"
419 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
420 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
421 # this touch frequently fails
422 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
423 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
424 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
427 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
429 # bug 1855 (a simpler form of test_11 above)
431 replay_barrier $SINGLEMDS
433 echo "old" > $DIR/$tfile
434 mv $DIR/$tfile $DIR/$tfile-2
435 grep old $DIR/$tfile-2
437 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
439 run_test 19 "mcreate, open, write, rename "
441 test_20a() { # was test_20
442 replay_barrier $SINGLEMDS
443 multiop_bg_pause $DIR/$tfile O_tSc ||
444 error "multiop_bg_pause $DIR/$tfile failed"
449 kill -USR1 $pid || error "multiop $pid not running"
450 wait $pid || error "multiop $pid failed"
451 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
454 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
456 test_20b() { # bug 10480
457 local wait_timeout=$((TIMEOUT * 4))
461 BEFOREUSED=$(df -P $DIR | tail -1 | awk '{ print $3 }')
462 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
463 while [ ! -e $DIR/$tfile ] ; do
464 usleep 60 # give dd a chance to start
467 $GETSTRIPE $DIR/$tfile || error "$GETSTRIPE $DIR/$tfile failed"
469 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
471 client_up || client_up || true # reconnect
473 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync 1"
475 fail $SINGLEMDS # start orphan recovery
476 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
477 wait_delete_completed_mds $wait_timeout ||
478 error "delete did not complete"
480 AFTERUSED=$(df -P $DIR | tail -1 | awk '{ print $3 }')
481 log "before $BEFOREUSED, after $AFTERUSED"
482 (( $AFTERUSED > $BEFOREUSED + $(fs_log_size) )) &&
483 error "after $AFTERUSED > before $BEFOREUSED"
486 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"
488 test_20c() { # bug 10480
489 multiop_bg_pause $DIR/$tfile Ow_c ||
490 error "multiop_bg_pause $DIR/$tfile failed"
496 client_up || client_up || true # reconnect
498 kill -USR1 $pid || error "multiop $pid not running"
499 wait $pid || error "multiop $pid failed"
500 [ -s $DIR/$tfile ] || error "File was truncated"
504 run_test 20c "check that client eviction does not affect file content"
507 replay_barrier $SINGLEMDS
508 multiop_bg_pause $DIR/$tfile O_tSc ||
509 error "multiop_bg_pause $DIR/$tfile failed"
512 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
515 kill -USR1 $pid || error "multiop $pid not running"
516 wait $pid || error "multiop $pid failed"
517 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
518 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
521 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
524 multiop_bg_pause $DIR/$tfile O_tSc ||
525 error "multiop_bg_pause $DIR/$tfile failed"
528 replay_barrier $SINGLEMDS
532 kill -USR1 $pid || error "multiop $pid not running"
533 wait $pid || error "multiop $pid failed"
534 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
537 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
540 multiop_bg_pause $DIR/$tfile O_tSc ||
541 error "multiop_bg_pause $DIR/$tfile failed"
544 replay_barrier $SINGLEMDS
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 23 "open(O_CREAT), |X| 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
565 kill -USR1 $pid || error "multiop $pid not running"
566 wait $pid || error "multiop $pid failed"
567 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
570 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
573 multiop_bg_pause $DIR/$tfile O_tSc ||
574 error "multiop_bg_pause $DIR/$tfile failed"
578 replay_barrier $SINGLEMDS
580 kill -USR1 $pid || error "multiop $pid not running"
581 wait $pid || error "multiop $pid failed"
582 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
585 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
588 replay_barrier $SINGLEMDS
589 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
590 error "multiop_bg_pause $DIR/$tfile-1 failed"
592 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
593 error "multiop_bg_pause $DIR/$tfile-2 failed"
597 kill -USR1 $pid2 || error "second multiop $pid2 not running"
598 wait $pid2 || error "second multiop $pid2 failed"
601 kill -USR1 $pid1 || error "multiop $pid1 not running"
602 wait $pid1 || error "multiop $pid1 failed"
603 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
604 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
607 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
610 replay_barrier $SINGLEMDS
611 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
612 error "multiop_bg_pause $DIR/$tfile-1 failed"
614 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
615 error "multiop_bg_pause $DIR/$tfile-2 failed"
621 kill -USR1 $pid1 || error "multiop $pid1 not running"
622 wait $pid1 || error "multiop $pid1 failed"
623 kill -USR1 $pid2 || error "second multiop $pid2 not running"
624 wait $pid2 || error "second multiop $pid2 failed"
625 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
626 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
629 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
632 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
633 error "multiop_bg_pause $DIR/$tfile-1 failed"
635 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
636 error "multiop_bg_pause $DIR/$tfile-2 failed"
638 replay_barrier $SINGLEMDS
641 kill -USR1 $pid2 || error "second multiop $pid2 not running"
642 wait $pid2 || error "second multiop $pid2 failed"
645 kill -USR1 $pid1 || error "multiop $pid1 not running"
646 wait $pid1 || error "multiop $pid1 failed"
647 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
648 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
651 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
654 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
655 error "multiop_bg_pause $DIR/$tfile-1 failed"
657 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
658 error "multiop_bg_pause $DIR/$tfile-2 failed"
660 replay_barrier $SINGLEMDS
665 kill -USR1 $pid1 || error "multiop $pid1 not running"
666 wait $pid1 || error "multiop $pid1 failed"
667 kill -USR1 $pid2 || error "second multiop $pid2 not running"
668 wait $pid2 || error "second multiop $pid2 failed"
669 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
670 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
673 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
676 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
677 error "multiop_bg_pause $DIR/$tfile-1 failed"
679 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
680 error "multiop_bg_pause $DIR/$tfile-2 failed"
685 replay_barrier $SINGLEMDS
687 kill -USR1 $pid1 || error "multiop $pid1 not running"
688 wait $pid1 || error "multiop $pid1 failed"
689 kill -USR1 $pid2 || error "second multiop $pid2 not running"
690 wait $pid2 || error "second multiop $pid2 failed"
691 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
692 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
695 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
698 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
699 error "multiop_bg_pause $DIR/$tfile-1 failed"
701 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
702 error "multiop_bg_pause $DIR/$tfile-2 failed"
706 replay_barrier $SINGLEMDS
709 kill -USR1 $pid1 || error "multiop $pid1 not running"
710 wait $pid1 || error "multiop $pid1 failed"
711 kill -USR1 $pid2 || error "second multiop $pid2 not running"
712 wait $pid2 || error "second multiop $pid2 failed"
713 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
714 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
717 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
719 # tests for bug 2104; completion without crashing is success. The close is
720 # stale, but we always return 0 for close, so the app never sees it.
722 multiop_bg_pause $DIR/$tfile O_c ||
723 error "multiop_bg_pause $DIR/$tfile failed"
725 multiop_bg_pause $DIR/$tfile O_c ||
726 error "second multiop_bg_pause $DIR/$tfile failed"
729 client_up || client_up || error "client_up failed"
730 kill -USR1 $pid1 || error "multiop $pid1 not running"
731 kill -USR1 $pid2 || error "second multiop $pid2 not running"
732 wait $pid1 || error "multiop $pid1 failed"
733 wait $pid2 || error "second multiop $pid2 failed"
736 run_test 32 "close() notices client eviction; close() after client eviction"
739 createmany -o $DIR/$tfile-%d 10 ||
740 error "createmany create $DIR/$tfile failed"
741 replay_barrier_nosync $SINGLEMDS
742 fail_abort $SINGLEMDS
743 # recreate shouldn't fail
744 createmany -o $DIR/$tfile--%d 10 ||
745 error "createmany recreate $DIR/$tfile failed"
749 run_test 33a "fid seq shouldn't be reused after abort recovery"
752 #define OBD_FAIL_SEQ_ALLOC 0x1311
753 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
755 createmany -o $DIR/$tfile-%d 10
756 replay_barrier_nosync $SINGLEMDS
757 fail_abort $SINGLEMDS
758 # recreate shouldn't fail
759 createmany -o $DIR/$tfile--%d 10 ||
760 error "createmany recreate $DIR/$tfile failed"
764 run_test 33b "test fid seq allocation"
767 multiop_bg_pause $DIR/$tfile O_c ||
768 error "multiop_bg_pause $DIR/$tfile failed"
772 replay_barrier $SINGLEMDS
773 fail_abort $SINGLEMDS
774 kill -USR1 $pid || error "multiop $pid not running"
775 wait $pid || error "multiop $pid failed"
776 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
780 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
782 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
784 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
786 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
787 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
792 # give a chance to remove from MDS
793 fail_abort $SINGLEMDS
794 $CHECKSTAT -t file $DIR/$tfile &&
795 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
798 run_test 35 "test recovery from llog for unlink op"
800 # b=2432 resent cancel after replay uses wrong cookie,
801 # so don't resend cancels
803 replay_barrier $SINGLEMDS
805 checkstat $DIR/$tfile
806 facet_failover $SINGLEMDS
808 if dmesg | grep "unknown lock cookie"; then
809 error "cancel after replay failed"
812 run_test 36 "don't resend cancel"
815 # directory orphans can't be unlinked from PENDING directory
817 rmdir $DIR/$tfile 2>/dev/null
818 multiop_bg_pause $DIR/$tfile dD_c ||
819 error "multiop_bg_pause $DIR/$tfile failed"
823 replay_barrier $SINGLEMDS
824 # clear the dmesg buffer so we only see errors from this recovery
825 do_facet $SINGLEMDS dmesg -c >/dev/null
826 fail_abort $SINGLEMDS
827 kill -USR1 $pid || error "multiop $pid not running"
828 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
829 error "error unlinking files"
830 wait $pid || error "multiop $pid failed"
834 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
837 createmany -o $DIR/$tfile-%d 800 ||
838 error "createmany -o $DIR/$tfile failed"
839 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
840 replay_barrier $SINGLEMDS
842 unlinkmany $DIR/$tfile-%d 400 400 ||
843 error "unlinkmany $DIR/$tfile 400 failed"
845 $CHECKSTAT -t file $DIR/$tfile-* &&
846 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
849 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
851 test_39() { # bug 4176
852 createmany -o $DIR/$tfile-%d 800 ||
853 error "createmany -o $DIR/$tfile failed"
854 replay_barrier $SINGLEMDS
855 unlinkmany $DIR/$tfile-%d 0 400
857 unlinkmany $DIR/$tfile-%d 400 400 ||
858 error "unlinkmany $DIR/$tfile 400 failed"
860 $CHECKSTAT -t file $DIR/$tfile-* &&
861 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
864 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
867 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
872 # always need connection to MDS to verify layout during IO. LU-2628.
873 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
874 skip "layout_lock needs MDS connection for IO" && return 0
876 $LCTL mark multiop $MOUNT/$tfile OS_c
877 multiop $MOUNT/$tfile OS_c &
879 writeme -s $MOUNT/${tfile}-2 &
882 facet_failover $SINGLEMDS
883 #define OBD_FAIL_MDS_CONNECT_NET 0x117
884 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
886 stat1=$(count_ost_writes)
888 stat2=$(count_ost_writes)
889 echo "$stat1, $stat2"
890 if [ $stat1 -lt $stat2 ]; then
891 echo "writes continuing during recovery"
894 echo "writes not continuing during recovery, bug 2477"
897 echo "waiting for writeme $WRITE_PID"
901 echo "waiting for multiop $PID"
902 wait $PID || error "multiop $PID failed"
903 do_facet client munlink $MOUNT/$tfile ||
904 error "munlink $MOUNT/$tfile failed"
905 do_facet client munlink $MOUNT/${tfile}-2 ||
906 error "munlink $MOUNT/$tfile-2 failed"
909 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
912 # make sure that a read to one osc doesn't try to double-unlock its page just
913 # because another osc is invalid. trigger_group_io used to mistakenly return
914 # an error if any oscs were invalid even after having successfully put rpcs
915 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
916 # the page, guarnateeing that the unlock from the RPC completion would
917 # assert on trying to unlock the unlocked page.
919 [ $OSTCOUNT -lt 2 ] &&
920 skip_env "skipping test 41: we don't have a second OST to test with" &&
923 local f=$MOUNT/$tfile
924 # make sure the start of the file is ost1
925 $SETSTRIPE -S $((128 * 1024)) -i 0 $f
926 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
927 error "dd on client failed"
929 # fail ost2 and read from ost1
930 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
931 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
932 grep $mdtosc | awk '{print $1}')
933 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
934 lctl get_param -n devices &&
935 error "OST 2 $osc2dev does not exist"
936 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
937 error "deactive device on $SINGLEMDS failed"
938 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
939 error "second dd on client failed"
940 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
941 error "active device on $SINGLEMDS failed"
944 run_test 41 "read from a valid osc while other oscs are invalid"
946 # test MDS recovery after ost failure
948 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
949 createmany -o $DIR/$tfile-%d 800 ||
950 error "createmany -o $DIR/$tfile failed"
952 unlinkmany $DIR/$tfile-%d 0 400
954 lctl set_param debug=-1
957 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
958 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
959 #[ $blocks_after -lt $blocks ] || return 1
960 echo "wait for MDS to timeout and recover"
961 sleep $((TIMEOUT * 2))
963 unlinkmany $DIR/$tfile-%d 400 400 ||
964 error "unlinkmany $DIR/$tfile 400 failed"
965 $CHECKSTAT -t file $DIR/$tfile-* &&
966 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
969 run_test 42 "recovery after ost failure"
971 # timeout in MDS/OST recovery RPC will LBUG MDS
972 test_43() { # bug 2530
973 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
975 replay_barrier $SINGLEMDS
977 # OBD_FAIL_OST_CREATE_NET 0x204
978 do_facet ost1 "lctl set_param fail_loc=0x80000204"
984 run_test 43 "mds osc import failure during recovery; don't LBUG"
986 test_44a() { # was test_44
989 local mdcdev=$($LCTL dl |
990 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
991 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
992 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
993 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
995 # adaptive timeouts slow this way down
996 if at_is_enabled; then
997 at_max_saved=$(at_max_get mds)
1001 for i in $(seq 1 10); do
1002 echo "$i of 10 ($(date +%s))"
1003 do_facet $SINGLEMDS \
1004 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1005 #define OBD_FAIL_TGT_CONN_RACE 0x701
1006 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1007 # lctl below may fail, it is valid case
1008 $LCTL --device $mdcdev recover
1011 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1012 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1015 run_test 44a "race in target handle connect"
1018 local mdcdev=$($LCTL dl |
1019 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1020 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1021 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1022 { echo mdcdev=$mdcdev; $LCTL dl;
1023 error "more than one ${FSNAME}-MDT0000-mdc"; }
1025 for i in $(seq 1 10); do
1026 echo "$i of 10 ($(date +%s))"
1027 do_facet $SINGLEMDS \
1028 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1029 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1030 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1031 # lctl below may fail, it is valid case
1032 $LCTL --device $mdcdev recover
1037 run_test 44b "race in target handle connect"
1040 replay_barrier $SINGLEMDS
1041 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1042 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1043 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1044 fail_abort $SINGLEMDS
1045 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1047 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1050 run_test 44c "race in target handle connect"
1052 # Handle failed close
1054 local mdcdev=$($LCTL get_param -n devices |
1055 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1056 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1057 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1058 { echo mdcdev=$mdcdev; $LCTL dl;
1059 error "more than one ${FSNAME}-MDT0000-mdc"; }
1061 $LCTL --device $mdcdev recover ||
1062 error "$LCTL --device $mdcdev recover failed"
1064 multiop_bg_pause $DIR/$tfile O_c ||
1065 error "multiop_bg_pause $DIR/$tfile failed"
1068 # This will cause the CLOSE to fail before even
1069 # allocating a reply buffer
1070 $LCTL --device $mdcdev deactivate ||
1071 error "$LCTL --device $mdcdev deactivate failed"
1074 kill -USR1 $pid || error "multiop $pid not running"
1075 wait $pid || error "multiop $pid failed"
1077 $LCTL --device $mdcdev activate ||
1078 error "$LCTL --device $mdcdev activate failed"
1081 $CHECKSTAT -t file $DIR/$tfile ||
1082 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1085 run_test 45 "Handle failed close"
1089 drop_reply "touch $DIR/$tfile"
1091 # ironically, the previous test, 45, will cause a real forced close,
1092 # so just look for one for this test
1093 dmesg | grep -i "force closing client file handle for $tfile" &&
1094 error "found force closing in dmesg"
1097 run_test 46 "Don't leak file handle after open resend (3325)"
1099 test_47() { # bug 2824
1100 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1102 # create some files to make sure precreate has been done on all
1103 # OSTs. (just in case this test is run independently)
1104 createmany -o $DIR/$tfile 20 ||
1105 error "createmany create $DIR/$tfile failed"
1107 # OBD_FAIL_OST_CREATE_NET 0x204
1109 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1110 client_up || error "client_up failed"
1112 # let the MDS discover the OST failure, attempt to recover, fail
1113 # and recover again.
1114 sleep $((3 * TIMEOUT))
1116 # Without 2824, this createmany would hang
1117 createmany -o $DIR/$tfile 20 ||
1118 error "createmany recraete $DIR/$tfile failed"
1119 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1123 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1126 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1127 [ "$OSTCOUNT" -lt "2" ] &&
1128 skip_env "$OSTCOUNT < 2 OSTs -- skipping" && return
1130 replay_barrier $SINGLEMDS
1131 createmany -o $DIR/$tfile 20 ||
1132 error "createmany -o $DIR/$tfile failed"
1133 # OBD_FAIL_OST_EROFS 0x216
1134 facet_failover $SINGLEMDS
1135 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1136 client_up || error "client_up failed"
1138 createmany -o $DIR/$tfile 20 20 ||
1139 error "createmany recraete $DIR/$tfile failed"
1140 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1143 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1146 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1147 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1148 grep $mdtosc | awk '{print $1}')
1149 [ "$oscdev" ] || error "could not find OSC device on MDS"
1150 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1151 error "OSC device $oscdev recovery failed"
1152 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1153 error "second OSC device $oscdev recovery failed"
1154 # give the mds_lov_sync threads a chance to run
1157 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1159 # b3764 timed out lock replay
1161 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.90) ] &&
1162 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly" &&
1165 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1166 cancel_lru_locks mdc
1168 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1171 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1172 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1173 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1175 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1177 wait $mpid || error "multiop_bg_pause pid failed"
1179 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1180 lctl set_param fail_loc=0x0
1181 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1184 run_test 52 "time out lock replay (3764)"
1186 # bug 3462 - simultaneous MDC requests
1188 [[ $(lctl get_param mdc.*.import |
1189 grep "connect_flags:.*multi_mod_rpc") ]] ||
1190 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1192 cancel_lru_locks mdc # cleanup locks from former test cases
1193 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1194 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1195 multiop $DIR/${tdir}-1/f O_c &
1197 # give multiop a change to open
1200 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1201 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1202 kill -USR1 $close_pid
1203 cancel_lru_locks mdc # force the close
1204 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1206 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1208 # close should still be here
1209 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1211 replay_barrier_nodf $SINGLEMDS
1213 wait $close_pid || error "close_pid $close_pid failed"
1215 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1216 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1217 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1218 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1219 rm -rf $DIR/${tdir}-*
1221 run_test 53a "|X| close request while two MDC requests in flight"
1224 cancel_lru_locks mdc # cleanup locks from former test cases
1226 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1227 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1228 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1229 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1232 #define OBD_FAIL_MDS_REINT_NET 0x107
1233 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1234 mcreate $DIR/${tdir}-2/f &
1238 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1239 kill -USR1 $close_pid
1240 cancel_lru_locks mdc # force the close
1241 wait $close_pid || error "close_pid $close_pid failed"
1242 # open should still be here
1243 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1245 replay_barrier_nodf $SINGLEMDS
1247 wait $open_pid || error "open_pid failed"
1249 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1250 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1251 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1252 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1253 rm -rf $DIR/${tdir}-*
1255 run_test 53b "|X| open request while two MDC requests in flight"
1258 cancel_lru_locks mdc # cleanup locks from former test cases
1260 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1261 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1262 multiop $DIR/${tdir}-1/f O_c &
1265 #define OBD_FAIL_MDS_REINT_NET 0x107
1266 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1267 mcreate $DIR/${tdir}-2/f &
1271 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1272 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1273 kill -USR1 $close_pid
1274 cancel_lru_locks mdc # force the close
1276 #bz20647: make sure all pids exist before failover
1277 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1278 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1279 replay_barrier_nodf $SINGLEMDS
1280 fail_nodf $SINGLEMDS
1281 wait $open_pid || error "open_pid failed"
1283 # close should be gone
1284 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1285 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1287 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1288 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1289 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1290 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1291 rm -rf $DIR/${tdir}-*
1293 run_test 53c "|X| open request and close request while two MDC requests in flight"
1296 [[ $(lctl get_param mdc.*.import |
1297 grep "connect_flags:.*multi_mod_rpc") ]] ||
1298 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1300 cancel_lru_locks mdc # cleanup locks from former test cases
1302 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1303 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1304 multiop $DIR/${tdir}-1/f O_c &
1306 # give multiop a chance to open
1309 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1310 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1311 kill -USR1 $close_pid
1312 cancel_lru_locks mdc # force the close
1313 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1314 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1316 # close should still be here
1317 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1319 wait $close_pid || error "close_pid failed"
1321 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1322 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1323 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1324 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1325 rm -rf $DIR/${tdir}-*
1327 run_test 53d "close reply while two MDC requests in flight"
1330 cancel_lru_locks mdc # cleanup locks from former test cases
1332 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1333 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1334 multiop $DIR/${tdir}-1/f O_c &
1337 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1338 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1339 mcreate $DIR/${tdir}-2/f &
1343 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1344 kill -USR1 $close_pid
1345 cancel_lru_locks mdc # force the close
1346 wait $close_pid || error "close_pid failed"
1347 # open should still be here
1348 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1350 replay_barrier_nodf $SINGLEMDS
1352 wait $open_pid || error "open_pid failed"
1354 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1355 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1356 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1357 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1358 rm -rf $DIR/${tdir}-*
1360 run_test 53e "|X| open reply while two MDC requests in flight"
1363 cancel_lru_locks mdc # cleanup locks from former test cases
1365 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1366 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1367 multiop $DIR/${tdir}-1/f O_c &
1370 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1371 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1372 mcreate $DIR/${tdir}-2/f &
1376 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1377 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1378 kill -USR1 $close_pid
1379 cancel_lru_locks mdc # force the close
1381 #bz20647: make sure all pids are exists before failover
1382 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1383 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1384 replay_barrier_nodf $SINGLEMDS
1385 fail_nodf $SINGLEMDS
1386 wait $open_pid || error "open_pid failed"
1388 # close should be gone
1389 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1390 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1392 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1393 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1394 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1395 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1396 rm -rf $DIR/${tdir}-*
1398 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1401 cancel_lru_locks mdc # cleanup locks from former test cases
1403 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1404 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1405 multiop $DIR/${tdir}-1/f O_c &
1408 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1409 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1410 mcreate $DIR/${tdir}-2/f &
1414 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1415 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1416 kill -USR1 $close_pid
1417 cancel_lru_locks mdc # force the close
1418 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1420 #bz20647: make sure all pids are exists before failover
1421 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1422 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1423 replay_barrier_nodf $SINGLEMDS
1424 fail_nodf $SINGLEMDS
1425 wait $open_pid || error "open_pid failed"
1427 # close should be gone
1428 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1430 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1431 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1432 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1433 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1434 rm -rf $DIR/${tdir}-*
1436 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1439 cancel_lru_locks mdc # cleanup locks from former test cases
1441 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1442 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1443 multiop $DIR/${tdir}-1/f O_c &
1446 #define OBD_FAIL_MDS_REINT_NET 0x107
1447 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1448 mcreate $DIR/${tdir}-2/f &
1452 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1453 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1454 kill -USR1 $close_pid
1455 cancel_lru_locks mdc # force the close
1458 #bz20647: make sure all pids are exists before failover
1459 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1460 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1461 replay_barrier_nodf $SINGLEMDS
1462 fail_nodf $SINGLEMDS
1463 wait $open_pid || error "open_pid failed"
1465 # close should be gone
1466 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1467 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1469 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1470 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1471 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1472 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1473 rm -rf $DIR/${tdir}-*
1475 run_test 53h "open request and close reply while two MDC requests in flight"
1477 #b3761 ASSERTION(hash != 0) failed
1479 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1480 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1482 # give touch a chance to run
1484 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1488 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1490 #b3440 ASSERTION(rec->ur_fid2->id) failed
1492 ln -s foo $DIR/$tfile
1493 replay_barrier $SINGLEMDS
1494 #drop_reply "cat $DIR/$tfile"
1498 run_test 56 "don't replay a symlink open request (3440)"
1500 #recovery one mds-ost setattr from llog
1502 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1503 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1504 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1505 replay_barrier $SINGLEMDS
1508 $CHECKSTAT -t file $DIR/$tfile ||
1509 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1510 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1513 run_test 57 "test recovery from llog for setattr op"
1516 zconf_umount $(hostname) $MOUNT2
1520 #recovery many mds-ost setattr from llog
1522 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1523 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1524 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1525 createmany -o $DIR/$tdir/$tfile-%d 2500
1526 replay_barrier $SINGLEMDS
1529 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1530 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1531 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1532 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1533 error "unlinkmany $DIR/$tfile failed"
1536 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1542 trap cleanup_58 EXIT
1544 large_xattr_enabled &&
1545 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1546 # Original extended attribute can be long. Print a small version of
1547 # attribute if an error occurs
1548 local sm_msg=$(printf "%.9s" $orig)
1550 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1551 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1552 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1553 replay_barrier $SINGLEMDS
1554 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1556 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1557 [[ "$new" = "$orig" ]] ||
1558 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1559 rm -f $DIR/$tdir/$tfile
1562 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1564 run_test 58b "test replay of setxattr op"
1566 test_58c() { # bug 16570
1571 trap cleanup_58 EXIT
1573 if large_xattr_enabled; then
1574 local xattr_size=$(max_xattr_size)
1575 orig="$(generate_string $((xattr_size / 2)))"
1576 orig1="$(generate_string $xattr_size)"
1582 # PING_INTERVAL max(obd_timeout / 4, 1U)
1583 sleep $((TIMEOUT / 4))
1585 # Original extended attribute can be long. Print a small version of
1586 # attribute if an error occurs
1587 local sm_msg=$(printf "%.9s" $orig)
1588 local sm_msg1=$(printf "%.9s" $orig1)
1590 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1591 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1592 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1593 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1594 error "drop_request for setfattr failed"
1595 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1596 [[ "$new" = "$orig" ]] ||
1597 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1598 drop_reint_reply "setfattr -n trusted.foo1 \
1599 -v $orig1 $DIR/$tdir/$tfile" ||
1600 error "drop_reint_reply for setfattr failed"
1601 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1602 [[ "$new" = "$orig1" ]] ||
1603 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1604 rm -f $DIR/$tdir/$tfile
1608 run_test 58c "resend/reconstruct setxattr op"
1610 # log_commit_thread vs filter_destroy race used to lead to import use after free
1613 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1615 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1616 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1617 error "createmany create files failed"
1619 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1620 error "unlinkmany $DIR/$tdir/$tfile failed"
1621 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1622 do_facet ost1 "lctl set_param fail_loc=0x507"
1625 do_facet ost1 "lctl set_param fail_loc=0x0"
1629 run_test 59 "test log_commit_thread vs filter_destroy race"
1631 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1632 # bug 12086: should no oops and No ctxt error for this test
1634 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1635 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1636 error "createmany create files failed"
1637 replay_barrier $SINGLEMDS
1638 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1640 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1641 local no_ctxt=$(dmesg | grep "No ctxt")
1642 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1644 run_test 60 "test llog post recovery init vs llog unlink"
1646 #test race llog recovery thread vs llog cleanup
1647 test_61a() { # was test_61
1648 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1650 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1651 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1652 error "createmany create files failed"
1654 unlinkmany $DIR/$tdir/$tfile-%d 800
1655 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1656 set_nodes_failloc "$(osts_nodes)" 0x80000221
1661 set_nodes_failloc "$(osts_nodes)" 0x0
1663 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1664 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1667 run_test 61a "test race llog recovery vs llog cleanup"
1669 #test race mds llog sync vs llog cleanup
1671 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1672 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1673 facet_failover $SINGLEMDS
1676 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1679 run_test 61b "test race mds llog sync vs llog cleanup"
1681 #test race cancel cookie cb vs llog cleanup
1683 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1685 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1686 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1687 set_nodes_failloc "$(osts_nodes)" 0x80000222
1691 set_nodes_failloc "$(osts_nodes)" 0x0
1693 run_test 61c "test race mds llog sync vs llog cleanup"
1695 test_61d() { # bug 16002 # bug 17466 # bug 22137
1696 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1698 do_facet mgs "lctl set_param fail_loc=0x80000605"
1699 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1700 error "mgs start should have failed"
1701 do_facet mgs "lctl set_param fail_loc=0"
1702 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1704 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1706 test_62() { # Bug 15756 - don't mis-drop resent replay
1707 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1708 replay_barrier $SINGLEMDS
1709 createmany -o $DIR/$tdir/$tfile- 25 ||
1710 error "createmany create files failed"
1711 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1712 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1714 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1715 unlinkmany $DIR/$tdir/$tfile- 25 ||
1716 error "unlinkmany $DIR/$tdir/$tfile failed"
1719 run_test 62 "don't mis-drop resent replay"
1721 #Adaptive Timeouts (bug 3055)
1729 echo "Cleaning up AT ..."
1730 if [ -n "$ATOLDBASE" ]; then
1731 local at_history=$($LCTL get_param -n at_history)
1732 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1733 do_facet ost1 "lctl set_param at_history=$at_history" || true
1736 if [ $AT_MAX_SET -ne 0 ]; then
1737 for facet in mds client ost; do
1738 var=AT_MAX_SAVE_${facet}
1739 echo restore AT on $facet to saved value ${!var}
1740 at_max_set ${!var} $facet
1741 at_new=$(at_max_get $facet)
1742 echo Restored AT value on $facet $at_new
1743 [ $at_new -eq ${!var} ] ||
1744 error "AT value not restored SAVED ${!var} NEW $at_new"
1751 local at_max_new=600
1753 # Save at_max original values
1755 if [ $AT_MAX_SET -eq 0 ]; then
1756 # Suppose that all osts have the same at_max
1757 for facet in mds client ost; do
1758 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1762 for facet in mds client ost; do
1763 at_max=$(at_max_get $facet)
1764 if [ $at_max -ne $at_max_new ]; then
1765 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1766 at_max_set $at_max_new $facet
1771 if [ -z "$ATOLDBASE" ]; then
1772 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1773 # speed up the timebase so we can check decreasing AT
1774 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1775 do_facet ost1 "lctl set_param at_history=8" || true
1777 # sleep for a while to cool down, should be > 8s and also allow
1778 # at least one ping to be sent. simply use TIMEOUT to be safe.
1783 test_65a() #bug 3055
1785 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1787 at_start || return 0
1788 $LCTL dk > /dev/null
1790 $LCTL set_param debug="other"
1791 # Slow down a request to the current service time, this is critical
1792 # because previous tests may have caused this value to increase.
1793 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1794 awk '/portal 12/ {print $5}'`
1795 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1797 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1798 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1799 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1800 createmany -o $DIR/$tfile 10 > /dev/null
1801 unlinkmany $DIR/$tfile 10 > /dev/null
1802 # check for log message
1803 $LCTL dk | grep "Early reply #" || error "No early reply"
1805 # client should show REQ_DELAY estimates
1806 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1808 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1810 run_test 65a "AT: verify early replies"
1812 test_65b() #bug 3055
1814 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1816 at_start || return 0
1819 $LCTL set_param debug="other trace"
1820 $LCTL dk > /dev/null
1821 # Slow down a request to the current service time, this is critical
1822 # because previous tests may have caused this value to increase.
1823 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1824 multiop $DIR/$tfile Ow1yc
1825 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1826 awk '/portal 6/ {print $5}'`
1827 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1829 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1830 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1831 do_facet ost1 $LCTL set_param fail_loc=0x224
1834 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1835 # force some real bulk transfer
1836 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1838 do_facet ost1 $LCTL set_param fail_loc=0
1839 # check for log message
1840 $LCTL dk | grep "Early reply #" || error "No early reply"
1842 # client should show REQ_DELAY estimates
1843 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1845 run_test 65b "AT: verify early replies on packed reply / bulk"
1847 test_66a() #bug 3055
1849 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1851 at_start || return 0
1852 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1853 # adjust 5s at a time so no early reply is sent (within deadline)
1854 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1855 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1856 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1857 createmany -o $DIR/$tfile 20 > /dev/null
1858 unlinkmany $DIR/$tfile 20 > /dev/null
1859 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1860 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1861 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1862 createmany -o $DIR/$tfile 20 > /dev/null
1863 unlinkmany $DIR/$tfile 20 > /dev/null
1864 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1865 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1867 createmany -o $DIR/$tfile 20 > /dev/null
1868 unlinkmany $DIR/$tfile 20 > /dev/null
1869 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1870 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1871 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1872 echo "Current MDT timeout $CUR, worst $WORST"
1873 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1875 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1877 test_66b() #bug 3055
1879 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1881 at_start || return 0
1882 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1883 awk '/network/ {print $4}')
1884 $LCTL set_param fail_val=$(($ORIG + 5))
1885 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1886 $LCTL set_param fail_loc=0x50c
1887 ls $DIR/$tfile > /dev/null 2>&1
1888 $LCTL set_param fail_loc=0
1889 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1890 awk '/network/ {print $4}')
1891 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1892 awk '/network/ {print $6}')
1893 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1894 [ $WORST -gt $ORIG ] ||
1895 error "Worst $WORST should be worse than orig $ORIG"
1897 run_test 66b "AT: verify net latency adjusts"
1899 test_67a() #bug 3055
1901 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1903 at_start || return 0
1904 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1905 # sleeping threads may drive values above this
1906 do_facet ost1 "$LCTL set_param fail_val=400"
1907 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1908 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1909 createmany -o $DIR/$tfile 20 > /dev/null
1910 unlinkmany $DIR/$tfile 20 > /dev/null
1911 do_facet ost1 "$LCTL set_param fail_loc=0"
1912 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1913 ATTEMPTS=$(($CONN2 - $CONN1))
1914 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1915 [ $ATTEMPTS -gt 0 ] &&
1916 error_ignore bz13721 "AT should have prevented reconnect"
1919 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1921 test_67b() #bug 3055
1923 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1925 at_start || return 0
1926 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1928 # exhaust precreations on ost1
1929 local OST=$(ostname_from_index 0)
1930 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1931 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1932 osc.$mdtosc.prealloc_last_id)
1933 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1934 osc.$mdtosc.prealloc_next_id)
1936 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1937 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/${OST} || error "$SETSTRIPE failed"
1938 echo "Creating to objid $last_id on ost $OST..."
1939 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1940 do_facet ost1 "$LCTL set_param fail_val=20000"
1941 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1942 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1945 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1947 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1948 ATTEMPTS=$(($CONN2 - $CONN1))
1949 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1950 # do it again; should not timeout
1951 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1952 cp /etc/profile $DIR/$tfile || error "cp failed"
1953 do_facet ost1 "$LCTL set_param fail_loc=0"
1955 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1956 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1957 ATTEMPTS=$(($CONN3 - $CONN2))
1958 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1959 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1962 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1964 test_68 () #bug 13813
1966 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1968 at_start || return 0
1969 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1970 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1971 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1972 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
1973 local ENQ_MIN=$(cat $ldlm_enqueue_min)
1974 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
1975 echo $TIMEOUT >> $ldlm_enqueue_min
1976 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
1978 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1979 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tdir
1980 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
1981 $LCTL set_param fail_val=$(($TIMEOUT - 1))
1982 $LCTL set_param fail_loc=0x80000312
1983 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
1984 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
1985 $LCTL set_param fail_loc=0x80000312
1986 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
1987 $LCTL set_param fail_loc=0
1989 echo $ENQ_MIN >> $ldlm_enqueue_min
1990 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
1994 run_test 68 "AT: verify slowing locks"
1997 # end of AT tests includes above lines
1999 # start multi-client tests
2001 [ -z "$CLIENTS" ] &&
2002 { skip "Need two or more clients." && return; }
2003 [ $CLIENTCOUNT -lt 2 ] &&
2004 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2006 echo "mount clients $CLIENTS ..."
2007 zconf_mount_clients $CLIENTS $MOUNT
2009 local clients=${CLIENTS//,/ }
2010 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2011 for CLIENT in $clients; do
2012 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2013 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2014 error "dd failed on $CLIENT"
2017 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2018 for C in ${CLIENTS//,/ }; do
2019 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2020 of=/dev/null 2>/dev/null ||
2021 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2027 run_test 70a "check multi client t-f"
2029 check_for_process () {
2034 killall_process $clients "$prog" -0
2038 local clients=${CLIENTS:-$HOSTNAME}
2039 local mdscount=$MDSCOUNT
2041 # until LU-6844 is fixed, run on one MDT instead of disabling test
2044 zconf_mount_clients $clients $MOUNT
2047 [ "$SLOW" = "no" ] && duration=120
2048 # set duration to 900 because it takes some time to boot node
2049 [ "$FAILURE_MODE" = HARD ] && duration=900
2052 local start_ts=$(date +%s)
2053 local cmd="rundbench 1 -t $duration"
2055 if [ $mdscount -ge 2 ]; then
2056 test_mkdir -p -c$mdscount $DIR/$tdir
2057 $LFS setdirstripe -D -c$mdscount $DIR/$tdir
2059 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2060 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2061 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2062 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2065 #LU-1897 wait for all dbench copies to start
2066 while ! check_for_process $clients dbench; do
2067 elapsed=$(($(date +%s) - start_ts))
2068 if [ $elapsed -gt $duration ]; then
2069 killall_process $clients dbench
2070 error "dbench failed to start on $clients!"
2075 log "Started rundbench load pid=$pid ..."
2077 elapsed=$(($(date +%s) - start_ts))
2078 local num_failovers=0
2080 while [ $elapsed -lt $duration ]; do
2081 if ! check_for_process $clients dbench; then
2082 error_noexit "dbench stopped on some of $clients!"
2083 killall_process $clients dbench
2087 replay_barrier mds$fail_index
2088 sleep 1 # give clients a time to do operations
2089 # Increment the number of failovers
2090 num_failovers=$((num_failovers+1))
2091 log "$TESTNAME fail mds$fail_index $num_failovers times"
2093 elapsed=$(($(date +%s) - start_ts))
2094 if [ $fail_index -ge $mdscount ]; then
2097 fail_index=$((fail_index+1))
2101 wait $pid || error "rundbench load on $clients failed!"
2103 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2104 # end multi-client tests
2109 local monitor_pid=$3
2111 local start_ts=$(date +%s)
2112 local num_failovers=0
2115 elapsed=$(($(date +%s) - start_ts))
2116 while [ $elapsed -lt $duration ]; do
2117 fail_index=$((RANDOM%max_index+1))
2118 kill -0 $monitor_pid ||
2119 error "$monitor_pid stopped"
2121 replay_barrier mds$fail_index
2123 # Increment the number of failovers
2124 num_failovers=$((num_failovers+1))
2125 log "$TESTNAME fail mds$fail_index $num_failovers times"
2127 elapsed=$(($(date +%s) - start_ts))
2133 rm -f $DIR/replay-single.70c.lck
2138 local clients=${CLIENTS:-$HOSTNAME}
2141 zconf_mount_clients $clients $MOUNT
2144 [ "$SLOW" = "no" ] && duration=180
2145 # set duration to 900 because it takes some time to boot node
2146 [ "$FAILURE_MODE" = HARD ] && duration=600
2149 local start_ts=$(date +%s)
2151 trap cleanup_70c EXIT
2153 while [ ! -e $DIR/replay-single.70c.lck ]; do
2154 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2155 if [ $MDSCOUNT -ge 2 ]; then
2156 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2157 error "set default dirstripe failed"
2159 cd $DIR/$tdir || break
2160 tar cf - /etc | tar xf - || error "tar failed in loop"
2164 echo "Started tar $tar_70c_pid"
2166 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2167 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2169 touch $DIR/replay-single.70c.lck
2170 wait $tar_70c_pid || error "$?: tar failed"
2175 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2179 kill -9 $mkdir_70d_pid
2183 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2184 local clients=${CLIENTS:-$HOSTNAME}
2187 zconf_mount_clients $clients $MOUNT
2190 [ "$SLOW" = "no" ] && duration=180
2191 # set duration to 900 because it takes some time to boot node
2192 [ "$FAILURE_MODE" = HARD ] && duration=900
2197 local start_ts=$(date +%s)
2199 trap cleanup_70d EXIT
2202 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2206 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2211 touch $DIR/$tdir/test/a || {
2215 mkdir $DIR/$tdir/test/b || {
2219 rm -rf $DIR/$tdir/test || {
2224 touch $DIR/$tdir/test1/a || {
2228 mkdir $DIR/$tdir/test1/b || {
2233 rm -rf $DIR/$tdir/test1 || {
2240 echo "Started $mkdir_70d_pid"
2242 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2243 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2248 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2252 kill -9 $rename_70e_pid
2256 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2257 local clients=${CLIENTS:-$HOSTNAME}
2260 echo ha > /proc/sys/lnet/debug
2261 zconf_mount_clients $clients $MOUNT
2264 [ "$SLOW" = "no" ] && duration=180
2265 # set duration to 900 because it takes some time to boot node
2266 [ "$FAILURE_MODE" = HARD ] && duration=900
2269 $LFS mkdir -i0 $DIR/$tdir/test_0
2270 $LFS mkdir -i0 $DIR/$tdir/test_1
2271 touch $DIR/$tdir/test_0/a
2272 touch $DIR/$tdir/test_1/b
2273 trap cleanup_70e EXIT
2276 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > \
2282 checkstat $DIR/$tdir/test_0/a && {
2283 echo "a still exists"
2287 checkstat $DIR/$tdir/test_1/b || {
2288 echo "b still exists"
2292 touch $DIR/$tdir/test_0/a || {
2293 echo "touch a fails"
2297 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > \
2305 echo "Started $rename_70e_pid"
2307 random_fail_mdt 2 $duration $rename_70e_pid
2308 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2313 run_test 70e "rename cross-MDT with random fails"
2317 kill -9 $mkdir_71a_pid
2320 random_double_fail_mdt() {
2323 local monitor_pid=$3
2325 local start_ts=$(date +%s)
2326 local num_failovers=0
2330 elapsed=$(($(date +%s) - start_ts))
2331 while [ $elapsed -lt $duration ]; do
2332 fail_index=$((RANDOM%max_index + 1))
2333 if [ $fail_index -eq $max_index ]; then
2336 second_index=$((fail_index + 1))
2338 kill -0 $monitor_pid ||
2339 error "$monitor_pid stopped"
2341 replay_barrier mds$fail_index
2342 replay_barrier mds$second_index
2344 # Increment the number of failovers
2345 num_failovers=$((num_failovers+1))
2346 log "fail mds$fail_index mds$second_index $num_failovers times"
2347 fail mds${fail_index},mds${second_index}
2348 elapsed=$(($(date +%s) - start_ts))
2353 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2354 local clients=${CLIENTS:-$HOSTNAME}
2357 zconf_mount_clients $clients $MOUNT
2360 [ "$SLOW" = "no" ] && duration=180
2361 # set duration to 900 because it takes some time to boot node
2362 [ "$FAILURE_MODE" = HARD ] && duration=900
2367 local start_ts=$(date +%s)
2369 trap cleanup_71a EXIT
2372 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2373 rmdir $DIR/$tdir/test
2377 echo "Started $mkdir_71a_pid"
2379 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2380 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2385 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2388 multiop_bg_pause $DIR/$tfile O_tSc ||
2389 error "multiop_bg_pause $DIR/$tfile failed"
2393 replay_barrier $SINGLEMDS
2394 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2395 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2398 wait $pid || error "multiop pid failed"
2399 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2402 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2405 multiop_bg_pause $DIR/$tfile O_tSc ||
2406 error "multiop_bg_pause $DIR/$tfile failed"
2410 replay_barrier $SINGLEMDS
2411 #define OBD_FAIL_LDLM_REPLY 0x30c
2412 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
2415 wait $pid || error "multiop pid failed"
2416 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2419 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2423 local clients=${CLIENTS:-$HOSTNAME}
2425 zconf_umount_clients $clients $MOUNT
2427 facet_failover $SINGLEMDS
2428 zconf_mount_clients $clients $MOUNT
2430 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2431 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2432 clients_up || error "client evicted: $?"
2435 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2437 remote_dir_check_80() {
2442 diridx=$($GETSTRIPE -M $remote_dir) ||
2443 error "$GETSTRIPE -M $remote_dir failed"
2444 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
2446 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2447 fileidx=$($GETSTRIPE -M $remote_dir/f-1) ||
2448 error "$GETSTRIPE -M $remote_dir/f-1 failed"
2449 [ $fileidx -eq $MDTIDX ] || error "$fileidx != $MDTIDX"
2455 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2456 ([ $FAILURE_MODE == "HARD" ] &&
2457 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2458 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2462 local remote_dir=$DIR/$tdir/remote_dir
2464 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2465 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2466 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2467 $LFS mkdir -i $MDTIDX $remote_dir &
2473 wait $CLIENT_PID || error "remote creation failed"
2475 remote_dir_check_80 || error "remote dir check failed"
2476 rm -rf $DIR/$tdir || error "rmdir failed"
2480 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2483 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2484 ([ $FAILURE_MODE == "HARD" ] &&
2485 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2486 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2490 local remote_dir=$DIR/$tdir/remote_dir
2492 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2493 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2494 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2495 $LFS mkdir -i $MDTIDX $remote_dir &
2500 fail mds$((MDTIDX + 1))
2502 wait $CLIENT_PID || error "remote creation failed"
2504 remote_dir_check_80 || error "remote dir check failed"
2505 rm -rf $DIR/$tdir || error "rmdir failed"
2509 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2512 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2513 ([ $FAILURE_MODE == "HARD" ] &&
2514 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2515 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2519 local remote_dir=$DIR/$tdir/remote_dir
2521 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2522 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2523 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2524 $LFS mkdir -i $MDTIDX $remote_dir &
2530 fail mds$((MDTIDX + 1))
2532 wait $CLIENT_PID || error "remote creation failed"
2534 remote_dir_check_80 || error "remote dir check failed"
2535 rm -rf $DIR/$tdir || error "rmdir failed"
2539 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2542 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2544 local remote_dir=$DIR/$tdir/remote_dir
2546 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2547 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2548 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2549 $LFS mkdir -i $MDTIDX $remote_dir &
2552 # sleep 3 seconds to make sure MDTs are failed after
2553 # lfs mkdir -i has finished on all of MDTs.
2558 fail mds${MDTIDX},mds$((MDTIDX + 1))
2560 wait $CLIENT_PID || error "remote creation failed"
2562 remote_dir_check_80 || error "remote dir check failed"
2563 rm -rf $DIR/$tdir || error "rmdir failed"
2567 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2570 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2571 ([ $FAILURE_MODE == "HARD" ] &&
2572 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2573 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2577 local remote_dir=$DIR/$tdir/remote_dir
2579 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2580 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2581 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2582 $LFS mkdir -i $MDTIDX $remote_dir &
2585 # sleep 3 seconds to make sure MDTs are failed after
2586 # lfs mkdir -i has finished on all of MDTs.
2592 wait $CLIENT_PID || error "remote creation failed"
2594 remote_dir_check_80 || error "remote dir check failed"
2595 rm -rf $DIR/$tdir || error "rmdir failed"
2599 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2602 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2603 ([ $FAILURE_MODE == "HARD" ] &&
2604 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2605 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2608 local remote_dir=$DIR/$tdir/remote_dir
2610 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2611 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2612 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2613 $LFS mkdir -i $MDTIDX $remote_dir &
2617 fail mds$((MDTIDX + 1))
2619 wait $CLIENT_PID || error "remote creation failed"
2621 remote_dir_check_80 || error "remote dir check failed"
2622 rm -rf $DIR/$tdir || error "rmdir failed"
2626 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2629 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2630 ([ $FAILURE_MODE == "HARD" ] &&
2631 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2632 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2636 local remote_dir=$DIR/$tdir/remote_dir
2638 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2639 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2640 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2641 $LFS mkdir -i $MDTIDX $remote_dir &
2644 # sleep 3 seconds to make sure MDTs are failed after
2645 # lfs mkdir -i has finished on all of MDTs.
2651 fail mds$((MDTIDX + 1))
2653 wait $CLIENT_PID || error "remote creation failed"
2655 remote_dir_check_80 || error "remote dir check failed"
2656 rm -rf $DIR/$tdir || error "rmdir failed"
2660 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2663 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2665 local remote_dir=$DIR/$tdir/remote_dir
2667 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2668 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2669 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2670 $LFS mkdir -i $MDTIDX $remote_dir &
2673 # sleep 3 seconds to make sure MDTs are failed after
2674 # lfs mkdir -i has finished on all of MDTs.
2679 fail mds${MDTIDX},mds$((MDTIDX + 1))
2681 wait $CLIENT_PID || error "remote dir creation failed"
2683 remote_dir_check_80 || error "remote dir check failed"
2684 rm -rf $DIR/$tdir || error "rmdir failed"
2688 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2691 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2692 ([ $FAILURE_MODE == "HARD" ] &&
2693 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2694 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2698 local remote_dir=$DIR/$tdir/remote_dir
2700 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2701 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2703 touch $remote_dir || error "touch $remote_dir failed"
2704 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2705 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2710 fail mds$((MDTIDX + 1))
2712 wait $CLIENT_PID || error "rm remote dir failed"
2714 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2716 rm -rf $DIR/$tdir || error "rmdir failed"
2720 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2723 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2724 ([ $FAILURE_MODE == "HARD" ] &&
2725 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2726 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2729 local remote_dir=$DIR/$tdir/remote_dir
2731 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2732 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2734 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2735 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2742 wait $CLIENT_PID || error "rm remote dir failed"
2744 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2746 rm -rf $DIR/$tdir || error "rmdir failed"
2750 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2753 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2754 ([ $FAILURE_MODE == "HARD" ] &&
2755 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2756 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2760 local remote_dir=$DIR/$tdir/remote_dir
2762 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2763 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2765 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2766 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2773 fail mds$((MDTIDX + 1))
2775 wait $CLIENT_PID || error "rm remote dir failed"
2777 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2779 rm -rf $DIR/$tdir || error "rmdir failed"
2783 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2786 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2788 local remote_dir=$DIR/$tdir/remote_dir
2790 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2791 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2793 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2794 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2800 fail mds${MDTIDX},mds$((MDTIDX + 1))
2802 wait $CLIENT_PID || error "rm remote dir failed"
2804 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2806 rm -rf $DIR/$tdir || error "rmdir failed"
2810 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2813 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2814 ([ $FAILURE_MODE == "HARD" ] &&
2815 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2816 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2820 local remote_dir=$DIR/$tdir/remote_dir
2822 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2823 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2825 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2826 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2829 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2834 wait $CLIENT_PID || error "rm remote dir failed"
2836 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2838 rm -rf $DIR/$tdir || error "rmdir failed"
2842 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2845 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2846 ([ $FAILURE_MODE == "HARD" ] &&
2847 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2848 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2852 local remote_dir=$DIR/$tdir/remote_dir
2854 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2855 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2857 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2858 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2863 fail mds$((MDTIDX + 1))
2865 wait $CLIENT_PID || error "rm remote dir failed"
2867 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2869 rm -rf $DIR/$tdir || error "rmdir failed"
2873 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
2876 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2877 ([ $FAILURE_MODE == "HARD" ] &&
2878 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2879 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2883 local remote_dir=$DIR/$tdir/remote_dir
2885 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2886 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2888 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2889 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2896 fail mds$((MDTIDX + 1))
2898 wait $CLIENT_PID || error "rm remote dir failed"
2900 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2902 rm -rf $DIR/$tdir || error "rmdir failed"
2906 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
2909 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2911 local remote_dir=$DIR/$tdir/remote_dir
2913 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2914 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2916 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2917 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2923 fail mds${MDTIDX},mds$((MDTIDX + 1))
2925 wait $CLIENT_PID || error "rm remote dir failed"
2927 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2929 rm -rf $DIR/$tdir || error "rmdir failed"
2933 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
2936 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
2937 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
2938 createmany -o $DIR/$tfile- 1 &
2942 client_up || client_up || true # reconnect
2944 run_test 84a "stale open during export disconnect"
2946 test_85a() { #bug 16774
2947 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2949 for i in $(seq 100); do
2950 echo "tag-$i" > $DIR/$tfile-$i
2951 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
2954 lov_id=$(lctl dl | grep "clilov")
2955 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}')
2956 count=$(lctl get_param -n \
2957 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
2958 echo "before recovery: unused locks count = $count"
2962 count2=$(lctl get_param -n \
2963 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
2964 echo "after recovery: unused locks count = $count2"
2966 if [ $count2 -ge $count ]; then
2967 error "unused locks are not canceled"
2970 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
2972 test_85b() { #bug 16774
2973 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2975 do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME ||
2976 error "unable to create pool $TESTNAME"
2977 do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $FSNAME-OST0000 ||
2978 error "unable to add pool $TESTNAME"
2980 $SETSTRIPE -c 1 -p $FSNAME.$TESTNAME $DIR
2982 for i in $(seq 100); do
2983 dd if=/dev/urandom of=$DIR/$tfile-$i bs=4096 \
2984 count=32 >/dev/null 2>&1
2987 cancel_lru_locks osc
2989 for i in $(seq 100); do
2990 dd if=$DIR/$tfile-$i of=/dev/null bs=4096 \
2991 count=32 >/dev/null 2>&1
2994 lov_id=$(lctl dl | grep "clilov")
2995 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
2996 count=$(lctl get_param -n \
2997 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
2998 echo "before recovery: unused locks count = $count"
2999 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3003 count2=$(lctl get_param \
3004 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3005 echo "after recovery: unused locks count = $count2"
3007 do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $FSNAME-OST0000 ||
3008 error "unable to remove pool $TESTNAME"
3009 do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME ||
3010 error "unable to destroy the pool $TESTNAME"
3012 if [ $count2 -ge $count ]; then
3013 error "unused locks are not canceled"
3016 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3019 local clients=${CLIENTS:-$HOSTNAME}
3021 zconf_umount_clients $clients $MOUNT
3022 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3023 remount_facet $SINGLEMDS
3024 zconf_mount_clients $clients $MOUNT
3026 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3029 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3032 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
3033 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3034 error "dd to $DIR/$tfile failed"
3035 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3036 cancel_lru_locks osc
3038 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3039 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3040 if [ $cksum != $cksum2 ] ; then
3041 error "New checksum $cksum2 does not match original $cksum"
3044 run_test 87 "write replay"
3047 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3050 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
3051 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3052 error "dd to $DIR/$tfile failed"
3053 sleep 1 # Give it a chance to flush dirty data
3054 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3055 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3056 cancel_lru_locks osc
3058 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3059 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3060 if [ $cksum != $cksum2 ] ; then
3061 error "New checksum $cksum2 does not match original $cksum"
3064 run_test 87b "write replay with changed data (checksum resend)"
3066 test_88() { #bug 17485
3067 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3068 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3070 $SETSTRIPE -i 0 -c 1 $DIR/$tdir || error "$SETSTRIPE"
3073 replay_barrier $SINGLEMDS
3075 # exhaust precreations on ost1
3076 local OST=$(ostname_from_index 0)
3077 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3078 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
3079 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
3080 echo "before test: last_id = $last_id, next_id = $next_id"
3082 echo "Creating to objid $last_id on ost $OST..."
3083 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3084 error "createmany create files to last_id failed"
3086 #create some files to use some uncommitted objids
3087 last_id=$(($last_id + 1))
3088 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3089 error "createmany create files with uncommitted objids failed"
3091 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
3092 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
3093 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3095 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3096 # it has to take care about the affected facets, bug20407
3097 local affected_mds1=$(affected_facets mds1)
3098 local affected_ost1=$(affected_facets ost1)
3100 shutdown_facet $SINGLEMDS
3103 reboot_facet $SINGLEMDS
3104 change_active $affected_mds1
3105 wait_for_facet $affected_mds1
3106 mount_facets $affected_mds1 || error "Restart of mds failed"
3109 change_active $affected_ost1
3110 wait_for_facet $affected_ost1
3111 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3115 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
3116 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
3117 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3119 # create new files, which should use new objids, and ensure the orphan
3120 # cleanup phase for ost1 is completed at the same time
3121 for i in $(seq 8); do
3122 file_id=$(($last_id + 10 + $i))
3123 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3126 # if the objids were not recreated, then "ls" will fail with -ENOENT
3127 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3130 # write into previously created files
3131 for i in $(seq 8); do
3132 file_id=$(($last_id + $i))
3133 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3134 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3137 # compare the content
3138 for i in $(seq 8); do
3139 file_id=$(($last_id + $i))
3140 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3141 error "the content of file is modified!"
3146 run_test 88 "MDS should not assign same objid to different files "
3149 cancel_lru_locks osc
3150 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3151 rm -f $DIR/$tdir/$tfile
3153 wait_delete_completed
3154 BLOCKS1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
3155 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
3156 dd if=/dev/zero bs=1M count=10 of=$DIR/$tdir/$tfile
3159 facet_failover $SINGLEMDS
3160 rm $DIR/$tdir/$tfile
3163 zconf_mount $(hostname) $MOUNT || error "mount fails"
3164 client_up || error "client_up failed"
3166 wait_delete_completed
3167 BLOCKS2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
3168 [ $((BLOCKS2 - BLOCKS1)) -le 4 ] ||
3169 error $((BLOCKS2 - BLOCKS1)) blocks leaked
3172 run_test 89 "no disk space leak on late ost connection"
3178 change_active $facet
3179 wait_for_facet $facet
3180 mount_facet $facet || error "Restart of $facet failed"
3184 test_90() { # bug 19494
3185 local dir=$DIR/$tdir
3186 local ostfail=$(get_random_entry $(get_facets OST))
3188 if [[ $FAILURE_MODE = HARD ]]; then
3189 local affected=$(affected_facets $ostfail);
3190 if [[ "$affected" != $ostfail ]]; then
3191 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
3196 mkdir $dir || error "mkdir $dir failed"
3198 echo "Create the files"
3200 # file "f${index}" striped over 1 OST
3201 # file "all" striped over all OSTs
3203 $SETSTRIPE -c $OSTCOUNT $dir/all ||
3204 error "setstripe failed to create $dir/all"
3206 for (( i=0; i<$OSTCOUNT; i++ )); do
3208 $SETSTRIPE -i $i -c 1 $f || error "$SETSTRIPE failed to create $f"
3210 # confirm setstripe actually created the stripe on the requested OST
3211 local uuid=$(ostuuid_from_index $i)
3212 for file in f$i all; do
3213 if [[ $dir/$file != $($LFS find --obd $uuid --name $file $dir) ]]; then
3214 $GETSTRIPE $dir/$file
3215 error wrong stripe: $file, uuid: $uuid
3220 # Before failing an OST, get its obd name and index
3221 local varsvc=${ostfail}_svc
3222 local obd=$(do_facet $ostfail lctl get_param \
3223 -n obdfilter.${!varsvc}.uuid)
3224 local index=$(($(facet_number $ostfail) - 1))
3226 echo "Fail $ostfail $obd, display the list of affected files"
3227 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3229 trap "cleanup_90 $ostfail" EXIT INT
3230 echo "General Query: lfs find $dir"
3231 local list=$($LFS find $dir)
3233 for (( i=0; i<$OSTCOUNT; i++ )); do
3234 list_member "$list" $dir/f$i ||
3235 error_noexit "lfs find $dir: no file f$i"
3237 list_member "$list" $dir/all ||
3238 error_noexit "lfs find $dir: no file all"
3240 # focus on the missing OST,
3241 # we expect to see only two files affected: "f$(index)" and "all"
3243 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3244 list=$($LFS find --obd $obd $dir)
3246 for file in all f$index; do
3247 list_member "$list" $dir/$file ||
3248 error_noexit "lfs find does not report the affected $obd for $file"
3251 [[ $(echo $list | wc -w) -eq 2 ]] ||
3252 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3254 echo "Check getstripe: $GETSTRIPE -r --obd $obd"
3255 list=$($GETSTRIPE -r --obd $obd $dir)
3257 for file in all f$index; do
3258 echo "$list" | grep $dir/$file ||
3259 error_noexit "lfs getsripe does not report the affected $obd for $file"
3264 run_test 90 "lfs find identifies the missing striped file segments"
3267 local server_version=$(lustre_version_code $SINGLEMDS)
3268 [[ $server_version -ge $(version_code 2.6.90) ]] ||
3269 [[ $server_version -ge $(version_code 2.5.4) &&
3270 $server_version -lt $(version_code 2.5.50) ]] ||
3271 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
3273 cancel_lru_locks osc
3275 $SETSTRIPE -i 0 -c 1 $DIR/$tfile ||
3276 error "$SETSTRIPE $DIR/$tfile failed"
3277 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3278 error "dd to $DIR/$tfile failed"
3279 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3280 # We need to emulate a state that OST is waiting for other clients
3281 # not completing the recovery. Final ping is queued, but reply will be
3282 # sent on the recovery completion. It is done by sleep before
3283 # processing final pings
3284 do_facet ost1 "$LCTL set_param fail_val=40"
3285 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3288 run_test 93 "replay + reconnect"
3290 striped_dir_check_100() {
3291 local striped_dir=$DIR/$tdir/striped_dir
3292 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3294 $LFS getdirstripe $striped_dir
3295 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3297 createmany -o $striped_dir/f-%d 20 ||
3298 error "creation failed under striped dir"
3302 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3303 ([ $FAILURE_MODE == "HARD" ] &&
3304 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3305 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3308 local striped_dir=$DIR/$tdir/striped_dir
3311 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3313 #To make sure MDT1 and MDT0 are connected
3314 #otherwise it may create single stripe dir here
3315 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3317 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3318 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3319 $LFS setdirstripe -i0 -c2 $striped_dir &
3322 fail mds$((MDTIDX + 1))
3324 wait $CLIENT_PID || error "striped dir creation failed"
3326 striped_dir_check_100 || error "striped dir check failed"
3327 rm -rf $DIR/$tdir || error "rmdir failed"
3329 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3332 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3333 ([ $FAILURE_MODE == "HARD" ] &&
3334 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3335 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3338 local striped_dir=$DIR/$tdir/striped_dir
3341 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3343 #To make sure MDT1 and MDT0 are connected
3344 #otherwise it may create single stripe dir here
3345 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3347 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3348 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3349 $LFS mkdir -i0 -c2 $striped_dir &
3354 wait $CLIENT_PID || error "striped dir creation failed"
3356 striped_dir_check_100 || error "striped dir check failed"
3357 rm -rf $DIR/$tdir || error "rmdir failed"
3359 run_test 100b "DNE: create striped dir, fail MDT0"
3361 test_101() { #LU-5648
3362 mkdir -p $DIR/$tdir/d1
3363 mkdir -p $DIR/$tdir/d2
3364 touch $DIR/$tdir/file0
3367 replay_barrier $SINGLEMDS
3368 for i in $(seq $num) ; do
3369 echo test$i > $DIR/$tdir/d1/file$i
3372 fail_abort $SINGLEMDS
3373 for i in $(seq $num) ; do
3374 touch $DIR/$tdir/d2/file$i
3375 test -s $DIR/$tdir/d2/file$i &&
3376 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3381 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3390 [[ $(lctl get_param mdc.*.import |
3391 grep "connect_flags:.*multi_mod_rpc") ]] ||
3392 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3394 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3395 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3396 facet="mds$((0x$idx + 1))"
3398 # get current value of max_mod_rcps_in_flight
3399 num=$($LCTL get_param -n \
3400 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3401 # set default value if client does not support multi mod RPCs
3402 [ -z "$num" ] && num=1
3404 echo "creating $num files ..."
3406 for i in $(seq $num); do
3407 touch $DIR/$tdir/file-$i
3410 # drop request on MDT to force resend
3411 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3412 do_facet $facet "$LCTL set_param fail_loc=0x159"
3413 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3414 for i in $(seq $num); do
3415 chmod 0600 $DIR/$tdir/file-$i &
3419 do_facet $facet "$LCTL set_param fail_loc=0"
3420 for pid in $pids; do
3421 wait $pid || error "chmod failed"
3423 echo "done ($(date +%H:%M:%S))"
3425 # check chmod succeed
3426 for i in $(seq $num); do
3427 checkstat -vp 0600 $DIR/$tdir/file-$i
3432 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3441 [[ $(lctl get_param mdc.*.import |
3442 grep "connect_flags:.*multi_mod_rpc") ]] ||
3443 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3445 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3446 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3447 facet="mds$((0x$idx + 1))"
3449 # get current value of max_mod_rcps_in_flight
3450 num=$($LCTL get_param -n \
3451 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3452 # set default value if client does not support multi mod RPCs
3453 [ -z "$num" ] && num=1
3455 echo "creating $num files ..."
3457 for i in $(seq $num); do
3458 touch $DIR/$tdir/file-$i
3461 # drop reply on MDT to force reconstruction
3462 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3463 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3464 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3465 for i in $(seq $num); do
3466 chmod 0600 $DIR/$tdir/file-$i &
3470 do_facet $facet "$LCTL set_param fail_loc=0"
3471 for pid in $pids; do
3472 wait $pid || error "chmod failed"
3474 echo "done ($(date +%H:%M:%S))"
3476 # check chmod succeed
3477 for i in $(seq $num); do
3478 checkstat -vp 0600 $DIR/$tdir/file-$i
3483 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3492 [[ $(lctl get_param mdc.*.import |
3493 grep "connect_flags:.*multi_mod_rpc") ]] ||
3494 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3496 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3497 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3498 facet="mds$((0x$idx + 1))"
3500 # get current value of max_mod_rcps_in_flight
3501 num=$($LCTL get_param -n \
3502 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3503 # set default value if client does not support multi mod RPCs
3504 [ -z "$num" ] && num=1
3506 echo "creating $num files ..."
3508 for i in $(seq $num); do
3509 touch $DIR/$tdir/file-$i
3512 replay_barrier $facet
3515 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3516 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3517 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3518 for i in $(seq $num); do
3519 chmod 0600 $DIR/$tdir/file-$i &
3523 do_facet $facet "$LCTL set_param fail_loc=0"
3528 for pid in $pids; do
3529 wait $pid || error "chmod failed"
3531 echo "done ($(date +%H:%M:%S))"
3533 # check chmod succeed
3534 for i in $(seq $num); do
3535 checkstat -vp 0600 $DIR/$tdir/file-$i
3540 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3549 [[ $(lctl get_param mdc.*.import |
3550 grep "connect_flags:.*multi_mod_rpc") ]] ||
3551 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3553 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3554 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3555 facet="mds$((0x$idx + 1))"
3557 # get current value of max_mod_rcps_in_flight
3558 num=$($LCTL get_param -n \
3559 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3560 # set default value if client does not support multi mod RPCs
3561 [ -z "$num" ] && num=1
3563 echo "creating $num files ..."
3565 for i in $(seq $num); do
3566 touch $DIR/$tdir/file-$i
3570 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3571 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3572 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3573 for i in $(seq $num); do
3574 chmod 0600 $DIR/$tdir/file-$i &
3579 # write MDT transactions to disk
3580 do_facet $facet "sync; sync; sync"
3582 do_facet $facet "$LCTL set_param fail_loc=0"
3587 for pid in $pids; do
3588 wait $pid || error "chmod failed"
3590 echo "done ($(date +%H:%M:%S))"
3592 # check chmod succeed
3593 for i in $(seq $num); do
3594 checkstat -vp 0600 $DIR/$tdir/file-$i
3599 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3602 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3603 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3604 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3607 createmany -o $DIR/$tdir/t- 30 ||
3608 error "create files on remote directory failed"
3610 rm -rf $DIR/$tdir/t-*
3612 #MDS should crash with tr->otr_next_id overflow
3615 run_test 103 "Check otr_next_id overflow"
3618 check_striped_dir_110()
3620 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3621 error "create striped dir failed"
3622 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3623 [ $stripe_count -eq $MDSCOUNT ] ||
3624 error "$stripe_count != 2 after recovery"
3628 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3629 ([ $FAILURE_MODE == "HARD" ] &&
3630 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3631 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3636 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3639 check_striped_dir_110 || error "check striped_dir failed"
3640 rm -rf $DIR/$tdir || error "rmdir failed"
3644 run_test 110a "DNE: create striped dir, fail MDT1"
3647 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3648 ([ $FAILURE_MODE == "HARD" ] &&
3649 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3650 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3655 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3658 zconf_mount $(hostname) $MOUNT
3659 client_up || return 1
3661 check_striped_dir_110 || error "check striped_dir failed"
3663 rm -rf $DIR/$tdir || error "rmdir failed"
3667 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3670 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3671 ([ $FAILURE_MODE == "HARD" ] &&
3672 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3673 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3678 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3681 check_striped_dir_110 || error "check striped_dir failed"
3683 rm -rf $DIR/$tdir || error "rmdir failed"
3687 run_test 110c "DNE: create striped dir, fail MDT2"
3690 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3691 ([ $FAILURE_MODE == "HARD" ] &&
3692 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3693 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3698 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3701 zconf_mount $(hostname) $MOUNT
3702 client_up || return 1
3704 check_striped_dir_110 || error "check striped_dir failed"
3706 rm -rf $DIR/$tdir || error "rmdir failed"
3710 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3713 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3714 ([ $FAILURE_MODE == "HARD" ] &&
3715 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3716 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3721 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3725 zconf_mount $(hostname) $MOUNT
3726 client_up || return 1
3728 check_striped_dir_110 || error "check striped_dir failed"
3730 rm -rf $DIR/$tdir || error "rmdir failed"
3734 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3737 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3738 ([ $FAILURE_MODE == "HARD" ] &&
3739 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3740 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3746 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3749 check_striped_dir_110 || error "check striped_dir failed"
3751 rm -rf $DIR/$tdir || error "rmdir failed"
3755 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3758 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3759 ([ $FAILURE_MODE == "HARD" ] &&
3760 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3761 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3766 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3770 zconf_mount $(hostname) $MOUNT
3771 client_up || return 1
3773 check_striped_dir_110 || error "check striped_dir failed"
3775 rm -rf $DIR/$tdir || error "rmdir failed"
3779 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
3782 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3783 ([ $FAILURE_MODE == "HARD" ] &&
3784 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3785 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3789 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3791 rm -rf $DIR/$tdir/striped_dir
3794 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3795 error "striped dir still exists"
3798 run_test 111a "DNE: unlink striped dir, fail MDT1"
3801 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3802 ([ $FAILURE_MODE == "HARD" ] &&
3803 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3804 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3808 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3810 rm -rf $DIR/$tdir/striped_dir
3813 zconf_mount $(hostname) $MOUNT
3814 client_up || return 1
3816 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3817 error "striped dir still exists"
3820 run_test 111b "DNE: unlink striped dir, fail MDT2"
3823 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3824 ([ $FAILURE_MODE == "HARD" ] &&
3825 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3826 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3830 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3832 rm -rf $DIR/$tdir/striped_dir
3836 zconf_mount $(hostname) $MOUNT
3837 client_up || return 1
3838 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3839 error "striped dir still exists"
3842 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
3845 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3846 ([ $FAILURE_MODE == "HARD" ] &&
3847 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3848 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3852 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3854 rm -rf $DIR/$tdir/striped_dir
3858 zconf_mount $(hostname) $MOUNT
3859 client_up || return 1
3860 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3861 error "striped dir still exists"
3865 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3868 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3869 ([ $FAILURE_MODE == "HARD" ] &&
3870 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3871 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3875 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3877 rm -rf $DIR/$tdir/striped_dir
3880 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3881 error "striped dir still exists"
3884 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
3887 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3888 ([ $FAILURE_MODE == "HARD" ] &&
3889 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3890 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3894 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3896 rm -rf $DIR/$tdir/striped_dir
3899 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3900 error "striped dir still exists"
3903 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
3906 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3907 ([ $FAILURE_MODE == "HARD" ] &&
3908 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3909 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3913 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
3916 rm -rf $DIR/$tdir/striped_dir
3918 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
3919 error "striped dir still exists"
3922 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
3924 test_112_rename_prepare() {
3925 mkdir -p $DIR/$tdir/src_dir
3926 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
3927 error "create remote source failed"
3929 touch $DIR/$tdir/src_dir/src_child/a
3931 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
3932 error "create remote target dir failed"
3934 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
3935 error "create remote target child failed"
3940 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
3941 error "src_child still exists after rename"
3943 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
3944 error "missing file(a) after rename"
3948 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
3949 ([ $FAILURE_MODE == "HARD" ] &&
3950 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3951 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3954 test_112_rename_prepare
3957 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
3958 error "rename dir cross MDT failed!"
3962 rm -rf $DIR/$tdir || error "rmdir failed"
3964 run_test 112a "DNE: cross MDT rename, fail MDT1"
3967 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
3968 ([ $FAILURE_MODE == "HARD" ] &&
3969 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3970 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3973 test_112_rename_prepare
3976 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
3977 error "rename dir cross MDT failed!"
3982 rm -rf $DIR/$tdir || error "rmdir failed"
3984 run_test 112b "DNE: cross MDT rename, fail MDT2"
3987 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
3988 ([ $FAILURE_MODE == "HARD" ] &&
3989 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3990 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3993 test_112_rename_prepare
3996 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
3997 error "rename dir cross MDT failed!"
4002 rm -rf $DIR/$tdir || error "rmdir failed"
4004 run_test 112c "DNE: cross MDT rename, fail MDT3"
4007 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4008 ([ $FAILURE_MODE == "HARD" ] &&
4009 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4010 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4013 test_112_rename_prepare
4016 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4017 error "rename dir cross MDT failed!"
4022 rm -rf $DIR/$tdir || error "rmdir failed"
4024 run_test 112d "DNE: cross MDT rename, fail MDT4"
4027 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4028 ([ $FAILURE_MODE == "HARD" ] &&
4029 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4030 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4033 test_112_rename_prepare
4037 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4038 error "rename dir cross MDT failed!"
4043 rm -rf $DIR/$tdir || error "rmdir failed"
4045 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4048 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4049 ([ $FAILURE_MODE == "HARD" ] &&
4050 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4051 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4054 test_112_rename_prepare
4058 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4059 error "rename dir cross MDT failed!"
4064 rm -rf $DIR/$tdir || error "rmdir failed"
4066 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4069 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4070 ([ $FAILURE_MODE == "HARD" ] &&
4071 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4072 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4075 test_112_rename_prepare
4079 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4080 error "rename dir cross MDT failed!"
4085 rm -rf $DIR/$tdir || error "rmdir failed"
4087 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4090 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4091 ([ $FAILURE_MODE == "HARD" ] &&
4092 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4093 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4096 test_112_rename_prepare
4100 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4101 error "rename dir cross MDT failed!"
4106 rm -rf $DIR/$tdir || error "rmdir failed"
4108 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4111 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4112 ([ $FAILURE_MODE == "HARD" ] &&
4113 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4114 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4117 test_112_rename_prepare
4121 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4122 error "rename dir cross MDT failed!"
4127 rm -rf $DIR/$tdir || error "rmdir failed"
4129 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4132 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4133 ([ $FAILURE_MODE == "HARD" ] &&
4134 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4135 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4138 test_112_rename_prepare
4142 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4143 error "rename dir cross MDT failed!"
4148 rm -rf $DIR/$tdir || error "rmdir failed"
4150 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4153 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4154 ([ $FAILURE_MODE == "HARD" ] &&
4155 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4156 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4159 test_112_rename_prepare
4164 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4165 error "rename dir cross MDT failed!"
4170 rm -rf $DIR/$tdir || error "rmdir failed"
4172 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4175 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4176 ([ $FAILURE_MODE == "HARD" ] &&
4177 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4178 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4181 test_112_rename_prepare
4186 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4187 error "rename dir cross MDT failed!"
4192 rm -rf $DIR/$tdir || error "rmdir failed"
4194 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4197 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4198 ([ $FAILURE_MODE == "HARD" ] &&
4199 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4200 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4203 test_112_rename_prepare
4208 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4209 error "rename dir cross MDT failed!"
4214 rm -rf $DIR/$tdir || error "rmdir failed"
4216 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4219 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4220 ([ $FAILURE_MODE == "HARD" ] &&
4221 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4222 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4225 test_112_rename_prepare
4230 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4231 error "rename dir cross MDT failed!"
4236 rm -rf $DIR/$tdir || error "rmdir failed"
4238 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4241 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4242 ([ $FAILURE_MODE == "HARD" ] &&
4243 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4244 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4252 for ((j=0;j<$((MDSCOUNT));j++)); do
4253 fail_index=$((fail_index+1))
4254 index=$((fail_index % MDSCOUNT))
4255 replay_barrier mds$((index + 1))
4256 for ((i=0;i<5;i++)); do
4257 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4258 error "create striped dir $DIR/$tdir/test_$i"
4261 fail mds$((index + 1))
4262 for ((i=0;i<5;i++)); do
4263 checkstat -t dir $DIR/$tdir/test_$i ||
4264 error "$DIR/$tdir/test_$i does not exist!"
4266 rm -rf $DIR/$tdir/test_* ||
4270 run_test 115 "failover for create/unlink striped directory"
4273 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4274 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4275 skip "Do not support large update log before 2.7.55" &&
4277 ([ $FAILURE_MODE == "HARD" ] &&
4278 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4279 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4286 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4287 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4288 $LFS setdirstripe -c$MDSCOUNT $DIR/$tdir/striped_dir
4291 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4292 error "stried_dir does not exists"
4294 run_test 116a "large update log master MDT recovery"
4297 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4298 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4299 skip "Do not support large update log before 2.7.55" &&
4302 ([ $FAILURE_MODE == "HARD" ] &&
4303 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4304 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4311 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4312 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4313 $LFS setdirstripe -c$MDSCOUNT $DIR/$tdir/striped_dir
4316 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4317 error "stried_dir does not exists"
4319 run_test 116b "large update log slave MDT recovery"
4322 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4323 ([ $FAILURE_MODE == "HARD" ] &&
4324 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4325 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4331 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4332 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4335 # Let's set rdonly on all MDTs, so client will send
4336 # replay requests on all MDTs and replay these requests
4337 # at the same time. This test will verify the recovery
4338 # will not be deadlock in this case, LU-7531.
4339 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4340 replay_barrier mds$((index + 1))
4341 if [ -z $mds_indexs ]; then
4342 mds_indexs="${mds_indexs}mds$((index+1))"
4344 mds_indexs="${mds_indexs},mds$((index+1))"
4348 rm -rf $DIR/$tdir/remote_dir
4349 rm -rf $DIR/$tdir/remote_dir_1
4353 rm -rf $DIR/$tdir || error "rmdir failed"
4355 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4358 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4359 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4360 skip "Do not support large update log before 2.7.64" &&
4365 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4366 error "setdirstripe fails"
4367 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4368 error "setdirstripe fails 1"
4369 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4371 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4372 do_facet mds1 "lctl set_param fail_loc=0x1705"
4373 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4374 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4375 do_facet mds1 "lctl set_param fail_loc=0x0"
4378 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4379 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4384 run_test 118 "invalidate osp update will not cause update log corruption"
4387 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4388 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4389 skip "Do not support large update log before 2.7.64" &&
4392 local hard_timeout=$(do_facet mds1 \
4393 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4395 local clients=${CLIENTS:-$HOSTNAME}
4396 local time_min=$(recovery_time_min)
4399 mkdir $DIR/$tdir/tmp
4400 rmdir $DIR/$tdir/tmp
4403 mkdir $DIR/$tdir/dir_1
4404 for ((i = 0; i < 20; i++)); do
4405 $LFS setdirstripe -c2 $DIR/$tdir/stripe_dir-$i
4412 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4413 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4414 #sleep (timeout + 5), so mds will evict the client exports,
4415 #but DNE update recovery will keep going.
4416 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4418 mount_facet mds1 "-o recovery_time_hard=$time_min"
4420 wait_clients_import_state "$clients" mds1 FULL
4422 clients_up || clients_up || error "failover df: $?"
4424 #revert back the hard timeout
4425 do_facet mds1 $LCTL set_param \
4426 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4428 for ((i = 0; i < 20; i++)); do
4429 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4430 [ $stripe_count == 2 ] || {
4431 error "stripe_dir-$i creation replay fails"
4436 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4439 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4440 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4441 skip "Do not support large update log before 2.7.64" &&
4445 replay_barrier_nosync mds1
4446 for ((i = 0; i < 20; i++)); do
4447 mkdir $DIR/$tdir/dir-$i || {
4448 error "create dir-$i fails"
4451 $LFS setdirstripe -c2 $DIR/$tdir/stripe_dir-$i || {
4452 error "create stripe_dir-$i fails"
4459 for ((i = 0; i < 20; i++)); do
4460 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4461 error "dir-$i still exists"
4464 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4465 error "stripe_dir-$i still exists"
4470 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4473 check_and_cleanup_lustre