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 if [ "$FAILURE_MODE" = "HARD" ] && mixed_ost_devs; then
15 CONFIG_EXCEPTIONS="52"
16 echo -n "Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. "
17 echo "Except the tests: $CONFIG_EXCEPTIONS"
18 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
21 # also long tests: 19, 21a, 21e, 21f, 23, 27
22 # 1 2.5 2.5 4 4 (min)"
23 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17 26a 26b 50 51 57"
27 # Allow us to override the setup if we already have a mounted system by
28 # setting SETUP=" " and CLEANUP=" "
30 CLEANUP=${CLEANUP:-""}
32 cleanup_and_setup_lustre
34 rm -rf $DIR/[df][0-9]*
37 drop_request "mcreate $DIR/f1" || return 1
38 drop_reint_reply "mcreate $DIR/f2" || return 2
40 run_test 1 "mcreate: drop req, drop rep"
43 drop_request "tchmod 111 $DIR/f2" || return 1
44 drop_reint_reply "tchmod 666 $DIR/f2" || return 2
46 run_test 2 "chmod: drop req, drop rep"
49 drop_request "statone $DIR/f2" || return 1
50 drop_reply "statone $DIR/f2" || return 2
52 run_test 3 "stat: drop req, drop rep"
54 SAMPLE_NAME=f0.recovery-small.junk
55 SAMPLE_FILE=$TMP/$SAMPLE_NAME
56 # make this big, else test 9 doesn't wait for bulk -- bz 5595
57 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
60 do_facet client "cp $SAMPLE_FILE $DIR/$SAMPLE_NAME" || return 1
61 drop_request "cat $DIR/$SAMPLE_NAME > /dev/null" || return 2
62 drop_reply "cat $DIR/$SAMPLE_NAME > /dev/null" || return 3
64 run_test 4 "open: drop req, drop rep"
66 RENAMED_AGAIN=$DIR/f0.renamed-again
69 drop_request "mv $DIR/$SAMPLE_NAME $DIR/$tfile-renamed" || return 1
70 drop_reint_reply "mv $DIR/$tfile-renamed $RENAMED_AGAIN" || return 2
71 do_facet client "checkstat -v $RENAMED_AGAIN" || return 3
73 run_test 5 "rename: drop req, drop rep"
75 [ ! -e $RENAMED_AGAIN ] && cp $SAMPLE_FILE $RENAMED_AGAIN
80 drop_request "mlink $RENAMED_AGAIN $LINK1" || return 1
81 drop_reint_reply "mlink $RENAMED_AGAIN $LINK2" || return 2
83 run_test 6 "link: drop req, drop rep"
85 [ ! -e $LINK1 ] && mlink $RENAMED_AGAIN $LINK1
86 [ ! -e $LINK2 ] && mlink $RENAMED_AGAIN $LINK2
88 drop_request "munlink $LINK1" || return 1
89 drop_reint_reply "munlink $LINK2" || return 2
91 run_test 7 "unlink: drop req, drop rep"
95 drop_reint_reply "touch $DIR/$tfile" || return 1
97 run_test 8 "touch: drop rep (bug 1423)"
101 pause_bulk "cp /etc/profile $DIR/$tfile" || return 1
102 do_facet client "cp $SAMPLE_FILE $DIR/${tfile}.2" || return 2
103 do_facet client "sync"
104 do_facet client "rm $DIR/$tfile $DIR/${tfile}.2" || return 3
106 run_test 9 "pause bulk on OST (bug 1420)"
110 do_facet client mcreate $DIR/$tfile || return 1
111 drop_bl_callback "chmod 0777 $DIR/$tfile" || echo "evicted as expected"
112 # wait for the mds to evict the client
113 #echo "sleep $(($TIMEOUT*2))"
114 #sleep $(($TIMEOUT*2))
115 do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
116 do_facet client checkstat -v -p 0777 $DIR/$tfile || return 3
117 do_facet client "munlink $DIR/$tfile"
119 run_test 10 "finish request on server after client eviction (bug 1521)"
122 # wake up a thread waiting for completion after eviction
124 do_facet client multiop $DIR/$tfile Ow || return 1
125 do_facet client multiop $DIR/$tfile or || return 2
129 do_facet client multiop $DIR/$tfile or || return 3
130 drop_bl_callback multiop $DIR/$tfile Ow || echo "evicted as expected"
132 do_facet client munlink $DIR/$tfile || return 4
134 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
138 $LCTL mark multiop $DIR/$tfile OS_c
139 do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
140 clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
141 multiop_bg_pause $DIR/$tfile OS_c || return 1
143 #define OBD_FAIL_MDS_CLOSE_NET 0x115
145 echo "waiting for multiop $PID"
146 wait $PID || return 2
147 do_facet client munlink $DIR/$tfile || return 3
149 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
151 # Bug 113, check that readdir lost recv timeout works.
153 mkdir -p $DIR/$tdir || return 1
154 touch $DIR/$tdir/newentry || return
155 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
156 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
157 ls $DIR/$tdir || return 3
158 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
159 rm -rf $DIR/$tdir || return 4
161 run_test 13 "mdc_readpage restart test (bug 1138)"
163 # Bug 113, check that readdir lost send timeout works.
166 touch $DIR/$tdir/newentry
167 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
168 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
169 ls $DIR/$tdir || return 1
170 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
172 run_test 14 "mdc_readpage resend test (bug 1138)"
175 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
176 touch $DIR/$tfile && return 1
179 run_test 15 "failed open (-ENOMEM)"
181 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
183 lctl set_param -n llite.*.max_read_ahead_mb 0
187 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
191 do_facet client cp $SAMPLE_FILE $DIR
195 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
196 do_facet ost1 "lctl set_param fail_loc=0x80000504"
198 # OST bulk will time out here, client resends
199 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 1
200 do_facet ost1 lctl set_param fail_loc=0
201 # give recovery a chance to finish (shouldn't take long)
203 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 2
206 run_test 16 "timeout bulk put, don't evict client (2732)"
211 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
212 if at_is_valid && at_is_enabled; then
213 at_max_saved=$(at_max_get ost1)
214 at_max_set $TIMEOUT ost1
217 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
218 # OST bulk will time out here, client retries
219 do_facet ost1 lctl set_param fail_loc=0x80000503
220 # need to ensure we send an RPC
221 do_facet client cp /etc/termcap $DIR/$tfile
224 # with AT, client will wait adaptive_max*factor+net_latency before
225 # expiring the req, hopefully timeout*2 is enough
226 sleep $(($TIMEOUT*2))
228 do_facet ost1 lctl set_param fail_loc=0
229 do_facet client "df $DIR"
230 # expect cmp to succeed, client resent bulk
231 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
232 do_facet client "rm $DIR/$tfile" || return 4
233 [ $at_max_saved -ne 0 ] && $(at_max_set $at_max_saved ost1)
236 run_test 17 "timeout bulk get, don't evict client (2732)"
239 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
241 do_facet client mkdir -p $DIR/$tdir
245 pgcache_empty || return 1
248 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
250 do_facet client cp $SAMPLE_FILE $f
252 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
253 $LCTL --device $osc2dev deactivate || return 3
254 # my understanding is that there should be nothing in the page
255 # cache after the client reconnects?
257 pgcache_empty || rc=2
258 $LCTL --device $osc2dev activate
262 run_test 18a "manual ost invalidate clears page cache immediately"
265 do_facet client mkdir -p $DIR/$tdir
267 f2=$DIR/$tdir/${tfile}-2
270 pgcache_empty || return 1
272 # shouldn't have to set stripe size of count==1
273 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
274 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
276 do_facet client cp $SAMPLE_FILE $f
279 # allow recovery to complete
280 sleep $((TIMEOUT + 2))
281 # my understanding is that there should be nothing in the page
282 # cache after the client reconnects?
284 pgcache_empty || rc=2
288 run_test 18b "eviction and reconnect clears page cache (2766)"
291 do_facet client mkdir -p $DIR/$tdir
293 f2=$DIR/$tdir/${tfile}-2
296 pgcache_empty || return 1
298 # shouldn't have to set stripe size of count==1
299 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
300 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
302 do_facet client cp $SAMPLE_FILE $f
306 # OBD_FAIL_OST_CONNECT_NET2
307 # lost reply to connect request
308 do_facet ost1 lctl set_param fail_loc=0x80000225
310 df $MOUNT > /dev/null 2>&1
312 # my understanding is that there should be nothing in the page
313 # cache after the client reconnects?
315 pgcache_empty || rc=2
319 run_test 18c "Dropped connect reply after eviction handing (14755)"
323 do_facet client mcreate $f || return 1
324 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
326 do_facet client checkstat -v -p 0777 $f || echo evicted
327 # let the client reconnect
329 do_facet client "munlink $f"
331 run_test 19a "test expired_lock_main on mds (2867)"
335 do_facet client multiop $f Ow || return 1
336 do_facet client multiop $f or || return 2
340 do_facet client multiop $f or || return 3
341 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
343 do_facet client munlink $f || return 4
345 run_test 19b "test expired_lock_main on ost (2867)"
347 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
349 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
350 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
353 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
354 do_facet ost1 lctl set_param fail_loc=0x80000308
355 kill -USR1 $MULTI_PID
358 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
360 run_test 20a "ldlm_handle_enqueue error (should return error)"
362 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
364 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
366 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
367 do_facet ost1 lctl set_param fail_loc=0x80000308
368 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
369 error "didn't fail open enqueue" || true
371 run_test 20b "ldlm_handle_enqueue error (should return error)"
374 mkdir -p $DIR/$tdir-1
375 mkdir -p $DIR/$tdir-2
376 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
379 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
380 multiop $DIR/$tdir-2/f Oc &
383 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
385 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
386 kill -USR1 $close_pid
388 wait $close_pid || return 1
389 wait $open_pid || return 2
390 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
392 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
393 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
397 run_test 21a "drop close request while close and open are both in flight"
400 mkdir -p $DIR/$tdir-1
401 mkdir -p $DIR/$tdir-2
402 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
405 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
406 mcreate $DIR/$tdir-2/f &
409 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
411 kill -USR1 $close_pid
413 wait $close_pid || return 1
414 wait $open_pid || return 3
416 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
417 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
420 run_test 21b "drop open request while close and open are both in flight"
423 mkdir -p $DIR/$tdir-1
424 mkdir -p $DIR/$tdir-2
425 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
428 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
429 mcreate $DIR/$tdir-2/f &
432 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
434 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
435 kill -USR1 $close_pid
437 wait $close_pid || return 1
438 wait $open_pid || return 2
440 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
442 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
443 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
446 run_test 21c "drop both request while close and open are both in flight"
449 mkdir -p $DIR/$tdir-1
450 mkdir -p $DIR/$tdir-2
451 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
454 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
455 multiop $DIR/$tdir-2/f Oc &
457 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
459 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
462 wait $pid || return 1
463 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
465 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
466 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
470 run_test 21d "drop close reply while close and open are both in flight"
473 mkdir -p $DIR/$tdir-1
474 mkdir -p $DIR/$tdir-2
475 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
478 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
479 touch $DIR/$tdir-2/f &
481 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
485 wait $pid || return 1
488 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
489 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
492 run_test 21e "drop open reply while close and open are both in flight"
495 mkdir -p $DIR/$tdir-1
496 mkdir -p $DIR/$tdir-2
497 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
500 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
501 touch $DIR/$tdir-2/f &
503 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
505 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
508 wait $pid || return 1
509 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
511 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
512 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
515 run_test 21f "drop both reply while close and open are both in flight"
518 mkdir -p $DIR/$tdir-1
519 mkdir -p $DIR/$tdir-2
520 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
523 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
524 touch $DIR/$tdir-2/f &
526 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
528 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
531 wait $pid || return 1
532 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
534 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
535 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
538 run_test 21g "drop open reply and close request while close and open are both in flight"
541 mkdir -p $DIR/$tdir-1
542 mkdir -p $DIR/$tdir-2
543 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
546 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
547 touch $DIR/$tdir-2/f &
550 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
552 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
555 wait $pid || return 1
556 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
558 wait $touch_pid || return 2
560 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
561 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
564 run_test 21h "drop open request and close reply while close and open are both in flight"
566 # bug 3462 - multiple MDC requests
571 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
576 multiop $f1 msu || return 1
579 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
581 wait $close_pid || return 2
582 rm -rf $f2 || return 4
584 run_test 22 "drop close request and do mknod"
587 multiop_bg_pause $DIR/$tfile O_c || return 1
589 # give a chance for open
593 drop_request "kill -USR1 $pid"
596 wait $pid || return 1
599 run_test 23 "client hang when close a file after mds crash"
601 test_24() { # bug 11710 details correct fsync() behavior
603 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
605 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
608 kill -USR1 $MULTI_PID
611 lctl set_param fail_loc=0x0
613 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
615 run_test 24 "fsync error (should return error)"
617 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
618 # this test can only run from a client on a separate node.
619 remote_ost || { skip "local OST" && return 0; }
620 remote_mds || { skip "local MDS" && return 0; }
621 OST_FILE=obdfilter.${ost1_svc}.num_exports
622 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
623 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
624 echo starting with $OST_NEXP1 OST exports
625 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
626 do_facet client lctl set_param fail_loc=0x505
627 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
628 # But if there's a race to start the evictor from various obds,
629 # the loser might have to wait for the next ping.
630 echo Waiting for $(($TIMEOUT * 8)) secs
631 sleep $(($TIMEOUT * 8))
632 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
633 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
634 echo ending with $OST_NEXP2 OST exports
635 do_facet client lctl set_param fail_loc=0x0
636 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
639 run_test 26a "evict dead exports"
641 test_26b() { # bug 10140 - evict dead exports by pinger
643 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
644 sleep 1 # wait connections being established
645 MDS_FILE=mdt.${mds1_svc}.num_exports
646 MDS_NEXP1="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
647 OST_FILE=obdfilter.${ost1_svc}.num_exports
648 OST_NEXP1="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
649 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
650 zconf_umount `hostname` $MOUNT2 -f
651 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
652 # But if there's a race to start the evictor from various obds,
653 # the loser might have to wait for the next ping.
654 echo Waiting for $(($TIMEOUT * 3)) secs
655 sleep $(($TIMEOUT * 3))
656 OST_NEXP2="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
657 MDS_NEXP2="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
658 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
659 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
660 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
663 run_test 26b "evict dead exports"
666 remote_mds && { skip "remote MDS" && return 0; }
668 writemany -q -a $DIR/$tdir/$tfile 0 5 &
672 facet_failover $SINGLEMDS
673 #define OBD_FAIL_OSC_SHUTDOWN 0x407
674 lctl set_param fail_loc=0x80000407
675 # need to wait for reconnect
676 echo -n waiting for fail_loc
677 while [ `lctl get_param -n fail_loc` -eq -2147482617 ]; do
681 facet_failover $SINGLEMDS
683 kill -USR1 $CLIENT_PID
687 run_test 27 "fail LOV while using OSC's"
689 test_28() { # bug 6086 - error adding new clients
690 do_facet client mcreate $DIR/$tfile || return 1
691 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
692 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
693 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
694 # fail once (evicted), reconnect fail (fail_loc), ok
695 df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
697 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
699 run_test 28 "handle error adding new clients (bug 6086)"
703 # put a load of file creates/writes/deletes
704 writemany -q $DIR/$tdir/$tfile 0 5 &
706 echo writemany pid $CLIENT_PID
710 # wait for client to reconnect to MDS
715 # client process should see no problems even though MDS went down
717 kill -USR1 $CLIENT_PID
720 echo writemany returned $rc
721 #these may fail because of eviction due to slow AST response.
722 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
724 run_test 50 "failover MDS under load"
728 # put a load of file creates/writes/deletes
729 writemany -q $DIR/$tdir/$tfile 0 5 &
733 facet_failover $SINGLEMDS
734 # failover at various points during recovery
735 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
736 echo will failover at $SEQ
739 echo failover in $i sec
741 facet_failover $SINGLEMDS
743 # client process should see no problems even though MDS went down
744 # and recovery was interrupted
746 kill -USR1 $CLIENT_PID
749 echo writemany returned $rc
750 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
752 run_test 51 "failover MDS during recovery"
755 do_facet client "mkdir -p $DIR/$tdir"
756 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
758 echo writemany pid $CLIENT_PID
763 wait $CLIENT_PID || rc=$?
764 # active client process should see an EIO for down OST
765 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
766 # but timing or failover setup may allow success
767 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
768 echo "writemany returned $rc"
776 [ $rc -ne 0 ] && { return $rc; }
777 # wait for client to reconnect to OST
781 [ $rc -ne 0 ] && { return $rc; }
788 run_test 52 "failover OST under load"
790 # test of open reconstruct
793 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
796 run_test 53 "touch: drop rep"
799 zconf_mount `hostname` $MOUNT2
803 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
806 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
807 [ x"$ERROR" == x ] || error "back in time occured"
809 run_test 54 "back in time"
811 # bug 11330 - liblustre application death during I/O locks up OST
813 remote_ost && { skip "remote OST" && return 0; }
817 # first dd should be finished quickly
818 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
821 echo "step1: testing ......"
823 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
825 if [ $count -gt 64 ]; then
826 error "dd should be finished!"
830 echo "(dd_pid=$DDPID, time=$count)successful"
832 #define OBD_FAIL_OST_DROP_REQ 0x21d
833 do_facet ost lctl set_param fail_loc=0x0000021d
834 # second dd will be never finished
835 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
838 echo "step2: testing ......"
839 while [ $count -le 64 ]; do
840 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
841 if [ -z $dd_name ]; then
843 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
844 error "dd shouldn't be finished!"
849 echo "(dd_pid=$DDPID, time=$count)successful"
851 #Recover fail_loc and dd will finish soon
852 do_facet ost lctl set_param fail_loc=0
854 echo "step3: testing ......"
856 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
858 if [ $count -gt 500 ]; then
859 error "dd should be finished!"
863 echo "(dd_pid=$DDPID, time=$count)successful"
867 run_test 55 "ost_brw_read/write drops timed-out read/write request"
869 test_56() { # b=11277
870 #define OBD_FAIL_MDS_RESEND 0x136
872 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
874 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
877 run_test 56 "do not allow reconnect to busy exports"
880 # no oscs means no client or mdt
881 while lctl get_param osc.*.* > /dev/null 2>&1; do
882 : # loop until proc file is removed
886 test_57() { # bug 10866
890 #define OBD_FAIL_LPROC_REMOVE 0xB00
891 lctl set_param fail_loc=0x80000B00
892 zconf_umount `hostname` $DIR
893 lctl set_param fail_loc=0x80000B00
894 fail_abort $SINGLEMDS
896 lctl set_param fail_loc=0
898 do_facet client "df $DIR"
900 run_test 57 "read procfs entries causes kernel crash"
902 test_58() { # bug 11546
903 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
906 lctl set_param fail_loc=0x80000801
907 cp $DIR/$tfile /dev/null &
910 lctl set_param fail_loc=0
911 drop_bl_callback rm -f $DIR/$tfile
913 do_facet client "df $DIR"
915 run_test 58 "Eviction in the middle of open RPC reply processing"
917 test_59() { # bug 10589
918 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
919 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
920 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
921 lctl set_param fail_loc=0x311
922 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
923 [ $? = 0 ] || error "dd write failed"
924 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
925 lctl set_param fail_loc=0
927 zconf_umount `hostname` $MOUNT2 -f
928 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
929 [ $? = 0 ] || error "dd read failed"
930 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
931 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
933 run_test 59 "Read cancel race on client eviction"
935 equals_msg `basename $0`: test complete, cleaning up
936 check_and_cleanup_lustre
937 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true