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
1072 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.90) ] &&
1073 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly" &&
1077 cancel_lru_locks mdc
1079 multiop_bg_pause $DIR/$tfile s_s || return 1
1082 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1083 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1084 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1086 fail $SINGLEMDS || return 2
1088 wait $mpid || return 3
1090 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1091 lctl set_param fail_loc=0x0
1092 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1095 run_test 52 "time out lock replay (3764)"
1097 # bug 3462 - simultaneous MDC requests
1099 cancel_lru_locks mdc # cleanup locks from former test cases
1100 mkdir -p $DIR/${tdir}-1
1101 mkdir -p $DIR/${tdir}-2
1102 multiop $DIR/${tdir}-1/f O_c &
1104 # give multiop a change to open
1107 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1108 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1109 kill -USR1 $close_pid
1110 cancel_lru_locks mdc # force the close
1111 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1113 mcreate $DIR/${tdir}-2/f || return 1
1115 # close should still be here
1116 [ -d /proc/$close_pid ] || return 2
1118 replay_barrier_nodf $SINGLEMDS
1120 wait $close_pid || return 3
1122 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1123 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1124 rm -rf $DIR/${tdir}-*
1126 run_test 53a "|X| close request while two MDC requests in flight"
1129 cancel_lru_locks mdc # cleanup locks from former test cases
1130 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1132 mkdir -p $DIR/${tdir}-1
1133 mkdir -p $DIR/${tdir}-2
1134 multiop_bg_pause $DIR/${tdir}-1/f O_c || return 6
1137 #define OBD_FAIL_MDS_REINT_NET 0x107
1138 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1139 mcreate $DIR/${tdir}-2/f &
1143 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1144 kill -USR1 $close_pid
1145 cancel_lru_locks mdc # force the close
1146 wait $close_pid || return 1
1147 # open should still be here
1148 [ -d /proc/$open_pid ] || return 2
1150 replay_barrier_nodf $SINGLEMDS
1152 wait $open_pid || return 3
1154 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1155 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1156 rm -rf $DIR/${tdir}-*
1158 run_test 53b "|X| open request while two MDC requests in flight"
1161 cancel_lru_locks mdc # cleanup locks from former test cases
1162 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1164 mkdir -p $DIR/${tdir}-1
1165 mkdir -p $DIR/${tdir}-2
1166 multiop $DIR/${tdir}-1/f O_c &
1169 #define OBD_FAIL_MDS_REINT_NET 0x107
1170 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1171 mcreate $DIR/${tdir}-2/f &
1175 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1176 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1177 kill -USR1 $close_pid
1178 cancel_lru_locks mdc # force the close
1180 #bz20647: make sure all pids are exists before failover
1181 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1182 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1183 replay_barrier_nodf $SINGLEMDS
1184 fail_nodf $SINGLEMDS
1185 wait $open_pid || return 1
1187 # close should be gone
1188 [ -d /proc/$close_pid ] && return 2
1189 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1191 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1192 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1193 rm -rf $DIR/${tdir}-*
1195 run_test 53c "|X| open request and close request while two MDC requests in flight"
1198 cancel_lru_locks mdc # cleanup locks from former test cases
1199 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1201 mkdir -p $DIR/${tdir}-1
1202 mkdir -p $DIR/${tdir}-2
1203 multiop $DIR/${tdir}-1/f O_c &
1205 # give multiop a chance to open
1208 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1209 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1210 kill -USR1 $close_pid
1211 cancel_lru_locks mdc # force the close
1212 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1213 mcreate $DIR/${tdir}-2/f || return 1
1215 # close should still be here
1216 [ -d /proc/$close_pid ] || return 2
1218 wait $close_pid || return 3
1220 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1221 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1222 rm -rf $DIR/${tdir}-*
1224 run_test 53d "|X| close reply while two MDC requests in flight"
1227 cancel_lru_locks mdc # cleanup locks from former test cases
1228 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1230 mkdir -p $DIR/${tdir}-1
1231 mkdir -p $DIR/${tdir}-2
1232 multiop $DIR/${tdir}-1/f O_c &
1235 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1236 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1237 mcreate $DIR/${tdir}-2/f &
1241 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1242 kill -USR1 $close_pid
1243 cancel_lru_locks mdc # force the close
1244 wait $close_pid || return 1
1245 # open should still be here
1246 [ -d /proc/$open_pid ] || return 2
1248 replay_barrier_nodf $SINGLEMDS
1250 wait $open_pid || return 3
1252 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 4
1253 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 5
1254 rm -rf $DIR/${tdir}-*
1256 run_test 53e "|X| open reply while two MDC requests in flight"
1259 cancel_lru_locks mdc # cleanup locks from former test cases
1260 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1262 mkdir -p $DIR/${tdir}-1
1263 mkdir -p $DIR/${tdir}-2
1264 multiop $DIR/${tdir}-1/f O_c &
1267 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1268 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1269 mcreate $DIR/${tdir}-2/f &
1273 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1274 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1275 kill -USR1 $close_pid
1276 cancel_lru_locks mdc # force the close
1278 #bz20647: make sure all pids are exists before failover
1279 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1280 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1281 replay_barrier_nodf $SINGLEMDS
1282 fail_nodf $SINGLEMDS
1283 wait $open_pid || return 1
1285 # close should be gone
1286 [ -d /proc/$close_pid ] && return 2
1287 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1289 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1290 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1291 rm -rf $DIR/${tdir}-*
1293 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1296 cancel_lru_locks mdc # cleanup locks from former test cases
1297 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1299 mkdir -p $DIR/${tdir}-1
1300 mkdir -p $DIR/${tdir}-2
1301 multiop $DIR/${tdir}-1/f O_c &
1304 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1305 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1306 mcreate $DIR/${tdir}-2/f &
1310 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1311 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1312 kill -USR1 $close_pid
1313 cancel_lru_locks mdc # force the close
1314 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1316 #bz20647: make sure all pids are exists before failover
1317 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1318 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1319 replay_barrier_nodf $SINGLEMDS
1320 fail_nodf $SINGLEMDS
1321 wait $open_pid || return 1
1323 # close should be gone
1324 [ -d /proc/$close_pid ] && return 2
1326 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1327 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1328 rm -rf $DIR/${tdir}-*
1330 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1333 cancel_lru_locks mdc # cleanup locks from former test cases
1334 rm -rf $DIR/${tdir}-1 $DIR/${tdir}-2
1336 mkdir -p $DIR/${tdir}-1
1337 mkdir -p $DIR/${tdir}-2
1338 multiop $DIR/${tdir}-1/f O_c &
1341 #define OBD_FAIL_MDS_REINT_NET 0x107
1342 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1343 mcreate $DIR/${tdir}-2/f &
1347 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1348 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1349 kill -USR1 $close_pid
1350 cancel_lru_locks mdc # force the close
1353 #bz20647: make sure all pids are exists before failover
1354 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1355 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1356 replay_barrier_nodf $SINGLEMDS
1357 fail_nodf $SINGLEMDS
1358 wait $open_pid || return 1
1360 # close should be gone
1361 [ -d /proc/$close_pid ] && return 2
1362 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1364 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1365 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 4
1366 rm -rf $DIR/${tdir}-*
1368 run_test 53h "|X| open request and close reply while two MDC requests in flight"
1370 #b_cray 54 "|X| open request and close reply while two MDC requests in flight"
1372 #b3761 ASSERTION(hash != 0) failed
1374 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1375 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1377 # give touch a chance to run
1379 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1383 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1385 #b3440 ASSERTION(rec->ur_fid2->id) failed
1387 ln -s foo $DIR/$tfile
1388 replay_barrier $SINGLEMDS
1389 #drop_reply "cat $DIR/$tfile"
1393 run_test 56 "don't replay a symlink open request (3440)"
1395 #recovery one mds-ost setattr from llog
1397 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1398 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1400 replay_barrier $SINGLEMDS
1403 $CHECKSTAT -t file $DIR/$tfile || return 1
1404 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1407 run_test 57 "test recovery from llog for setattr op"
1410 zconf_umount `hostname` $MOUNT2
1414 #recovery many mds-ost setattr from llog
1417 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1418 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1419 createmany -o $DIR/$tdir/$tfile-%d 2500
1420 replay_barrier $SINGLEMDS
1423 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null || return 1
1424 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1425 unlinkmany $DIR/$tdir/$tfile-%d 2500
1428 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1434 trap cleanup_58 EXIT
1436 large_xattr_enabled &&
1437 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1439 mount_client $MOUNT2
1441 touch $DIR/$tdir/$tfile
1442 replay_barrier $SINGLEMDS
1443 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1445 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1446 [[ "$new" = "$orig" ]] || return 1
1447 rm -f $DIR/$tdir/$tfile
1451 run_test 58b "test replay of setxattr op"
1453 test_58c() { # bug 16570
1458 trap cleanup_58 EXIT
1460 if large_xattr_enabled; then
1461 local xattr_size=$(max_xattr_size)
1462 orig="$(generate_string $((xattr_size / 2)))"
1463 orig1="$(generate_string $xattr_size)"
1469 mount_client $MOUNT2
1471 touch $DIR/$tdir/$tfile
1472 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1474 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1475 [[ "$new" = "$orig" ]] || return 2
1476 drop_reint_reply "setfattr -n trusted.foo1 -v $orig1 $DIR/$tdir/$tfile" ||
1478 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1479 [[ "$new" = "$orig1" ]] || return 4
1480 rm -f $DIR/$tdir/$tfile
1484 run_test 58c "resend/reconstruct setxattr op"
1486 # log_commit_thread vs filter_destroy race used to lead to import use after free
1489 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1492 createmany -o $DIR/$tdir/$tfile-%d 200
1494 unlinkmany $DIR/$tdir/$tfile-%d 200
1495 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1496 do_facet ost1 "lctl set_param fail_loc=0x507"
1499 do_facet ost1 "lctl set_param fail_loc=0x0"
1503 run_test 59 "test log_commit_thread vs filter_destroy race"
1505 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1506 # bug 12086: should no oops and No ctxt error for this test
1509 createmany -o $DIR/$tdir/$tfile-%d 200
1510 replay_barrier $SINGLEMDS
1511 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1513 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1514 local no_ctxt=`dmesg | grep "No ctxt"`
1515 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1517 run_test 60 "test llog post recovery init vs llog unlink"
1519 #test race llog recovery thread vs llog cleanup
1520 test_61a() { # was test_61
1521 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1524 createmany -o $DIR/$tdir/$tfile-%d 800
1526 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1527 unlinkmany $DIR/$tdir/$tfile-%d 800
1528 set_nodes_failloc "$(osts_nodes)" 0x80000221
1533 set_nodes_failloc "$(osts_nodes)" 0x0
1535 $CHECKSTAT -t file $DIR/$tdir/$tfile-* && return 1
1538 run_test 61a "test race llog recovery vs llog cleanup"
1540 #test race mds llog sync vs llog cleanup
1542 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1543 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1544 facet_failover $SINGLEMDS
1547 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 || return 1
1549 run_test 61b "test race mds llog sync vs llog cleanup"
1551 #test race cancel cookie cb vs llog cleanup
1553 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1555 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1557 set_nodes_failloc "$(osts_nodes)" 0x80000222
1561 set_nodes_failloc "$(osts_nodes)" 0x0
1563 run_test 61c "test race mds llog sync vs llog cleanup"
1565 test_61d() { # bug 16002 # bug 17466 # bug 22137
1566 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1568 do_facet mgs "lctl set_param fail_loc=0x80000605"
1569 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1570 error "mgs start should have failed"
1571 do_facet mgs "lctl set_param fail_loc=0"
1572 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1574 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1576 test_62() { # Bug 15756 - don't mis-drop resent replay
1578 replay_barrier $SINGLEMDS
1579 createmany -o $DIR/$tdir/$tfile- 25
1580 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1581 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1583 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1584 unlinkmany $DIR/$tdir/$tfile- 25 || return 2
1587 run_test 62 "don't mis-drop resent replay"
1589 #Adaptive Timeouts (bug 3055)
1597 echo "Cleaning up AT ..."
1598 if [ -n "$ATOLDBASE" ]; then
1599 local at_history=$($LCTL get_param -n at_history)
1600 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1601 do_facet ost1 "lctl set_param at_history=$at_history" || true
1604 if [ $AT_MAX_SET -ne 0 ]; then
1605 for facet in mds client ost; do
1606 var=AT_MAX_SAVE_${facet}
1607 echo restore AT on $facet to saved value ${!var}
1608 at_max_set ${!var} $facet
1609 at_new=$(at_max_get $facet)
1610 echo Restored AT value on $facet $at_new
1611 [ $at_new -eq ${!var} ] || \
1612 error "$facet : AT value was not restored SAVED ${!var} NEW $at_new"
1619 local at_max_new=600
1621 # Save at_max original values
1623 if [ $AT_MAX_SET -eq 0 ]; then
1624 # Suppose that all osts have the same at_max
1625 for facet in mds client ost; do
1626 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1630 for facet in mds client ost; do
1631 at_max=$(at_max_get $facet)
1632 if [ $at_max -ne $at_max_new ]; then
1633 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1634 at_max_set $at_max_new $facet
1639 if [ -z "$ATOLDBASE" ]; then
1640 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1641 # speed up the timebase so we can check decreasing AT
1642 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1643 do_facet ost1 "lctl set_param at_history=8" || true
1645 # sleep for a while to cool down, should be > 8s and also allow
1646 # at least one ping to be sent. simply use TIMEOUT to be safe.
1651 test_65a() #bug 3055
1653 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1655 at_start || return 0
1656 $LCTL dk > /dev/null
1658 $LCTL set_param debug="other"
1659 # Slow down a request to the current service time, this is critical
1660 # because previous tests may have caused this value to increase.
1661 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1662 awk '/portal 12/ {print $5}'`
1663 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1665 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1666 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1667 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1668 createmany -o $DIR/$tfile 10 > /dev/null
1669 unlinkmany $DIR/$tfile 10 > /dev/null
1670 # check for log message
1671 $LCTL dk | grep "Early reply #" || error "No early reply"
1673 # client should show REQ_DELAY estimates
1674 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1676 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1678 run_test 65a "AT: verify early replies"
1680 test_65b() #bug 3055
1682 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1684 at_start || return 0
1687 $LCTL set_param debug="other trace"
1688 $LCTL dk > /dev/null
1689 # Slow down a request to the current service time, this is critical
1690 # because previous tests may have caused this value to increase.
1691 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1692 multiop $DIR/$tfile Ow1yc
1693 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1694 awk '/portal 6/ {print $5}'`
1695 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1697 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1698 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1699 do_facet ost1 $LCTL set_param fail_loc=0x224
1702 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tfile
1703 # force some real bulk transfer
1704 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1706 do_facet ost1 $LCTL set_param fail_loc=0
1707 # check for log message
1708 $LCTL dk | grep "Early reply #" || error "No early reply"
1710 # client should show REQ_DELAY estimates
1711 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1713 run_test 65b "AT: verify early replies on packed reply / bulk"
1715 test_66a() #bug 3055
1717 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1719 at_start || return 0
1720 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1721 # adjust 5s at a time so no early reply is sent (within deadline)
1722 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1723 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1724 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1725 createmany -o $DIR/$tfile 20 > /dev/null
1726 unlinkmany $DIR/$tfile 20 > /dev/null
1727 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1728 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1729 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1730 createmany -o $DIR/$tfile 20 > /dev/null
1731 unlinkmany $DIR/$tfile 20 > /dev/null
1732 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1733 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1735 createmany -o $DIR/$tfile 20 > /dev/null
1736 unlinkmany $DIR/$tfile 20 > /dev/null
1737 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1738 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1739 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1740 echo "Current MDT timeout $CUR, worst $WORST"
1741 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1743 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1745 test_66b() #bug 3055
1747 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1749 at_start || return 0
1750 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1751 awk '/network/ {print $4}')
1752 $LCTL set_param fail_val=$(($ORIG + 5))
1753 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1754 $LCTL set_param fail_loc=0x50c
1755 ls $DIR/$tfile > /dev/null 2>&1
1756 $LCTL set_param fail_loc=0
1757 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1758 awk '/network/ {print $4}')
1759 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1760 awk '/network/ {print $6}')
1761 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1762 [ $WORST -gt $ORIG ] ||
1763 error "Worst $WORST should be worse than orig $ORIG"
1765 run_test 66b "AT: verify net latency adjusts"
1767 test_67a() #bug 3055
1769 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1771 at_start || return 0
1772 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1773 # sleeping threads may drive values above this
1774 do_facet ost1 "$LCTL set_param fail_val=400"
1775 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1776 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1777 createmany -o $DIR/$tfile 20 > /dev/null
1778 unlinkmany $DIR/$tfile 20 > /dev/null
1779 do_facet ost1 "$LCTL set_param fail_loc=0"
1780 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1781 ATTEMPTS=$(($CONN2 - $CONN1))
1782 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1783 [ $ATTEMPTS -gt 0 ] &&
1784 error_ignore bz13721 "AT should have prevented reconnect"
1787 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1789 test_67b() #bug 3055
1791 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1793 at_start || return 0
1794 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1796 # exhaust precreations on ost1
1797 local OST=$(ostname_from_index 0)
1798 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1799 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1800 osc.$mdtosc.prealloc_last_id)
1801 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1802 osc.$mdtosc.prealloc_next_id)
1804 mkdir -p $DIR/$tdir/${OST}
1805 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/${OST} || error "$SETSTRIPE"
1806 echo "Creating to objid $last_id on ost $OST..."
1807 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1808 do_facet ost1 "$LCTL set_param fail_val=20000"
1809 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1810 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1813 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1815 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1816 ATTEMPTS=$(($CONN2 - $CONN1))
1817 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1818 # do it again; should not timeout
1819 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1820 cp /etc/profile $DIR/$tfile || error "cp failed"
1821 do_facet ost1 "$LCTL set_param fail_loc=0"
1823 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1824 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1825 ATTEMPTS=$(($CONN3 - $CONN2))
1826 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1827 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1830 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1832 test_68 () #bug 13813
1834 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1836 at_start || return 0
1837 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1838 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1839 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1840 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
1841 local ENQ_MIN=$(cat $ldlm_enqueue_min)
1842 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
1843 echo $TIMEOUT >> $ldlm_enqueue_min
1844 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
1848 $SETSTRIPE --stripe-index=0 --count=1 $DIR/$tdir
1849 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
1850 $LCTL set_param fail_val=$(($TIMEOUT - 1))
1851 $LCTL set_param fail_loc=0x80000312
1852 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
1853 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
1854 $LCTL set_param fail_loc=0x80000312
1855 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
1856 $LCTL set_param fail_loc=0
1858 echo $ENQ_MIN >> $ldlm_enqueue_min
1859 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
1863 run_test 68 "AT: verify slowing locks"
1866 # end of AT tests includes above lines
1869 # start multi-client tests
1871 [ -z "$CLIENTS" ] && \
1872 { skip "Need two or more clients." && return; }
1873 [ $CLIENTCOUNT -lt 2 ] && \
1874 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
1876 echo "mount clients $CLIENTS ..."
1877 zconf_mount_clients $CLIENTS $MOUNT
1879 local clients=${CLIENTS//,/ }
1880 echo "Write/read files on $DIR ; clients $CLIENTS ... "
1881 for CLIENT in $clients; do
1882 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
1883 of=$DIR/${tfile}_${CLIENT} 2>/dev/null || \
1884 error "dd failed on $CLIENT"
1887 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
1888 for C in ${CLIENTS//,/ }; do
1889 do_node $prev_client dd if=$DIR/${tfile}_${C} of=/dev/null 2>/dev/null || \
1890 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
1896 run_test 70a "check multi client t-f"
1898 check_for_process () {
1903 killall_process $clients "$prog" -0
1906 killall_process () {
1907 local clients=${1:-$(hostname)}
1912 do_nodes $clients "killall $signal $name"
1916 local clients=${CLIENTS:-$HOSTNAME}
1918 zconf_mount_clients $clients $MOUNT
1921 [ "$SLOW" = "no" ] && duration=120
1922 # set duration to 900 because it takes some time to boot node
1923 [ "$FAILURE_MODE" = HARD ] && duration=900
1926 local start_ts=$(date +%s)
1927 local cmd="rundbench 1 -t $duration"
1929 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
1930 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
1931 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
1932 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
1935 #LU-1897 wait for all dbench copies to start
1936 while ! check_for_process $clients dbench; do
1937 elapsed=$(($(date +%s) - start_ts))
1938 if [ $elapsed -gt $duration ]; then
1939 killall_process $clients dbench
1940 error "dbench failed to start on $clients!"
1945 log "Started rundbench load pid=$pid ..."
1947 elapsed=$(($(date +%s) - start_ts))
1948 local num_failovers=0
1949 while [ $elapsed -lt $duration ]; do
1950 if ! check_for_process $clients dbench; then
1951 error_noexit "dbench stopped on some of $clients!"
1952 killall_process $clients dbench
1956 replay_barrier $SINGLEMDS
1957 sleep 1 # give clients a time to do operations
1958 # Increment the number of failovers
1959 num_failovers=$((num_failovers+1))
1960 log "$TESTNAME fail $SINGLEMDS $num_failovers times"
1962 elapsed=$(($(date +%s) - start_ts))
1965 wait $pid || error "rundbench load on $clients failed!"
1967 run_test 70b "mds recovery; $CLIENTCOUNT clients"
1968 # end multi-client tests
1971 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1975 replay_barrier $SINGLEMDS
1976 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
1977 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
1980 wait $pid || return 1
1981 [ -e $DIR/$tfile ] && return 2
1984 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay , close"
1987 multiop_bg_pause $DIR/$tfile O_tSc || return 3
1991 replay_barrier $SINGLEMDS
1992 #define OBD_FAIL_LDLM_REPLY 0x30c
1993 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000030c"
1996 wait $pid || return 1
1997 [ -e $DIR/$tfile ] && return 2
2000 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2004 local clients=${CLIENTS:-$HOSTNAME}
2006 zconf_umount_clients $clients $MOUNT
2008 facet_failover $SINGLEMDS
2009 zconf_mount_clients $clients $MOUNT
2011 touch $DIR/$tfile || return 1
2012 rm $DIR/$tfile || return 2
2013 clients_up || error "client evicted: $?"
2016 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2018 remote_dir_check_80() {
2020 local diridx=$($GETSTRIPE -M $remote_dir)
2021 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
2023 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2024 local fileidx=$($GETSTRIPE -M $remote_dir/f-1)
2025 [ $fileidx -eq $MDTIDX ] || error "$fileidx != $MDTIDX"
2031 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2032 ([ $FAILURE_MODE == "HARD" ] &&
2033 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2034 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2038 local remote_dir=$DIR/$tdir/remote_dir
2041 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2042 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2043 $LFS mkdir -i $MDTIDX $remote_dir &
2048 wait $CLIENT_PID || error "remote creation failed"
2050 remote_dir_check_80 || error "remote dir check failed"
2051 rm -rf $DIR/$tdir || error "rmdir failed"
2055 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2058 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2059 ([ $FAILURE_MODE == "HARD" ] &&
2060 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2061 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2065 local remote_dir=$DIR/$tdir/remote_dir
2068 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2069 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2070 $LFS mkdir -i $MDTIDX $remote_dir &
2073 fail mds$((MDTIDX + 1))
2075 wait $CLIENT_PID || error "remote creation failed"
2077 remote_dir_check_80 || error "remote dir check failed"
2078 rm -rf $DIR/$tdir || error "rmdir failed"
2082 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2085 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2086 ([ $FAILURE_MODE == "HARD" ] &&
2087 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2088 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2092 local remote_dir=$DIR/$tdir/remote_dir
2095 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2096 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2097 $LFS mkdir -i $MDTIDX $remote_dir &
2101 fail mds$((MDTIDX + 1))
2103 wait $CLIENT_PID || error "remote creation failed"
2105 remote_dir_check_80 || error "remote dir check failed"
2106 rm -rf $DIR/$tdir || error "rmdir failed"
2110 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2113 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2115 local remote_dir=$DIR/$tdir/remote_dir
2118 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
2119 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2120 $LFS mkdir -i $MDTIDX $remote_dir &
2123 # sleep 3 seconds to make sure MDTs are failed after
2124 # lfs mkdir -i has finished on all of MDTs.
2126 fail mds${MDTIDX},mds$((MDTIDX + 1))
2128 wait $CLIENT_PID || error "remote creation failed"
2130 remote_dir_check_80 || error "remote dir check failed"
2131 rm -rf $DIR/$tdir || error "rmdir failed"
2135 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2138 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2139 ([ $FAILURE_MODE == "HARD" ] &&
2140 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2141 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2145 local remote_dir=$DIR/$tdir/remote_dir
2148 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2149 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2150 $LFS mkdir -i $MDTIDX $remote_dir &
2153 # sleep 3 seconds to make sure MDTs are failed after
2154 # lfs mkdir -i has finished on all of MDTs.
2159 wait $CLIENT_PID || error "remote creation failed"
2161 remote_dir_check_80 || error "remote dir check failed"
2162 rm -rf $DIR/$tdir || error "rmdir failed"
2166 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2169 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2170 ([ $FAILURE_MODE == "HARD" ] &&
2171 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2172 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2175 local remote_dir=$DIR/$tdir/remote_dir
2178 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2179 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2180 $LFS mkdir -i $MDTIDX $remote_dir &
2183 fail mds$((MDTIDX + 1))
2185 wait $CLIENT_PID || error "remote creation failed"
2187 remote_dir_check_80 || error "remote dir check failed"
2188 rm -rf $DIR/$tdir || error "rmdir failed"
2192 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2195 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2196 ([ $FAILURE_MODE == "HARD" ] &&
2197 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2198 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2202 local remote_dir=$DIR/$tdir/remote_dir
2205 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2206 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2207 $LFS mkdir -i $MDTIDX $remote_dir &
2210 # sleep 3 seconds to make sure MDTs are failed after
2211 # lfs mkdir -i has finished on all of MDTs.
2215 fail mds$((MDTIDX + 1))
2217 wait $CLIENT_PID || error "remote creation failed"
2219 remote_dir_check_80 || error "remote dir check failed"
2220 rm -rf $DIR/$tdir || error "rmdir failed"
2224 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2227 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2229 local remote_dir=$DIR/$tdir/remote_dir
2232 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2233 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2234 $LFS mkdir -i $MDTIDX $remote_dir &
2237 # sleep 3 seconds to make sure MDTs are failed after
2238 # lfs mkdir -i has finished on all of MDTs.
2241 fail mds${MDTIDX},mds$((MDTIDX + 1))
2243 wait $CLIENT_PID || return 1
2245 remote_dir_check_80 || error "remote dir check failed"
2246 rm -rf $DIR/$tdir || error "rmdir failed"
2250 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2253 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2254 ([ $FAILURE_MODE == "HARD" ] &&
2255 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2256 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2260 local remote_dir=$DIR/$tdir/remote_dir
2263 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2266 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2267 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2271 fail mds$((MDTIDX + 1))
2273 wait $CLIENT_PID || error "rm remote dir failed"
2275 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2277 rm -rf $DIR/$tdir || error "rmdir failed"
2281 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2284 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2285 ([ $FAILURE_MODE == "HARD" ] &&
2286 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2287 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2290 local remote_dir=$DIR/$tdir/remote_dir
2293 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2295 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2296 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2302 wait $CLIENT_PID || error "rm remote dir failed"
2304 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2306 rm -rf $DIR/$tdir || error "rmdir failed"
2310 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2313 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2314 ([ $FAILURE_MODE == "HARD" ] &&
2315 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2316 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2320 local remote_dir=$DIR/$tdir/remote_dir
2323 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2325 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2326 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2331 fail mds$((MDTIDX + 1))
2333 wait $CLIENT_PID || error "rm remote dir failed"
2335 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2337 rm -rf $DIR/$tdir || error "rmdir failed"
2341 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2344 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2346 local remote_dir=$DIR/$tdir/remote_dir
2349 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2351 # OBD_FAIL_OBJ_UPDATE_NET_REP 0x1701
2352 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2356 fail mds${MDTIDX},mds$((MDTIDX + 1))
2358 wait $CLIENT_PID || error "rm remote dir failed"
2360 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2362 rm -rf $DIR/$tdir || error "rmdir failed"
2366 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2369 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2370 ([ $FAILURE_MODE == "HARD" ] &&
2371 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2372 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2376 local remote_dir=$DIR/$tdir/remote_dir
2379 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2381 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2382 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2385 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2389 wait $CLIENT_PID || error "rm remote dir failed"
2391 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2393 rm -rf $DIR/$tdir || error "rmdir failed"
2397 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2400 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2401 ([ $FAILURE_MODE == "HARD" ] &&
2402 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2403 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2407 local remote_dir=$DIR/$tdir/remote_dir
2410 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2412 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2413 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2417 fail mds$((MDTIDX + 1))
2419 wait $CLIENT_PID || error "rm remote dir failed"
2421 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2423 rm -rf $DIR/$tdir || error "rmdir failed"
2427 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
2430 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2431 ([ $FAILURE_MODE == "HARD" ] &&
2432 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2433 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2437 local remote_dir=$DIR/$tdir/remote_dir
2440 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2442 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2443 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2448 fail mds$((MDTIDX + 1))
2450 wait $CLIENT_PID || error "rm remote dir failed"
2452 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2454 rm -rf $DIR/$tdir || error "rmdir failed"
2458 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
2461 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2463 local remote_dir=$DIR/$tdir/remote_dir
2466 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2468 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2469 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2473 fail mds${MDTIDX},mds$((MDTIDX + 1))
2475 wait $CLIENT_PID || error "rm remote dir failed"
2477 stat $remote_dir 2&>/dev/null && error "$remote_dir still exist!"
2479 rm -rf $DIR/$tdir || error "rmdir failed"
2483 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
2486 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
2487 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
2488 createmany -o $DIR/$tfile- 1 &
2492 client_up || client_up || true # reconnect
2494 run_test 84a "stale open during export disconnect"
2496 test_85a() { #bug 16774
2497 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2499 for i in `seq 100`; do
2500 echo "tag-$i" > $DIR/$tfile-$i
2501 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
2504 lov_id=`lctl dl | grep "clilov"`
2505 addr=`echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}'`
2506 count=`lctl get_param -n ldlm.namespaces.*MDT0000*$addr.lock_unused_count`
2507 echo "before recovery: unused locks count = $count"
2511 count2=`lctl get_param -n ldlm.namespaces.*MDT0000*$addr.lock_unused_count`
2512 echo "after recovery: unused locks count = $count2"
2514 if [ $count2 -ge $count ]; then
2515 error "unused locks are not canceled"
2518 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
2520 test_85b() { #bug 16774
2521 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
2523 do_facet mgs $LCTL pool_new $FSNAME.$TESTNAME || return 1
2524 do_facet mgs $LCTL pool_add $FSNAME.$TESTNAME $FSNAME-OST0000 || return 2
2526 $SETSTRIPE -c 1 -p $FSNAME.$TESTNAME $DIR
2528 for i in `seq 100`; do
2529 dd if=/dev/urandom of=$DIR/$tfile-$i bs=4096 count=32 >/dev/null 2>&1
2532 cancel_lru_locks osc
2534 for i in `seq 100`; do
2535 dd if=$DIR/$tfile-$i of=/dev/null bs=4096 count=32 >/dev/null 2>&1
2538 lov_id=`lctl dl | grep "clilov"`
2539 addr=`echo $lov_id | awk '{print $4}' | awk -F '-' '{print $3}'`
2540 count=`lctl get_param -n ldlm.namespaces.*OST0000*$addr.lock_unused_count`
2541 echo "before recovery: unused locks count = $count"
2542 [ $count != 0 ] || return 3
2546 count2=`lctl get_param -n ldlm.namespaces.*OST0000*$addr.lock_unused_count`
2547 echo "after recovery: unused locks count = $count2"
2549 do_facet mgs $LCTL pool_remove $FSNAME.$TESTNAME $FSNAME-OST0000 || return 4
2550 do_facet mgs $LCTL pool_destroy $FSNAME.$TESTNAME || return 5
2552 if [ $count2 -ge $count ]; then
2553 error "unused locks are not canceled"
2556 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
2559 local clients=${CLIENTS:-$HOSTNAME}
2561 zconf_umount_clients $clients $MOUNT
2562 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
2563 remount_facet $SINGLEMDS
2564 zconf_mount_clients $clients $MOUNT
2566 run_test 86 "umount server after clear nid_stats should not hit LBUG"
2569 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
2572 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2573 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 || error "Cannot write"
2574 cksum=`md5sum $DIR/$tfile | awk '{print $1}'`
2575 cancel_lru_locks osc
2577 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
2578 cksum2=`md5sum $DIR/$tfile | awk '{print $1}'`
2579 if [ $cksum != $cksum2 ] ; then
2580 error "New checksum $cksum2 does not match original $cksum"
2583 run_test 87 "write replay"
2586 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
2589 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2590 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 || error "Cannot write"
2591 sleep 1 # Give it a chance to flush dirty data
2592 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
2593 cksum=`md5sum $DIR/$tfile | awk '{print $1}'`
2594 cancel_lru_locks osc
2596 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
2597 cksum2=`md5sum $DIR/$tfile | awk '{print $1}'`
2598 if [ $cksum != $cksum2 ] ; then
2599 error "New checksum $cksum2 does not match original $cksum"
2602 run_test 87b "write replay with changed data (checksum resend)"
2604 test_88() { #bug 17485
2608 $SETSTRIPE -i 0 -c 1 $DIR/$tdir || error "$SETSTRIPE"
2611 replay_barrier $SINGLEMDS
2613 # exhaust precreations on ost1
2614 local OST=$(ostname_from_index 0)
2615 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
2616 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2617 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2618 echo "before test: last_id = $last_id, next_id = $next_id"
2620 echo "Creating to objid $last_id on ost $OST..."
2621 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2))
2623 #create some files to use some uncommitted objids
2624 last_id=$(($last_id + 1))
2625 createmany -o $DIR/$tdir/f-%d $last_id 8
2627 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2628 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2629 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
2631 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
2632 # it has to take care about the affected facets, bug20407
2633 local affected_mds1=$(affected_facets mds1)
2634 local affected_ost1=$(affected_facets ost1)
2636 shutdown_facet $SINGLEMDS
2639 reboot_facet $SINGLEMDS
2640 change_active $affected_mds1
2641 wait_for_facet $affected_mds1
2642 mount_facets $affected_mds1 || error "Restart of mds failed"
2645 change_active $affected_ost1
2646 wait_for_facet $affected_ost1
2647 mount_facets $affected_ost1 || error "Restart of ost1 failed"
2651 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_last_id)
2652 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osc.$mdtosc.prealloc_next_id)
2653 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
2655 # create new files, which should use new objids, and ensure the orphan
2656 # cleanup phase for ost1 is completed at the same time
2657 for i in `seq 8`; do
2658 file_id=$(($last_id + 10 + $i))
2659 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
2662 # if the objids were not recreated, then "ls" will fail with -ENOENT
2663 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
2666 # write into previously created files
2667 for i in `seq 8`; do
2668 file_id=$(($last_id + $i))
2669 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
2670 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
2673 # compare the content
2674 for i in `seq 8`; do
2675 file_id=$(($last_id + $i))
2676 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id || error "the content" \
2677 "of file is modified!"
2682 run_test 88 "MDS should not assign same objid to different files "
2685 cancel_lru_locks osc
2687 rm -f $DIR/$tdir/$tfile
2689 wait_delete_completed
2690 BLOCKS1=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
2691 $SETSTRIPE -i 0 -c 1 $DIR/$tdir/$tfile
2692 dd if=/dev/zero bs=1M count=10 of=$DIR/$tdir/$tfile
2695 facet_failover $SINGLEMDS
2696 rm $DIR/$tdir/$tfile
2699 zconf_mount $(hostname) $MOUNT
2700 client_up || return 1
2702 wait_delete_completed
2703 BLOCKS2=$(df -P $MOUNT | tail -n 1 | awk '{ print $3 }')
2704 [ $((BLOCKS2 - BLOCKS1)) -le 4 ] || \
2705 error $((BLOCKS2 - BLOCKS1)) blocks leaked
2708 run_test 89 "no disk space leak on late ost connection"
2714 change_active $facet
2715 wait_for_facet $facet
2716 mount_facet $facet || error "Restart of $facet failed"
2720 test_90() { # bug 19494
2721 local dir=$DIR/$tdir
2722 local ostfail=$(get_random_entry $(get_facets OST))
2724 if [[ $FAILURE_MODE = HARD ]]; then
2725 local affected=$(affected_facets $ostfail);
2726 if [[ "$affected" != $ostfail ]]; then
2727 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
2734 echo "Create the files"
2736 # file "f${index}" striped over 1 OST
2737 # file "all" striped over all OSTs
2739 $SETSTRIPE -c $OSTCOUNT $dir/all ||
2740 error "setstripe failed to create $dir/all"
2742 for (( i=0; i<$OSTCOUNT; i++ )); do
2744 $SETSTRIPE -i $i -c 1 $f || error "$SETSTRIPE failed to create $f"
2746 # confirm setstripe actually created the stripe on the requested OST
2747 local uuid=$(ostuuid_from_index $i)
2748 for file in f$i all; do
2749 if [[ $dir/$file != $($LFS find --obd $uuid --name $file $dir) ]]; then
2750 $GETSTRIPE $dir/$file
2751 error wrong stripe: $file, uuid: $uuid
2756 # Before failing an OST, get its obd name and index
2757 local varsvc=${ostfail}_svc
2758 local obd=$(do_facet $ostfail lctl get_param -n obdfilter.${!varsvc}.uuid)
2759 local index=$(($(facet_number $ostfail) - 1))
2761 echo "Fail $ostfail $obd, display the list of affected files"
2762 shutdown_facet $ostfail || return 2
2764 trap "cleanup_90 $ostfail" EXIT INT
2765 echo "General Query: lfs find $dir"
2766 local list=$($LFS find $dir)
2768 for (( i=0; i<$OSTCOUNT; i++ )); do
2769 list_member "$list" $dir/f$i || error_noexit "lfs find $dir: no file f$i"
2771 list_member "$list" $dir/all || error_noexit "lfs find $dir: no file all"
2773 # focus on the missing OST,
2774 # we expect to see only two files affected: "f$(index)" and "all"
2776 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
2777 list=$($LFS find --obd $obd $dir)
2779 for file in all f$index; do
2780 list_member "$list" $dir/$file ||
2781 error_noexit "lfs find does not report the affected $obd for $file"
2784 [[ $(echo $list | wc -w) -eq 2 ]] ||
2785 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
2787 echo "Check getstripe: $GETSTRIPE -r --obd $obd"
2788 list=$($GETSTRIPE -r --obd $obd $dir)
2790 for file in all f$index; do
2791 echo "$list" | grep $dir/$file ||
2792 error_noexit "lfs getsripe does not report the affected $obd for $file"
2797 run_test 90 "lfs find identifies the missing striped file segments"
2800 local server_version=$(lustre_version_code $SINGLEMDS)
2801 [[ $server_version -ge $(version_code 2.6.90) ]] ||
2802 [[ $server_version -ge $(version_code 2.5.4) &&
2803 $server_version -lt $(version_code 2.5.50) ]] ||
2804 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
2806 cancel_lru_locks osc
2808 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
2809 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1
2810 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
2811 # We need to emulate a state that OST is waiting for other clients
2812 # not completing the recovery. Final ping is queued, but reply will be sent
2813 # on the recovery completion. It is done by sleep before processing final
2815 do_facet ost1 "$LCTL set_param fail_val=40"
2816 do_facet ost1 "$LCTL set_param fail_loc=0x715"
2819 run_test 93 "replay + reconnect"
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_OUT_UPDATE_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"
2892 test_101() { #LU-5648
2893 mkdir -p $DIR/$tdir/d1
2894 mkdir -p $DIR/$tdir/d2
2895 touch $DIR/$tdir/file0
2898 replay_barrier $SINGLEMDS
2899 for i in $(seq $num) ; do
2900 echo test$i > $DIR/$tdir/d1/file$i
2903 fail_abort $SINGLEMDS
2904 for i in $(seq $num) ; do
2905 touch $DIR/$tdir/d2/file$i
2906 test -s $DIR/$tdir/d2/file$i &&
2907 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
2912 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
2915 check_and_cleanup_lustre