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=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
171 lctl set_param -n llite.*.max_read_ahead_mb 0
175 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
179 do_facet client cp /etc/termcap $MOUNT
183 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
184 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000504"
186 # OST bulk will time out here, client resends
187 do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 1
188 do_facet ost1 sysctl -w lustre.fail_loc=0
189 # give recovery a chance to finish (shouldn't take long)
191 do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 2
194 run_test 16 "timeout bulk put, don't evict client (2732)"
197 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
198 # OST bulk will time out here, client retries
199 do_facet ost1 sysctl -w lustre.fail_loc=0x80000503
200 # need to ensure we send an RPC
201 do_facet client cp /etc/termcap $DIR/$tfile
205 do_facet ost1 sysctl -w lustre.fail_loc=0
206 do_facet client "df $DIR"
207 # expect cmp to succeed, client resent bulk
208 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
209 do_facet client "rm $DIR/$tfile" || return 4
212 run_test 17 "timeout bulk get, don't evict client (2732)"
215 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
217 do_facet client mkdir -p $MOUNT/$tdir
218 f=$MOUNT/$tdir/$tfile
221 pgcache_empty || return 1
224 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
226 do_facet client cp $SAMPLE_FILE $f
228 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
229 $LCTL --device $osc2dev deactivate || return 3
230 # my understanding is that there should be nothing in the page
231 # cache after the client reconnects?
233 pgcache_empty || rc=2
234 $LCTL --device $osc2dev activate
238 run_test 18a "manual ost invalidate clears page cache immediately"
241 do_facet client mkdir -p $MOUNT/$tdir
242 f=$MOUNT/$tdir/$tfile
243 f2=$MOUNT/$tdir/${tfile}-2
246 pgcache_empty || return 1
248 # shouldn't have to set stripe size of count==1
249 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
250 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
252 do_facet client cp $SAMPLE_FILE $f
255 # allow recovery to complete
256 sleep $((TIMEOUT + 2))
257 # my understanding is that there should be nothing in the page
258 # cache after the client reconnects?
260 pgcache_empty || rc=2
264 run_test 18b "eviction and reconnect clears page cache (2766)"
267 do_facet client mkdir -p $MOUNT/$tdir
268 f=$MOUNT/$tdir/$tfile
269 f2=$MOUNT/$tdir/${tfile}-2
272 pgcache_empty || return 1
274 # shouldn't have to set stripe size of count==1
275 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
276 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
278 do_facet client cp $SAMPLE_FILE $f
282 # OBD_FAIL_OST_CONNECT_NET2
283 # lost reply to connect request
284 do_facet ost1 sysctl -w lustre.fail_loc=0x80000225
286 df $MOUNT > /dev/null 2>&1
288 # my understanding is that there should be nothing in the page
289 # cache after the client reconnects?
291 pgcache_empty || rc=2
295 run_test 18c "Dropped connect reply after eviction handing (14755)"
299 do_facet client mcreate $f || return 1
300 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
302 do_facet client checkstat -v -p 0777 $f || echo evicted
303 # let the client reconnect
305 do_facet client "munlink $f"
307 run_test 19a "test expired_lock_main on mds (2867)"
311 do_facet client multiop $f Ow || return 1
312 do_facet client multiop $f or || return 2
316 do_facet client multiop $f or || return 3
317 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
319 do_facet client munlink $f || return 4
321 run_test 19b "test expired_lock_main on ost (2867)"
323 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
325 multiop $DIR/$tdir/${tfile} O_wc &
329 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
330 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
331 kill -USR1 $MULTI_PID
334 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
336 run_test 20a "ldlm_handle_enqueue error (should return error)"
338 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
340 touch $DIR/$tdir/${tfile}
342 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
343 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
344 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
345 error "didn't fail open enqueue" || true
347 run_test 20b "ldlm_handle_enqueue error (should return error)"
350 mkdir -p $DIR/$tdir-1
351 mkdir -p $DIR/$tdir-2
352 multiop $DIR/$tdir-1/f O_c &
355 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
356 multiop $DIR/$tdir-2/f Oc &
359 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
361 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
362 kill -USR1 $close_pid
364 wait $close_pid || return 1
365 wait $open_pid || return 2
366 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
368 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
369 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
373 run_test 21a "drop close request while close and open are both in flight"
376 mkdir -p $DIR/$tdir-1
377 mkdir -p $DIR/$tdir-2
378 multiop $DIR/$tdir-1/f O_c &
381 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
382 mcreate $DIR/$tdir-2/f &
385 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
387 kill -USR1 $close_pid
389 wait $close_pid || return 1
390 wait $open_pid || return 3
392 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
393 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
396 run_test 21b "drop open request while close and open are both in flight"
399 mkdir -p $DIR/$tdir-1
400 mkdir -p $DIR/$tdir-2
401 multiop $DIR/$tdir-1/f O_c &
404 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
405 mcreate $DIR/$tdir-2/f &
408 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
410 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
411 kill -USR1 $close_pid
413 wait $close_pid || return 1
414 wait $open_pid || return 2
416 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
418 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
419 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
422 run_test 21c "drop both request while close and open are both in flight"
425 mkdir -p $DIR/$tdir-1
426 mkdir -p $DIR/$tdir-2
427 multiop $DIR/$tdir-1/f O_c &
430 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
431 multiop $DIR/$tdir-2/f Oc &
433 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
435 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
438 wait $pid || return 1
439 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
441 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
442 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
446 run_test 21d "drop close reply while close and open are both in flight"
449 mkdir -p $DIR/$tdir-1
450 mkdir -p $DIR/$tdir-2
451 multiop $DIR/$tdir-1/f O_c &
454 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
455 touch $DIR/$tdir-2/f &
457 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
461 wait $pid || return 1
464 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
465 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
468 run_test 21e "drop open reply while close and open are both in flight"
471 mkdir -p $DIR/$tdir-1
472 mkdir -p $DIR/$tdir-2
473 multiop $DIR/$tdir-1/f O_c &
476 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
477 touch $DIR/$tdir-2/f &
479 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
481 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
484 wait $pid || return 1
485 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
487 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
488 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
491 run_test 21f "drop both reply while close and open are both in flight"
494 mkdir -p $DIR/$tdir-1
495 mkdir -p $DIR/$tdir-2
496 multiop $DIR/$tdir-1/f O_c &
499 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
500 touch $DIR/$tdir-2/f &
502 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
504 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
507 wait $pid || return 1
508 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
510 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
511 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
514 run_test 21g "drop open reply and close request while close and open are both in flight"
517 mkdir -p $DIR/$tdir-1
518 mkdir -p $DIR/$tdir-2
519 multiop $DIR/$tdir-1/f O_c &
522 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
523 touch $DIR/$tdir-2/f &
526 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
528 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
531 wait $pid || return 1
532 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
534 wait $touch_pid || return 2
536 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
537 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
540 run_test 21h "drop open request and close reply while close and open are both in flight"
542 # bug 3462 - multiple MDC requests
547 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
552 multiop $f1 msu || return 1
555 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
557 wait $close_pid || return 2
558 rm -rf $f2 || return 4
560 run_test 22 "drop close request and do mknod"
563 multiop $DIR/$tfile O_c &
565 # give a chance for open
569 drop_request "kill -USR1 $pid"
572 wait $pid || return 1
575 run_test 23 "client hang when close a file after mds crash"
577 test_24() { # bug 2248 - eviction fails writeback but app doesn't see it
580 multiop $DIR/$tdir/$tfile Owy_wyc &
585 kill -USR1 $MULTI_PID
588 sysctl -w lustre.fail_loc=0x0
590 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
592 run_test 24 "fsync error (should return error)"
594 test_26() { # bug 5921 - evict dead exports by pinger
595 # this test can only run from a client on a separate node.
596 remote_ost || skip "local OST" && return
597 remote_mds || skip "local MDS" && return
598 OST_FILE=obdfilter.${ost1_svc}.num_exports
599 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
600 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
601 echo starting with $OST_NEXP1 OST exports
602 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
603 do_facet client sysctl -w lustre.fail_loc=0x505
604 # evictor takes up to 2.25x to evict. But if there's a
605 # race to start the evictor from various obds, the loser
606 # might have to wait for the next ping.
607 echo Waiting for $(($TIMEOUT * 4)) secs
608 sleep $(($TIMEOUT * 4))
609 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
610 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
611 echo ending with $OST_NEXP2 OST exports
612 do_facet client sysctl -w lustre.fail_loc=0x0
613 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
616 run_test 26 "evict dead exports"
618 test_26b() { # bug 10140 - evict dead exports by pinger
620 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
621 sleep 1 # wait connections being established
622 MDS_FILE=mdt.${mds1_svc}.num_exports
623 MDS_NEXP1="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
624 OST_FILE=obdfilter.${ost1_svc}.num_exports
625 OST_NEXP1="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
626 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
627 zconf_umount `hostname` $MOUNT2 -f
628 # evictor takes up to 2.25x to evict. But if there's a
629 # race to start the evictor from various obds, the loser
630 # might have to wait for the next ping.
631 echo Waiting for $(($TIMEOUT * 4)) secs
632 sleep $(($TIMEOUT * 4))
633 OST_NEXP2="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
634 MDS_NEXP2="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
635 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
636 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
637 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
640 run_test 26b "evict dead exports"
643 remote_mds && { skip "remote MDS" && return 0; }
645 writemany -q -a $DIR/$tdir/$tfile 0 5 &
649 facet_failover $SINGLEMDS
650 #define OBD_FAIL_OSC_SHUTDOWN 0x407
651 sysctl -w lustre.fail_loc=0x80000407
652 # need to wait for reconnect
653 echo -n waiting for fail_loc
654 while [ `sysctl -n lustre.fail_loc` -eq -2147482617 ]; do
658 facet_failover $SINGLEMDS
660 kill -USR1 $CLIENT_PID
664 run_test 27 "fail LOV while using OSC's"
666 test_28() { # bug 6086 - error adding new clients
667 do_facet client mcreate $MOUNT/$tfile || return 1
668 drop_bl_callback "chmod 0777 $MOUNT/$tfile" ||echo "evicted as expected"
669 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
670 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x8000012f"
671 # fail once (evicted), reconnect fail (fail_loc), ok
672 df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
674 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
676 run_test 28 "handle error adding new clients (bug 6086)"
680 # put a load of file creates/writes/deletes
681 writemany -q $DIR/$tdir/$tfile 0 5 &
683 echo writemany pid $CLIENT_PID
687 # wait for client to reconnect to MDS
692 # client process should see no problems even though MDS went down
694 kill -USR1 $CLIENT_PID
697 echo writemany returned $rc
698 #these may fail because of eviction due to slow AST response.
699 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
701 run_test 50 "failover MDS under load"
705 # put a load of file creates/writes/deletes
706 writemany -q $DIR/$tdir/$tfile 0 5 &
710 facet_failover $SINGLEMDS
711 # failover at various points during recovery
712 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
713 echo will failover at $SEQ
716 echo failover in $i sec
718 facet_failover $SINGLEMDS
720 # client process should see no problems even though MDS went down
721 # and recovery was interrupted
723 kill -USR1 $CLIENT_PID
726 echo writemany returned $rc
727 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
729 run_test 51 "failover MDS during recovery"
732 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
734 echo writemany pid $CLIENT_PID
739 wait $CLIENT_PID || rc=$?
740 # active client process should see an EIO for down OST
741 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
742 # but timing or failover setup may allow success
743 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
744 echo "writemany returned $rc"
752 [ $rc -ne 0 ] && { return $rc; }
753 # wait for client to reconnect to OST
757 [ $rc -ne 0 ] && { return $rc; }
764 run_test 52 "failover OST under load"
766 # test of open reconstruct
769 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
772 run_test 53 "touch: drop rep"
775 zconf_mount `hostname` $MOUNT2
779 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
782 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
783 [ x"$ERROR" == x ] || error "back in time occured"
785 run_test 54 "back in time"
787 # bug 11330 - liblustre application death during I/O locks up OST
789 remote_ost && { skip "remote OST" && return 0; }
793 # first dd should be finished quickly
794 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
797 echo "step1: testing ......"
799 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
801 if [ $count -gt 64 ]; then
802 error "dd should be finished!"
806 echo "(dd_pid=$DDPID, time=$count)successful"
808 #define OBD_FAIL_OST_DROP_REQ 0x21d
809 do_facet ost sysctl -w lustre.fail_loc=0x0000021d
810 # second dd will be never finished
811 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
814 echo "step2: testing ......"
815 while [ $count -le 64 ]; do
816 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
817 if [ -z $dd_name ]; then
819 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
820 error "dd shouldn't be finished!"
825 echo "(dd_pid=$DDPID, time=$count)successful"
827 #Recover fail_loc and dd will finish soon
828 do_facet ost sysctl -w lustre.fail_loc=0
830 echo "step3: testing ......"
832 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
834 if [ $count -gt 500 ]; then
835 error "dd should be finished!"
839 echo "(dd_pid=$DDPID, time=$count)successful"
843 run_test 55 "ost_brw_read/write drops timed-out read/write request"
845 test_56() { # b=11277
846 #define OBD_FAIL_MDS_RESEND 0x136
848 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000136"
850 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
853 run_test 56 "do not allow reconnect to busy exports"
856 # no oscs means no client or mdt
857 while lctl get_param osc.*.* > /dev/null 2>&1; do
858 : # loop until proc file is removed
862 test_57() { # bug 10866
866 #define OBD_FAIL_LPROC_REMOVE 0xB00
867 sysctl -w lustre.fail_loc=0x80000B00
868 zconf_umount `hostname` $DIR
869 sysctl -w lustre.fail_loc=0x80000B00
870 fail_abort $SINGLEMDS
872 sysctl -w lustre.fail_loc=0
874 do_facet client "df $DIR"
876 run_test 57 "read procfs entries causes kernel crash"
878 test_58() { # bug 11546
879 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
882 sysctl -w lustre.fail_loc=0x80000801
883 cp $MOUNT/$tfile /dev/null &
886 sysctl -w lustre.fail_loc=0
887 drop_bl_callback rm -f $MOUNT/$tfile
889 do_facet client "df $DIR"
891 run_test 58 "Eviction in the middle of open RPC reply processing"
893 test_59() { # bug 10589
894 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
895 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
896 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
897 sysctl -w lustre.fail_loc=0x311
898 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
899 [ $? = 0 ] || error "dd write failed"
900 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
901 sysctl -w lustre.fail_loc=0
903 zconf_umount `hostname` $MOUNT2 -f
904 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
905 [ $? = 0 ] || error "dd read failed"
906 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
907 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
909 run_test 59 "Read cancel race on client eviction"
911 equals_msg `basename $0`: test complete, cleaning up
912 check_and_cleanup_lustre
913 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true