6 # This test needs to be run on the client
9 LUSTRE=${LUSTRE:-`dirname $0`/..}
10 . $LUSTRE/tests/test-framework.sh
14 . ${CONFIG:=$LUSTRE/tests/cfg/lmv.sh}
21 # 46 - The MDS will always have to force close the cached opens
24 if [ `using_krb5_sec $SECURITY` == 'n' ] ; then
25 ALWAYS_EXCEPT="0c $ALWAYS_EXCEPT"
32 if [ "$MDSCOUNT" -gt 1 ]; then
34 for mds in `mds_list`; do
35 MDSDEV=$TMP/${mds}-`hostname`
36 add_mds $mds --dev $MDSDEV --size $MDSSIZE --lmv lmv1_svc
38 add_lov_to_lmv lov1 lmv1_svc --stripe_sz $STRIPE_BYTES \
39 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
42 add_mds mds1 --dev $MDSDEV --size $MDSSIZE
43 if [ ! -z "$mds1failover_HOST" ]; then
44 add_mdsfailover mds1 --dev $MDSDEV --size $MDSSIZE
46 add_lov lov1 mds1 --stripe_sz $STRIPE_BYTES \
47 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
51 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
52 add_ost ost2 --lov lov1 --dev ${OSTDEV}-2 --size $OSTSIZE
53 add_client client $MDS --lov lov1 --path $MOUNT
59 # make sure we are using the primary MDS, so the config log will
60 # be able to clean up properly.
61 activemds=`facet_active mds1`
62 if [ $activemds != "mds1" ]; then
65 zconf_umount `hostname` $MOUNT
66 for mds in `mds_list`; do
67 stop $mds ${FORCE} $MDSLCONFARGS
71 stop ost2 ${FORCE} --dump cleanup.log
72 stop ost ${FORCE} --dump cleanup.log
75 if [ "$ONLY" == "cleanup" ]; then
76 sysctl -w portals.debug=0 || true
81 SETUP=${SETUP:-"setup"}
82 CLEANUP=${CLEANUP:-"cleanup"}
87 start_krb5_kdc || exit 1
88 start ost --reformat $OSTLCONFARGS
89 start ost2 --reformat $OSTLCONFARGS
90 start_lsvcgssd || exit 2
92 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
93 for mds in `mds_list`; do
94 start $mds --reformat $MDSLCONFARGS
96 grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
101 if [ "$ONLY" == "setup" ]; then
111 run_test 0 "empty replay"
114 # this test attempts to trigger a race in the precreation code,
115 # and must run before any other objects are created on the filesystem
117 createmany -o $DIR/$tfile 20 || return 1
118 unlinkmany $DIR/$tfile 20 || return 2
120 run_test 0b "ensure object created after recover exists. (3284)"
123 # drop gss error notification
127 # drop gss init request
131 run_test 0c "empty replay with gss init failures"
137 $CHECKSTAT -t file $DIR/$tfile || return 1
140 run_test 1 "simple create"
146 $CHECKSTAT -t file $DIR/$tfile || return 1
152 ./mcreate $DIR/$tfile
156 $CHECKSTAT -t file $DIR/$tfile || return 1
164 o_directory $DIR/$tfile
166 $CHECKSTAT -t file $DIR/$tfile || return 2
169 run_test 3a "replay failed open(O_DIRECTORY)"
173 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
174 do_facet mds "sysctl -w lustre.fail_loc=0x80000114"
176 do_facet mds "sysctl -w lustre.fail_loc=0"
178 $CHECKSTAT -t file $DIR/$tfile && return 2
181 run_test 3b "replay failed open -ENOMEM"
185 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
186 do_facet mds "sysctl -w lustre.fail_loc=0x80000128"
188 do_facet mds "sysctl -w lustre.fail_loc=0"
191 $CHECKSTAT -t file $DIR/$tfile && return 2
194 run_test 3c "replay failed open -ENOMEM"
198 for i in `seq 10`; do
199 echo "tag-$i" > $DIR/$tfile-$i
202 for i in `seq 10`; do
203 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
206 run_test 4 "|x| 10 open(O_CREAT)s"
212 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
214 run_test 4b "|x| rm 10 files"
216 # The idea is to get past the first block of precreated files on both
217 # osts, and then replay.
220 for i in `seq 220`; do
221 echo "tag-$i" > $DIR/$tfile-$i
224 for i in `seq 220`; do
225 grep -q "tag-$i" $DIR/$tfile-$i || error "f1c-$i"
229 # waiting for commitment of removal
231 run_test 5 "|x| 220 open(O_CREAT)"
237 mcreate $DIR/$tdir/$tfile
239 $CHECKSTAT -t dir $DIR/$tdir || return 1
240 $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
242 # waiting for log process thread
244 run_test 6 "mkdir + contained create"
250 $CHECKSTAT -t dir $DIR/$tdir && return 1 || true
252 run_test 6b "|X| rmdir"
257 mcreate $DIR/$tdir/$tfile
259 $CHECKSTAT -t dir $DIR/$tdir || return 1
260 $CHECKSTAT -t file $DIR/$tdir/$tfile || return 2
263 run_test 7 "mkdir |X| contained create"
267 multiop $DIR/$tfile mo_c &
272 $CHECKSTAT -t file $DIR/$tfile || return 1
273 kill -USR1 $MULTIPID || return 2
274 wait $MULTIPID || return 3
277 run_test 8 "creat open |X| close"
282 local old_inum=`ls -i $DIR/$tfile | awk '{print $1}'`
284 local new_inum=`ls -i $DIR/$tfile | awk '{print $1}'`
286 echo " old_inum == $old_inum, new_inum == $new_inum"
287 if [ $old_inum -eq $new_inum ] ;
289 echo " old_inum and new_inum match"
291 echo "!!!! old_inum and new_inum NOT match"
296 run_test 9 "|X| create (same inum/gen)"
301 mv $DIR/$tfile $DIR/$tfile-2
305 $CHECKSTAT $DIR/$tfile && return 1
306 $CHECKSTAT $DIR/$tfile-2 || return 2
310 run_test 10 "create |X| rename unlink"
314 echo "old" > $DIR/$tfile
315 mv $DIR/$tfile $DIR/$tfile-2
317 echo "new" > $DIR/$tfile
319 grep old $DIR/$tfile-2
321 grep new $DIR/$tfile || return 1
322 grep old $DIR/$tfile-2 || return 2
324 run_test 11 "create open write rename |X| create-old-name read"
328 multiop $DIR/$tfile o_tSc &
330 # give multiop a chance to open
335 wait $pid || return 1
338 [ -e $DIR/$tfile ] && return 2
341 run_test 12 "open, unlink |X| close"
344 # 1777 - replay open after committed chmod that would make
345 # a regular open a failure
348 multiop $DIR/$tfile O_wc &
350 # give multiop a chance to open
353 $CHECKSTAT -p 0 $DIR/$tfile
357 wait $pid || return 1
359 $CHECKSTAT -s 1 -p 0 $DIR/$tfile || return 2
362 run_test 13 "open chmod 0 |x| write close"
365 multiop $DIR/$tfile O_tSc &
367 # give multiop a chance to open
371 kill -USR1 $pid || return 1
372 wait $pid || return 2
375 [ -e $DIR/$tfile ] && return 3
378 run_test 14 "open(O_CREAT), unlink |X| close"
381 multiop $DIR/$tfile O_tSc &
383 # give multiop a chance to open
387 touch $DIR/g11 || return 1
389 wait $pid || return 2
392 [ -e $DIR/$tfile ] && return 3
393 touch $DIR/h11 || return 4
396 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
403 mcreate $DIR/$tfile-2
405 [ -e $DIR/$tfile ] && return 1
406 [ -e $DIR/$tfile-2 ] || return 2
407 munlink $DIR/$tfile-2 || return 3
409 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
413 multiop $DIR/$tfile O_c &
415 # give multiop a chance to open
418 kill -USR1 $pid || return 1
419 wait $pid || return 2
420 $CHECKSTAT -t file $DIR/$tfile || return 3
423 run_test 17 "|X| open(O_CREAT), |replay| close"
427 multiop $DIR/$tfile O_tSc &
429 # give multiop a chance to open
432 touch $DIR/$tfile-2 || return 1
433 echo "pid: $pid will close"
435 wait $pid || return 2
438 [ -e $DIR/$tfile ] && return 3
439 [ -e $DIR/$tfile-2 ] || return 4
440 # this touch frequently fails
441 touch $DIR/$tfile-3 || return 5
442 munlink $DIR/$tfile-2 || return 6
443 munlink $DIR/$tfile-3 || return 7
446 run_test 18 "|X| open(O_CREAT), unlink, touch new, close, touch, unlink"
448 # bug 1855 (a simpler form of test_11 above)
452 echo "old" > $DIR/$tfile
453 mv $DIR/$tfile $DIR/$tfile-2
454 grep old $DIR/$tfile-2
456 grep old $DIR/$tfile-2 || return 2
458 run_test 19 "|X| mcreate, open, write, rename "
462 multiop $DIR/$tfile O_tSc &
464 # give multiop a chance to open
470 wait $pid || return 1
471 [ -e $DIR/$tfile ] && return 2
474 run_test 20 "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
478 multiop $DIR/$tfile O_tSc &
480 # give multiop a chance to open
483 touch $DIR/g11 || return 1
487 wait $pid || return 2
488 [ -e $DIR/$tfile ] && return 3
489 touch $DIR/h11 || return 4
492 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
495 multiop $DIR/$tfile O_tSc &
497 # give multiop a chance to open
505 wait $pid || return 1
506 [ -e $DIR/$tfile ] && return 2
509 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
512 multiop $DIR/$tfile O_tSc &
514 # give multiop a chance to open
519 touch $DIR/g11 || return 1
523 wait $pid || return 2
524 [ -e $DIR/$tfile ] && return 3
525 touch $DIR/h11 || return 4
528 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
531 multiop $DIR/$tfile O_tSc &
533 # give multiop a chance to open
540 wait $pid || return 1
541 [ -e $DIR/$tfile ] && return 2
544 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
547 multiop $DIR/$tfile O_tSc &
549 # give multiop a chance to open
556 wait $pid || return 1
557 [ -e $DIR/$tfile ] && return 2
560 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
564 multiop $DIR/$tfile-1 O_tSc &
566 multiop $DIR/$tfile-2 O_tSc &
568 # give multiop a chance to open
573 wait $pid2 || return 1
577 wait $pid1 || return 2
578 [ -e $DIR/$tfile-1 ] && return 3
579 [ -e $DIR/$tfile-2 ] && return 4
582 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
586 multiop $DIR/$tfile-1 O_tSc &
588 multiop $DIR/$tfile-2 O_tSc &
590 # give multiop a chance to open
597 wait $pid1 || return 1
599 wait $pid2 || return 2
600 [ -e $DIR/$tfile-1 ] && return 3
601 [ -e $DIR/$tfile-2 ] && return 4
604 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
607 multiop $DIR/$tfile-1 O_tSc &
609 multiop $DIR/$tfile-2 O_tSc &
611 # give multiop a chance to open
617 wait $pid2 || return 1
621 wait $pid1 || return 2
622 [ -e $DIR/$tfile-1 ] && return 3
623 [ -e $DIR/$tfile-2 ] && return 4
626 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
629 multiop $DIR/$tfile-1 O_tSc &
631 multiop $DIR/$tfile-2 O_tSc &
633 # give multiop a chance to open
641 wait $pid1 || return 1
643 wait $pid2 || return 2
644 [ -e $DIR/$tfile-1 ] && return 3
645 [ -e $DIR/$tfile-2 ] && return 4
648 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
651 multiop $DIR/$tfile-1 O_tSc &
653 multiop $DIR/$tfile-2 O_tSc &
655 # give multiop a chance to open
663 wait $pid1 || return 1
665 wait $pid2 || return 2
666 [ -e $DIR/$tfile-1 ] && return 3
667 [ -e $DIR/$tfile-2 ] && return 4
670 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
673 multiop $DIR/$tfile-1 O_tSc &
675 multiop $DIR/$tfile-2 O_tSc &
677 # give multiop a chance to open
685 wait $pid1 || return 1
687 wait $pid2 || return 2
688 [ -e $DIR/$tfile-1 ] && return 3
689 [ -e $DIR/$tfile-2 ] && return 4
692 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
694 # tests for bug 2104; completion without crashing is success. The close is
695 # stale, but we always return 0 for close, so the app never sees it.
697 multiop $DIR/$tfile O_c &
699 multiop $DIR/$tfile O_c &
701 # give multiop a chance to open
704 df $MOUNT || sleep 1 && df $MOUNT || return 1
710 run_test 32 "close() notices client eviction; close() after client eviction"
712 # Abort recovery before client complete
717 # this file should be gone, because the replay was aborted
718 $CHECKSTAT -t file $DIR/$tfile && return 1
721 run_test 33 "abort recovery before client does replay"
724 multiop $DIR/$tfile O_c &
726 # give multiop a chance to open
733 [ -e $DIR/$tfile ] && return 1
737 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
739 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
743 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
744 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
749 # give a chance to remove from MDS
751 $CHECKSTAT -t file $DIR/$tfile && return 1 || true
753 run_test 35 "test recovery from llog for unlink op"
755 # b=2432 resent cancel after replay uses wrong cookie,
756 # so don't resend cancels
760 checkstat $DIR/$tfile
763 if dmesg | grep "unknown lock cookie"; then
764 echo "cancel after replay failed"
768 run_test 36 "don't resend cancel"
771 # directory orphans can't be unlinked from PENDING directory
773 rmdir $DIR/$tfile 2>/dev/null
774 multiop $DIR/$tfile dD_c &
776 # give multiop a chance to open
781 # clear the dmesg buffer so we only see errors from this recovery
785 dmesg | grep "mds_unlink_orphan.*error .* unlinking orphan" && return 1
789 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
792 createmany -o $DIR/$tfile-%d 800
793 unlinkmany $DIR/$tfile-%d 0 400
796 unlinkmany $DIR/$tfile-%d 400 400
798 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
800 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
803 createmany -o $DIR/$tfile-%d 800
805 unlinkmany $DIR/$tfile-%d 0 400
807 unlinkmany $DIR/$tfile-%d 400 400
809 $CHECKSTAT -t file $DIR/$tfile-* && return 1 || true
811 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
814 cat /proc/fs/lustre/osc/*/stats |
815 awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
820 $LCTL mark multiop $MOUNT/$tfile OS_c
821 multiop $MOUNT/$tfile OS_c &
823 writeme -s $MOUNT/${tfile}-2 &
827 #define OBD_FAIL_MDS_CONNECT_NET 0x117
828 do_facet mds "sysctl -w lustre.fail_loc=0x80000117"
830 stat1=`count_ost_writes`
832 stat2=`count_ost_writes`
833 echo "$stat1, $stat2"
834 if [ $stat1 -lt $stat2 ]; then
835 echo "writes continuing during recovery"
838 echo "writes not continuing during recovery, bug 2477"
841 echo "waiting for writeme $WRITE_PID"
845 echo "waiting for multiop $PID"
846 wait $PID || return 2
847 do_facet client munlink $MOUNT/$tfile || return 3
848 do_facet client munlink $MOUNT/${tfile}-2 || return 3
851 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
855 # make sure that a read to one osc doesn't try to double-unlock its page just
856 # because another osc is invalid. trigger_group_io used to mistakenly return
857 # an error if any oscs were invalid even after having successfully put rpcs
858 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
859 # the page, guarnateeing that the unlock from the RPC completion would
860 # assert on trying to unlock the unlocked page.
862 local f=$MOUNT/$tfile
863 # make sure the start of the file is ost1
864 lfs setstripe $f $((128 * 1024)) 0 0
865 do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3
867 # fail ost2 and read from ost1
868 local osc2_dev=`$LCTL device_list | \
869 awk '(/ost2.*client_facet/){print $4}' `
870 $LCTL --device %$osc2_dev deactivate
871 do_facet client dd if=$f of=/dev/null bs=4k count=1 || return 3
872 $LCTL --device %$osc2_dev activate
875 run_test 41 "read from a valid osc while other oscs are invalid"
877 # test MDS recovery after ost failure
879 blocks=`df $MOUNT | tail -n 1 | awk '{ print $1 }'`
880 createmany -o $DIR/$tfile-%d 800
882 unlinkmany $DIR/$tfile-%d 0 400
885 # osc is evicted, fs is smaller
886 blocks_after=`df $MOUNT | tail -n 1 | awk '{ print $1 }'`
887 [ $blocks_after -lt $blocks ] || return 1
888 echo wait for MDS to timeout and recover
889 sleep $((TIMEOUT * 2))
890 unlinkmany $DIR/$tfile-%d 400 400
891 $CHECKSTAT -t file $DIR/$tfile-* && return 2 || true
893 run_test 42 "recovery after ost failure"
896 # timeout in MDS/OST recovery RPC will LBUG MDS
900 # OBD_FAIL_OST_CREATE_NET 0x204
901 do_facet ost "sysctl -w lustre.fail_loc=0x80000204"
903 df $MOUNT || return 1
905 do_facet ost "sysctl -w lustre.fail_loc=0"
909 run_test 43 "mds osc import failure during recovery; don't LBUG"
912 mdcdev=`awk '/mds_svc_MNT/ {print $1}' < /proc/fs/lustre/devices`
913 do_facet mds "sysctl -w lustre.fail_loc=0x80000701"
914 $LCTL --device $mdcdev recover
916 do_facet mds "sysctl -w lustre.fail_loc=0"
919 run_test 44 "race in target handle connect"
921 # Handle failed close
923 mdcdev=`awk '/mds_svc_MNT/ {print $1}' < /proc/fs/lustre/devices`
924 $LCTL --device $mdcdev recover
926 multiop $DIR/$tfile O_c &
930 # This will cause the CLOSE to fail before even
931 # allocating a reply buffer
932 $LCTL --device $mdcdev deactivate
936 wait $pid || return 1
938 $LCTL --device $mdcdev activate
941 $CHECKSTAT -t file $DIR/$tfile || return 2
944 run_test 45 "Handle failed close"
948 drop_reply "touch $DIR/$tfile"
950 # ironically, the previous test, 45, will cause a real forced close,
951 # so just look for one for this test
952 dmesg | grep -i "force closing client file handle for $tfile" && return 1
955 run_test 46 "Don't leak file handle after open resend (3325)"
960 # create some files to make sure precreate has been done on all
961 # OSTs. (just in case this test is run independently)
962 createmany -o $DIR/$tfile 20 || return 1
964 # OBD_FAIL_OST_CREATE_NET 0x204
966 do_facet ost "sysctl -w lustre.fail_loc=0x80000204"
967 df $MOUNT || return 2
969 # let the MDS discover the OST failure, attempt to recover, fail
971 sleep $((3 * TIMEOUT))
973 # Without 2824, this createmany would hang
974 createmany -o $DIR/$tfile 20 || return 3
975 unlinkmany $DIR/$tfile 20 || return 4
977 do_facet ost "sysctl -w lustre.fail_loc=0"
980 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
984 createmany -o $DIR/${tfile}- 100
985 $CHECKSTAT $DIR/${tfile}-99 || return 1
987 df $MOUNT || df $MOUNT || return 2
989 $CHECKSTAT $DIR/${tfile}-99 || return 3
994 unlinkmany $DIR/${tfile}- 100 || return 4
995 if dmesg | grep "back in time"; then
996 echo "server went back in time!"
1001 run_test 48 "Don't lose transno when client is evicted (2525)"
1003 # b=3550 - replay of unlink
1006 createmany -o $DIR/$tfile-%d 400 || return 1
1007 unlinkmany $DIR/$tfile-%d 0 400 || return 2
1009 $CHECKSTAT -t file $DIR/$tfile-* && return 3 || true
1011 run_test 49 "re-write records to llog as written during fail"
1014 local osc_dev=`$LCTL device_list | \
1015 awk '(/ost_svc_mds1_svc/){print $4}' `
1016 $LCTL --device %$osc_dev recover && $LCTL --device %$osc_dev recover
1017 # give the mds_lov_sync threads a chance to run
1020 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1022 # bug 3462 - simultaneous MDC requests
1024 replay_barrier_nodf mds
1025 mkdir -p $DIR/${tdir}-1
1026 mkdir -p $DIR/${tdir}-2
1027 touch $DIR/${tdir}-2/f
1028 multiop $DIR/${tdir}-1/f O_c &
1030 # give multiop a chance to open
1033 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
1035 do_facet mds "sysctl -w lustre.fail_loc=0"
1036 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 1
1040 wait $pid || return 2
1041 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1042 rm -rf $DIR/${tdir}-*
1044 run_test 51a "|X| close request while two MDC requests in flight"
1047 replay_barrier_nodf mds
1048 mkdir -p $DIR/$tdir-1
1049 mkdir -p $DIR/$tdir-2
1050 multiop $DIR/$tdir-1/f O_c &
1052 # give multiop a chance to open
1055 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
1056 touch $DIR/${tdir}-2/f &
1058 do_facet mds "sysctl -w lustre.fail_loc=0"
1061 wait $pid || return 1
1065 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 2
1066 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 3
1067 rm -rf $DIR/${tdir}-*
1069 run_test 51b "|X| open request while two MDC requests in flight"
1072 replay_barrier_nodf mds
1073 mkdir -p $DIR/${tdir}-1
1074 mkdir -p $DIR/${tdir}-2
1075 multiop $DIR/${tdir}-1/f O_c &
1077 # give multiop a chance to open
1080 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
1081 touch $DIR/${tdir}-2/f &
1082 do_facet mds "sysctl -w lustre.fail_loc=0"
1084 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
1086 do_facet mds "sysctl -w lustre.fail_loc=0"
1090 wait $pid || return 1
1091 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 2
1092 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 3
1093 rm -rf $DIR/${tdir}-*
1095 run_test 51c "|X| open request and close request while two MDC requests in flight"
1098 replay_barrier_nodf mds
1099 mkdir -p $DIR/${tdir}-1
1100 mkdir -p $DIR/${tdir}-2
1101 touch $DIR/${tdir}-2/f
1102 multiop $DIR/${tdir}-1/f O_c &
1104 # give multiop a chance to open
1107 do_facet mds "sysctl -w lustre.fail_loc=0x80000122"
1109 do_facet mds "sysctl -w lustre.fail_loc=0"
1110 #$CHECKSTAT -t file $DIR/${tdir}-2/f || return 1
1114 wait $pid || return 2
1115 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 3
1116 rm -rf $DIR/${tdir}-*
1118 run_test 51d "|X| close reply while two MDC requests in flight"
1121 replay_barrier_nodf mds
1122 mkdir -p $DIR/$tdir-1
1123 mkdir -p $DIR/$tdir-2
1124 multiop $DIR/$tdir-1/f O_c &
1126 # give multiop a chance to open
1129 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
1130 touch $DIR/${tdir}-2/f &
1132 do_facet mds "sysctl -w lustre.fail_loc=0"
1135 wait $pid || return 1
1139 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 2
1140 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 3
1141 rm -rf $DIR/${tdir}-*
1143 run_test 51e "|X| open reply while two MDC requests in flight"
1146 replay_barrier_nodf mds
1147 mkdir -p $DIR/${tdir}-1
1148 mkdir -p $DIR/${tdir}-2
1149 multiop $DIR/${tdir}-1/f O_c &
1151 # give multiop a chance to open
1154 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
1155 touch $DIR/${tdir}-2/f &
1156 do_facet mds "sysctl -w lustre.fail_loc=0"
1158 do_facet mds "sysctl -w lustre.fail_loc=0x80000122"
1160 do_facet mds "sysctl -w lustre.fail_loc=0"
1164 wait $pid || return 1
1165 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 2
1166 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 3
1167 rm -rf $DIR/${tdir}-*
1169 run_test 51f "|X| open reply and close reply while two MDC requests in flight"
1172 replay_barrier_nodf mds
1173 mkdir -p $DIR/${tdir}-1
1174 mkdir -p $DIR/${tdir}-2
1175 multiop $DIR/${tdir}-1/f O_c &
1177 # give multiop a chance to open
1180 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
1181 touch $DIR/${tdir}-2/f &
1182 do_facet mds "sysctl -w lustre.fail_loc=0"
1184 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
1186 do_facet mds "sysctl -w lustre.fail_loc=0"
1190 wait $pid || return 1
1191 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 2
1192 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 3
1193 rm -rf $DIR/${tdir}-*
1195 run_test 51g "|X| open reply and close request while two MDC requests in flight"
1198 replay_barrier_nodf mds
1199 mkdir -p $DIR/${tdir}-1
1200 mkdir -p $DIR/${tdir}-2
1201 multiop $DIR/${tdir}-1/f O_c &
1203 # give multiop a chance to open
1206 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
1207 touch $DIR/${tdir}-2/f &
1208 do_facet mds "sysctl -w lustre.fail_loc=0"
1210 do_facet mds "sysctl -w lustre.fail_loc=0x80000122"
1212 do_facet mds "sysctl -w lustre.fail_loc=0"
1216 wait $pid || return 1
1217 $CHECKSTAT -t file $DIR/${tdir}-1/f || return 2
1218 $CHECKSTAT -t file $DIR/${tdir}-2/f || return 3
1219 rm -rf $DIR/${tdir}-*
1221 run_test 51h "|X| open request and close reply while two MDC requests in flight"
1223 # b3764 timed out lock replay
1226 cancel_lru_locks MDC
1228 multiop $DIR/$tfile s
1230 do_facet mds1 "sysctl -w lustre.fail_loc=0x8000030c"
1232 do_facet mds1 "sysctl -w lustre.fail_loc=0x0"
1234 $CHECKSTAT -t file $DIR/$tfile-* && return 3 || true
1236 run_test 52 "time out lock replay (3764)"
1239 replay_barrier_nodf mds
1246 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
1248 do_facet mds "sysctl -w lustre.fail_loc=0"
1253 run_test 53 "|X| open request and close reply while two MDC requests in flight"
1257 createmany -o $DIR/$tfile 20
1258 unlinkmany $DIR/$tfile 20
1261 run_test 54 "|X| open request and close reply while two MDC requests in flight"
1263 #b3440 ASSERTION(rec->ur_fid2->id) failed
1265 sysctl -w portals.debug=-1 portals.debug_mb=25
1266 ln -s foo $DIR/$tfile
1268 #drop_reply "cat $DIR/$tfile"
1271 lctl dk /r/tmp/debug
1273 run_test 55 "don't replay a symlink open request (3440)"
1275 #b3761 ASSERTION(hash != 0) failed
1277 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1278 do_facet mds "sysctl -w lustre.fail_loc=0x8000012b"
1281 # give a chance for touch to run
1283 do_facet mds "sysctl -w lustre.fail_loc=0x0"
1284 wait $pid || return 1
1288 run_test 56 "let MDS_CHECK_RESENT return the original return code instead of 0
1290 equals_msg test complete, cleaning up