6 ALWAYS_EXCEPT="24 27 52 $RECOVERY_SMALL_EXCEPT"
8 PTLDEBUG=${PTLDEBUG:--1}
9 LUSTRE=${LUSTRE:-`dirname $0`/..}
10 . $LUSTRE/tests/test-framework.sh
12 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
14 # also long tests: 19, 21a, 21e, 21f, 23, 27
16 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17 26b 50 51 57"
20 # Allow us to override the setup if we already have a mounted system by
21 # setting SETUP=" " and CLEANUP=" "
23 CLEANUP=${CLEANUP:-""}
25 cleanup_and_setup_lustre
26 rm -rf $DIR/[df][0-9]*
28 SAMPLE_NAME=recovery-small.junk
29 SAMPLE_FILE=$TMP/$SAMPLE_NAME
30 # make this big, else test 9 doesn't wait for bulk -- bz 5595
31 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
34 drop_request "mcreate $MOUNT/1" || return 1
35 drop_reint_reply "mcreate $MOUNT/2" || return 2
37 run_test 1 "mcreate: drop req, drop rep"
40 drop_request "tchmod 111 $MOUNT/2" || return 1
41 drop_reint_reply "tchmod 666 $MOUNT/2" || return 2
43 run_test 2 "chmod: drop req, drop rep"
46 drop_request "statone $MOUNT/2" || return 1
47 drop_reply "statone $MOUNT/2" || return 2
49 run_test 3 "stat: drop req, drop rep"
52 do_facet client "cp /etc/inittab $MOUNT/inittab" || return 1
53 drop_request "cat $MOUNT/inittab > /dev/null" || return 2
54 drop_reply "cat $MOUNT/inittab > /dev/null" || return 3
56 run_test 4 "open: drop req, drop rep"
59 drop_request "mv $MOUNT/inittab $MOUNT/renamed" || return 1
60 drop_reint_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
61 do_facet client "checkstat -v $MOUNT/renamed-again" || return 3
63 run_test 5 "rename: drop req, drop rep"
65 [ ! -e $MOUNT/renamed-again ] && cp /etc/inittab $MOUNT/renamed-again
67 drop_request "mlink $MOUNT/renamed-again $MOUNT/link1" || return 1
68 drop_reint_reply "mlink $MOUNT/renamed-again $MOUNT/link2" || return 2
70 run_test 6 "link: drop req, drop rep"
72 [ ! -e $MOUNT/link1 ] && mlink $MOUNT/renamed-again $MOUNT/link1
73 [ ! -e $MOUNT/link2 ] && mlink $MOUNT/renamed-again $MOUNT/link2
75 drop_request "munlink $MOUNT/link1" || return 1
76 drop_reint_reply "munlink $MOUNT/link2" || return 2
78 run_test 7 "unlink: drop req, drop rep"
82 drop_reint_reply "touch $MOUNT/$tfile" || return 1
84 run_test 8 "touch: drop rep (bug 1423)"
88 pause_bulk "cp /etc/profile $MOUNT/$tfile" || return 1
89 do_facet client "cp ${SAMPLE_FILE} $MOUNT/${tfile}.2" || return 2
90 do_facet client "sync"
91 do_facet client "rm $MOUNT/$tfile $MOUNT/${tfile}.2" || return 3
93 run_test 9 "pause bulk on OST (bug 1420)"
97 do_facet client mcreate $MOUNT/$tfile || return 1
98 drop_bl_callback "chmod 0777 $MOUNT/$tfile" || echo "evicted as expected"
99 # wait for the mds to evict the client
100 #echo "sleep $(($TIMEOUT*2))"
101 #sleep $(($TIMEOUT*2))
102 do_facet client touch $MOUNT/$tfile || echo "touch failed, evicted"
103 do_facet client checkstat -v -p 0777 $MOUNT/$tfile || return 3
104 do_facet client "munlink $MOUNT/$tfile"
106 run_test 10 "finish request on server after client eviction (bug 1521)"
109 # wake up a thread waiting for completion after eviction
111 do_facet client multiop $MOUNT/$tfile Ow || return 1
112 do_facet client multiop $MOUNT/$tfile or || return 2
116 do_facet client multiop $MOUNT/$tfile or || return 3
117 drop_bl_callback multiop $MOUNT/$tfile Ow || echo "evicted as expected"
119 do_facet client munlink $MOUNT/$tfile || return 4
121 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
125 $LCTL mark multiop $MOUNT/$tfile OS_c
126 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x115"
127 clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
128 multiop $MOUNT/$tfile OS_c &
130 #define OBD_FAIL_MDS_CLOSE_NET 0x115
133 echo "waiting for multiop $PID"
134 wait $PID || return 2
135 do_facet client munlink $MOUNT/$tfile || return 3
137 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
139 # Bug 113, check that readdir lost recv timeout works.
141 mkdir $MOUNT/readdir || return 1
142 touch $MOUNT/readdir/newentry || return
143 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
144 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000104"
145 ls $MOUNT/readdir || return 3
146 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
147 rm -rf $MOUNT/readdir || return 4
149 run_test 13 "mdc_readpage restart test (bug 1138)"
151 # Bug 113, check that readdir lost send timeout works.
154 touch $MOUNT/readdir/newentry
155 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
156 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000106"
157 ls $MOUNT/readdir || return 1
158 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
160 run_test 14 "mdc_readpage resend test (bug 1138)"
163 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000128"
164 touch $DIR/$tfile && return 1
167 run_test 15 "failed open (-ENOMEM)"
169 READ_AHEAD=`cat $LPROC/llite/*/max_read_ahead_mb | head -n 1`
171 for f in $LPROC/llite/*/max_read_ahead_mb; do
177 for f in $LPROC/llite/*/max_read_ahead_mb; do
178 echo $READ_AHEAD > $f
183 do_facet client cp /etc/termcap $MOUNT
187 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
188 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000504"
190 # OST bulk will time out here, client resends
191 do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 1
192 do_facet ost1 sysctl -w lustre.fail_loc=0
193 # give recovery a chance to finish (shouldn't take long)
195 do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 2
198 run_test 16 "timeout bulk put, don't evict client (2732)"
201 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
202 # OST bulk will time out here, client retries
203 do_facet ost1 sysctl -w lustre.fail_loc=0x80000503
204 # need to ensure we send an RPC
205 do_facet client cp /etc/termcap $DIR/$tfile
209 do_facet ost1 sysctl -w lustre.fail_loc=0
210 do_facet client "df $DIR"
211 # expect cmp to succeed, client resent bulk
212 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
213 do_facet client "rm $DIR/$tfile" || return 4
216 run_test 17 "timeout bulk get, don't evict client (2732)"
219 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
221 do_facet client mkdir -p $MOUNT/$tdir
222 f=$MOUNT/$tdir/$tfile
225 pgcache_empty || return 1
228 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
230 do_facet client cp $SAMPLE_FILE $f
232 local osc2dev=`grep ${ost2_svc}-osc- $LPROC/devices | egrep -v 'MDT' | awk '{print $1}'`
233 $LCTL --device $osc2dev deactivate || return 3
234 # my understanding is that there should be nothing in the page
235 # cache after the client reconnects?
237 pgcache_empty || rc=2
238 $LCTL --device $osc2dev activate
242 run_test 18a "manual ost invalidate clears page cache immediately"
245 do_facet client mkdir -p $MOUNT/$tdir
246 f=$MOUNT/$tdir/$tfile
247 f2=$MOUNT/$tdir/${tfile}-2
250 pgcache_empty || return 1
252 # shouldn't have to set stripe size of count==1
253 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
254 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
256 do_facet client cp $SAMPLE_FILE $f
259 # allow recovery to complete
260 sleep $((TIMEOUT + 2))
261 # my understanding is that there should be nothing in the page
262 # cache after the client reconnects?
264 pgcache_empty || rc=2
268 run_test 18b "eviction and reconnect clears page cache (2766)"
271 do_facet client mkdir -p $MOUNT/$tdir
272 f=$MOUNT/$tdir/$tfile
273 f2=$MOUNT/$tdir/${tfile}-2
276 pgcache_empty || return 1
278 # shouldn't have to set stripe size of count==1
279 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
280 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
282 do_facet client cp $SAMPLE_FILE $f
286 # OBD_FAIL_OST_CONNECT_NET2
287 # lost reply to connect request
288 do_facet ost1 sysctl -w lustre.fail_loc=0x80000225
290 df $MOUNT > /dev/null 2>&1
292 # my understanding is that there should be nothing in the page
293 # cache after the client reconnects?
295 pgcache_empty || rc=2
299 run_test 18c "Dropped connect reply after eviction handing (14755)"
303 do_facet client mcreate $f || return 1
304 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
306 do_facet client checkstat -v -p 0777 $f || echo evicted
307 # let the client reconnect
309 do_facet client "munlink $f"
311 run_test 19a "test expired_lock_main on mds (2867)"
315 do_facet client multiop $f Ow || return 1
316 do_facet client multiop $f or || return 2
320 do_facet client multiop $f or || return 3
321 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
323 do_facet client munlink $f || return 4
325 run_test 19b "test expired_lock_main on ost (2867)"
327 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
329 multiop $DIR/$tdir/${tfile} O_wc &
333 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
334 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
335 kill -USR1 $MULTI_PID
338 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
340 run_test 20a "ldlm_handle_enqueue error (should return error)"
342 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
344 touch $DIR/$tdir/${tfile}
346 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
347 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
348 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
349 error "didn't fail open enqueue" || true
351 run_test 20b "ldlm_handle_enqueue error (should return error)"
354 mkdir -p $DIR/$tdir-1
355 mkdir -p $DIR/$tdir-2
356 multiop $DIR/$tdir-1/f O_c &
359 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
360 multiop $DIR/$tdir-2/f Oc &
363 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
365 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
366 kill -USR1 $close_pid
368 wait $close_pid || return 1
369 wait $open_pid || return 2
370 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
372 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
373 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
377 run_test 21a "drop close request while close and open are both in flight"
380 mkdir -p $DIR/$tdir-1
381 mkdir -p $DIR/$tdir-2
382 multiop $DIR/$tdir-1/f O_c &
385 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
386 mcreate $DIR/$tdir-2/f &
389 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
391 kill -USR1 $close_pid
393 wait $close_pid || return 1
394 wait $open_pid || return 3
396 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
397 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
400 run_test 21b "drop open request while close and open are both in flight"
403 mkdir -p $DIR/$tdir-1
404 mkdir -p $DIR/$tdir-2
405 multiop $DIR/$tdir-1/f O_c &
408 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
409 mcreate $DIR/$tdir-2/f &
412 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
414 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
415 kill -USR1 $close_pid
417 wait $close_pid || return 1
418 wait $open_pid || return 2
420 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
422 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
423 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
426 run_test 21c "drop both request while close and open are both in flight"
429 mkdir -p $DIR/$tdir-1
430 mkdir -p $DIR/$tdir-2
431 multiop $DIR/$tdir-1/f O_c &
434 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
435 multiop $DIR/$tdir-2/f Oc &
437 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
439 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
442 wait $pid || return 1
443 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
445 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
446 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
450 run_test 21d "drop close reply while close and open are both in flight"
453 mkdir -p $DIR/$tdir-1
454 mkdir -p $DIR/$tdir-2
455 multiop $DIR/$tdir-1/f O_c &
458 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
459 touch $DIR/$tdir-2/f &
461 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
465 wait $pid || return 1
468 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
469 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
472 run_test 21e "drop open reply while close and open are both in flight"
475 mkdir -p $DIR/$tdir-1
476 mkdir -p $DIR/$tdir-2
477 multiop $DIR/$tdir-1/f O_c &
480 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
481 touch $DIR/$tdir-2/f &
483 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
485 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
488 wait $pid || return 1
489 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
491 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
492 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
495 run_test 21f "drop both reply while close and open are both in flight"
498 mkdir -p $DIR/$tdir-1
499 mkdir -p $DIR/$tdir-2
500 multiop $DIR/$tdir-1/f O_c &
503 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
504 touch $DIR/$tdir-2/f &
506 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
508 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
511 wait $pid || return 1
512 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
514 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
515 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
518 run_test 21g "drop open reply and close request while close and open are both in flight"
521 mkdir -p $DIR/$tdir-1
522 mkdir -p $DIR/$tdir-2
523 multiop $DIR/$tdir-1/f O_c &
526 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
527 touch $DIR/$tdir-2/f &
530 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
532 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
535 wait $pid || return 1
536 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
538 wait $touch_pid || return 2
540 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
541 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
544 run_test 21h "drop open request and close reply while close and open are both in flight"
546 # bug 3462 - multiple MDC requests
551 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
556 multiop $f1 msu || return 1
559 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
561 wait $close_pid || return 2
562 rm -rf $f2 || return 4
564 run_test 22 "drop close request and do mknod"
567 multiop $DIR/$tfile O_c &
569 # give a chance for open
573 drop_request "kill -USR1 $pid"
576 wait $pid || return 1
579 run_test 23 "client hang when close a file after mds crash"
581 test_24() { # bug 2248 - eviction fails writeback but app doesn't see it
584 multiop $DIR/$tdir/$tfile Owy_wyc &
589 kill -USR1 $MULTI_PID
592 sysctl -w lustre.fail_loc=0x0
594 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
596 run_test 24 "fsync error (should return error)"
598 test_26() { # bug 5921 - evict dead exports by pinger
599 # this test can only run from a client on a separate node.
600 remote_ost || skip "local OST" && return
601 remote_mds || skip "local MDS" && return
602 OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports
603 OST_EXP="`do_facet ost1 cat $OST_FILE`"
604 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
605 echo starting with $OST_NEXP1 OST exports
606 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
607 do_facet client sysctl -w lustre.fail_loc=0x505
608 # evictor takes up to 2.25x to evict. But if there's a
609 # race to start the evictor from various obds, the loser
610 # might have to wait for the next ping.
611 echo Waiting for $(($TIMEOUT * 4)) secs
612 sleep $(($TIMEOUT * 4))
613 OST_EXP="`do_facet ost1 cat $OST_FILE`"
614 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
615 echo ending with $OST_NEXP2 OST exports
616 do_facet client sysctl -w lustre.fail_loc=0x0
617 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
620 run_test 26 "evict dead exports"
622 test_26b() { # bug 10140 - evict dead exports by pinger
624 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
625 sleep 1 # wait connections being established
626 MDS_FILE=$LPROC/mdt/${mds1_svc}/num_exports
627 MDS_NEXP1="`do_facet $SINGLEMDS cat $MDS_FILE | cut -d' ' -f2`"
628 OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports
629 OST_NEXP1="`do_facet ost1 cat $OST_FILE | cut -d' ' -f2`"
630 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
631 zconf_umount `hostname` $MOUNT2 -f
632 # evictor takes up to 2.25x to evict. But if there's a
633 # race to start the evictor from various obds, the loser
634 # might have to wait for the next ping.
635 echo Waiting for $(($TIMEOUT * 4)) secs
636 sleep $(($TIMEOUT * 4))
637 OST_NEXP2="`do_facet ost1 cat $OST_FILE | cut -d' ' -f2`"
638 MDS_NEXP2="`do_facet $SINGLEMDS cat $MDS_FILE | cut -d' ' -f2`"
639 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
640 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
641 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
644 run_test 26b "evict dead exports"
647 remote_mds && { skip "remote MDS" && return 0; }
649 writemany -q -a $DIR/$tdir/$tfile 0 5 &
653 facet_failover $SINGLEMDS
654 #define OBD_FAIL_OSC_SHUTDOWN 0x407
655 sysctl -w lustre.fail_loc=0x80000407
656 # need to wait for reconnect
657 echo -n waiting for fail_loc
658 while [ `sysctl -n lustre.fail_loc` -eq -2147482617 ]; do
662 facet_failover $SINGLEMDS
664 kill -USR1 $CLIENT_PID
668 run_test 27 "fail LOV while using OSC's"
670 test_28() { # bug 6086 - error adding new clients
671 do_facet client mcreate $MOUNT/$tfile || return 1
672 drop_bl_callback "chmod 0777 $MOUNT/$tfile" ||echo "evicted as expected"
673 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
674 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x8000012f"
675 # fail once (evicted), reconnect fail (fail_loc), ok
676 df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
678 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
680 run_test 28 "handle error adding new clients (bug 6086)"
684 # put a load of file creates/writes/deletes
685 writemany -q $DIR/$tdir/$tfile 0 5 &
687 echo writemany pid $CLIENT_PID
691 # wait for client to reconnect to MDS
696 # client process should see no problems even though MDS went down
698 kill -USR1 $CLIENT_PID
701 echo writemany returned $rc
702 #these may fail because of eviction due to slow AST response.
703 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
705 run_test 50 "failover MDS under load"
709 # put a load of file creates/writes/deletes
710 writemany -q $DIR/$tdir/$tfile 0 5 &
714 facet_failover $SINGLEMDS
715 # failover at various points during recovery
716 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
717 echo will failover at $SEQ
720 echo failover in $i sec
722 facet_failover $SINGLEMDS
724 # client process should see no problems even though MDS went down
725 # and recovery was interrupted
727 kill -USR1 $CLIENT_PID
730 echo writemany returned $rc
731 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
733 run_test 51 "failover MDS during recovery"
736 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
738 echo writemany pid $CLIENT_PID
743 wait $CLIENT_PID || rc=$?
744 # active client process should see an EIO for down OST
745 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
746 # but timing or failover setup may allow success
747 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
748 echo "writemany returned $rc"
756 [ $rc -ne 0 ] && { return $rc; }
757 # wait for client to reconnect to OST
761 [ $rc -ne 0 ] && { return $rc; }
768 run_test 52 "failover OST under load"
770 # test of open reconstruct
773 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
776 run_test 53 "touch: drop rep"
779 zconf_mount `hostname` $MOUNT2
783 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
786 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
787 [ x"$ERROR" == x ] || error "back in time occured"
789 run_test 54 "back in time"
791 # bug 11330 - liblustre application death during I/O locks up OST
793 remote_ost && { skip "remote OST" && return 0; }
797 # first dd should be finished quickly
798 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
801 echo "step1: testing ......"
803 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
805 if [ $count -gt 64 ]; then
806 error "dd should be finished!"
810 echo "(dd_pid=$DDPID, time=$count)successful"
812 #define OBD_FAIL_OST_DROP_REQ 0x21d
813 do_facet ost sysctl -w lustre.fail_loc=0x0000021d
814 # second dd will be never finished
815 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
818 echo "step2: testing ......"
819 while [ $count -le 64 ]; do
820 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
821 if [ -z $dd_name ]; then
823 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
824 error "dd shouldn't be finished!"
829 echo "(dd_pid=$DDPID, time=$count)successful"
831 #Recover fail_loc and dd will finish soon
832 do_facet ost sysctl -w lustre.fail_loc=0
834 echo "step3: testing ......"
836 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
838 if [ $count -gt 500 ]; then
839 error "dd should be finished!"
843 echo "(dd_pid=$DDPID, time=$count)successful"
847 run_test 55 "ost_brw_read/write drops timed-out read/write request"
849 test_56() { # b=11277
850 #define OBD_FAIL_MDS_RESEND 0x136
852 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000136"
854 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
857 run_test 56 "do not allow reconnect to busy exports"
860 # no oscs means no client or mdt
861 while [ -e $LPROC/osc ]; do
862 for f in `find $LPROC -type f`; do
863 cat $f > /dev/null 2>&1
868 test_57() { # bug 10866
872 #define OBD_FAIL_LPROC_REMOVE 0xB00
873 sysctl -w lustre.fail_loc=0x80000B00
874 zconf_umount `hostname` $DIR
875 sysctl -w lustre.fail_loc=0x80000B00
876 fail_abort $SINGLEMDS
878 sysctl -w lustre.fail_loc=0
880 do_facet client "df $DIR"
882 run_test 57 "read procfs entries causes kernel crash"
884 test_58() { # bug 11546
885 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
888 sysctl -w lustre.fail_loc=0x80000801
889 cp $MOUNT/$tfile /dev/null &
892 sysctl -w lustre.fail_loc=0
893 drop_bl_callback rm -f $MOUNT/$tfile
895 do_facet client "df $DIR"
897 run_test 58 "Eviction in the middle of open RPC reply processing"
899 test_59() { # bug 10589
900 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
901 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
902 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
903 sysctl -w lustre.fail_loc=0x311
904 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
905 [ $? = 0 ] || error "dd write failed"
906 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
907 sysctl -w lustre.fail_loc=0
909 zconf_umount `hostname` $MOUNT2 -f
910 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
911 [ $? = 0 ] || error "dd read failed"
912 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
913 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
915 run_test 59 "Read cancel race on client eviction"
917 equals_msg `basename $0`: test complete, cleaning up
918 check_and_cleanup_lustre
919 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true