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: 17466 18857 LU-1473
25 ALWAYS_EXCEPT="61d 33a 33b 62 $REPLAY_SINGLE_EXCEPT"
27 # 63 min 7 min AT AT AT AT"
28 [ "$SLOW" = "no" ] && EXCEPT_SLOW="1 2 3 4 6 12 16 44a 44b 65 66 67 68"
30 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
31 # bug number for skipped test: LU-1867 LU-3127
32 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 89 73b"
36 check_and_setup_lustre
41 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
43 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
44 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
46 do_facet $SINGLEMDS sync
49 test_0a() { # was test_0
51 replay_barrier $SINGLEMDS
55 run_test 0a "empty replay"
58 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
60 # this test attempts to trigger a race in the precreation code,
61 # and must run before any other objects are created on the filesystem
63 createmany -o $DIR/$tfile 20 || return 1
64 unlinkmany $DIR/$tfile 20 || return 2
66 run_test 0b "ensure object created after recover exists. (3284)"
69 replay_barrier $SINGLEMDS
72 facet_failover $SINGLEMDS
73 zconf_mount `hostname` $MOUNT || error "mount fails"
74 client_up || error "post-failover df failed"
75 # file shouldn't exist if replay-barrier works as expected
76 rm $DIR/$tfile && error "File exists and it shouldn't"
79 run_test 0c "check replay-barrier"
82 replay_barrier $SINGLEMDS
84 facet_failover $SINGLEMDS
85 zconf_mount `hostname` $MOUNT || error "mount fails"
86 client_up || error "post-failover df failed"
88 run_test 0d "expired recovery with no clients"
91 replay_barrier $SINGLEMDS
94 $CHECKSTAT -t file $DIR/$tfile || return 1
97 run_test 1 "simple create"
100 replay_barrier $SINGLEMDS
103 $CHECKSTAT -t file $DIR/$tfile || return 1
110 replay_barrier $SINGLEMDS
113 $CHECKSTAT -t file $DIR/$tfile || return 1
119 local file=$DIR/$tfile
120 replay_barrier $SINGLEMDS
122 openfile -f O_DIRECTORY $file
124 $CHECKSTAT -t file $file || return 2
127 run_test 3a "replay failed open(O_DIRECTORY)"
130 replay_barrier $SINGLEMDS
131 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
132 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
134 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
136 $CHECKSTAT -t file $DIR/$tfile && return 2
139 run_test 3b "replay failed open -ENOMEM"
142 replay_barrier $SINGLEMDS
143 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
144 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
146 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
149 $CHECKSTAT -t file $DIR/$tfile && return 2
152 run_test 3c "replay failed open -ENOMEM"
154 test_4a() { # was test_4
155 replay_barrier $SINGLEMDS
156 for i in `seq 10`; do
157 echo "tag-$i" > $DIR/$tfile-$i
160 for i in `seq 10`; do
161 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
164 run_test 4a "|x| 10 open(O_CREAT)s"
167 replay_barrier $SINGLEMDS
170 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
172 run_test 4b "|x| rm 10 files"
174 # The idea is to get past the first block of precreated files on both
175 # osts, and then replay.
177 replay_barrier $SINGLEMDS
178 for i in `seq 220`; do
179 echo "tag-$i" > $DIR/$tfile-$i
182 for i in `seq 220`; do
183 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
187 # waiting for commitment of removal
189 run_test 5 "|x| 220 open(O_CREAT)"
192 test_6a() { # was test_6
194 replay_barrier $SINGLEMDS
195 mcreate $DIR/$tdir/$tfile
197 $CHECKSTAT -t dir $DIR/$tdir || return 1
198 $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
200 # waiting for log process thread
202 run_test 6a "mkdir + contained create"
206 replay_barrier $SINGLEMDS
209 $CHECKSTAT -t dir $DIR/$tdir && return 1 || true
211 run_test 6b "|X| rmdir"
215 replay_barrier $SINGLEMDS
216 mcreate $DIR/$tdir/$tfile
218 $CHECKSTAT -t dir $DIR/$tdir || return 1
219 $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
222 run_test 7 "mkdir |X| contained create"
225 # make sure no side-effect from previous test.
227 replay_barrier $SINGLEMDS
228 multiop_bg_pause $DIR/$tfile mo_c || return 4
232 $CHECKSTAT -t file $DIR/$tfile || return 1
233 kill -USR1 $MULTIPID || return 2
234 wait $MULTIPID || return 3
237 run_test 8 "creat open |X| close"
240 replay_barrier $SINGLEMDS
242 local old_inum=`ls -i $DIR/$tfile | awk '{print $1}'`
244 local new_inum=`ls -i $DIR/$tfile | awk '{print $1}'`
246 echo " old_inum == $old_inum, new_inum == $new_inum"
247 if [ $old_inum -eq $new_inum ] ;
249 echo " old_inum and new_inum match"
251 echo "!!!! old_inum and new_inum NOT match"
256 run_test 9 "|X| create (same inum/gen)"
260 replay_barrier $SINGLEMDS
261 mv $DIR/$tfile $DIR/$tfile-2
264 $CHECKSTAT $DIR/$tfile && return 1
265 $CHECKSTAT $DIR/$tfile-2 ||return 2
269 run_test 10 "create |X| rename unlink"
273 echo "old" > $DIR/$tfile
274 mv $DIR/$tfile $DIR/$tfile-2
275 replay_barrier $SINGLEMDS
276 echo "new" > $DIR/$tfile
278 grep old $DIR/$tfile-2
280 grep new $DIR/$tfile || return 1
281 grep old $DIR/$tfile-2 || return 2
283 run_test 11 "create open write rename |X| create-old-name read"
287 multiop_bg_pause $DIR/$tfile o_tSc || return 3
290 replay_barrier $SINGLEMDS
292 wait $pid || return 1
295 [ -e $DIR/$tfile ] && return 2
298 run_test 12 "open, unlink |X| close"
301 # 1777 - replay open after committed chmod that would make
302 # a regular open a failure
305 multiop_bg_pause $DIR/$tfile O_wc || return 3
308 $CHECKSTAT -p 0 $DIR/$tfile
309 replay_barrier $SINGLEMDS
312 wait $pid || return 1
314 $CHECKSTAT -s 1 -p 0 $DIR/$tfile || return 2
315 rm $DIR/$tfile || return 4
318 run_test 13 "open chmod 0 |x| write close"
321 multiop_bg_pause $DIR/$tfile O_tSc || return 4
324 replay_barrier $SINGLEMDS
325 kill -USR1 $pid || return 1
326 wait $pid || return 2
329 [ -e $DIR/$tfile ] && return 3
332 run_test 14 "open(O_CREAT), unlink |X| close"
335 multiop_bg_pause $DIR/$tfile O_tSc || return 5
338 replay_barrier $SINGLEMDS
339 touch $DIR/g11 || return 1
341 wait $pid || return 2
344 [ -e $DIR/$tfile ] && return 3
345 touch $DIR/h11 || return 4
348 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
352 replay_barrier $SINGLEMDS
355 mcreate $DIR/$tfile-2
357 [ -e $DIR/$tfile ] && return 1
358 [ -e $DIR/$tfile-2 ] || return 2
359 munlink $DIR/$tfile-2 || return 3
361 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
364 replay_barrier $SINGLEMDS
365 multiop_bg_pause $DIR/$tfile O_c || return 4
368 kill -USR1 $pid || return 1
369 wait $pid || return 2
370 $CHECKSTAT -t file $DIR/$tfile || return 3
373 run_test 17 "|X| open(O_CREAT), |replay| close"
376 replay_barrier $SINGLEMDS
377 multiop_bg_pause $DIR/$tfile O_tSc || return 8
380 touch $DIR/$tfile-2 || return 1
381 echo "pid: $pid will close"
383 wait $pid || return 2
386 [ -e $DIR/$tfile ] && return 3
387 [ -e $DIR/$tfile-2 ] || return 4
388 # this touch frequently fails
389 touch $DIR/$tfile-3 || return 5
390 munlink $DIR/$tfile-2 || return 6
391 munlink $DIR/$tfile-3 || return 7
394 run_test 18 "|X| open(O_CREAT), unlink, touch new, close, touch, unlink"
396 # bug 1855 (a simpler form of test_11 above)
398 replay_barrier $SINGLEMDS
400 echo "old" > $DIR/$tfile
401 mv $DIR/$tfile $DIR/$tfile-2
402 grep old $DIR/$tfile-2
404 grep old $DIR/$tfile-2 || return 2
406 run_test 19 "|X| mcreate, open, write, rename "
408 test_20a() { # was test_20
409 replay_barrier $SINGLEMDS
410 multiop_bg_pause $DIR/$tfile O_tSc || return 3
416 wait $pid || return 1
417 [ -e $DIR/$tfile ] && return 2
420 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
422 test_20b() { # bug 10480
423 local wait_timeout=$((TIMEOUT * 4))
427 BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
428 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
430 while [ ! -e $DIR/$tfile ] ; do
431 usleep 60 # give dd a chance to start
434 $GETSTRIPE $DIR/$tfile || return 1
435 rm -f $DIR/$tfile || return 2 # make it an orphan
437 client_up || client_up || true # reconnect
439 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync 1"
441 fail $SINGLEMDS # start orphan recovery
442 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
443 wait_delete_completed_mds $wait_timeout || return 3
445 AFTERUSED=$(df -P $DIR | tail -1 | awk '{ print $3 }')
446 log "before $BEFOREUSED, after $AFTERUSED"
447 (( $AFTERUSED > $BEFOREUSED + $(fs_log_size) )) &&
448 error "after $AFTERUSED > before $BEFOREUSED"
451 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"
453 test_20c() { # bug 10480
454 multiop_bg_pause $DIR/$tfile Ow_c || return 1
460 client_up || client_up || true # reconnect
463 wait $pid || return 1
464 [ -s $DIR/$tfile ] || error "File was truncated"
468 run_test 20c "check that client eviction does not affect file content"
471 replay_barrier $SINGLEMDS
472 multiop_bg_pause $DIR/$tfile O_tSc || return 5
475 touch $DIR/g11 || return 1
479 wait $pid || return 2
480 [ -e $DIR/$tfile ] && return 3
481 touch $DIR/h11 || return 4
484 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
487 multiop_bg_pause $DIR/$tfile O_tSc || return 3
490 replay_barrier $SINGLEMDS
495 wait $pid || return 1
496 [ -e $DIR/$tfile ] && return 2
499 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
502 multiop_bg_pause $DIR/$tfile O_tSc || return 5
505 replay_barrier $SINGLEMDS
507 touch $DIR/g11 || return 1
511 wait $pid || return 2
512 [ -e $DIR/$tfile ] && return 3
513 touch $DIR/h11 || return 4
516 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
519 multiop_bg_pause $DIR/$tfile O_tSc || return 3
522 replay_barrier $SINGLEMDS
526 wait $pid || return 1
527 [ -e $DIR/$tfile ] && return 2
530 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
533 multiop_bg_pause $DIR/$tfile O_tSc || return 3
537 replay_barrier $SINGLEMDS
540 wait $pid || return 1
541 [ -e $DIR/$tfile ] && return 2
544 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
547 replay_barrier $SINGLEMDS
548 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
550 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
555 wait $pid2 || return 1
559 wait $pid1 || return 2
560 [ -e $DIR/$tfile-1 ] && return 3
561 [ -e $DIR/$tfile-2 ] && return 4
564 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
567 replay_barrier $SINGLEMDS
568 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
570 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
577 wait $pid1 || return 1
579 wait $pid2 || return 2
580 [ -e $DIR/$tfile-1 ] && return 3
581 [ -e $DIR/$tfile-2 ] && return 4
584 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
587 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
589 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
591 replay_barrier $SINGLEMDS
595 wait $pid2 || return 1
599 wait $pid1 || return 2
600 [ -e $DIR/$tfile-1 ] && return 3
601 [ -e $DIR/$tfile-2 ] && return 4
604 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
607 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
609 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
611 replay_barrier $SINGLEMDS
617 wait $pid1 || return 1
619 wait $pid2 || return 2
620 [ -e $DIR/$tfile-1 ] && return 3
621 [ -e $DIR/$tfile-2 ] && return 4
624 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
627 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
629 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
634 replay_barrier $SINGLEMDS
637 wait $pid1 || return 1
639 wait $pid2 || return 2
640 [ -e $DIR/$tfile-1 ] && return 3
641 [ -e $DIR/$tfile-2 ] && return 4
644 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
647 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
649 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
653 replay_barrier $SINGLEMDS
657 wait $pid1 || return 1
659 wait $pid2 || return 2
660 [ -e $DIR/$tfile-1 ] && return 3
661 [ -e $DIR/$tfile-2 ] && return 4
664 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
666 # tests for bug 2104; completion without crashing is success. The close is
667 # stale, but we always return 0 for close, so the app never sees it.
669 multiop_bg_pause $DIR/$tfile O_c || return 2
671 multiop_bg_pause $DIR/$tfile O_c || return 3
674 client_up || client_up || return 1
677 wait $pid1 || return 4
678 wait $pid2 || return 5
681 run_test 32 "close() notices client eviction; close() after client eviction"
684 createmany -o $DIR/$tfile-%d 10
685 replay_barrier_nosync $SINGLEMDS
686 fail_abort $SINGLEMDS
687 # recreate shouldn't fail
688 createmany -o $DIR/$tfile--%d 10 || return 1
692 run_test 33a "fid seq shouldn't be reused after abort recovery"
695 #define OBD_FAIL_SEQ_ALLOC 0x1311
696 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
698 createmany -o $DIR/$tfile-%d 10
699 replay_barrier_nosync $SINGLEMDS
700 fail_abort $SINGLEMDS
701 # recreate shouldn't fail
702 createmany -o $DIR/$tfile--%d 10 || return 1
706 run_test 33b "test fid seq allocation"
709 multiop_bg_pause $DIR/$tfile O_c || return 2
713 replay_barrier $SINGLEMDS
714 fail_abort $SINGLEMDS
716 wait $pid || return 3
717 [ -e $DIR/$tfile ] && return 1
721 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
723 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
727 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
728 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
733 # give a chance to remove from MDS
734 fail_abort $SINGLEMDS
735 $CHECKSTAT -t file $DIR/$tfile && return 1 || true
737 run_test 35 "test recovery from llog for unlink op"
739 # b=2432 resent cancel after replay uses wrong cookie,
740 # so don't resend cancels
742 replay_barrier $SINGLEMDS
744 checkstat $DIR/$tfile
745 facet_failover $SINGLEMDS
747 if dmesg | grep "unknown lock cookie"; then
748 echo "cancel after replay failed"
752 run_test 36 "don't resend cancel"
755 # directory orphans can't be unlinked from PENDING directory
757 rmdir $DIR/$tfile 2>/dev/null
758 multiop_bg_pause $DIR/$tfile dD_c || return 2
762 replay_barrier $SINGLEMDS
763 # clear the dmesg buffer so we only see errors from this recovery
764 do_facet $SINGLEMDS dmesg -c >/dev/null
765 fail_abort $SINGLEMDS
767 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
769 wait $pid || return 3
773 start_full_debug_logging
774 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
775 stop_full_debug_logging
778 createmany -o $DIR/$tfile-%d 800
779 unlinkmany $DIR/$tfile-%d 0 400
780 replay_barrier $SINGLEMDS
782 unlinkmany $DIR/$tfile-%d 400 400
784 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
786 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
788 test_39() { # bug 4176
789 createmany -o $DIR/$tfile-%d 800
790 replay_barrier $SINGLEMDS
791 unlinkmany $DIR/$tfile-%d 0 400
793 unlinkmany $DIR/$tfile-%d 400 400
795 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
797 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
800 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
805 # always need connection to MDS to verify layout during IO. LU-2628.
806 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
807 skip "layout_lock needs MDS connection for IO" && return 0
809 $LCTL mark multiop $MOUNT/$tfile OS_c
810 multiop $MOUNT/$tfile OS_c &
812 writeme -s $MOUNT/${tfile}-2 &
815 facet_failover $SINGLEMDS
816 #define OBD_FAIL_MDS_CONNECT_NET 0x117
817 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
819 stat1=`count_ost_writes`
821 stat2=`count_ost_writes`
822 echo "$stat1, $stat2"
823 if [ $stat1 -lt $stat2 ]; then
824 echo "writes continuing during recovery"
827 echo "writes not continuing during recovery, bug 2477"
830 echo "waiting for writeme $WRITE_PID"
834 echo "waiting for multiop $PID"
835 wait $PID || return 2
836 do_facet client munlink $MOUNT/$tfile || return 3
837 do_facet client munlink $MOUNT/${tfile}-2 || return 3
840 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
844 # make sure that a read to one osc doesn't try to double-unlock its page just
845 # because another osc is invalid. trigger_group_io used to mistakenly return
846 # an error if any oscs were invalid even after having successfully put rpcs
847 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
848 # the page, guarnateeing that the unlock from the RPC completion would
849 # assert on trying to unlock the unlocked page.
851 [ $OSTCOUNT -lt 2 ] &&
852 skip_env "skipping test 41: we don't have a second OST to test with" &&
855 local f=$MOUNT/$tfile
856 # make sure the start of the file is ost1
857 $SETSTRIPE -S $((128 * 1024)) -i 0 $f
858 do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3
860 # fail ost2 and read from ost1
861 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
862 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | \
863 grep $mdtosc | awk '{print $1}')
864 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" && lctl get_param -n devices &&
866 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate || return 1
867 do_facet client dd if=$f of=/dev/null bs=4k count=1 || return 3
868 do_facet $SINGLEMDS $LCTL --device $osc2dev activate || return 2
871 run_test 41 "read from a valid osc while other oscs are invalid"
873 # test MDS recovery after ost failure
875 blocks=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
876 createmany -o $DIR/$tfile-%d 800
878 unlinkmany $DIR/$tfile-%d 0 400
880 lctl set_param debug=-1
883 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
884 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
885 #[ $blocks_after -lt $blocks ] || return 1
886 echo wait for MDS to timeout and recover
887 sleep $((TIMEOUT * 2))
889 unlinkmany $DIR/$tfile-%d 400 400
890 $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
892 run_test 42 "recovery after ost failure"
894 # timeout in MDS/OST recovery RPC will LBUG MDS
895 test_43() { # bug 2530
896 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
898 replay_barrier $SINGLEMDS
900 # OBD_FAIL_OST_CREATE_NET 0x204
901 do_facet ost1 "lctl set_param fail_loc=0x80000204"
904 do_facet ost1 "lctl set_param fail_loc=0"
908 run_test 43 "mds osc import failure during recovery; don't LBUG"
910 test_44a() { # was test_44
913 local mdcdev=$($LCTL dl |
914 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
915 [ "$mdcdev" ] || return 2
916 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
917 { echo mdcdev=$mdcdev; $LCTL dl; return 3; }
919 # adaptive timeouts slow this way down
920 if at_is_enabled; then
921 at_max_saved=$(at_max_get mds)
925 for i in `seq 1 10`; do
926 echo "$i of 10 ($(date +%s))"
927 do_facet $SINGLEMDS \
928 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
929 #define OBD_FAIL_TGT_CONN_RACE 0x701
930 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
931 # lctl below may fail, it is valid case
932 $LCTL --device $mdcdev recover
935 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
936 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
939 run_test 44a "race in target handle connect"
942 local mdcdev=$($LCTL dl |
943 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
944 [ "$mdcdev" ] || return 2
945 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
946 { echo mdcdev=$mdcdev; $LCTL dl; return 3; }
948 for i in `seq 1 10`; do
949 echo "$i of 10 ($(date +%s))"
950 do_facet $SINGLEMDS \
951 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
952 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
953 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
954 # lctl below may fail, it is valid case
955 $LCTL --device $mdcdev recover
958 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
961 run_test 44b "race in target handle connect"
964 replay_barrier $SINGLEMDS
965 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
966 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
967 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
968 fail_abort $SINGLEMDS
969 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
971 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
974 run_test 44c "race in target handle connect"
976 # Handle failed close
978 local mdcdev=$($LCTL get_param -n devices |
979 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
980 [ "$mdcdev" ] || return 2
981 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
982 { echo mdcdev=$mdcdev; $LCTL dl; return 3; }
984 $LCTL --device $mdcdev recover || return 6
986 multiop_bg_pause $DIR/$tfile O_c || return 1
989 # This will cause the CLOSE to fail before even
990 # allocating a reply buffer
991 $LCTL --device $mdcdev deactivate || return 4
995 wait $pid || return 1
997 $LCTL --device $mdcdev activate || return 5
1000 $CHECKSTAT -t file $DIR/$tfile || return 2
1003 run_test 45 "Handle failed close"
1007 drop_reply "touch $DIR/$tfile"
1009 # ironically, the previous test, 45, will cause a real forced close,
1010 # so just look for one for this test
1011 dmesg | grep -i "force closing client file handle for $tfile" && return 1
1014 run_test 46 "Don't leak file handle after open resend (3325)"
1016 test_47() { # bug 2824
1017 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1019 # create some files to make sure precreate has been done on all
1020 # OSTs. (just in case this test is run independently)
1021 createmany -o $DIR/$tfile 20 || return 1
1023 # OBD_FAIL_OST_CREATE_NET 0x204
1025 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1026 client_up || return 2
1028 # let the MDS discover the OST failure, attempt to recover, fail
1029 # and recover again.
1030 sleep $((3 * TIMEOUT))
1032 # Without 2824, this createmany would hang
1033 createmany -o $DIR/$tfile 20 || return 3
1034 unlinkmany $DIR/$tfile 20 || return 4
1036 do_facet ost1 "lctl set_param fail_loc=0"
1039 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1042 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1043 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2 OSTs -- skipping" && return
1045 replay_barrier $SINGLEMDS
1046 createmany -o $DIR/$tfile 20 || return 1
1047 # OBD_FAIL_OST_EROFS 0x216
1048 facet_failover $SINGLEMDS
1049 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1050 client_up || return 2
1052 createmany -o $DIR/$tfile 20 20 || return 2
1053 unlinkmany $DIR/$tfile 40 || return 3
1056 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1059 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1060 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | \
1061 grep $mdtosc | awk '{print $1}')
1062 [ "$oscdev" ] || return 1
1063 do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 2
1064 do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 3
1065 # give the mds_lov_sync threads a chance to run
1068 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1070 # b3764 timed out lock replay
1073 cancel_lru_locks mdc
1075 multiop $DIR/$tfile s || return 1
1076 replay_barrier $SINGLEMDS
1077 #define OBD_FAIL_LDLM_REPLY 0x30c
1078 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
1079 fail $SINGLEMDS || return 2
1080 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1082 $CHECKSTAT -t file $DIR/$tfile-* && return 3 || true
1084 run_test 52 "time out lock replay (3764)"
1086 # bug 3462 - simultaneous MDC requests
1088 cancel_lru_locks mdc # cleanup locks from former test cases
1089 mkdir -p $DIR/${tdir}-1
1090 mkdir -p $DIR/${tdir}-2
1091 multiop $DIR/${tdir}-1/f O_c &
1093 # give multiop a change to open
1096 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1097 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1098 kill -USR1 $close_pid
1099 cancel_lru_locks mdc # force the close
1100 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1102 mcreate $DIR/${tdir}-2/f || return 1
1104 # close should still be here
1105 [ -d /proc/$close_pid ] || return 2
1107 replay_barrier_nodf $SINGLEMDS
1109 wait $close_pid || return 3
1111 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1112 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1113 rm -rf $DIR/${tdir}-*
1115 run_test 53a "|X| close request while two MDC requests in flight"
1118 cancel_lru_locks mdc # cleanup locks from former test cases
1119 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1121 mkdir -p $DIR/${tdir}-1
1122 mkdir -p $DIR/${tdir}-2
1123 multiop_bg_pause $DIR/${tdir}-1/f O_c || return 6
1126 #define OBD_FAIL_MDS_REINT_NET 0x107
1127 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1128 mcreate $DIR/${tdir}-2/f &
1132 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1133 kill -USR1 $close_pid
1134 cancel_lru_locks mdc # force the close
1135 wait $close_pid || return 1
1136 # open should still be here
1137 [ -d /proc/$open_pid ] || return 2
1139 replay_barrier_nodf $SINGLEMDS
1141 wait $open_pid || return 3
1143 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1144 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1145 rm -rf $DIR/${tdir}-*
1147 run_test 53b "|X| open request while two MDC requests in flight"
1150 cancel_lru_locks mdc # cleanup locks from former test cases
1151 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1153 mkdir -p $DIR/${tdir}-1
1154 mkdir -p $DIR/${tdir}-2
1155 multiop $DIR/${tdir}-1/f O_c &
1158 #define OBD_FAIL_MDS_REINT_NET 0x107
1159 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1160 mcreate $DIR/${tdir}-2/f &
1164 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1165 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1166 kill -USR1 $close_pid
1167 cancel_lru_locks mdc # force the close
1169 #bz20647: make sure all pids are exists before failover
1170 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1171 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1172 replay_barrier_nodf $SINGLEMDS
1173 fail_nodf $SINGLEMDS
1174 wait $open_pid || return 1
1176 # close should be gone
1177 [ -d /proc/$close_pid ] && return 2
1178 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1180 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1181 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1182 rm -rf $DIR/${tdir}-*
1184 run_test 53c "|X| open request and close request while two MDC requests in flight"
1187 cancel_lru_locks mdc # cleanup locks from former test cases
1188 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1190 mkdir -p $DIR/${tdir}-1
1191 mkdir -p $DIR/${tdir}-2
1192 multiop $DIR/${tdir}-1/f O_c &
1194 # give multiop a chance to open
1197 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1198 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1199 kill -USR1 $close_pid
1200 cancel_lru_locks mdc # force the close
1201 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1202 mcreate $DIR/${tdir}-2/f || return 1
1204 # close should still be here
1205 [ -d /proc/$close_pid ] || return 2
1207 wait $close_pid || return 3
1209 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1210 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1211 rm -rf $DIR/${tdir}-*
1213 run_test 53d "|X| close reply while two MDC requests in flight"
1216 cancel_lru_locks mdc # cleanup locks from former test cases
1217 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1219 mkdir -p $DIR/${tdir}-1
1220 mkdir -p $DIR/${tdir}-2
1221 multiop $DIR/${tdir}-1/f O_c &
1224 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1225 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1226 mcreate $DIR/${tdir}-2/f &
1230 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1231 kill -USR1 $close_pid
1232 cancel_lru_locks mdc # force the close
1233 wait $close_pid || return 1
1234 # open should still be here
1235 [ -d /proc/$open_pid ] || return 2
1237 replay_barrier_nodf $SINGLEMDS
1239 wait $open_pid || return 3
1241 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1242 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1243 rm -rf $DIR/${tdir}-*
1245 run_test 53e "|X| open reply while two MDC requests in flight"
1248 cancel_lru_locks mdc # cleanup locks from former test cases
1249 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1251 mkdir -p $DIR/${tdir}-1
1252 mkdir -p $DIR/${tdir}-2
1253 multiop $DIR/${tdir}-1/f O_c &
1256 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1257 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1258 mcreate $DIR/${tdir}-2/f &
1262 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1263 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1264 kill -USR1 $close_pid
1265 cancel_lru_locks mdc # force the close
1267 #bz20647: make sure all pids are exists before failover
1268 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1269 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1270 replay_barrier_nodf $SINGLEMDS
1271 fail_nodf $SINGLEMDS
1272 wait $open_pid || return 1
1274 # close should be gone
1275 [ -d /proc/$close_pid ] && return 2
1276 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1278 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1279 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1280 rm -rf $DIR/${tdir}-*
1282 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1285 cancel_lru_locks mdc # cleanup locks from former test cases
1286 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1288 mkdir -p $DIR/${tdir}-1
1289 mkdir -p $DIR/${tdir}-2
1290 multiop $DIR/${tdir}-1/f O_c &
1293 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1294 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1295 mcreate $DIR/${tdir}-2/f &
1299 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1300 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1301 kill -USR1 $close_pid
1302 cancel_lru_locks mdc # force the close
1303 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1305 #bz20647: make sure all pids are exists before failover
1306 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1307 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1308 replay_barrier_nodf $SINGLEMDS
1309 fail_nodf $SINGLEMDS
1310 wait $open_pid || return 1
1312 # close should be gone
1313 [ -d /proc/$close_pid ] && return 2
1315 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1316 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1317 rm -rf $DIR/${tdir}-*
1319 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1322 cancel_lru_locks mdc # cleanup locks from former test cases
1323 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1325 mkdir -p $DIR/${tdir}-1
1326 mkdir -p $DIR/${tdir}-2
1327 multiop $DIR/${tdir}-1/f O_c &
1330 #define OBD_FAIL_MDS_REINT_NET 0x107
1331 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1332 mcreate $DIR/${tdir}-2/f &
1336 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1337 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1338 kill -USR1 $close_pid
1339 cancel_lru_locks mdc # force the close
1342 #bz20647: make sure all pids are exists before failover
1343 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1344 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1345 replay_barrier_nodf $SINGLEMDS
1346 fail_nodf $SINGLEMDS
1347 wait $open_pid || return 1
1349 # close should be gone
1350 [ -d /proc/$close_pid ] && return 2
1351 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1353 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1354 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1355 rm -rf $DIR/${tdir}-*
1357 run_test 53h "|X| open request and close reply while two MDC requests in flight"
1359 #b_cray 54 "|X| open request and close reply while two MDC requests in flight"
1361 #b3761 ASSERTION(hash != 0) failed
1363 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1364 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1366 # give touch a chance to run
1368 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1372 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1374 #b3440 ASSERTION(rec->ur_fid2->id) failed
1376 ln -s foo $DIR/$tfile
1377 replay_barrier $SINGLEMDS
1378 #drop_reply "cat $DIR/$tfile"
1382 run_test 56 "don't replay a symlink open request (3440)"
1384 #recovery one mds-ost setattr from llog
1386 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1387 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1389 replay_barrier $SINGLEMDS
1392 $CHECKSTAT -t file $DIR/$tfile || return 1
1393 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1396 run_test 57 "test recovery from llog for setattr op"
1399 zconf_umount `hostname` $MOUNT2
1403 #recovery many mds-ost setattr from llog
1406 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1407 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1408 createmany -o $DIR/$tdir/$tfile-%d 2500
1409 replay_barrier $SINGLEMDS
1412 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null || return 1
1413 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1414 unlinkmany $DIR/$tdir/$tfile-%d 2500
1417 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1423 trap cleanup_58 EXIT
1425 large_xattr_enabled &&
1426 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1428 mount_client $MOUNT2
1430 touch $DIR/$tdir/$tfile
1431 replay_barrier $SINGLEMDS
1432 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1434 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1435 [[ "$new" = "$orig" ]] || return 1
1436 rm -f $DIR/$tdir/$tfile
1440 run_test 58b "test replay of setxattr op"
1442 test_58c() { # bug 16570
1447 trap cleanup_58 EXIT
1449 if large_xattr_enabled; then
1450 local xattr_size=$(max_xattr_size)
1451 orig="$(generate_string $((xattr_size / 2)))"
1452 orig1="$(generate_string $xattr_size)"
1458 mount_client $MOUNT2
1460 touch $DIR/$tdir/$tfile
1461 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1463 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1464 [[ "$new" = "$orig" ]] || return 2
1465 drop_reint_reply "setfattr -n trusted.foo1 -v $orig1 $DIR/$tdir/$tfile" ||
1467 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1468 [[ "$new" = "$orig1" ]] || return 4
1469 rm -f $DIR/$tdir/$tfile
1473 run_test 58c "resend/reconstruct setxattr op"
1475 # log_commit_thread vs filter_destroy race used to lead to import use after free
1478 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1481 createmany -o $DIR/$tdir/$tfile-%d 200
1483 unlinkmany $DIR/$tdir/$tfile-%d 200
1484 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1485 do_facet ost1 "lctl set_param fail_loc=0x507"
1488 do_facet ost1 "lctl set_param fail_loc=0x0"
1492 run_test 59 "test log_commit_thread vs filter_destroy race"
1494 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1495 # bug 12086: should no oops and No ctxt error for this test
1498 createmany -o $DIR/$tdir/$tfile-%d 200
1499 replay_barrier $SINGLEMDS
1500 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1502 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1503 local no_ctxt=`dmesg | grep "No ctxt"`
1504 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1506 run_test 60 "test llog post recovery init vs llog unlink"
1508 #test race llog recovery thread vs llog cleanup
1509 test_61a() { # was test_61
1510 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1513 createmany -o $DIR/$tdir/$tfile-%d 800
1515 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1516 unlinkmany $DIR/$tdir/$tfile-%d 800
1517 set_nodes_failloc "$(osts_nodes)" 0x80000221
1522 set_nodes_failloc "$(osts_nodes)" 0x0
1524 $CHECKSTAT -t file $DIR/$tdir/$tfile-* && return 1
1527 run_test 61a "test race llog recovery vs llog cleanup"
1529 #test race mds llog sync vs llog cleanup
1531 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1532 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1533 facet_failover $SINGLEMDS
1536 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 || return 1
1538 run_test 61b "test race mds llog sync vs llog cleanup"
1540 #test race cancel cookie cb vs llog cleanup
1542 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1544 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1546 set_nodes_failloc "$(osts_nodes)" 0x80000222
1550 set_nodes_failloc "$(osts_nodes)" 0x0
1552 run_test 61c "test race mds llog sync vs llog cleanup"
1554 test_61d() { # bug 16002 # bug 17466 # bug 22137
1555 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1557 do_facet mgs "lctl set_param fail_loc=0x80000605"
1558 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1559 error "mgs start should have failed"
1560 do_facet mgs "lctl set_param fail_loc=0"
1561 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1563 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1565 test_62() { # Bug 15756 - don't mis-drop resent replay
1567 replay_barrier $SINGLEMDS
1568 createmany -o $DIR/$tdir/$tfile- 25
1569 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1570 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1572 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1573 unlinkmany $DIR/$tdir/$tfile- 25 || return 2
1576 run_test 62 "don't mis-drop resent replay"
1578 #Adaptive Timeouts (bug 3055)
1586 echo "Cleaning up AT ..."
1587 if [ -n "$ATOLDBASE" ]; then
1588 local at_history=$($LCTL get_param -n at_history)
1589 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1590 do_facet ost1 "lctl set_param at_history=$at_history" || true
1593 if [ $AT_MAX_SET -ne 0 ]; then
1594 for facet in mds client ost; do
1595 var=AT_MAX_SAVE_${facet}
1596 echo restore AT on $facet to saved value ${!var}
1597 at_max_set ${!var} $facet
1598 at_new=$(at_max_get $facet)
1599 echo Restored AT value on $facet $at_new
1600 [ $at_new -eq ${!var} ] || \
1601 error "$facet : AT value was not restored SAVED ${!var} NEW $at_new"
1608 local at_max_new=600
1610 # Save at_max original values
1612 if [ $AT_MAX_SET -eq 0 ]; then
1613 # Suppose that all osts have the same at_max
1614 for facet in mds client ost; do
1615 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1619 for facet in mds client ost; do
1620 at_max=$(at_max_get $facet)
1621 if [ $at_max -ne $at_max_new ]; then
1622 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1623 at_max_set $at_max_new $facet
1628 if [ -z "$ATOLDBASE" ]; then
1629 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1630 # speed up the timebase so we can check decreasing AT
1631 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1632 do_facet ost1 "lctl set_param at_history=8" || true
1634 # sleep for a while to cool down, should be > 8s and also allow
1635 # at least one ping to be sent. simply use TIMEOUT to be safe.
1640 test_65a() #bug 3055
1642 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1644 at_start || return 0
1645 $LCTL dk > /dev/null
1647 $LCTL set_param debug="other"
1648 # Slow down a request to the current service time, this is critical
1649 # because previous tests may have caused this value to increase.
1650 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1651 awk '/portal 12/ {print $5}'`
1652 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1654 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1655 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1656 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1657 createmany -o $DIR/$tfile 10 > /dev/null
1658 unlinkmany $DIR/$tfile 10 > /dev/null
1659 # check for log message
1660 $LCTL dk | grep "Early reply #" || error "No early reply"
1662 # client should show REQ_DELAY estimates
1663 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1665 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1667 run_test 65a "AT: verify early replies"
1669 test_65b() #bug 3055
1671 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1673 at_start || return 0
1676 $LCTL set_param debug="other trace"
1677 $LCTL dk > /dev/null
1678 # Slow down a request to the current service time, this is critical
1679 # because previous tests may have caused this value to increase.
1680 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1681 multiop $DIR/$tfile Ow1yc
1682 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1683 awk '/portal 6/ {print $5}'`
1684 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1686 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1687 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1688 do_facet ost1 $LCTL set_param fail_loc=0x224
1691 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1692 # force some real bulk transfer
1693 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1695 do_facet ost1 $LCTL set_param fail_loc=0
1696 # check for log message
1697 $LCTL dk | grep "Early reply #" || error "No early reply"
1699 # client should show REQ_DELAY estimates
1700 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1702 run_test 65b "AT: verify early replies on packed reply / bulk"
1704 test_66a() #bug 3055
1706 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1708 at_start || return 0
1709 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1710 # adjust 5s at a time so no early reply is sent (within deadline)
1711 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1712 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1713 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1714 createmany -o $DIR/$tfile 20 > /dev/null
1715 unlinkmany $DIR/$tfile 20 > /dev/null
1716 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1717 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1718 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1719 createmany -o $DIR/$tfile 20 > /dev/null
1720 unlinkmany $DIR/$tfile 20 > /dev/null
1721 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1722 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1724 createmany -o $DIR/$tfile 20 > /dev/null
1725 unlinkmany $DIR/$tfile 20 > /dev/null
1726 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1727 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1728 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1729 echo "Current MDT timeout $CUR, worst $WORST"
1730 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1732 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1734 test_66b() #bug 3055
1736 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1738 at_start || return 0
1739 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1740 awk '/network/ {print $4}')
1741 $LCTL set_param fail_val=$(($ORIG + 5))
1742 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1743 $LCTL set_param fail_loc=0x50c
1744 ls $DIR/$tfile > /dev/null 2>&1
1745 $LCTL set_param fail_loc=0
1746 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1747 awk '/network/ {print $4}')
1748 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1749 awk '/network/ {print $6}')
1750 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1751 [ $WORST -gt $ORIG ] ||
1752 error "Worst $WORST should be worse than orig $ORIG"
1754 run_test 66b "AT: verify net latency adjusts"
1756 test_67a() #bug 3055
1758 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1760 at_start || return 0
1761 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1762 # sleeping threads may drive values above this
1763 do_facet ost1 "$LCTL set_param fail_val=400"
1764 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1765 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1766 createmany -o $DIR/$tfile 20 > /dev/null
1767 unlinkmany $DIR/$tfile 20 > /dev/null
1768 do_facet ost1 "$LCTL set_param fail_loc=0"
1769 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1770 ATTEMPTS=$(($CONN2 - $CONN1))
1771 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1772 [ $ATTEMPTS -gt 0 ] &&
1773 error_ignore bz13721 "AT should have prevented reconnect"
1776 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1778 test_67b() #bug 3055
1780 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1782 at_start || return 0
1783 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1785 # exhaust precreations on ost1
1786 local OST=$(ostname_from_index 0)
1787 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1788 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1789 osc.$mdtosc.prealloc_last_id)
1790 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1791 osc.$mdtosc.prealloc_next_id)
1793 mkdir -p $DIR/$tdir/${OST}
1794 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/${OST} || error "$SETSTRIPE"
1795 echo "Creating to objid $last_id on ost $OST..."
1796 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1797 do_facet ost1 "$LCTL set_param fail_val=20000"
1798 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1799 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1802 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1804 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1805 ATTEMPTS=$(($CONN2 - $CONN1))
1806 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1807 # do it again; should not timeout
1808 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1809 cp /etc/profile $DIR/$tfile || error "cp failed"
1810 do_facet ost1 "$LCTL set_param fail_loc=0"
1812 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1813 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1814 ATTEMPTS=$(($CONN3 - $CONN2))
1815 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1816 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1819 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1821 test_68 () #bug 13813
1823 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1825 at_start || return 0
1826 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1827 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1828 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1829 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
1830 local ENQ_MIN=$(cat $ldlm_enqueue_min)
1831 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
1832 echo $TIMEOUT >> $ldlm_enqueue_min
1833 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
1837 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tdir
1838 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
1839 $LCTL set_param fail_val=$(($TIMEOUT - 1))
1840 $LCTL set_param fail_loc=0x80000312
1841 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
1842 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
1843 $LCTL set_param fail_loc=0x80000312
1844 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
1845 $LCTL set_param fail_loc=0
1847 echo $ENQ_MIN >> $ldlm_enqueue_min
1848 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
1852 run_test 68 "AT: verify slowing locks"
1855 # end of AT tests includes above lines
1858 # start multi-client tests
1860 [ -z "$CLIENTS" ] && \
1861 { skip "Need two or more clients." && return; }
1862 [ $CLIENTCOUNT -lt 2 ] && \
1863 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
1865 echo "mount clients $CLIENTS ..."
1866 zconf_mount_clients $CLIENTS $MOUNT
1868 local clients=${CLIENTS//,/ }
1869 echo "Write/read files on $DIR ; clients $CLIENTS ... "
1870 for CLIENT in $clients; do
1871 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
1872 of=$DIR/${tfile}_${CLIENT} 2>/dev/null || \
1873 error "dd failed on $CLIENT"
1876 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
1877 for C in ${CLIENTS//,/ }; do
1878 do_node $prev_client dd if=$DIR/${tfile}_${C} of=/dev/null 2>/dev/null || \
1879 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
1885 run_test 70a "check multi client t-f"
1887 check_for_process () {
1892 killall_process $clients "$prog" -0
1895 killall_process () {
1896 local clients=${1:-$(hostname)}
1901 do_nodes $clients "killall $signal $name"
1905 local clients=${CLIENTS:-$HOSTNAME}
1907 zconf_mount_clients $clients $MOUNT
1910 [ "$SLOW" = "no" ] && duration=120
1911 # set duration to 900 because it takes some time to boot node
1912 [ "$FAILURE_MODE" = HARD ] && duration=900
1915 local start_ts=$(date +%s)
1916 local cmd="rundbench 1 -t $duration"
1918 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
1919 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
1920 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
1921 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
1924 #LU-1897 wait for all dbench copies to start
1925 while ! check_for_process $clients dbench; do
1926 elapsed=$(($(date +%s) - start_ts))
1927 if [ $elapsed -gt $duration ]; then
1928 killall_process $clients dbench
1929 error "dbench failed to start on $clients!"
1934 log "Started rundbench load pid=$pid ..."
1936 elapsed=$(($(date +%s) - start_ts))
1937 local num_failovers=0
1938 while [ $elapsed -lt $duration ]; do
1939 if ! check_for_process $clients dbench; then
1940 error_noexit "dbench stopped on some of $clients!"
1941 killall_process $clients dbench
1945 replay_barrier $SINGLEMDS
1946 sleep 1 # give clients a time to do operations
1947 # Increment the number of failovers
1948 num_failovers=$((num_failovers+1))
1949 log "$TESTNAME fail $SINGLEMDS $num_failovers times"
1951 elapsed=$(($(date +%s) - start_ts))
1954 wait $pid || error "rundbench load on $clients failed!"
1956 run_test 70b "mds recovery; $CLIENTCOUNT clients"
1957 # end multi-client tests
1960 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1964 replay_barrier $SINGLEMDS
1965 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
1966 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
1969 wait $pid || return 1
1970 [ -e $DIR/$tfile ] && return 2
1973 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay , close"
1976 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1980 replay_barrier $SINGLEMDS
1981 #define OBD_FAIL_LDLM_REPLY 0x30c
1982 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
1985 wait $pid || return 1
1986 [ -e $DIR/$tfile ] && return 2
1989 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
1992 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1996 replay_barrier $SINGLEMDS
1997 #define OBD_FAIL_TGT_LAST_REPLAY 0x710
1998 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000710"
2001 wait $pid || return 1
2002 [ -e $DIR/$tfile ] && return 2
2005 run_test 73c "open(O_CREAT), unlink, replay, reconnect at last_replay, close"
2009 local clients=${CLIENTS:-$HOSTNAME}
2011 zconf_umount_clients $clients $MOUNT
2013 facet_failover $SINGLEMDS
2014 zconf_mount_clients $clients $MOUNT
2016 touch $DIR/$tfile || return 1
2017 rm $DIR/$tfile || return 2
2018 clients_up || error "client evicted: $?"
2021 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2023 remote_dir_check_80() {
2025 local diridx=$($GETSTRIPE -M $remote_dir)
2026 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
2028 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2029 local fileidx=$($GETSTRIPE -M $remote_dir/f-1)
2030 [ $fileidx -eq $MDTIDX ] || error "$fileidx != $MDTIDX"
2036 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2037 ([ $FAILURE_MODE == "HARD" ] &&
2038 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2039 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2043 local remote_dir=$DIR/$tdir/remote_dir
2046 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2047 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2048 $LFS mkdir -i $MDTIDX $remote_dir &
2053 wait $CLIENT_PID || error "remote creation failed"
2055 remote_dir_check_80 || error "remote dir check failed"
2056 rm -rf $DIR/$tdir || error "rmdir failed"
2060 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2063 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2064 ([ $FAILURE_MODE == "HARD" ] &&
2065 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2066 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2070 local remote_dir=$DIR/$tdir/remote_dir
2073 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2074 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2075 $LFS mkdir -i $MDTIDX $remote_dir &
2078 fail mds$((MDTIDX + 1))
2080 wait $CLIENT_PID || error "remote creation failed"
2082 remote_dir_check_80 || error "remote dir check failed"
2083 rm -rf $DIR/$tdir || error "rmdir failed"
2087 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2090 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2091 ([ $FAILURE_MODE == "HARD" ] &&
2092 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2093 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2097 local remote_dir=$DIR/$tdir/remote_dir
2100 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2101 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2102 $LFS mkdir -i $MDTIDX $remote_dir &
2106 fail mds$((MDTIDX + 1))
2108 wait $CLIENT_PID || error "remote creation failed"
2110 remote_dir_check_80 || error "remote dir check failed"
2111 rm -rf $DIR/$tdir || error "rmdir failed"
2115 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2118 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2120 local remote_dir=$DIR/$tdir/remote_dir
2123 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2124 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2125 $LFS mkdir -i $MDTIDX $remote_dir &
2128 # sleep 3 seconds to make sure MDTs are failed after
2129 # lfs mkdir -i has finished on all of MDTs.
2131 fail mds${MDTIDX},mds$((MDTIDX + 1))
2133 wait $CLIENT_PID || error "remote creation failed"
2135 remote_dir_check_80 || error "remote dir check failed"
2136 rm -rf $DIR/$tdir || error "rmdir failed"
2140 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2143 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2144 ([ $FAILURE_MODE == "HARD" ] &&
2145 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2146 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2150 local remote_dir=$DIR/$tdir/remote_dir
2153 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2154 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2155 $LFS mkdir -i $MDTIDX $remote_dir &
2158 # sleep 3 seconds to make sure MDTs are failed after
2159 # lfs mkdir -i has finished on all of MDTs.
2164 wait $CLIENT_PID || error "remote creation failed"
2166 remote_dir_check_80 || error "remote dir check failed"
2167 rm -rf $DIR/$tdir || error "rmdir failed"
2171 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2174 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2175 ([ $FAILURE_MODE == "HARD" ] &&
2176 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2177 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2180 local remote_dir=$DIR/$tdir/remote_dir
2183 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2184 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2185 $LFS mkdir -i $MDTIDX $remote_dir &
2188 fail mds$((MDTIDX + 1))
2190 wait $CLIENT_PID || error "remote creation failed"
2192 remote_dir_check_80 || error "remote dir check failed"
2193 rm -rf $DIR/$tdir || error "rmdir failed"
2197 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2200 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2201 ([ $FAILURE_MODE == "HARD" ] &&
2202 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2203 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2207 local remote_dir=$DIR/$tdir/remote_dir
2210 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2211 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2212 $LFS mkdir -i $MDTIDX $remote_dir &
2215 # sleep 3 seconds to make sure MDTs are failed after
2216 # lfs mkdir -i has finished on all of MDTs.
2220 fail mds$((MDTIDX + 1))
2222 wait $CLIENT_PID || error "remote creation failed"
2224 remote_dir_check_80 || error "remote dir check failed"
2225 rm -rf $DIR/$tdir || error "rmdir failed"
2229 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2232 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2234 local remote_dir=$DIR/$tdir/remote_dir
2237 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2238 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2239 $LFS mkdir -i $MDTIDX $remote_dir &
2242 # sleep 3 seconds to make sure MDTs are failed after
2243 # lfs mkdir -i has finished on all of MDTs.
2246 fail mds${MDTIDX},mds$((MDTIDX + 1))
2248 wait $CLIENT_PID || return 1
2250 remote_dir_check_80 || error "remote dir check failed"
2251 rm -rf $DIR/$tdir || error "rmdir failed"
2255 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2258 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2259 ([ $FAILURE_MODE == "HARD" ] &&
2260 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2261 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2265 local remote_dir=$DIR/$tdir/remote_dir
2268 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2271 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2272 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2276 fail mds$((MDTIDX + 1))
2278 wait $CLIENT_PID || error "rm remote dir failed"
2280 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2282 rm -rf $DIR/$tdir || error "rmdir failed"
2286 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2289 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2290 ([ $FAILURE_MODE == "HARD" ] &&
2291 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2292 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2295 local remote_dir=$DIR/$tdir/remote_dir
2298 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2300 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2301 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2307 wait $CLIENT_PID || error "rm remote dir failed"
2309 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2311 rm -rf $DIR/$tdir || error "rmdir failed"
2315 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2318 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2319 ([ $FAILURE_MODE == "HARD" ] &&
2320 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2321 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2325 local remote_dir=$DIR/$tdir/remote_dir
2328 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2330 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2331 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2336 fail mds$((MDTIDX + 1))
2338 wait $CLIENT_PID || error "rm remote dir failed"
2340 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2342 rm -rf $DIR/$tdir || error "rmdir failed"
2346 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2349 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2351 local remote_dir=$DIR/$tdir/remote_dir
2354 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2356 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2357 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2361 fail mds${MDTIDX},mds$((MDTIDX + 1))
2363 wait $CLIENT_PID || error "rm remote dir failed"
2365 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2367 rm -rf $DIR/$tdir || error "rmdir failed"
2371 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2374 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2375 ([ $FAILURE_MODE == "HARD" ] &&
2376 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2377 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2381 local remote_dir=$DIR/$tdir/remote_dir
2384 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2386 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2387 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2390 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2394 wait $CLIENT_PID || error "rm remote dir failed"
2396 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2398 rm -rf $DIR/$tdir || error "rmdir failed"
2402 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2405 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2406 ([ $FAILURE_MODE == "HARD" ] &&
2407 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2408 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2412 local remote_dir=$DIR/$tdir/remote_dir
2415 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2417 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2418 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2422 fail mds$((MDTIDX + 1))
2424 wait $CLIENT_PID || error "rm remote dir failed"
2426 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2428 rm -rf $DIR/$tdir || error "rmdir failed"
2432 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
2435 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2436 ([ $FAILURE_MODE == "HARD" ] &&
2437 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2438 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2442 local remote_dir=$DIR/$tdir/remote_dir
2445 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2447 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2448 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2453 fail mds$((MDTIDX + 1))
2455 wait $CLIENT_PID || error "rm remote dir failed"
2457 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2459 rm -rf $DIR/$tdir || error "rmdir failed"
2463 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
2466 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2468 local remote_dir=$DIR/$tdir/remote_dir
2471 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2473 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2474 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2478 fail mds${MDTIDX},mds$((MDTIDX + 1))
2480 wait $CLIENT_PID || error "rm remote dir failed"
2482 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2484 rm -rf $DIR/$tdir || error "rmdir failed"
2488 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
2492 createmany -o $DIR/$tdir/$tfile- 10 || return 1
2493 #define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD 0x140
2494 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000140"
2495 unlinkmany $DIR/$tdir/$tfile- 10 || return 2
2497 run_test 83a "fail log_add during unlink recovery"
2501 createmany -o $DIR/$tdir/$tfile- 10 || return 1
2502 replay_barrier $SINGLEMDS
2503 unlinkmany $DIR/$tdir/$tfile- 10 || return 2
2504 #define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD 0x140
2505 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000140"
2508 run_test 83b "fail log_add during unlink recovery"
2511 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
2512 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
2513 createmany -o $DIR/$tfile- 1 &
2517 client_up || client_up || true # reconnect
2519 run_test 84a "stale open during export disconnect"
2521 test_85a() { #bug 16774
2522 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2524 for i in `seq 100`; do
2525 echo "tag-$i" > $DIR/$tfile-$i
2526 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
2529 lov_id=`lctl dl | grep "clilov"`
2530 addr=`echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}'`
2531 count=`lctl get_param -n ldlm.namespaces.*MDT0000*$addr.lock_unused_count`
2532 echo "before recovery: unused locks count = $count"
2536 count2=`lctl get_param -n ldlm.namespaces.*MDT0000*$addr.lock_unused_count`
2537 echo "after recovery: unused locks count = $count2"
2539 if [ $count2 -ge $count ]; then
2540 error "unused locks are not canceled"
2543 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
2545 test_85b() { #bug 16774
2546 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2548 do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || return 1
2549 do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $FSNAME-OST0000 || return 2
2551 $SETSTRIPE -c 1 -p $FSNAME.$TESTNAME $DIR
2553 for i in `seq 100`; do
2554 dd if=/dev/urandom of=$DIR/$tfile-$i bs=4096 count=32 >/dev/null 2>&1
2557 cancel_lru_locks osc
2559 for i in `seq 100`; do
2560 dd if=$DIR/$tfile-$i of=/dev/null bs=4096 count=32 >/dev/null 2>&1
2563 lov_id=`lctl dl | grep "clilov"`
2564 addr=`echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}'`
2565 count=`lctl get_param -n ldlm.namespaces.*OST0000*$addr.lock_unused_count`
2566 echo "before recovery: unused locks count = $count"
2567 [ $count != 0 ] || return 3
2571 count2=`lctl get_param -n ldlm.namespaces.*OST0000*$addr.lock_unused_count`
2572 echo "after recovery: unused locks count = $count2"
2574 do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $FSNAME-OST0000 || return 4
2575 do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME || return 5
2577 if [ $count2 -ge $count ]; then
2578 error "unused locks are not canceled"
2581 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
2584 local clients=${CLIENTS:-$HOSTNAME}
2586 zconf_umount_clients $clients $MOUNT
2587 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
2588 remount_facet $SINGLEMDS
2589 zconf_mount_clients $clients $MOUNT
2591 run_test 86 "umount server after clear nid_stats should not hit LBUG"
2594 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
2597 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2598 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 || error "Cannot write"
2599 cksum=`md5sum $DIR/$tfile | awk '{print $1}'`
2600 cancel_lru_locks osc
2602 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
2603 cksum2=`md5sum $DIR/$tfile | awk '{print $1}'`
2604 if [ $cksum != $cksum2 ] ; then
2605 error "New checksum $cksum2 does not match original $cksum"
2608 run_test 87 "write replay"
2611 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
2614 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2615 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 || error "Cannot write"
2616 sleep 1 # Give it a chance to flush dirty data
2617 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
2618 cksum=`md5sum $DIR/$tfile | awk '{print $1}'`
2619 cancel_lru_locks osc
2621 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
2622 cksum2=`md5sum $DIR/$tfile | awk '{print $1}'`
2623 if [ $cksum != $cksum2 ] ; then
2624 error "New checksum $cksum2 does not match original $cksum"
2627 run_test 87b "write replay with changed data (checksum resend)"
2629 test_88() { #bug 17485
2633 $SETSTRIPE -i 0 -c 1 $DIR/$tdir || error "$SETSTRIPE"
2636 replay_barrier $SINGLEMDS
2638 # exhaust precreations on ost1
2639 local OST=$(ostname_from_index 0)
2640 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
2641 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2642 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2643 echo "before test: last_id = $last_id, next_id = $next_id"
2645 echo "Creating to objid $last_id on ost $OST..."
2646 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2))
2648 #create some files to use some uncommitted objids
2649 last_id=$(($last_id + 1))
2650 createmany -o $DIR/$tdir/f-%d $last_id 8
2652 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2653 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2654 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
2656 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
2657 # it has to take care about the affected facets, bug20407
2658 local affected_mds1=$(affected_facets mds1)
2659 local affected_ost1=$(affected_facets ost1)
2661 shutdown_facet $SINGLEMDS
2664 reboot_facet $SINGLEMDS
2665 change_active $affected_mds1
2666 wait_for_facet $affected_mds1
2667 mount_facets $affected_mds1 || error "Restart of mds failed"
2670 change_active $affected_ost1
2671 wait_for_facet $affected_ost1
2672 mount_facets $affected_ost1 || error "Restart of ost1 failed"
2676 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2677 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2678 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
2680 # create new files, which should use new objids, and ensure the orphan
2681 # cleanup phase for ost1 is completed at the same time
2682 for i in `seq 8`; do
2683 file_id=$(($last_id + 10 + $i))
2684 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
2687 # if the objids were not recreated, then "ls" will failed for -ENOENT
2688 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
2691 # write into previously created files
2692 for i in `seq 8`; do
2693 file_id=$(($last_id + $i))
2694 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
2695 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
2698 # compare the content
2699 for i in `seq 8`; do
2700 file_id=$(($last_id + $i))
2701 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id || error "the content" \
2702 "of file is modified!"
2707 run_test 88 "MDS should not assign same objid to different files "
2710 cancel_lru_locks osc
2712 rm -f $DIR/$tdir/$tfile
2714 wait_delete_completed
2715 BLOCKS1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
2716 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
2717 dd if=/dev/zero bs=1M count=10 of=$DIR/$tdir/$tfile
2720 facet_failover $SINGLEMDS
2721 rm $DIR/$tdir/$tfile
2724 zconf_mount $(hostname) $MOUNT
2725 client_up || return 1
2727 wait_delete_completed
2728 BLOCKS2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
2729 [ $((BLOCKS2 - BLOCKS1)) -le 4 ] || \
2730 error $((BLOCKS2 - BLOCKS1)) blocks leaked
2733 run_test 89 "no disk space leak on late ost connection"
2739 change_active $facet
2740 wait_for_facet $facet
2741 mount_facet $facet || error "Restart of $facet failed"
2745 test_90() { # bug 19494
2746 local dir=$DIR/$tdir
2747 local ostfail=$(get_random_entry $(get_facets OST))
2749 if [[ $FAILURE_MODE = HARD ]]; then
2750 local affected=$(affected_facets $ostfail);
2751 if [[ "$affected" != $ostfail ]]; then
2752 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
2759 echo "Create the files"
2761 # file "f${index}" striped over 1 OST
2762 # file "all" striped over all OSTs
2764 $SETSTRIPE -c $OSTCOUNT $dir/all ||
2765 error "setstripe failed to create $dir/all"
2767 for (( i=0; i<$OSTCOUNT; i++ )); do
2769 $SETSTRIPE -i $i -c 1 $f || error "$SETSTRIPE failed to create $f"
2771 # confirm setstripe actually created the stripe on the requested OST
2772 local uuid=$(ostuuid_from_index $i)
2773 for file in f$i all; do
2774 if [[ $dir/$file != $($LFS find --obd $uuid --name $file $dir) ]]; then
2775 $GETSTRIPE $dir/$file
2776 error wrong stripe: $file, uuid: $uuid
2781 # Before failing an OST, get its obd name and index
2782 local varsvc=${ostfail}_svc
2783 local obd=$(do_facet $ostfail lctl get_param -n obdfilter.${!varsvc}.uuid)
2784 local index=$(($(facet_number $ostfail) - 1))
2786 echo "Fail $ostfail $obd, display the list of affected files"
2787 shutdown_facet $ostfail || return 2
2789 trap "cleanup_90 $ostfail" EXIT INT
2790 echo "General Query: lfs find $dir"
2791 local list=$($LFS find $dir)
2793 for (( i=0; i<$OSTCOUNT; i++ )); do
2794 list_member "$list" $dir/f$i || error_noexit "lfs find $dir: no file f$i"
2796 list_member "$list" $dir/all || error_noexit "lfs find $dir: no file all"
2798 # focus on the missing OST,
2799 # we expect to see only two files affected: "f$(index)" and "all"
2801 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
2802 list=$($LFS find --obd $obd $dir)
2804 for file in all f$index; do
2805 list_member "$list" $dir/$file ||
2806 error_noexit "lfs find does not report the affected $obd for $file"
2809 [[ $(echo $list | wc -w) -eq 2 ]] ||
2810 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
2812 echo "Check getstripe: $GETSTRIPE -r --obd $obd"
2813 list=$($GETSTRIPE -r --obd $obd $dir)
2815 for file in all f$index; do
2816 echo "$list" | grep $dir/$file ||
2817 error_noexit "lfs getsripe does not report the affected $obd for $file"
2822 run_test 90 "lfs find identifies the missing striped file segments"
2825 local server_version=$(lustre_version_code $SINGLEMDS)
2826 [[ $server_version -ge $(version_code 2.6.90) ]] ||
2827 [[ $server_version -ge $(version_code 2.5.4) &&
2828 $server_version -lt $(version_code 2.5.50) ]] ||
2829 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
2831 cancel_lru_locks osc
2833 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2834 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1
2835 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
2836 # We need to emulate a state that OST is waiting for other clients
2837 # not completing the recovery. Final ping is queued, but reply will be sent
2838 # on the recovery completion. It is done by sleep before processing final
2840 do_facet ost1 "$LCTL set_param fail_val=40"
2841 do_facet ost1 "$LCTL set_param fail_loc=0x715"
2844 run_test 93 "replay + reconnect"
2846 striped_dir_check_100() {
2847 local striped_dir=$DIR/$tdir/striped_dir
2848 local stripe_count=$($LFS getdirstripe -c $striped_dir)
2850 $LFS getdirstripe $striped_dir
2851 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
2853 createmany -o $striped_dir/f-%d 20 ||
2854 error "creation failed under striped dir"
2858 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2859 ([ $FAILURE_MODE == "HARD" ] &&
2860 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2861 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2864 local striped_dir=$DIR/$tdir/striped_dir
2869 #To make sure MDT1 and MDT0 are connected
2870 #otherwise it may create single stripe dir here
2871 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
2873 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2874 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
2875 $LFS setdirstripe -i0 -c2 $striped_dir &
2878 fail mds$((MDTIDX + 1))
2880 wait $CLIENT_PID || error "striped dir creation failed"
2882 striped_dir_check_100 || error "striped dir check failed"
2883 rm -rf $DIR/$tdir || error "rmdir failed"
2885 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
2888 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2889 ([ $FAILURE_MODE == "HARD" ] &&
2890 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2891 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2894 local striped_dir=$DIR/$tdir/striped_dir
2899 #To make sure MDT1 and MDT0 are connected
2900 #otherwise it may create single stripe dir here
2901 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
2903 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2904 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
2905 $LFS mkdir -i0 -c2 $striped_dir &
2910 wait $CLIENT_PID || error "striped dir creation failed"
2912 striped_dir_check_100 || error "striped dir check failed"
2913 rm -rf $DIR/$tdir || error "rmdir failed"
2915 run_test 100b "DNE: create striped dir, fail MDT0"
2918 check_and_cleanup_lustre