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
15 # 1 2.5 2.5 4 4 (min)"
16 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17 26a 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
27 rm -rf $DIR/[df][0-9]*
30 drop_request "mcreate $DIR/f1" || return 1
31 drop_reint_reply "mcreate $DIR/f2" || return 2
33 run_test 1 "mcreate: drop req, drop rep"
36 drop_request "tchmod 111 $DIR/f2" || return 1
37 drop_reint_reply "tchmod 666 $DIR/f2" || return 2
39 run_test 2 "chmod: drop req, drop rep"
42 drop_request "statone $DIR/f2" || return 1
43 drop_reply "statone $DIR/f2" || return 2
45 run_test 3 "stat: drop req, drop rep"
47 SAMPLE_NAME=f0.recovery-small.junk
48 SAMPLE_FILE=$TMP/$SAMPLE_NAME
49 # make this big, else test 9 doesn't wait for bulk -- bz 5595
50 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
53 do_facet client "cp $SAMPLE_FILE $DIR/$SAMPLE_NAME" || return 1
54 drop_request "cat $DIR/$SAMPLE_NAME > /dev/null" || return 2
55 drop_reply "cat $DIR/$SAMPLE_NAME > /dev/null" || return 3
57 run_test 4 "open: drop req, drop rep"
59 RENAMED_AGAIN=$DIR/f0.renamed-again
62 drop_request "mv $DIR/$SAMPLE_NAME $DIR/$tfile-renamed" || return 1
63 drop_reint_reply "mv $DIR/$tfile-renamed $RENAMED_AGAIN" || return 2
64 do_facet client "checkstat -v $RENAMED_AGAIN" || return 3
66 run_test 5 "rename: drop req, drop rep"
68 [ ! -e $RENAMED_AGAIN ] && cp $SAMPLE_FILE $RENAMED_AGAIN
73 drop_request "mlink $RENAMED_AGAIN $LINK1" || return 1
74 drop_reint_reply "mlink $RENAMED_AGAIN $LINK2" || return 2
76 run_test 6 "link: drop req, drop rep"
78 [ ! -e $LINK1 ] && mlink $RENAMED_AGAIN $LINK1
79 [ ! -e $LINK2 ] && mlink $RENAMED_AGAIN $LINK2
81 drop_request "munlink $LINK1" || return 1
82 drop_reint_reply "munlink $LINK2" || return 2
84 run_test 7 "unlink: drop req, drop rep"
88 drop_reint_reply "touch $DIR/$tfile" || return 1
90 run_test 8 "touch: drop rep (bug 1423)"
94 pause_bulk "cp /etc/profile $DIR/$tfile" || return 1
95 do_facet client "cp $SAMPLE_FILE $DIR/${tfile}.2" || return 2
96 do_facet client "sync"
97 do_facet client "rm $DIR/$tfile $DIR/${tfile}.2" || return 3
99 run_test 9 "pause bulk on OST (bug 1420)"
103 do_facet client mcreate $DIR/$tfile || return 1
104 drop_bl_callback "chmod 0777 $DIR/$tfile" || echo "evicted as expected"
105 # wait for the mds to evict the client
106 #echo "sleep $(($TIMEOUT*2))"
107 #sleep $(($TIMEOUT*2))
108 do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
109 do_facet client checkstat -v -p 0777 $DIR/$tfile || return 3
110 do_facet client "munlink $DIR/$tfile"
112 run_test 10 "finish request on server after client eviction (bug 1521)"
115 # wake up a thread waiting for completion after eviction
117 do_facet client multiop $DIR/$tfile Ow || return 1
118 do_facet client multiop $DIR/$tfile or || return 2
122 do_facet client multiop $DIR/$tfile or || return 3
123 drop_bl_callback multiop $DIR/$tfile Ow || echo "evicted as expected"
125 do_facet client munlink $DIR/$tfile || return 4
127 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
131 $LCTL mark multiop $DIR/$tfile OS_c
132 do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
133 clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
134 multiop_bg_pause $DIR/$tfile OS_c || return 1
136 #define OBD_FAIL_MDS_CLOSE_NET 0x115
138 echo "waiting for multiop $PID"
139 wait $PID || return 2
140 do_facet client munlink $DIR/$tfile || return 3
142 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
144 # Bug 113, check that readdir lost recv timeout works.
146 mkdir $DIR/readdir || return 1
147 touch $DIR/readdir/newentry || return
148 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
149 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
150 ls $DIR/readdir || return 3
151 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
152 rm -rf $DIR/readdir || return 4
154 run_test 13 "mdc_readpage restart test (bug 1138)"
156 # Bug 113, check that readdir lost send timeout works.
159 touch $DIR/readdir/newentry
160 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
161 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
162 ls $DIR/readdir || return 1
163 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
165 run_test 14 "mdc_readpage resend test (bug 1138)"
168 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
169 touch $DIR/$tfile && return 1
172 run_test 15 "failed open (-ENOMEM)"
174 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
176 lctl set_param -n llite.*.max_read_ahead_mb 0
180 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
184 do_facet client cp $SAMPLE_FILE $DIR
188 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
189 do_facet ost1 "lctl set_param fail_loc=0x80000504"
191 # OST bulk will time out here, client resends
192 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 1
193 do_facet ost1 lctl set_param fail_loc=0
194 # give recovery a chance to finish (shouldn't take long)
196 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 2
199 run_test 16 "timeout bulk put, don't evict client (2732)"
204 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
205 if at_is_valid && at_is_enabled; then
206 at_max_saved=$(at_max_get ost1)
207 at_max_set $TIMEOUT ost1
210 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
211 # OST bulk will time out here, client retries
212 do_facet ost1 lctl set_param fail_loc=0x80000503
213 # need to ensure we send an RPC
214 do_facet client cp /etc/termcap $DIR/$tfile
217 # with AT, client will wait adaptive_max*factor+net_latency before
218 # expiring the req, hopefully timeout*2 is enough
219 sleep $(($TIMEOUT*2))
221 do_facet ost1 lctl set_param fail_loc=0
222 do_facet client "df $DIR"
223 # expect cmp to succeed, client resent bulk
224 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
225 do_facet client "rm $DIR/$tfile" || return 4
226 [ $at_max_saved -ne 0 ] && $(at_max_set $at_max_saved ost1)
229 run_test 17 "timeout bulk get, don't evict client (2732)"
232 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
234 do_facet client mkdir -p $DIR/$tdir
238 pgcache_empty || return 1
241 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
243 do_facet client cp $SAMPLE_FILE $f
245 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
246 $LCTL --device $osc2dev deactivate || return 3
247 # my understanding is that there should be nothing in the page
248 # cache after the client reconnects?
250 pgcache_empty || rc=2
251 $LCTL --device $osc2dev activate
255 run_test 18a "manual ost invalidate clears page cache immediately"
258 do_facet client mkdir -p $DIR/$tdir
260 f2=$DIR/$tdir/${tfile}-2
263 pgcache_empty || return 1
265 # shouldn't have to set stripe size of count==1
266 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
267 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
269 do_facet client cp $SAMPLE_FILE $f
272 # allow recovery to complete
273 sleep $((TIMEOUT + 2))
274 # my understanding is that there should be nothing in the page
275 # cache after the client reconnects?
277 pgcache_empty || rc=2
281 run_test 18b "eviction and reconnect clears page cache (2766)"
284 do_facet client mkdir -p $DIR/$tdir
286 f2=$DIR/$tdir/${tfile}-2
289 pgcache_empty || return 1
291 # shouldn't have to set stripe size of count==1
292 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
293 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
295 do_facet client cp $SAMPLE_FILE $f
299 # OBD_FAIL_OST_CONNECT_NET2
300 # lost reply to connect request
301 do_facet ost1 lctl set_param fail_loc=0x80000225
303 df $MOUNT > /dev/null 2>&1
305 # my understanding is that there should be nothing in the page
306 # cache after the client reconnects?
308 pgcache_empty || rc=2
312 run_test 18c "Dropped connect reply after eviction handing (14755)"
316 do_facet client mcreate $f || return 1
317 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
319 do_facet client checkstat -v -p 0777 $f || echo evicted
320 # let the client reconnect
322 do_facet client "munlink $f"
324 run_test 19a "test expired_lock_main on mds (2867)"
328 do_facet client multiop $f Ow || return 1
329 do_facet client multiop $f or || return 2
333 do_facet client multiop $f or || return 3
334 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
336 do_facet client munlink $f || return 4
338 run_test 19b "test expired_lock_main on ost (2867)"
340 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
342 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
343 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
346 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
347 do_facet ost1 lctl set_param fail_loc=0x80000308
348 kill -USR1 $MULTI_PID
351 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
353 run_test 20a "ldlm_handle_enqueue error (should return error)"
355 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
357 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
359 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
360 do_facet ost1 lctl set_param fail_loc=0x80000308
361 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
362 error "didn't fail open enqueue" || true
364 run_test 20b "ldlm_handle_enqueue error (should return error)"
367 mkdir -p $DIR/$tdir-1
368 mkdir -p $DIR/$tdir-2
369 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
372 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
373 multiop $DIR/$tdir-2/f Oc &
376 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
378 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
379 kill -USR1 $close_pid
381 wait $close_pid || return 1
382 wait $open_pid || return 2
383 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
385 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
386 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
390 run_test 21a "drop close request while close and open are both in flight"
393 mkdir -p $DIR/$tdir-1
394 mkdir -p $DIR/$tdir-2
395 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
398 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
399 mcreate $DIR/$tdir-2/f &
402 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
404 kill -USR1 $close_pid
406 wait $close_pid || return 1
407 wait $open_pid || return 3
409 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
410 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
413 run_test 21b "drop open request while close and open are both in flight"
416 mkdir -p $DIR/$tdir-1
417 mkdir -p $DIR/$tdir-2
418 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
421 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
422 mcreate $DIR/$tdir-2/f &
425 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
427 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
428 kill -USR1 $close_pid
430 wait $close_pid || return 1
431 wait $open_pid || return 2
433 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
435 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
436 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
439 run_test 21c "drop both request while close and open are both in flight"
442 mkdir -p $DIR/$tdir-1
443 mkdir -p $DIR/$tdir-2
444 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
447 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
448 multiop $DIR/$tdir-2/f Oc &
450 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
452 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
455 wait $pid || return 1
456 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
458 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
459 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
463 run_test 21d "drop close reply while close and open are both in flight"
466 mkdir -p $DIR/$tdir-1
467 mkdir -p $DIR/$tdir-2
468 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
471 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
472 touch $DIR/$tdir-2/f &
474 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
478 wait $pid || return 1
481 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
482 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
485 run_test 21e "drop open reply while close and open are both in flight"
488 mkdir -p $DIR/$tdir-1
489 mkdir -p $DIR/$tdir-2
490 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
493 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
494 touch $DIR/$tdir-2/f &
496 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
498 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
501 wait $pid || return 1
502 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
504 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
505 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
508 run_test 21f "drop both reply while close and open are both in flight"
511 mkdir -p $DIR/$tdir-1
512 mkdir -p $DIR/$tdir-2
513 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
516 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
517 touch $DIR/$tdir-2/f &
519 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
521 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
524 wait $pid || return 1
525 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
527 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
528 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
531 run_test 21g "drop open reply and close request while close and open are both in flight"
534 mkdir -p $DIR/$tdir-1
535 mkdir -p $DIR/$tdir-2
536 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
539 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
540 touch $DIR/$tdir-2/f &
543 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
545 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
548 wait $pid || return 1
549 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
551 wait $touch_pid || return 2
553 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
554 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
557 run_test 21h "drop open request and close reply while close and open are both in flight"
559 # bug 3462 - multiple MDC requests
564 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
569 multiop $f1 msu || return 1
572 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
574 wait $close_pid || return 2
575 rm -rf $f2 || return 4
577 run_test 22 "drop close request and do mknod"
580 multiop_bg_pause $DIR/$tfile O_c || return 1
582 # give a chance for open
586 drop_request "kill -USR1 $pid"
589 wait $pid || return 1
592 run_test 23 "client hang when close a file after mds crash"
594 test_24() { # bug 11710 details correct fsync() behavior
596 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
598 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
601 kill -USR1 $MULTI_PID
604 lctl set_param fail_loc=0x0
606 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
608 run_test 24 "fsync error (should return error)"
610 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
611 # this test can only run from a client on a separate node.
612 remote_ost || { skip "local OST" && return 0; }
613 remote_mds || { skip "local MDS" && return 0; }
614 OST_FILE=obdfilter.${ost1_svc}.num_exports
615 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
616 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
617 echo starting with $OST_NEXP1 OST exports
618 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
619 do_facet client lctl set_param fail_loc=0x505
620 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
621 # But if there's a race to start the evictor from various obds,
622 # the loser might have to wait for the next ping.
623 echo Waiting for $(($TIMEOUT * 8)) secs
624 sleep $(($TIMEOUT * 8))
625 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
626 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
627 echo ending with $OST_NEXP2 OST exports
628 do_facet client lctl set_param fail_loc=0x0
629 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
632 run_test 26a "evict dead exports"
634 test_26b() { # bug 10140 - evict dead exports by pinger
636 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
637 sleep 1 # wait connections being established
638 MDS_FILE=mdt.${mds1_svc}.num_exports
639 MDS_NEXP1="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
640 OST_FILE=obdfilter.${ost1_svc}.num_exports
641 OST_NEXP1="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
642 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
643 zconf_umount `hostname` $MOUNT2 -f
644 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
645 # But if there's a race to start the evictor from various obds,
646 # the loser might have to wait for the next ping.
647 echo Waiting for $(($TIMEOUT * 3)) secs
648 sleep $(($TIMEOUT * 3))
649 OST_NEXP2="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
650 MDS_NEXP2="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
651 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
652 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
653 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
656 run_test 26b "evict dead exports"
659 remote_mds && { skip "remote MDS" && return 0; }
661 writemany -q -a $DIR/$tdir/$tfile 0 5 &
665 facet_failover $SINGLEMDS
666 #define OBD_FAIL_OSC_SHUTDOWN 0x407
667 lctl set_param fail_loc=0x80000407
668 # need to wait for reconnect
669 echo -n waiting for fail_loc
670 while [ `lctl get_param -n fail_loc` -eq -2147482617 ]; do
674 facet_failover $SINGLEMDS
676 kill -USR1 $CLIENT_PID
680 run_test 27 "fail LOV while using OSC's"
682 test_28() { # bug 6086 - error adding new clients
683 do_facet client mcreate $DIR/$tfile || return 1
684 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
685 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
686 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
687 # fail once (evicted), reconnect fail (fail_loc), ok
688 df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
690 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
692 run_test 28 "handle error adding new clients (bug 6086)"
696 # put a load of file creates/writes/deletes
697 writemany -q $DIR/$tdir/$tfile 0 5 &
699 echo writemany pid $CLIENT_PID
703 # wait for client to reconnect to MDS
708 # client process should see no problems even though MDS went down
710 kill -USR1 $CLIENT_PID
713 echo writemany returned $rc
714 #these may fail because of eviction due to slow AST response.
715 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
717 run_test 50 "failover MDS under load"
721 # put a load of file creates/writes/deletes
722 writemany -q $DIR/$tdir/$tfile 0 5 &
726 facet_failover $SINGLEMDS
727 # failover at various points during recovery
728 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
729 echo will failover at $SEQ
732 echo failover in $i sec
734 facet_failover $SINGLEMDS
736 # client process should see no problems even though MDS went down
737 # and recovery was interrupted
739 kill -USR1 $CLIENT_PID
742 echo writemany returned $rc
743 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
745 run_test 51 "failover MDS during recovery"
748 do_facet client "mkdir -p $DIR/$tdir"
749 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
751 echo writemany pid $CLIENT_PID
756 wait $CLIENT_PID || rc=$?
757 # active client process should see an EIO for down OST
758 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
759 # but timing or failover setup may allow success
760 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
761 echo "writemany returned $rc"
769 [ $rc -ne 0 ] && { return $rc; }
770 # wait for client to reconnect to OST
774 [ $rc -ne 0 ] && { return $rc; }
781 run_test 52 "failover OST under load"
783 # test of open reconstruct
786 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
789 run_test 53 "touch: drop rep"
792 zconf_mount `hostname` $MOUNT2
796 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
799 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
800 [ x"$ERROR" == x ] || error "back in time occured"
802 run_test 54 "back in time"
804 # bug 11330 - liblustre application death during I/O locks up OST
806 remote_ost && { skip "remote OST" && return 0; }
810 # first dd should be finished quickly
811 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
814 echo "step1: testing ......"
816 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
818 if [ $count -gt 64 ]; then
819 error "dd should be finished!"
823 echo "(dd_pid=$DDPID, time=$count)successful"
825 #define OBD_FAIL_OST_DROP_REQ 0x21d
826 do_facet ost lctl set_param fail_loc=0x0000021d
827 # second dd will be never finished
828 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
831 echo "step2: testing ......"
832 while [ $count -le 64 ]; do
833 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
834 if [ -z $dd_name ]; then
836 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
837 error "dd shouldn't be finished!"
842 echo "(dd_pid=$DDPID, time=$count)successful"
844 #Recover fail_loc and dd will finish soon
845 do_facet ost lctl set_param fail_loc=0
847 echo "step3: testing ......"
849 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
851 if [ $count -gt 500 ]; then
852 error "dd should be finished!"
856 echo "(dd_pid=$DDPID, time=$count)successful"
860 run_test 55 "ost_brw_read/write drops timed-out read/write request"
862 test_56() { # b=11277
863 #define OBD_FAIL_MDS_RESEND 0x136
865 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
867 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
870 run_test 56 "do not allow reconnect to busy exports"
873 # no oscs means no client or mdt
874 while lctl get_param osc.*.* > /dev/null 2>&1; do
875 : # loop until proc file is removed
879 test_57() { # bug 10866
883 #define OBD_FAIL_LPROC_REMOVE 0xB00
884 lctl set_param fail_loc=0x80000B00
885 zconf_umount `hostname` $DIR
886 lctl set_param fail_loc=0x80000B00
887 fail_abort $SINGLEMDS
889 lctl set_param fail_loc=0
891 do_facet client "df $DIR"
893 run_test 57 "read procfs entries causes kernel crash"
895 test_58() { # bug 11546
896 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
899 lctl set_param fail_loc=0x80000801
900 cp $DIR/$tfile /dev/null &
903 lctl set_param fail_loc=0
904 drop_bl_callback rm -f $DIR/$tfile
906 do_facet client "df $DIR"
908 run_test 58 "Eviction in the middle of open RPC reply processing"
910 test_59() { # bug 10589
911 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
912 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
913 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
914 lctl set_param fail_loc=0x311
915 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
916 [ $? = 0 ] || error "dd write failed"
917 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
918 lctl set_param fail_loc=0
920 zconf_umount `hostname` $MOUNT2 -f
921 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
922 [ $? = 0 ] || error "dd read failed"
923 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
924 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
926 run_test 59 "Read cancel race on client eviction"
928 equals_msg `basename $0`: test complete, cleaning up
929 check_and_cleanup_lustre
930 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true