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 fail $SINGLEMDS # start orphan recovery
440 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
441 wait_delete_completed_mds $wait_timeout || return 3
442 AFTERUSED=$(df -P $DIR | tail -1 | awk '{ print $3 }')
443 log "before $BEFOREUSED, after $AFTERUSED"
444 (( $AFTERUSED > $BEFOREUSED + $(fs_log_size) )) &&
445 error "after $AFTERUSED > before $BEFOREUSED"
448 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"
450 test_20c() { # bug 10480
451 multiop_bg_pause $DIR/$tfile Ow_c || return 1
457 client_up || client_up || true # reconnect
460 wait $pid || return 1
461 [ -s $DIR/$tfile ] || error "File was truncated"
465 run_test 20c "check that client eviction does not affect file content"
468 replay_barrier $SINGLEMDS
469 multiop_bg_pause $DIR/$tfile O_tSc || return 5
472 touch $DIR/g11 || return 1
476 wait $pid || return 2
477 [ -e $DIR/$tfile ] && return 3
478 touch $DIR/h11 || return 4
481 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
484 multiop_bg_pause $DIR/$tfile O_tSc || return 3
487 replay_barrier $SINGLEMDS
492 wait $pid || return 1
493 [ -e $DIR/$tfile ] && return 2
496 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
499 multiop_bg_pause $DIR/$tfile O_tSc || return 5
502 replay_barrier $SINGLEMDS
504 touch $DIR/g11 || return 1
508 wait $pid || return 2
509 [ -e $DIR/$tfile ] && return 3
510 touch $DIR/h11 || return 4
513 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
516 multiop_bg_pause $DIR/$tfile O_tSc || return 3
519 replay_barrier $SINGLEMDS
523 wait $pid || return 1
524 [ -e $DIR/$tfile ] && return 2
527 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
530 multiop_bg_pause $DIR/$tfile O_tSc || return 3
534 replay_barrier $SINGLEMDS
537 wait $pid || return 1
538 [ -e $DIR/$tfile ] && return 2
541 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
544 replay_barrier $SINGLEMDS
545 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
547 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
552 wait $pid2 || return 1
556 wait $pid1 || return 2
557 [ -e $DIR/$tfile-1 ] && return 3
558 [ -e $DIR/$tfile-2 ] && return 4
561 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
564 replay_barrier $SINGLEMDS
565 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
567 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
574 wait $pid1 || return 1
576 wait $pid2 || return 2
577 [ -e $DIR/$tfile-1 ] && return 3
578 [ -e $DIR/$tfile-2 ] && return 4
581 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
584 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
586 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
588 replay_barrier $SINGLEMDS
592 wait $pid2 || return 1
596 wait $pid1 || return 2
597 [ -e $DIR/$tfile-1 ] && return 3
598 [ -e $DIR/$tfile-2 ] && return 4
601 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
604 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
606 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
608 replay_barrier $SINGLEMDS
614 wait $pid1 || return 1
616 wait $pid2 || return 2
617 [ -e $DIR/$tfile-1 ] && return 3
618 [ -e $DIR/$tfile-2 ] && return 4
621 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
624 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
626 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
631 replay_barrier $SINGLEMDS
634 wait $pid1 || return 1
636 wait $pid2 || return 2
637 [ -e $DIR/$tfile-1 ] && return 3
638 [ -e $DIR/$tfile-2 ] && return 4
641 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
644 multiop_bg_pause $DIR/$tfile-1 O_tSc || return 5
646 multiop_bg_pause $DIR/$tfile-2 O_tSc || return 6
650 replay_barrier $SINGLEMDS
654 wait $pid1 || return 1
656 wait $pid2 || return 2
657 [ -e $DIR/$tfile-1 ] && return 3
658 [ -e $DIR/$tfile-2 ] && return 4
661 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
663 # tests for bug 2104; completion without crashing is success. The close is
664 # stale, but we always return 0 for close, so the app never sees it.
666 multiop_bg_pause $DIR/$tfile O_c || return 2
668 multiop_bg_pause $DIR/$tfile O_c || return 3
671 client_up || client_up || return 1
674 wait $pid1 || return 4
675 wait $pid2 || return 5
678 run_test 32 "close() notices client eviction; close() after client eviction"
681 createmany -o $DIR/$tfile-%d 10
682 replay_barrier_nosync $SINGLEMDS
683 fail_abort $SINGLEMDS
684 # recreate shouldn't fail
685 createmany -o $DIR/$tfile--%d 10 || return 1
689 run_test 33a "fid seq shouldn't be reused after abort recovery"
692 #define OBD_FAIL_SEQ_ALLOC 0x1311
693 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
695 createmany -o $DIR/$tfile-%d 10
696 replay_barrier_nosync $SINGLEMDS
697 fail_abort $SINGLEMDS
698 # recreate shouldn't fail
699 createmany -o $DIR/$tfile--%d 10 || return 1
703 run_test 33b "test fid seq allocation"
706 multiop_bg_pause $DIR/$tfile O_c || return 2
710 replay_barrier $SINGLEMDS
711 fail_abort $SINGLEMDS
713 wait $pid || return 3
714 [ -e $DIR/$tfile ] && return 1
718 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
720 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
724 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
725 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
730 # give a chance to remove from MDS
731 fail_abort $SINGLEMDS
732 $CHECKSTAT -t file $DIR/$tfile && return 1 || true
734 run_test 35 "test recovery from llog for unlink op"
736 # b=2432 resent cancel after replay uses wrong cookie,
737 # so don't resend cancels
739 replay_barrier $SINGLEMDS
741 checkstat $DIR/$tfile
742 facet_failover $SINGLEMDS
744 if dmesg | grep "unknown lock cookie"; then
745 echo "cancel after replay failed"
749 run_test 36 "don't resend cancel"
752 # directory orphans can't be unlinked from PENDING directory
754 rmdir $DIR/$tfile 2>/dev/null
755 multiop_bg_pause $DIR/$tfile dD_c || return 2
759 replay_barrier $SINGLEMDS
760 # clear the dmesg buffer so we only see errors from this recovery
761 do_facet $SINGLEMDS dmesg -c >/dev/null
762 fail_abort $SINGLEMDS
764 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
766 wait $pid || return 3
770 start_full_debug_logging
771 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
772 stop_full_debug_logging
775 createmany -o $DIR/$tfile-%d 800
776 unlinkmany $DIR/$tfile-%d 0 400
777 replay_barrier $SINGLEMDS
779 unlinkmany $DIR/$tfile-%d 400 400
781 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
783 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
785 test_39() { # bug 4176
786 createmany -o $DIR/$tfile-%d 800
787 replay_barrier $SINGLEMDS
788 unlinkmany $DIR/$tfile-%d 0 400
790 unlinkmany $DIR/$tfile-%d 400 400
792 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
794 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
797 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
802 # always need connection to MDS to verify layout during IO. LU-2628.
803 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
804 skip "layout_lock needs MDS connection for IO" && return 0
806 $LCTL mark multiop $MOUNT/$tfile OS_c
807 multiop $MOUNT/$tfile OS_c &
809 writeme -s $MOUNT/${tfile}-2 &
812 facet_failover $SINGLEMDS
813 #define OBD_FAIL_MDS_CONNECT_NET 0x117
814 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
816 stat1=`count_ost_writes`
818 stat2=`count_ost_writes`
819 echo "$stat1, $stat2"
820 if [ $stat1 -lt $stat2 ]; then
821 echo "writes continuing during recovery"
824 echo "writes not continuing during recovery, bug 2477"
827 echo "waiting for writeme $WRITE_PID"
831 echo "waiting for multiop $PID"
832 wait $PID || return 2
833 do_facet client munlink $MOUNT/$tfile || return 3
834 do_facet client munlink $MOUNT/${tfile}-2 || return 3
837 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
841 # make sure that a read to one osc doesn't try to double-unlock its page just
842 # because another osc is invalid. trigger_group_io used to mistakenly return
843 # an error if any oscs were invalid even after having successfully put rpcs
844 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
845 # the page, guarnateeing that the unlock from the RPC completion would
846 # assert on trying to unlock the unlocked page.
848 [ $OSTCOUNT -lt 2 ] &&
849 skip_env "skipping test 41: we don't have a second OST to test with" &&
852 local f=$MOUNT/$tfile
853 # make sure the start of the file is ost1
854 $SETSTRIPE -S $((128 * 1024)) -i 0 $f
855 do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3
857 # fail ost2 and read from ost1
858 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
859 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | \
860 grep $mdtosc | awk '{print $1}')
861 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" && lctl get_param -n devices &&
863 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate || return 1
864 do_facet client dd if=$f of=/dev/null bs=4k count=1 || return 3
865 do_facet $SINGLEMDS $LCTL --device $osc2dev activate || return 2
868 run_test 41 "read from a valid osc while other oscs are invalid"
870 # test MDS recovery after ost failure
872 blocks=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
873 createmany -o $DIR/$tfile-%d 800
875 unlinkmany $DIR/$tfile-%d 0 400
877 lctl set_param debug=-1
880 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
881 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
882 #[ $blocks_after -lt $blocks ] || return 1
883 echo wait for MDS to timeout and recover
884 sleep $((TIMEOUT * 2))
886 unlinkmany $DIR/$tfile-%d 400 400
887 $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
889 run_test 42 "recovery after ost failure"
891 # timeout in MDS/OST recovery RPC will LBUG MDS
892 test_43() { # bug 2530
893 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
895 replay_barrier $SINGLEMDS
897 # OBD_FAIL_OST_CREATE_NET 0x204
898 do_facet ost1 "lctl set_param fail_loc=0x80000204"
901 do_facet ost1 "lctl set_param fail_loc=0"
905 run_test 43 "mds osc import failure during recovery; don't LBUG"
907 test_44a() { # was test_44
910 local mdcdev=$($LCTL dl |
911 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
912 [ "$mdcdev" ] || return 2
913 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
914 { echo mdcdev=$mdcdev; $LCTL dl; return 3; }
916 # adaptive timeouts slow this way down
917 if at_is_enabled; then
918 at_max_saved=$(at_max_get mds)
922 for i in `seq 1 10`; do
923 echo "$i of 10 ($(date +%s))"
924 do_facet $SINGLEMDS \
925 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
926 #define OBD_FAIL_TGT_CONN_RACE 0x701
927 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
928 # lctl below may fail, it is valid case
929 $LCTL --device $mdcdev recover
932 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
933 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
936 run_test 44a "race in target handle connect"
939 local mdcdev=$($LCTL dl |
940 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
941 [ "$mdcdev" ] || return 2
942 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
943 { echo mdcdev=$mdcdev; $LCTL dl; return 3; }
945 for i in `seq 1 10`; do
946 echo "$i of 10 ($(date +%s))"
947 do_facet $SINGLEMDS \
948 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
949 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
950 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
951 # lctl below may fail, it is valid case
952 $LCTL --device $mdcdev recover
955 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
958 run_test 44b "race in target handle connect"
961 replay_barrier $SINGLEMDS
962 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
963 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
964 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
965 fail_abort $SINGLEMDS
966 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
968 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
971 run_test 44c "race in target handle connect"
973 # Handle failed close
975 local mdcdev=$($LCTL get_param -n devices |
976 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
977 [ "$mdcdev" ] || return 2
978 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
979 { echo mdcdev=$mdcdev; $LCTL dl; return 3; }
981 $LCTL --device $mdcdev recover || return 6
983 multiop_bg_pause $DIR/$tfile O_c || return 1
986 # This will cause the CLOSE to fail before even
987 # allocating a reply buffer
988 $LCTL --device $mdcdev deactivate || return 4
992 wait $pid || return 1
994 $LCTL --device $mdcdev activate || return 5
997 $CHECKSTAT -t file $DIR/$tfile || return 2
1000 run_test 45 "Handle failed close"
1004 drop_reply "touch $DIR/$tfile"
1006 # ironically, the previous test, 45, will cause a real forced close,
1007 # so just look for one for this test
1008 dmesg | grep -i "force closing client file handle for $tfile" && return 1
1011 run_test 46 "Don't leak file handle after open resend (3325)"
1013 test_47() { # bug 2824
1014 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1016 # create some files to make sure precreate has been done on all
1017 # OSTs. (just in case this test is run independently)
1018 createmany -o $DIR/$tfile 20 || return 1
1020 # OBD_FAIL_OST_CREATE_NET 0x204
1022 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1023 client_up || return 2
1025 # let the MDS discover the OST failure, attempt to recover, fail
1026 # and recover again.
1027 sleep $((3 * TIMEOUT))
1029 # Without 2824, this createmany would hang
1030 createmany -o $DIR/$tfile 20 || return 3
1031 unlinkmany $DIR/$tfile 20 || return 4
1033 do_facet ost1 "lctl set_param fail_loc=0"
1036 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1039 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1040 [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2 OSTs -- skipping" && return
1042 replay_barrier $SINGLEMDS
1043 createmany -o $DIR/$tfile 20 || return 1
1044 # OBD_FAIL_OST_EROFS 0x216
1045 facet_failover $SINGLEMDS
1046 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1047 client_up || return 2
1049 createmany -o $DIR/$tfile 20 20 || return 2
1050 unlinkmany $DIR/$tfile 40 || return 3
1053 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1056 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1057 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | \
1058 grep $mdtosc | awk '{print $1}')
1059 [ "$oscdev" ] || return 1
1060 do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 2
1061 do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 3
1062 # give the mds_lov_sync threads a chance to run
1065 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1067 # b3764 timed out lock replay
1070 cancel_lru_locks mdc
1072 multiop $DIR/$tfile s || return 1
1073 replay_barrier $SINGLEMDS
1074 #define OBD_FAIL_LDLM_REPLY 0x30c
1075 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
1076 fail $SINGLEMDS || return 2
1077 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1079 $CHECKSTAT -t file $DIR/$tfile-* && return 3 || true
1081 run_test 52 "time out lock replay (3764)"
1083 # bug 3462 - simultaneous MDC requests
1085 cancel_lru_locks mdc # cleanup locks from former test cases
1086 mkdir -p $DIR/${tdir}-1
1087 mkdir -p $DIR/${tdir}-2
1088 multiop $DIR/${tdir}-1/f O_c &
1090 # give multiop a change to open
1093 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1094 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1095 kill -USR1 $close_pid
1096 cancel_lru_locks mdc # force the close
1097 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1099 mcreate $DIR/${tdir}-2/f || return 1
1101 # close should still be here
1102 [ -d /proc/$close_pid ] || return 2
1104 replay_barrier_nodf $SINGLEMDS
1106 wait $close_pid || return 3
1108 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1109 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1110 rm -rf $DIR/${tdir}-*
1112 run_test 53a "|X| close request while two MDC requests in flight"
1115 cancel_lru_locks mdc # cleanup locks from former test cases
1116 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1118 mkdir -p $DIR/${tdir}-1
1119 mkdir -p $DIR/${tdir}-2
1120 multiop_bg_pause $DIR/${tdir}-1/f O_c || return 6
1123 #define OBD_FAIL_MDS_REINT_NET 0x107
1124 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1125 mcreate $DIR/${tdir}-2/f &
1129 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1130 kill -USR1 $close_pid
1131 cancel_lru_locks mdc # force the close
1132 wait $close_pid || return 1
1133 # open should still be here
1134 [ -d /proc/$open_pid ] || return 2
1136 replay_barrier_nodf $SINGLEMDS
1138 wait $open_pid || return 3
1140 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1141 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1142 rm -rf $DIR/${tdir}-*
1144 run_test 53b "|X| open request while two MDC requests in flight"
1147 cancel_lru_locks mdc # cleanup locks from former test cases
1148 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1150 mkdir -p $DIR/${tdir}-1
1151 mkdir -p $DIR/${tdir}-2
1152 multiop $DIR/${tdir}-1/f O_c &
1155 #define OBD_FAIL_MDS_REINT_NET 0x107
1156 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1157 mcreate $DIR/${tdir}-2/f &
1161 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1162 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1163 kill -USR1 $close_pid
1164 cancel_lru_locks mdc # force the close
1166 #bz20647: make sure all pids are exists before failover
1167 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1168 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1169 replay_barrier_nodf $SINGLEMDS
1170 fail_nodf $SINGLEMDS
1171 wait $open_pid || return 1
1173 # close should be gone
1174 [ -d /proc/$close_pid ] && return 2
1175 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1177 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1178 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1179 rm -rf $DIR/${tdir}-*
1181 run_test 53c "|X| open request and close request while two MDC requests in flight"
1184 cancel_lru_locks mdc # cleanup locks from former test cases
1185 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1187 mkdir -p $DIR/${tdir}-1
1188 mkdir -p $DIR/${tdir}-2
1189 multiop $DIR/${tdir}-1/f O_c &
1191 # give multiop a chance to open
1194 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1195 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1196 kill -USR1 $close_pid
1197 cancel_lru_locks mdc # force the close
1198 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1199 mcreate $DIR/${tdir}-2/f || return 1
1201 # close should still be here
1202 [ -d /proc/$close_pid ] || return 2
1204 wait $close_pid || return 3
1206 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1207 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1208 rm -rf $DIR/${tdir}-*
1210 run_test 53d "|X| close reply while two MDC requests in flight"
1213 cancel_lru_locks mdc # cleanup locks from former test cases
1214 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1216 mkdir -p $DIR/${tdir}-1
1217 mkdir -p $DIR/${tdir}-2
1218 multiop $DIR/${tdir}-1/f O_c &
1221 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1222 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1223 mcreate $DIR/${tdir}-2/f &
1227 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1228 kill -USR1 $close_pid
1229 cancel_lru_locks mdc # force the close
1230 wait $close_pid || return 1
1231 # open should still be here
1232 [ -d /proc/$open_pid ] || return 2
1234 replay_barrier_nodf $SINGLEMDS
1236 wait $open_pid || return 3
1238 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1239 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1240 rm -rf $DIR/${tdir}-*
1242 run_test 53e "|X| open reply while two MDC requests in flight"
1245 cancel_lru_locks mdc # cleanup locks from former test cases
1246 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1248 mkdir -p $DIR/${tdir}-1
1249 mkdir -p $DIR/${tdir}-2
1250 multiop $DIR/${tdir}-1/f O_c &
1253 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1254 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1255 mcreate $DIR/${tdir}-2/f &
1259 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1260 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1261 kill -USR1 $close_pid
1262 cancel_lru_locks mdc # force the close
1264 #bz20647: make sure all pids are exists before failover
1265 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1266 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1267 replay_barrier_nodf $SINGLEMDS
1268 fail_nodf $SINGLEMDS
1269 wait $open_pid || return 1
1271 # close should be gone
1272 [ -d /proc/$close_pid ] && return 2
1273 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1275 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1276 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1277 rm -rf $DIR/${tdir}-*
1279 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1282 cancel_lru_locks mdc # cleanup locks from former test cases
1283 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1285 mkdir -p $DIR/${tdir}-1
1286 mkdir -p $DIR/${tdir}-2
1287 multiop $DIR/${tdir}-1/f O_c &
1290 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1291 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1292 mcreate $DIR/${tdir}-2/f &
1296 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1297 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1298 kill -USR1 $close_pid
1299 cancel_lru_locks mdc # force the close
1300 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1302 #bz20647: make sure all pids are exists before failover
1303 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1304 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1305 replay_barrier_nodf $SINGLEMDS
1306 fail_nodf $SINGLEMDS
1307 wait $open_pid || return 1
1309 # close should be gone
1310 [ -d /proc/$close_pid ] && return 2
1312 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1313 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1314 rm -rf $DIR/${tdir}-*
1316 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1319 cancel_lru_locks mdc # cleanup locks from former test cases
1320 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1322 mkdir -p $DIR/${tdir}-1
1323 mkdir -p $DIR/${tdir}-2
1324 multiop $DIR/${tdir}-1/f O_c &
1327 #define OBD_FAIL_MDS_REINT_NET 0x107
1328 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1329 mcreate $DIR/${tdir}-2/f &
1333 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1334 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1335 kill -USR1 $close_pid
1336 cancel_lru_locks mdc # force the close
1339 #bz20647: make sure all pids are exists before failover
1340 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1341 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1342 replay_barrier_nodf $SINGLEMDS
1343 fail_nodf $SINGLEMDS
1344 wait $open_pid || return 1
1346 # close should be gone
1347 [ -d /proc/$close_pid ] && return 2
1348 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1350 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1351 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1352 rm -rf $DIR/${tdir}-*
1354 run_test 53h "|X| open request and close reply while two MDC requests in flight"
1356 #b_cray 54 "|X| open request and close reply while two MDC requests in flight"
1358 #b3761 ASSERTION(hash != 0) failed
1360 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1361 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1363 # give touch a chance to run
1365 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1369 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1371 #b3440 ASSERTION(rec->ur_fid2->id) failed
1373 ln -s foo $DIR/$tfile
1374 replay_barrier $SINGLEMDS
1375 #drop_reply "cat $DIR/$tfile"
1379 run_test 56 "don't replay a symlink open request (3440)"
1381 #recovery one mds-ost setattr from llog
1383 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1384 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1386 replay_barrier $SINGLEMDS
1389 $CHECKSTAT -t file $DIR/$tfile || return 1
1390 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1393 run_test 57 "test recovery from llog for setattr op"
1396 zconf_umount `hostname` $MOUNT2
1400 #recovery many mds-ost setattr from llog
1403 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1404 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1405 createmany -o $DIR/$tdir/$tfile-%d 2500
1406 replay_barrier $SINGLEMDS
1409 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null || return 1
1410 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1411 unlinkmany $DIR/$tdir/$tfile-%d 2500
1414 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1420 trap cleanup_58 EXIT
1422 large_xattr_enabled &&
1423 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1425 mount_client $MOUNT2
1427 touch $DIR/$tdir/$tfile
1428 replay_barrier $SINGLEMDS
1429 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1431 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1432 [[ "$new" = "$orig" ]] || return 1
1433 rm -f $DIR/$tdir/$tfile
1437 run_test 58b "test replay of setxattr op"
1439 test_58c() { # bug 16570
1444 trap cleanup_58 EXIT
1446 if large_xattr_enabled; then
1447 local xattr_size=$(max_xattr_size)
1448 orig="$(generate_string $((xattr_size / 2)))"
1449 orig1="$(generate_string $xattr_size)"
1455 mount_client $MOUNT2
1457 touch $DIR/$tdir/$tfile
1458 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1460 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1461 [[ "$new" = "$orig" ]] || return 2
1462 drop_reint_reply "setfattr -n trusted.foo1 -v $orig1 $DIR/$tdir/$tfile" ||
1464 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1465 [[ "$new" = "$orig1" ]] || return 4
1466 rm -f $DIR/$tdir/$tfile
1470 run_test 58c "resend/reconstruct setxattr op"
1472 # log_commit_thread vs filter_destroy race used to lead to import use after free
1475 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1478 createmany -o $DIR/$tdir/$tfile-%d 200
1480 unlinkmany $DIR/$tdir/$tfile-%d 200
1481 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1482 do_facet ost1 "lctl set_param fail_loc=0x507"
1485 do_facet ost1 "lctl set_param fail_loc=0x0"
1489 run_test 59 "test log_commit_thread vs filter_destroy race"
1491 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1492 # bug 12086: should no oops and No ctxt error for this test
1495 createmany -o $DIR/$tdir/$tfile-%d 200
1496 replay_barrier $SINGLEMDS
1497 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1499 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1500 local no_ctxt=`dmesg | grep "No ctxt"`
1501 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1503 run_test 60 "test llog post recovery init vs llog unlink"
1505 #test race llog recovery thread vs llog cleanup
1506 test_61a() { # was test_61
1507 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1510 createmany -o $DIR/$tdir/$tfile-%d 800
1512 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1513 unlinkmany $DIR/$tdir/$tfile-%d 800
1514 set_nodes_failloc "$(osts_nodes)" 0x80000221
1519 set_nodes_failloc "$(osts_nodes)" 0x0
1521 $CHECKSTAT -t file $DIR/$tdir/$tfile-* && return 1
1524 run_test 61a "test race llog recovery vs llog cleanup"
1526 #test race mds llog sync vs llog cleanup
1528 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1529 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1530 facet_failover $SINGLEMDS
1533 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 || return 1
1535 run_test 61b "test race mds llog sync vs llog cleanup"
1537 #test race cancel cookie cb vs llog cleanup
1539 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1541 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1543 set_nodes_failloc "$(osts_nodes)" 0x80000222
1547 set_nodes_failloc "$(osts_nodes)" 0x0
1549 run_test 61c "test race mds llog sync vs llog cleanup"
1551 test_61d() { # bug 16002 # bug 17466 # bug 22137
1552 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1554 do_facet mgs "lctl set_param fail_loc=0x80000605"
1555 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1556 error "mgs start should have failed"
1557 do_facet mgs "lctl set_param fail_loc=0"
1558 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1560 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1562 test_62() { # Bug 15756 - don't mis-drop resent replay
1564 replay_barrier $SINGLEMDS
1565 createmany -o $DIR/$tdir/$tfile- 25
1566 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1567 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1569 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1570 unlinkmany $DIR/$tdir/$tfile- 25 || return 2
1573 run_test 62 "don't mis-drop resent replay"
1575 #Adaptive Timeouts (bug 3055)
1583 echo "Cleaning up AT ..."
1584 if [ -n "$ATOLDBASE" ]; then
1585 local at_history=$($LCTL get_param -n at_history)
1586 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1587 do_facet ost1 "lctl set_param at_history=$at_history" || true
1590 if [ $AT_MAX_SET -ne 0 ]; then
1591 for facet in mds client ost; do
1592 var=AT_MAX_SAVE_${facet}
1593 echo restore AT on $facet to saved value ${!var}
1594 at_max_set ${!var} $facet
1595 at_new=$(at_max_get $facet)
1596 echo Restored AT value on $facet $at_new
1597 [ $at_new -eq ${!var} ] || \
1598 error "$facet : AT value was not restored SAVED ${!var} NEW $at_new"
1605 local at_max_new=600
1607 # Save at_max original values
1609 if [ $AT_MAX_SET -eq 0 ]; then
1610 # Suppose that all osts have the same at_max
1611 for facet in mds client ost; do
1612 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1616 for facet in mds client ost; do
1617 at_max=$(at_max_get $facet)
1618 if [ $at_max -ne $at_max_new ]; then
1619 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1620 at_max_set $at_max_new $facet
1625 if [ -z "$ATOLDBASE" ]; then
1626 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1627 # speed up the timebase so we can check decreasing AT
1628 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1629 do_facet ost1 "lctl set_param at_history=8" || true
1631 # sleep for a while to cool down, should be > 8s and also allow
1632 # at least one ping to be sent. simply use TIMEOUT to be safe.
1637 test_65a() #bug 3055
1639 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1641 at_start || return 0
1642 $LCTL dk > /dev/null
1644 $LCTL set_param debug="other"
1645 # Slow down a request to the current service time, this is critical
1646 # because previous tests may have caused this value to increase.
1647 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1648 awk '/portal 12/ {print $5}'`
1649 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1651 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1652 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1653 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1654 createmany -o $DIR/$tfile 10 > /dev/null
1655 unlinkmany $DIR/$tfile 10 > /dev/null
1656 # check for log message
1657 $LCTL dk | grep "Early reply #" || error "No early reply"
1659 # client should show REQ_DELAY estimates
1660 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1662 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1664 run_test 65a "AT: verify early replies"
1666 test_65b() #bug 3055
1668 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1670 at_start || return 0
1673 $LCTL set_param debug="other trace"
1674 $LCTL dk > /dev/null
1675 # Slow down a request to the current service time, this is critical
1676 # because previous tests may have caused this value to increase.
1677 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1678 multiop $DIR/$tfile Ow1yc
1679 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1680 awk '/portal 6/ {print $5}'`
1681 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1683 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1684 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1685 do_facet ost1 $LCTL set_param fail_loc=0x224
1688 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1689 # force some real bulk transfer
1690 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1692 do_facet ost1 $LCTL set_param fail_loc=0
1693 # check for log message
1694 $LCTL dk | grep "Early reply #" || error "No early reply"
1696 # client should show REQ_DELAY estimates
1697 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1699 run_test 65b "AT: verify early replies on packed reply / bulk"
1701 test_66a() #bug 3055
1703 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1705 at_start || return 0
1706 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1707 # adjust 5s at a time so no early reply is sent (within deadline)
1708 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1709 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1710 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1711 createmany -o $DIR/$tfile 20 > /dev/null
1712 unlinkmany $DIR/$tfile 20 > /dev/null
1713 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1714 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1715 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1716 createmany -o $DIR/$tfile 20 > /dev/null
1717 unlinkmany $DIR/$tfile 20 > /dev/null
1718 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1719 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1721 createmany -o $DIR/$tfile 20 > /dev/null
1722 unlinkmany $DIR/$tfile 20 > /dev/null
1723 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1724 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1725 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1726 echo "Current MDT timeout $CUR, worst $WORST"
1727 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1729 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1731 test_66b() #bug 3055
1733 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1735 at_start || return 0
1736 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1737 awk '/network/ {print $4}')
1738 $LCTL set_param fail_val=$(($ORIG + 5))
1739 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1740 $LCTL set_param fail_loc=0x50c
1741 ls $DIR/$tfile > /dev/null 2>&1
1742 $LCTL set_param fail_loc=0
1743 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1744 awk '/network/ {print $4}')
1745 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1746 awk '/network/ {print $6}')
1747 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1748 [ $WORST -gt $ORIG ] ||
1749 error "Worst $WORST should be worse than orig $ORIG"
1751 run_test 66b "AT: verify net latency adjusts"
1753 test_67a() #bug 3055
1755 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1757 at_start || return 0
1758 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1759 # sleeping threads may drive values above this
1760 do_facet ost1 "$LCTL set_param fail_val=400"
1761 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1762 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1763 createmany -o $DIR/$tfile 20 > /dev/null
1764 unlinkmany $DIR/$tfile 20 > /dev/null
1765 do_facet ost1 "$LCTL set_param fail_loc=0"
1766 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1767 ATTEMPTS=$(($CONN2 - $CONN1))
1768 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1769 [ $ATTEMPTS -gt 0 ] &&
1770 error_ignore bz13721 "AT should have prevented reconnect"
1773 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1775 test_67b() #bug 3055
1777 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1779 at_start || return 0
1780 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1782 # exhaust precreations on ost1
1783 local OST=$(ostname_from_index 0)
1784 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1785 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1786 osc.$mdtosc.prealloc_last_id)
1787 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1788 osc.$mdtosc.prealloc_next_id)
1790 mkdir -p $DIR/$tdir/${OST}
1791 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/${OST} || error "$SETSTRIPE"
1792 echo "Creating to objid $last_id on ost $OST..."
1793 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1794 do_facet ost1 "$LCTL set_param fail_val=20000"
1795 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1796 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1799 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1801 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1802 ATTEMPTS=$(($CONN2 - $CONN1))
1803 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1804 # do it again; should not timeout
1805 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1806 cp /etc/profile $DIR/$tfile || error "cp failed"
1807 do_facet ost1 "$LCTL set_param fail_loc=0"
1809 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1810 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1811 ATTEMPTS=$(($CONN3 - $CONN2))
1812 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1813 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1816 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1818 test_68 () #bug 13813
1820 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1822 at_start || return 0
1823 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1824 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1825 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1826 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
1827 local ENQ_MIN=$(cat $ldlm_enqueue_min)
1828 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
1829 echo $TIMEOUT >> $ldlm_enqueue_min
1830 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
1834 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tdir
1835 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
1836 $LCTL set_param fail_val=$(($TIMEOUT - 1))
1837 $LCTL set_param fail_loc=0x80000312
1838 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
1839 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
1840 $LCTL set_param fail_loc=0x80000312
1841 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
1842 $LCTL set_param fail_loc=0
1844 echo $ENQ_MIN >> $ldlm_enqueue_min
1845 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
1849 run_test 68 "AT: verify slowing locks"
1852 # end of AT tests includes above lines
1855 # start multi-client tests
1857 [ -z "$CLIENTS" ] && \
1858 { skip "Need two or more clients." && return; }
1859 [ $CLIENTCOUNT -lt 2 ] && \
1860 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
1862 echo "mount clients $CLIENTS ..."
1863 zconf_mount_clients $CLIENTS $MOUNT
1865 local clients=${CLIENTS//,/ }
1866 echo "Write/read files on $DIR ; clients $CLIENTS ... "
1867 for CLIENT in $clients; do
1868 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
1869 of=$DIR/${tfile}_${CLIENT} 2>/dev/null || \
1870 error "dd failed on $CLIENT"
1873 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
1874 for C in ${CLIENTS//,/ }; do
1875 do_node $prev_client dd if=$DIR/${tfile}_${C} of=/dev/null 2>/dev/null || \
1876 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
1882 run_test 70a "check multi client t-f"
1884 check_for_process () {
1889 killall_process $clients "$prog" -0
1892 killall_process () {
1893 local clients=${1:-$(hostname)}
1898 do_nodes $clients "killall $signal $name"
1902 local clients=${CLIENTS:-$HOSTNAME}
1904 zconf_mount_clients $clients $MOUNT
1907 [ "$SLOW" = "no" ] && duration=120
1908 # set duration to 900 because it takes some time to boot node
1909 [ "$FAILURE_MODE" = HARD ] && duration=900
1912 local start_ts=$(date +%s)
1913 local cmd="rundbench 1 -t $duration"
1915 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
1916 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
1917 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
1918 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
1921 #LU-1897 wait for all dbench copies to start
1922 while ! check_for_process $clients dbench; do
1923 elapsed=$(($(date +%s) - start_ts))
1924 if [ $elapsed -gt $duration ]; then
1925 killall_process $clients dbench
1926 error "dbench failed to start on $clients!"
1931 log "Started rundbench load pid=$pid ..."
1933 elapsed=$(($(date +%s) - start_ts))
1934 local num_failovers=0
1935 while [ $elapsed -lt $duration ]; do
1936 if ! check_for_process $clients dbench; then
1937 error_noexit "dbench stopped on some of $clients!"
1938 killall_process $clients dbench
1942 replay_barrier $SINGLEMDS
1943 sleep 1 # give clients a time to do operations
1944 # Increment the number of failovers
1945 num_failovers=$((num_failovers+1))
1946 log "$TESTNAME fail $SINGLEMDS $num_failovers times"
1948 elapsed=$(($(date +%s) - start_ts))
1951 wait $pid || error "rundbench load on $clients failed!"
1953 run_test 70b "mds recovery; $CLIENTCOUNT clients"
1954 # end multi-client tests
1957 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1961 replay_barrier $SINGLEMDS
1962 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
1963 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
1966 wait $pid || return 1
1967 [ -e $DIR/$tfile ] && return 2
1970 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay , close"
1973 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1977 replay_barrier $SINGLEMDS
1978 #define OBD_FAIL_LDLM_REPLY 0x30c
1979 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
1982 wait $pid || return 1
1983 [ -e $DIR/$tfile ] && return 2
1986 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
1989 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1993 replay_barrier $SINGLEMDS
1994 #define OBD_FAIL_TGT_LAST_REPLAY 0x710
1995 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000710"
1998 wait $pid || return 1
1999 [ -e $DIR/$tfile ] && return 2
2002 run_test 73c "open(O_CREAT), unlink, replay, reconnect at last_replay, close"
2006 local clients=${CLIENTS:-$HOSTNAME}
2008 zconf_umount_clients $clients $MOUNT
2010 facet_failover $SINGLEMDS
2011 zconf_mount_clients $clients $MOUNT
2013 touch $DIR/$tfile || return 1
2014 rm $DIR/$tfile || return 2
2015 clients_up || error "client evicted: $?"
2018 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2020 remote_dir_check_80() {
2022 local diridx=$($GETSTRIPE -M $remote_dir)
2023 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
2025 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2026 local fileidx=$($GETSTRIPE -M $remote_dir/f-1)
2027 [ $fileidx -eq $MDTIDX ] || error "$fileidx != $MDTIDX"
2033 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2034 ([ $FAILURE_MODE == "HARD" ] &&
2035 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2036 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2040 local remote_dir=$DIR/$tdir/remote_dir
2043 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2044 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2045 $LFS mkdir -i $MDTIDX $remote_dir &
2050 wait $CLIENT_PID || error "remote creation failed"
2052 remote_dir_check_80 || error "remote dir check failed"
2053 rm -rf $DIR/$tdir || error "rmdir failed"
2057 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2060 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2061 ([ $FAILURE_MODE == "HARD" ] &&
2062 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2063 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2067 local remote_dir=$DIR/$tdir/remote_dir
2070 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2071 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2072 $LFS mkdir -i $MDTIDX $remote_dir &
2075 fail mds$((MDTIDX + 1))
2077 wait $CLIENT_PID || error "remote creation failed"
2079 remote_dir_check_80 || error "remote dir check failed"
2080 rm -rf $DIR/$tdir || error "rmdir failed"
2084 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2087 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2088 ([ $FAILURE_MODE == "HARD" ] &&
2089 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2090 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2094 local remote_dir=$DIR/$tdir/remote_dir
2097 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2098 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2099 $LFS mkdir -i $MDTIDX $remote_dir &
2103 fail mds$((MDTIDX + 1))
2105 wait $CLIENT_PID || error "remote creation failed"
2107 remote_dir_check_80 || error "remote dir check failed"
2108 rm -rf $DIR/$tdir || error "rmdir failed"
2112 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2115 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2117 local remote_dir=$DIR/$tdir/remote_dir
2120 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2121 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2122 $LFS mkdir -i $MDTIDX $remote_dir &
2125 # sleep 3 seconds to make sure MDTs are failed after
2126 # lfs mkdir -i has finished on all of MDTs.
2128 fail mds${MDTIDX},mds$((MDTIDX + 1))
2130 wait $CLIENT_PID || error "remote creation failed"
2132 remote_dir_check_80 || error "remote dir check failed"
2133 rm -rf $DIR/$tdir || error "rmdir failed"
2137 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2140 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2141 ([ $FAILURE_MODE == "HARD" ] &&
2142 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2143 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2147 local remote_dir=$DIR/$tdir/remote_dir
2150 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2151 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2152 $LFS mkdir -i $MDTIDX $remote_dir &
2155 # sleep 3 seconds to make sure MDTs are failed after
2156 # lfs mkdir -i has finished on all of MDTs.
2161 wait $CLIENT_PID || error "remote creation failed"
2163 remote_dir_check_80 || error "remote dir check failed"
2164 rm -rf $DIR/$tdir || error "rmdir failed"
2168 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2171 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2172 ([ $FAILURE_MODE == "HARD" ] &&
2173 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2174 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2177 local remote_dir=$DIR/$tdir/remote_dir
2180 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2181 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2182 $LFS mkdir -i $MDTIDX $remote_dir &
2185 fail mds$((MDTIDX + 1))
2187 wait $CLIENT_PID || error "remote creation failed"
2189 remote_dir_check_80 || error "remote dir check failed"
2190 rm -rf $DIR/$tdir || error "rmdir failed"
2194 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2197 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2198 ([ $FAILURE_MODE == "HARD" ] &&
2199 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2200 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2204 local remote_dir=$DIR/$tdir/remote_dir
2207 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2208 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2209 $LFS mkdir -i $MDTIDX $remote_dir &
2212 # sleep 3 seconds to make sure MDTs are failed after
2213 # lfs mkdir -i has finished on all of MDTs.
2217 fail mds$((MDTIDX + 1))
2219 wait $CLIENT_PID || error "remote creation failed"
2221 remote_dir_check_80 || error "remote dir check failed"
2222 rm -rf $DIR/$tdir || error "rmdir failed"
2226 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2229 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2231 local remote_dir=$DIR/$tdir/remote_dir
2234 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2235 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2236 $LFS mkdir -i $MDTIDX $remote_dir &
2239 # sleep 3 seconds to make sure MDTs are failed after
2240 # lfs mkdir -i has finished on all of MDTs.
2243 fail mds${MDTIDX},mds$((MDTIDX + 1))
2245 wait $CLIENT_PID || return 1
2247 remote_dir_check_80 || error "remote dir check failed"
2248 rm -rf $DIR/$tdir || error "rmdir failed"
2252 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2255 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2256 ([ $FAILURE_MODE == "HARD" ] &&
2257 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2258 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2262 local remote_dir=$DIR/$tdir/remote_dir
2265 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2268 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2269 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2273 fail mds$((MDTIDX + 1))
2275 wait $CLIENT_PID || error "rm remote dir failed"
2277 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2279 rm -rf $DIR/$tdir || error "rmdir failed"
2283 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2286 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2287 ([ $FAILURE_MODE == "HARD" ] &&
2288 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2289 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2292 local remote_dir=$DIR/$tdir/remote_dir
2295 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2297 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2298 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2304 wait $CLIENT_PID || error "rm remote dir failed"
2306 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2308 rm -rf $DIR/$tdir || error "rmdir failed"
2312 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2315 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2316 ([ $FAILURE_MODE == "HARD" ] &&
2317 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2318 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2322 local remote_dir=$DIR/$tdir/remote_dir
2325 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2327 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2328 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2333 fail mds$((MDTIDX + 1))
2335 wait $CLIENT_PID || error "rm remote dir failed"
2337 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2339 rm -rf $DIR/$tdir || error "rmdir failed"
2343 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2346 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2348 local remote_dir=$DIR/$tdir/remote_dir
2351 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2353 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2354 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2358 fail mds${MDTIDX},mds$((MDTIDX + 1))
2360 wait $CLIENT_PID || error "rm remote dir failed"
2362 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2364 rm -rf $DIR/$tdir || error "rmdir failed"
2368 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2371 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2372 ([ $FAILURE_MODE == "HARD" ] &&
2373 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2374 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2378 local remote_dir=$DIR/$tdir/remote_dir
2381 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2383 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2384 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2387 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2391 wait $CLIENT_PID || error "rm remote dir failed"
2393 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2395 rm -rf $DIR/$tdir || error "rmdir failed"
2399 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2402 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2403 ([ $FAILURE_MODE == "HARD" ] &&
2404 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2405 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2409 local remote_dir=$DIR/$tdir/remote_dir
2412 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2414 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2415 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2419 fail mds$((MDTIDX + 1))
2421 wait $CLIENT_PID || error "rm remote dir failed"
2423 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2425 rm -rf $DIR/$tdir || error "rmdir failed"
2429 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
2432 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2433 ([ $FAILURE_MODE == "HARD" ] &&
2434 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2435 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2439 local remote_dir=$DIR/$tdir/remote_dir
2442 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2444 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2445 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2450 fail mds$((MDTIDX + 1))
2452 wait $CLIENT_PID || error "rm remote dir failed"
2454 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2456 rm -rf $DIR/$tdir || error "rmdir failed"
2460 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
2463 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2465 local remote_dir=$DIR/$tdir/remote_dir
2468 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2470 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2471 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2475 fail mds${MDTIDX},mds$((MDTIDX + 1))
2477 wait $CLIENT_PID || error "rm remote dir failed"
2479 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2481 rm -rf $DIR/$tdir || error "rmdir failed"
2485 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
2489 createmany -o $DIR/$tdir/$tfile- 10 || return 1
2490 #define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD 0x140
2491 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000140"
2492 unlinkmany $DIR/$tdir/$tfile- 10 || return 2
2494 run_test 83a "fail log_add during unlink recovery"
2498 createmany -o $DIR/$tdir/$tfile- 10 || return 1
2499 replay_barrier $SINGLEMDS
2500 unlinkmany $DIR/$tdir/$tfile- 10 || return 2
2501 #define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD 0x140
2502 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000140"
2505 run_test 83b "fail log_add during unlink recovery"
2508 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
2509 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
2510 createmany -o $DIR/$tfile- 1 &
2514 client_up || client_up || true # reconnect
2516 run_test 84a "stale open during export disconnect"
2518 test_85a() { #bug 16774
2519 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2521 for i in `seq 100`; do
2522 echo "tag-$i" > $DIR/$tfile-$i
2523 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
2526 lov_id=`lctl dl | grep "clilov"`
2527 addr=`echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}'`
2528 count=`lctl get_param -n ldlm.namespaces.*MDT0000*$addr.lock_unused_count`
2529 echo "before recovery: unused locks count = $count"
2533 count2=`lctl get_param -n ldlm.namespaces.*MDT0000*$addr.lock_unused_count`
2534 echo "after recovery: unused locks count = $count2"
2536 if [ $count2 -ge $count ]; then
2537 error "unused locks are not canceled"
2540 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
2542 test_85b() { #bug 16774
2543 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2545 do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || return 1
2546 do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $FSNAME-OST0000 || return 2
2548 $SETSTRIPE -c 1 -p $FSNAME.$TESTNAME $DIR
2550 for i in `seq 100`; do
2551 dd if=/dev/urandom of=$DIR/$tfile-$i bs=4096 count=32 >/dev/null 2>&1
2554 cancel_lru_locks osc
2556 for i in `seq 100`; do
2557 dd if=$DIR/$tfile-$i of=/dev/null bs=4096 count=32 >/dev/null 2>&1
2560 lov_id=`lctl dl | grep "clilov"`
2561 addr=`echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}'`
2562 count=`lctl get_param -n ldlm.namespaces.*OST0000*$addr.lock_unused_count`
2563 echo "before recovery: unused locks count = $count"
2564 [ $count != 0 ] || return 3
2568 count2=`lctl get_param -n ldlm.namespaces.*OST0000*$addr.lock_unused_count`
2569 echo "after recovery: unused locks count = $count2"
2571 do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $FSNAME-OST0000 || return 4
2572 do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME || return 5
2574 if [ $count2 -ge $count ]; then
2575 error "unused locks are not canceled"
2578 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
2581 local clients=${CLIENTS:-$HOSTNAME}
2583 zconf_umount_clients $clients $MOUNT
2584 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
2585 remount_facet $SINGLEMDS
2586 zconf_mount_clients $clients $MOUNT
2588 run_test 86 "umount server after clear nid_stats should not hit LBUG"
2591 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
2594 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2595 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 || error "Cannot write"
2596 cksum=`md5sum $DIR/$tfile | awk '{print $1}'`
2597 cancel_lru_locks osc
2599 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
2600 cksum2=`md5sum $DIR/$tfile | awk '{print $1}'`
2601 if [ $cksum != $cksum2 ] ; then
2602 error "New checksum $cksum2 does not match original $cksum"
2605 run_test 87 "write replay"
2608 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
2611 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2612 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 || error "Cannot write"
2613 sleep 1 # Give it a chance to flush dirty data
2614 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
2615 cksum=`md5sum $DIR/$tfile | awk '{print $1}'`
2616 cancel_lru_locks osc
2618 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
2619 cksum2=`md5sum $DIR/$tfile | awk '{print $1}'`
2620 if [ $cksum != $cksum2 ] ; then
2621 error "New checksum $cksum2 does not match original $cksum"
2624 run_test 87b "write replay with changed data (checksum resend)"
2626 test_88() { #bug 17485
2630 $SETSTRIPE -i 0 -c 1 $DIR/$tdir || error "$SETSTRIPE"
2633 replay_barrier $SINGLEMDS
2635 # exhaust precreations on ost1
2636 local OST=$(ostname_from_index 0)
2637 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
2638 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2639 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2640 echo "before test: last_id = $last_id, next_id = $next_id"
2642 echo "Creating to objid $last_id on ost $OST..."
2643 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2))
2645 #create some files to use some uncommitted objids
2646 last_id=$(($last_id + 1))
2647 createmany -o $DIR/$tdir/f-%d $last_id 8
2649 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2650 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2651 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
2653 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
2654 # it has to take care about the affected facets, bug20407
2655 local affected_mds1=$(affected_facets mds1)
2656 local affected_ost1=$(affected_facets ost1)
2658 shutdown_facet $SINGLEMDS
2661 reboot_facet $SINGLEMDS
2662 change_active $affected_mds1
2663 wait_for_facet $affected_mds1
2664 mount_facets $affected_mds1 || error "Restart of mds failed"
2667 change_active $affected_ost1
2668 wait_for_facet $affected_ost1
2669 mount_facets $affected_ost1 || error "Restart of ost1 failed"
2673 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2674 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2675 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
2677 # create new files, which should use new objids, and ensure the orphan
2678 # cleanup phase for ost1 is completed at the same time
2679 for i in `seq 8`; do
2680 file_id=$(($last_id + 10 + $i))
2681 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
2684 # if the objids were not recreated, then "ls" will failed for -ENOENT
2685 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
2688 # write into previously created files
2689 for i in `seq 8`; do
2690 file_id=$(($last_id + $i))
2691 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
2692 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
2695 # compare the content
2696 for i in `seq 8`; do
2697 file_id=$(($last_id + $i))
2698 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id || error "the content" \
2699 "of file is modified!"
2704 run_test 88 "MDS should not assign same objid to different files "
2707 cancel_lru_locks osc
2709 rm -f $DIR/$tdir/$tfile
2711 wait_delete_completed
2712 BLOCKS1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
2713 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
2714 dd if=/dev/zero bs=1M count=10 of=$DIR/$tdir/$tfile
2717 facet_failover $SINGLEMDS
2718 rm $DIR/$tdir/$tfile
2721 zconf_mount $(hostname) $MOUNT
2722 client_up || return 1
2724 wait_delete_completed
2725 BLOCKS2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
2726 [ $((BLOCKS2 - BLOCKS1)) -le 4 ] || \
2727 error $((BLOCKS2 - BLOCKS1)) blocks leaked
2730 run_test 89 "no disk space leak on late ost connection"
2736 change_active $facet
2737 wait_for_facet $facet
2738 mount_facet $facet || error "Restart of $facet failed"
2742 test_90() { # bug 19494
2743 local dir=$DIR/$tdir
2744 local ostfail=$(get_random_entry $(get_facets OST))
2746 if [[ $FAILURE_MODE = HARD ]]; then
2747 local affected=$(affected_facets $ostfail);
2748 if [[ "$affected" != $ostfail ]]; then
2749 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
2756 echo "Create the files"
2758 # file "f${index}" striped over 1 OST
2759 # file "all" striped over all OSTs
2761 $SETSTRIPE -c $OSTCOUNT $dir/all ||
2762 error "setstripe failed to create $dir/all"
2764 for (( i=0; i<$OSTCOUNT; i++ )); do
2766 $SETSTRIPE -i $i -c 1 $f || error "$SETSTRIPE failed to create $f"
2768 # confirm setstripe actually created the stripe on the requested OST
2769 local uuid=$(ostuuid_from_index $i)
2770 for file in f$i all; do
2771 if [[ $dir/$file != $($LFS find --obd $uuid --name $file $dir) ]]; then
2772 $GETSTRIPE $dir/$file
2773 error wrong stripe: $file, uuid: $uuid
2778 # Before failing an OST, get its obd name and index
2779 local varsvc=${ostfail}_svc
2780 local obd=$(do_facet $ostfail lctl get_param -n obdfilter.${!varsvc}.uuid)
2781 local index=$(($(facet_number $ostfail) - 1))
2783 echo "Fail $ostfail $obd, display the list of affected files"
2784 shutdown_facet $ostfail || return 2
2786 trap "cleanup_90 $ostfail" EXIT INT
2787 echo "General Query: lfs find $dir"
2788 local list=$($LFS find $dir)
2790 for (( i=0; i<$OSTCOUNT; i++ )); do
2791 list_member "$list" $dir/f$i || error_noexit "lfs find $dir: no file f$i"
2793 list_member "$list" $dir/all || error_noexit "lfs find $dir: no file all"
2795 # focus on the missing OST,
2796 # we expect to see only two files affected: "f$(index)" and "all"
2798 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
2799 list=$($LFS find --obd $obd $dir)
2801 for file in all f$index; do
2802 list_member "$list" $dir/$file ||
2803 error_noexit "lfs find does not report the affected $obd for $file"
2806 [[ $(echo $list | wc -w) -eq 2 ]] ||
2807 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
2809 echo "Check getstripe: $GETSTRIPE -r --obd $obd"
2810 list=$($GETSTRIPE -r --obd $obd $dir)
2812 for file in all f$index; do
2813 echo "$list" | grep $dir/$file ||
2814 error_noexit "lfs getsripe does not report the affected $obd for $file"
2819 run_test 90 "lfs find identifies the missing striped file segments"
2821 striped_dir_check_100() {
2822 local striped_dir=$DIR/$tdir/striped_dir
2823 local stripe_count=$($LFS getdirstripe -c $striped_dir)
2825 $LFS getdirstripe $striped_dir
2826 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
2828 createmany -o $striped_dir/f-%d 20 ||
2829 error "creation failed under striped dir"
2833 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2834 ([ $FAILURE_MODE == "HARD" ] &&
2835 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2836 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2839 local striped_dir=$DIR/$tdir/striped_dir
2844 #To make sure MDT1 and MDT0 are connected
2845 #otherwise it may create single stripe dir here
2846 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
2848 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2849 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
2850 $LFS setdirstripe -i0 -c2 $striped_dir &
2853 fail mds$((MDTIDX + 1))
2855 wait $CLIENT_PID || error "striped dir creation failed"
2857 striped_dir_check_100 || error "striped dir check failed"
2858 rm -rf $DIR/$tdir || error "rmdir failed"
2860 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
2863 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2864 ([ $FAILURE_MODE == "HARD" ] &&
2865 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2866 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2869 local striped_dir=$DIR/$tdir/striped_dir
2874 #To make sure MDT1 and MDT0 are connected
2875 #otherwise it may create single stripe dir here
2876 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
2878 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2879 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
2880 $LFS mkdir -i0 -c2 $striped_dir &
2885 wait $CLIENT_PID || error "striped dir creation failed"
2887 striped_dir_check_100 || error "striped dir check failed"
2888 rm -rf $DIR/$tdir || error "rmdir failed"
2890 run_test 100b "DNE: create striped dir, fail MDT0"
2893 check_and_cleanup_lustre