7 # This test needs to be run on the client
10 LUSTRE=${LUSTRE:-`dirname $0`/..}
11 . $LUSTRE/tests/test-framework.sh
13 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
18 ALWAYS_EXCEPT="39 $REPLAY_SINGLE_EXCEPT"
22 add_mds mds --dev $MDSDEV --size $MDSSIZE
23 if [ ! -z "$mdsfailover_HOST" ]; then
24 add_mdsfailover mds --dev $MDSDEV --size $MDSSIZE
27 add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
28 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
29 add_ost ost --lov lov1 --dev `ostdevname 1` --size $OSTSIZE
30 add_ost ost2 --lov lov1 --dev `ostdevname 2` --size $OSTSIZE
31 add_client client mds --lov lov1 --path $MOUNT
36 SETUP=${SETUP:-"setup"}
37 CLEANUP=${CLEANUP:-"cleanupall"}
39 if [ "$ONLY" == "cleanup" ]; then
40 sysctl -w lnet.debug=0 || true
46 [ "$REFORMAT" ] && formatall
52 if [ "$ONLY" == "setup" ]; then
62 run_test 0 "empty replay"
65 # this test attempts to trigger a race in the precreation code,
66 # and must run before any other objects are created on the filesystem
68 createmany -o $DIR/$tfile 20 || return 1
69 unlinkmany $DIR/$tfile 20 || return 2
71 run_test 0b "ensure object created after recover exists. (3284)"
77 $CHECKSTAT -t file $DIR/$tfile || return 1
80 run_test 1 "simple create"
83 do_facet ost1 "sysctl -w lustre.fail_loc=0"
86 local old_last_id=`cat $LPROC/obdfilter/*/last_id`
87 touch -o $DIR/$tfile 1
89 local new_last_id=`cat $LPROC/obdfilter/*/last_id`
91 test "$old_last_id" = "$new_last_id" || {
92 echo "OST object create is caused by MDS"
96 old_last_id=`cat $LPROC/obdfilter/*/last_id`
97 echo "data" > $DIR/$tfile
99 new_last_id=`cat $LPROC/obdfilter/*/last_id`
100 test "$old_last_id" = "$new_last_id "&& {
101 echo "CROW does not work on write"
107 #define OBD_FAIL_OST_CROW_EIO | OBD_FAIL_ONCE
108 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000801"
111 old_last_id=`cat $LPROC/obdfilter/*/last_id`
112 echo "data" > $DIR/1a1
114 new_last_id=`cat $LPROC/obdfilter/*/last_id`
115 test "$old_last_id" = "$new_last_id" || {
116 echo "CROW does work with fail_loc=0x80000801"
122 do_facet ost1 "sysctl -w lustre.fail_loc=0"
124 #CROW run_test 1a "CROW object create (check OST last_id)"
130 $CHECKSTAT -t file $DIR/$tfile || return 1
136 ./mcreate $DIR/$tfile
140 $CHECKSTAT -t file $DIR/$tfile || return 1
148 o_directory $DIR/$tfile
150 $CHECKSTAT -t file $DIR/$tfile || return 2
153 run_test 3a "replay failed open(O_DIRECTORY)"
157 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
158 do_facet mds "sysctl -w lustre.fail_loc=0x80000114"
160 do_facet mds "sysctl -w lustre.fail_loc=0"
162 $CHECKSTAT -t file $DIR/$tfile && return 2
165 run_test 3b "replay failed open -ENOMEM"
169 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
170 do_facet mds "sysctl -w lustre.fail_loc=0x80000128"
172 do_facet mds "sysctl -w lustre.fail_loc=0"
175 $CHECKSTAT -t file $DIR/$tfile && return 2
178 run_test 3c "replay failed open -ENOMEM"
182 for i in `seq 10`; do
183 echo "tag-$i" > $DIR/$tfile-$i
186 for i in `seq 10`; do
187 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
190 run_test 4 "|x| 10 open(O_CREAT)s"
196 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
198 run_test 4b "|x| rm 10 files"
200 # The idea is to get past the first block of precreated files on both
201 # osts, and then replay.
204 for i in `seq 220`; do
205 echo "tag-$i" > $DIR/$tfile-$i
208 for i in `seq 220`; do
209 grep -q "tag-$i" $DIR/$tfile-$i || error "f1c-$i"
213 # waiting for commitment of removal
215 run_test 5 "|x| 220 open(O_CREAT)"
221 mcreate $DIR/$tdir/$tfile
223 $CHECKSTAT -t dir $DIR/$tdir || return 1
224 $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
226 # waiting for log process thread
228 run_test 6 "mkdir + contained create"
234 $CHECKSTAT -t dir $DIR/$tdir && return 1 || true
236 run_test 6b "|X| rmdir"
241 mcreate $DIR/$tdir/$tfile
243 $CHECKSTAT -t dir $DIR/$tdir || return 1
244 $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
247 run_test 7 "mkdir |X| contained create"
251 multiop $DIR/$tfile mo_c &
256 $CHECKSTAT -t file $DIR/$tfile || return 1
257 kill -USR1 $MULTIPID || return 2
258 wait $MULTIPID || return 3
261 run_test 8 "creat open |X| close"
266 local old_inum=`ls -i $DIR/$tfile | awk '{print $1}'`
268 local new_inum=`ls -i $DIR/$tfile | awk '{print $1}'`
270 echo " old_inum == $old_inum, new_inum == $new_inum"
271 if [ $old_inum -eq $new_inum ] ;
273 echo " old_inum and new_inum match"
275 echo "!!!! old_inum and new_inum NOT match"
280 run_test 9 "|X| create (same inum/gen)"
285 mv $DIR/$tfile $DIR/$tfile-2
288 $CHECKSTAT $DIR/$tfile && return 1
289 $CHECKSTAT $DIR/$tfile-2 ||return 2
293 run_test 10 "create |X| rename unlink"
297 echo "old" > $DIR/$tfile
298 mv $DIR/$tfile $DIR/$tfile-2
300 echo "new" > $DIR/$tfile
302 grep old $DIR/$tfile-2
304 grep new $DIR/$tfile || return 1
305 grep old $DIR/$tfile-2 || return 2
307 run_test 11 "create open write rename |X| create-old-name read"
311 multiop $DIR/$tfile o_tSc &
313 # give multiop a chance to open
318 wait $pid || return 1
321 [ -e $DIR/$tfile ] && return 2
324 run_test 12 "open, unlink |X| close"
327 # 1777 - replay open after committed chmod that would make
328 # a regular open a failure
331 multiop $DIR/$tfile O_wc &
333 # give multiop a chance to open
336 $CHECKSTAT -p 0 $DIR/$tfile
340 wait $pid || return 1
342 $CHECKSTAT -s 1 -p 0 $DIR/$tfile || return 2
345 run_test 13 "open chmod 0 |x| write close"
348 multiop $DIR/$tfile O_tSc &
350 # give multiop a chance to open
354 kill -USR1 $pid || return 1
355 wait $pid || return 2
358 [ -e $DIR/$tfile ] && return 3
361 run_test 14 "open(O_CREAT), unlink |X| close"
364 multiop $DIR/$tfile O_tSc &
366 # give multiop a chance to open
370 touch $DIR/g11 || return 1
372 wait $pid || return 2
375 [ -e $DIR/$tfile ] && return 3
376 touch $DIR/h11 || return 4
379 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
386 mcreate $DIR/$tfile-2
388 [ -e $DIR/$tfile ] && return 1
389 [ -e $DIR/$tfile-2 ] || return 2
390 munlink $DIR/$tfile-2 || return 3
392 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
396 multiop $DIR/$tfile O_c &
398 # give multiop a chance to open
401 kill -USR1 $pid || return 1
402 wait $pid || return 2
403 $CHECKSTAT -t file $DIR/$tfile || return 3
406 run_test 17 "|X| open(O_CREAT), |replay| close"
410 multiop $DIR/$tfile O_tSc &
412 # give multiop a chance to open
415 touch $DIR/$tfile-2 || return 1
416 echo "pid: $pid will close"
418 wait $pid || return 2
421 [ -e $DIR/$tfile ] && return 3
422 [ -e $DIR/$tfile-2 ] || return 4
423 # this touch frequently fails
424 touch $DIR/$tfile-3 || return 5
425 munlink $DIR/$tfile-2 || return 6
426 munlink $DIR/$tfile-3 || return 7
429 run_test 18 "|X| open(O_CREAT), unlink, touch new, close, touch, unlink"
431 # bug 1855 (a simpler form of test_11 above)
435 echo "old" > $DIR/$tfile
436 mv $DIR/$tfile $DIR/$tfile-2
437 grep old $DIR/$tfile-2
439 grep old $DIR/$tfile-2 || return 2
441 run_test 19 "|X| mcreate, open, write, rename "
445 multiop $DIR/$tfile O_tSc &
447 # give multiop a chance to open
453 wait $pid || return 1
454 [ -e $DIR/$tfile ] && return 2
457 run_test 20 "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
459 test_20b() { # bug 10480
460 BEFOREUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
462 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
464 while [ ! -e $DIR/$tfile ] ; do
465 usleep 60 # give dd a chance to start
468 lfs getstripe $DIR/$tfile || return 1
469 rm -f $DIR/$tfile || return 2 # make it an orphan
471 df -P $DIR || df -P $DIR || true # reconnect
473 fail mds # start orphan recovery
474 df -P $DIR || df -P $DIR || true # reconnect
477 AFTERUSED=`df -P $DIR | tail -1 | awk '{ print $3 }'`
478 log "before $BEFOREUSED, after $AFTERUSED"
479 [ $AFTERUSED -gt $((BEFOREUSED + 20)) ] && \
480 error "after $AFTERUSED > before $BEFOREUSED" && return 5
483 run_test 20b "write, unlink, eviction, replay, (test mds_cleanup_orphans)"
485 test_20c() { # bug 10480
486 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000
488 exec 100< $DIR/$tfile
494 df -P $DIR || df -P $DIR || true # reconnect
498 test -s $DIR/$tfile || error "File was truncated"
502 run_test 20c "check that client eviction does not affect file content"
506 multiop $DIR/$tfile O_tSc &
508 # give multiop a chance to open
511 touch $DIR/g11 || return 1
515 wait $pid || return 2
516 [ -e $DIR/$tfile ] && return 3
517 touch $DIR/h11 || return 4
520 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
523 multiop $DIR/$tfile O_tSc &
525 # give multiop a chance to open
533 wait $pid || return 1
534 [ -e $DIR/$tfile ] && return 2
537 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
540 multiop $DIR/$tfile O_tSc &
542 # give multiop a chance to open
547 touch $DIR/g11 || return 1
551 wait $pid || return 2
552 [ -e $DIR/$tfile ] && return 3
553 touch $DIR/h11 || return 4
556 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
559 multiop $DIR/$tfile O_tSc &
561 # give multiop a chance to open
568 wait $pid || return 1
569 [ -e $DIR/$tfile ] && return 2
572 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
575 multiop $DIR/$tfile O_tSc &
577 # give multiop a chance to open
584 wait $pid || return 1
585 [ -e $DIR/$tfile ] && return 2
588 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
592 multiop $DIR/$tfile-1 O_tSc &
594 multiop $DIR/$tfile-2 O_tSc &
596 # give multiop a chance to open
601 wait $pid2 || return 1
605 wait $pid1 || return 2
606 [ -e $DIR/$tfile-1 ] && return 3
607 [ -e $DIR/$tfile-2 ] && return 4
610 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
614 multiop $DIR/$tfile-1 O_tSc &
616 multiop $DIR/$tfile-2 O_tSc &
618 # give multiop a chance to open
625 wait $pid1 || return 1
627 wait $pid2 || return 2
628 [ -e $DIR/$tfile-1 ] && return 3
629 [ -e $DIR/$tfile-2 ] && return 4
632 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
635 multiop $DIR/$tfile-1 O_tSc &
637 multiop $DIR/$tfile-2 O_tSc &
639 # give multiop a chance to open
645 wait $pid2 || return 1
649 wait $pid1 || return 2
650 [ -e $DIR/$tfile-1 ] && return 3
651 [ -e $DIR/$tfile-2 ] && return 4
654 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
657 multiop $DIR/$tfile-1 O_tSc &
659 multiop $DIR/$tfile-2 O_tSc &
661 # give multiop a chance to open
669 wait $pid1 || return 1
671 wait $pid2 || return 2
672 [ -e $DIR/$tfile-1 ] && return 3
673 [ -e $DIR/$tfile-2 ] && return 4
676 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
679 multiop $DIR/$tfile-1 O_tSc &
681 multiop $DIR/$tfile-2 O_tSc &
683 # give multiop a chance to open
691 wait $pid1 || return 1
693 wait $pid2 || return 2
694 [ -e $DIR/$tfile-1 ] && return 3
695 [ -e $DIR/$tfile-2 ] && return 4
698 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
701 multiop $DIR/$tfile-1 O_tSc &
703 multiop $DIR/$tfile-2 O_tSc &
705 # give multiop a chance to open
713 wait $pid1 || return 1
715 wait $pid2 || return 2
716 [ -e $DIR/$tfile-1 ] && return 3
717 [ -e $DIR/$tfile-2 ] && return 4
720 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
722 # tests for bug 2104; completion without crashing is success. The close is
723 # stale, but we always return 0 for close, so the app never sees it.
725 multiop $DIR/$tfile O_c &
727 multiop $DIR/$tfile O_c &
729 # give multiop a chance to open
732 df $MOUNT || sleep 1 && df $MOUNT || return 1
738 run_test 32 "close() notices client eviction; close() after client eviction"
740 # Abort recovery before client complete
743 createmany -o $DIR/$tfile-%d 100
745 # this file should be gone, because the replay was aborted
746 $CHECKSTAT -t file $DIR/$tfile-* && return 3
747 unlinkmany $DIR/$tfile-%d 0 100
750 run_test 33 "abort recovery before client does replay"
753 multiop $DIR/$tfile O_c &
755 # give multiop a chance to open
762 [ -e $DIR/$tfile ] && return 1
766 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
768 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
772 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
773 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
778 # give a chance to remove from MDS
780 $CHECKSTAT -t file $DIR/$tfile && return 1 || true
782 run_test 35 "test recovery from llog for unlink op"
784 # b=2432 resent cancel after replay uses wrong cookie,
785 # so don't resend cancels
789 checkstat $DIR/$tfile
792 if dmesg | grep "unknown lock cookie"; then
793 echo "cancel after replay failed"
797 run_test 36 "don't resend cancel"
800 # directory orphans can't be unlinked from PENDING directory
802 rmdir $DIR/$tfile 2>/dev/null
803 multiop $DIR/$tfile dD_c &
805 # give multiop a chance to open
810 # clear the dmesg buffer so we only see errors from this recovery
814 dmesg | grep "mds_unlink_orphan.*error .* unlinking orphan" && return 1
818 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
821 createmany -o $DIR/$tfile-%d 800
822 unlinkmany $DIR/$tfile-%d 0 400
825 unlinkmany $DIR/$tfile-%d 400 400
827 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
829 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
831 test_39() { # bug 4176
832 createmany -o $DIR/$tfile-%d 800
834 unlinkmany $DIR/$tfile-%d 0 400
836 unlinkmany $DIR/$tfile-%d 400 400
839 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
841 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
844 awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }' $LPROC/osc/*/stats
849 $LCTL mark multiop $MOUNT/$tfile OS_c
850 multiop $MOUNT/$tfile OS_c &
852 writeme -s $MOUNT/${tfile}-2 &
856 #define OBD_FAIL_MDS_CONNECT_NET 0x117
857 do_facet mds "sysctl -w lustre.fail_loc=0x80000117"
859 stat1=`count_ost_writes`
861 stat2=`count_ost_writes`
862 echo "$stat1, $stat2"
863 if [ $stat1 -lt $stat2 ]; then
864 echo "writes continuing during recovery"
867 echo "writes not continuing during recovery, bug 2477"
870 echo "waiting for writeme $WRITE_PID"
874 echo "waiting for multiop $PID"
875 wait $PID || return 2
876 do_facet client munlink $MOUNT/$tfile || return 3
877 do_facet client munlink $MOUNT/${tfile}-2 || return 3
880 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
884 # make sure that a read to one osc doesn't try to double-unlock its page just
885 # because another osc is invalid. trigger_group_io used to mistakenly return
886 # an error if any oscs were invalid even after having successfully put rpcs
887 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
888 # the page, guarnateeing that the unlock from the RPC completion would
889 # assert on trying to unlock the unlocked page.
891 local f=$MOUNT/$tfile
892 # make sure the start of the file is ost1
893 lfs setstripe $f $((128 * 1024)) 0 0
894 do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3
896 # fail ost2 and read from ost1
897 local osc2dev=`grep ${ost2_svc}-osc- $LPROC/devices | awk '{print $1}'`
898 [ "$osc2dev" ] || return 4
899 $LCTL --device $osc2dev deactivate || return 1
900 do_facet client dd if=$f of=/dev/null bs=4k count=1 || return 3
901 $LCTL --device $osc2dev activate || return 2
904 run_test 41 "read from a valid osc while other oscs are invalid"
906 # test MDS recovery after ost failure
908 blocks=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
909 createmany -o $DIR/$tfile-%d 800
911 unlinkmany $DIR/$tfile-%d 0 400
913 sysctl -w lnet.debug=-1
916 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
917 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
918 #[ $blocks_after -lt $blocks ] || return 1
919 echo wait for MDS to timeout and recover
920 sleep $((TIMEOUT * 2))
922 unlinkmany $DIR/$tfile-%d 400 400
923 $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
925 run_test 42 "recovery after ost failure"
927 # timeout in MDS/OST recovery RPC will LBUG MDS
928 test_43() { # bug 2530
931 # OBD_FAIL_OST_CREATE_NET 0x204
932 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000204"
935 do_facet ost1 "sysctl -w lustre.fail_loc=0"
939 run_test 43 "mds osc import failure during recovery; don't LBUG"
942 mdcdev=`awk '/-mdc-/ {print $1}' $LPROC/devices`
943 [ "$mdcdev" ] || exit 2
944 for i in `seq 1 10`; do
945 #define OBD_FAIL_TGT_CONN_RACE 0x701
946 do_facet mds "sysctl -w lustre.fail_loc=0x80000701"
947 $LCTL --device $mdcdev recover
950 do_facet mds "sysctl -w lustre.fail_loc=0"
953 run_test 44 "race in target handle connect"
956 mdcdev=`awk '/-mdc-/ {print $1}' $LPROC/devices`
957 [ "$mdcdev" ] || exit 2
958 for i in `seq 1 10`; do
959 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
960 do_facet mds "sysctl -w lustre.fail_loc=0x80000704"
961 $LCTL --device $mdcdev recover
964 do_facet mds "sysctl -w lustre.fail_loc=0"
967 run_test 44b "race in target handle connect"
969 # Handle failed close
971 mdcdev=`awk '/-mdc-/ {print $1}' $LPROC/devices`
972 [ "$mdcdev" ] || exit 2
973 $LCTL --device $mdcdev recover
975 multiop $DIR/$tfile O_c &
979 # This will cause the CLOSE to fail before even
980 # allocating a reply buffer
981 $LCTL --device $mdcdev deactivate || return 4
985 wait $pid || return 1
987 $LCTL --device $mdcdev activate || return 5
990 $CHECKSTAT -t file $DIR/$tfile || return 2
993 run_test 45 "Handle failed close"
997 drop_reply "touch $DIR/$tfile"
999 # ironically, the previous test, 45, will cause a real forced close,
1000 # so just look for one for this test
1001 dmesg | grep -i "force closing client file handle for $tfile" && return 1
1004 run_test 46 "Don't leak file handle after open resend (3325)"
1006 test_47() { # bug 2824
1007 # create some files to make sure precreate has been done on all
1008 # OSTs. (just in case this test is run independently)
1009 createmany -o $DIR/$tfile 20 || return 1
1011 # OBD_FAIL_OST_CREATE_NET 0x204
1013 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000204"
1014 df $MOUNT || return 2
1016 # let the MDS discover the OST failure, attempt to recover, fail
1017 # and recover again.
1018 sleep $((3 * TIMEOUT))
1020 # Without 2824, this createmany would hang
1021 createmany -o $DIR/$tfile 20 || return 3
1022 unlinkmany $DIR/$tfile 20 || return 4
1024 do_facet ost1 "sysctl -w lustre.fail_loc=0"
1027 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1031 createmany -o $DIR/$tfile 20 || return 1
1032 # OBD_FAIL_OST_EROFS 0x216
1034 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000216"
1035 df $MOUNT || return 2
1037 createmany -o $DIR/$tfile 20 20 || return 2
1038 unlinkmany $DIR/$tfile 40 || return 3
1040 do_facet ost1 "sysctl -w lustre.fail_loc=0"
1043 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1046 local oscdev=`grep ${ost1_svc}-osc- $LPROC/devices | awk '{print $1}'`
1047 [ "$oscdev" ] || return 1
1048 $LCTL --device $oscdev recover && $LCTL --device $oscdev recover
1049 # give the mds_lov_sync threads a chance to run
1052 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1054 # b3764 timed out lock replay
1057 cancel_lru_locks mdc
1059 multiop $DIR/$tfile s || return 1
1061 #define OBD_FAIL_LDLM_REPLY 0x30c
1062 do_facet mds "sysctl -w lustre.fail_loc=0x8000030c"
1063 fail mds || return 2
1064 do_facet mds "sysctl -w lustre.fail_loc=0x0"
1066 $CHECKSTAT -t file $DIR/$tfile-* && return 3 || true
1068 run_test 52 "time out lock replay (3764)"
1070 #b_cray 53 "|X| open request and close reply while two MDC requests in flight"
1071 #b_cray 54 "|X| open request and close reply while two MDC requests in flight"
1073 #b3761 ASSERTION(hash != 0) failed
1075 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1076 do_facet mds "sysctl -w lustre.fail_loc=0x8000012b"
1078 # give touch a chance to run
1080 do_facet mds "sysctl -w lustre.fail_loc=0x0"
1084 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1086 #b3440 ASSERTION(rec->ur_fid2->id) failed
1088 ln -s foo $DIR/$tfile
1090 #drop_reply "cat $DIR/$tfile"
1094 run_test 56 "don't replay a symlink open request (3440)"
1096 #recovery one mds-ost setattr from llog
1098 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1099 do_facet mds "sysctl -w lustre.fail_loc=0x8000012c"
1104 $CHECKSTAT -t file $DIR/$tfile || return 1
1105 do_facet mds "sysctl -w lustre.fail_loc=0x0"
1108 run_test 57 "test recovery from llog for setattr op"
1110 #recovery many mds-ost setattr from llog
1112 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1113 do_facet mds "sysctl -w lustre.fail_loc=0x8000012c"
1115 createmany -o $DIR/$tdir/$tfile-%d 2500
1119 $CHECKSTAT -t file $DIR/$tdir/$tfile-* || return 1
1120 do_facet mds "sysctl -w lustre.fail_loc=0x0"
1121 unlinkmany $DIR/$tdir/$tfile-%d 2500
1124 run_test 58 "test recovery from llog for setattr op (test llog_gen_rec)"
1126 # log_commit_thread vs filter_destroy race used to lead to import use after free
1130 createmany -o $DIR/$tdir/$tfile-%d 200
1132 unlinkmany $DIR/$tdir/$tfile-%d 200
1133 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1134 do_facet ost1 "sysctl -w lustre.fail_loc=0x507"
1137 do_facet ost1 "sysctl -w lustre.fail_loc=0x0"
1141 run_test 59 "test log_commit_thread vs filter_destroy race"
1143 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1144 # bug 12086: should no oops and No ctxt error for this test
1147 createmany -o $DIR/$tdir/$tfile-%d 200
1149 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1151 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1152 local no_ctxt=`dmesg | grep "No ctxt"`
1153 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1155 run_test 60 "test llog post recovery init vs llog unlink"
1157 equals_msg `basename $0`: test complete, cleaning up