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
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_bg_pause $MOUNT/$tfile OS_c || return 1
130 #define OBD_FAIL_MDS_CLOSE_NET 0x115
132 echo "waiting for multiop $PID"
133 wait $PID || return 2
134 do_facet client munlink $MOUNT/$tfile || return 3
136 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
138 # Bug 113, check that readdir lost recv timeout works.
140 mkdir $MOUNT/readdir || return 1
141 touch $MOUNT/readdir/newentry || return
142 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
143 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000104"
144 ls $MOUNT/readdir || return 3
145 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
146 rm -rf $MOUNT/readdir || return 4
148 run_test 13 "mdc_readpage restart test (bug 1138)"
150 # Bug 113, check that readdir lost send timeout works.
153 touch $MOUNT/readdir/newentry
154 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
155 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000106"
156 ls $MOUNT/readdir || return 1
157 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
159 run_test 14 "mdc_readpage resend test (bug 1138)"
162 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000128"
163 touch $DIR/$tfile && return 1
166 run_test 15 "failed open (-ENOMEM)"
168 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
170 lctl set_param -n llite.*.max_read_ahead_mb 0
174 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
178 do_facet client cp /etc/termcap $MOUNT
182 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
183 do_facet ost1 "sysctl -w lustre.fail_loc=0x80000504"
185 # OST bulk will time out here, client resends
186 do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 1
187 do_facet ost1 sysctl -w lustre.fail_loc=0
188 # give recovery a chance to finish (shouldn't take long)
190 do_facet client "cmp /etc/termcap $MOUNT/termcap" || return 2
193 run_test 16 "timeout bulk put, don't evict client (2732)"
196 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
197 # OST bulk will time out here, client retries
198 do_facet ost1 sysctl -w lustre.fail_loc=0x80000503
199 # need to ensure we send an RPC
200 do_facet client cp /etc/termcap $DIR/$tfile
204 do_facet ost1 sysctl -w lustre.fail_loc=0
205 do_facet client "df $DIR"
206 # expect cmp to succeed, client resent bulk
207 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
208 do_facet client "rm $DIR/$tfile" || return 4
211 run_test 17 "timeout bulk get, don't evict client (2732)"
214 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
216 do_facet client mkdir -p $MOUNT/$tdir
217 f=$MOUNT/$tdir/$tfile
220 pgcache_empty || return 1
223 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
225 do_facet client cp $SAMPLE_FILE $f
227 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
228 $LCTL --device $osc2dev deactivate || return 3
229 # my understanding is that there should be nothing in the page
230 # cache after the client reconnects?
232 pgcache_empty || rc=2
233 $LCTL --device $osc2dev activate
237 run_test 18a "manual ost invalidate clears page cache immediately"
240 do_facet client mkdir -p $MOUNT/$tdir
241 f=$MOUNT/$tdir/$tfile
242 f2=$MOUNT/$tdir/${tfile}-2
245 pgcache_empty || return 1
247 # shouldn't have to set stripe size of count==1
248 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
249 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
251 do_facet client cp $SAMPLE_FILE $f
254 # allow recovery to complete
255 sleep $((TIMEOUT + 2))
256 # my understanding is that there should be nothing in the page
257 # cache after the client reconnects?
259 pgcache_empty || rc=2
263 run_test 18b "eviction and reconnect clears page cache (2766)"
266 do_facet client mkdir -p $MOUNT/$tdir
267 f=$MOUNT/$tdir/$tfile
268 f2=$MOUNT/$tdir/${tfile}-2
271 pgcache_empty || return 1
273 # shouldn't have to set stripe size of count==1
274 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
275 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
277 do_facet client cp $SAMPLE_FILE $f
281 # OBD_FAIL_OST_CONNECT_NET2
282 # lost reply to connect request
283 do_facet ost1 sysctl -w lustre.fail_loc=0x80000225
285 df $MOUNT > /dev/null 2>&1
287 # my understanding is that there should be nothing in the page
288 # cache after the client reconnects?
290 pgcache_empty || rc=2
294 run_test 18c "Dropped connect reply after eviction handing (14755)"
298 do_facet client mcreate $f || return 1
299 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
301 do_facet client checkstat -v -p 0777 $f || echo evicted
302 # let the client reconnect
304 do_facet client "munlink $f"
306 run_test 19a "test expired_lock_main on mds (2867)"
310 do_facet client multiop $f Ow || return 1
311 do_facet client multiop $f or || return 2
315 do_facet client multiop $f or || return 3
316 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
318 do_facet client munlink $f || return 4
320 run_test 19b "test expired_lock_main on ost (2867)"
322 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
324 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
325 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
328 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
329 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
330 kill -USR1 $MULTI_PID
333 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
335 run_test 20a "ldlm_handle_enqueue error (should return error)"
337 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
339 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
341 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
342 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
343 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
344 error "didn't fail open enqueue" || true
346 run_test 20b "ldlm_handle_enqueue error (should return error)"
349 mkdir -p $DIR/$tdir-1
350 mkdir -p $DIR/$tdir-2
351 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
354 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
355 multiop $DIR/$tdir-2/f Oc &
358 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
360 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
361 kill -USR1 $close_pid
363 wait $close_pid || return 1
364 wait $open_pid || return 2
365 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
367 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
368 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
372 run_test 21a "drop close request while close and open are both in flight"
375 mkdir -p $DIR/$tdir-1
376 mkdir -p $DIR/$tdir-2
377 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
380 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
381 mcreate $DIR/$tdir-2/f &
384 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
386 kill -USR1 $close_pid
388 wait $close_pid || return 1
389 wait $open_pid || return 3
391 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
392 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
395 run_test 21b "drop open request while close and open are both in flight"
398 mkdir -p $DIR/$tdir-1
399 mkdir -p $DIR/$tdir-2
400 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
403 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
404 mcreate $DIR/$tdir-2/f &
407 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
409 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
410 kill -USR1 $close_pid
412 wait $close_pid || return 1
413 wait $open_pid || return 2
415 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
417 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
418 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
421 run_test 21c "drop both request while close and open are both in flight"
424 mkdir -p $DIR/$tdir-1
425 mkdir -p $DIR/$tdir-2
426 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
429 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000129"
430 multiop $DIR/$tdir-2/f Oc &
432 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
434 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
437 wait $pid || return 1
438 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
440 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
441 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
445 run_test 21d "drop close reply while close and open are both in flight"
448 mkdir -p $DIR/$tdir-1
449 mkdir -p $DIR/$tdir-2
450 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
453 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
454 touch $DIR/$tdir-2/f &
456 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
460 wait $pid || return 1
463 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
464 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
467 run_test 21e "drop open reply while close and open are both in flight"
470 mkdir -p $DIR/$tdir-1
471 mkdir -p $DIR/$tdir-2
472 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
475 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
476 touch $DIR/$tdir-2/f &
478 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
480 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
483 wait $pid || return 1
484 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
486 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
487 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
490 run_test 21f "drop both reply while close and open are both in flight"
493 mkdir -p $DIR/$tdir-1
494 mkdir -p $DIR/$tdir-2
495 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
498 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000119"
499 touch $DIR/$tdir-2/f &
501 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
503 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
506 wait $pid || return 1
507 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
509 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
510 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
513 run_test 21g "drop open reply and close request while close and open are both in flight"
516 mkdir -p $DIR/$tdir-1
517 mkdir -p $DIR/$tdir-2
518 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
521 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000107"
522 touch $DIR/$tdir-2/f &
525 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
527 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000122"
530 wait $pid || return 1
531 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
533 wait $touch_pid || return 2
535 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
536 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
539 run_test 21h "drop open request and close reply while close and open are both in flight"
541 # bug 3462 - multiple MDC requests
546 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000115"
551 multiop $f1 msu || return 1
554 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
556 wait $close_pid || return 2
557 rm -rf $f2 || return 4
559 run_test 22 "drop close request and do mknod"
562 multiop_bg_pause $DIR/$tfile O_c || return 1
564 # give a chance for open
568 drop_request "kill -USR1 $pid"
571 wait $pid || return 1
574 run_test 23 "client hang when close a file after mds crash"
576 test_24() { # bug 2248 - eviction fails writeback but app doesn't see it
579 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
582 kill -USR1 $MULTI_PID
585 sysctl -w lustre.fail_loc=0x0
587 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
589 run_test 24 "fsync error (should return error)"
591 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
592 # this test can only run from a client on a separate node.
593 remote_ost || { skip "local OST" && return 0; }
594 remote_mds || { skip "local MDS" && return 0; }
595 OST_FILE=obdfilter.${ost1_svc}.num_exports
596 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
597 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
598 echo starting with $OST_NEXP1 OST exports
599 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
600 do_facet client sysctl -w lustre.fail_loc=0x505
601 # evictor takes up to 2.25x to evict. But if there's a
602 # race to start the evictor from various obds, the loser
603 # might have to wait for the next ping.
604 echo Waiting for $(($TIMEOUT * 4)) secs
605 sleep $(($TIMEOUT * 4))
606 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
607 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
608 echo ending with $OST_NEXP2 OST exports
609 do_facet client sysctl -w lustre.fail_loc=0x0
610 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
613 run_test 26a "evict dead exports"
615 test_26b() { # bug 10140 - evict dead exports by pinger
617 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
618 sleep 1 # wait connections being established
619 MDS_FILE=mdt.${mds1_svc}.num_exports
620 MDS_NEXP1="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
621 OST_FILE=obdfilter.${ost1_svc}.num_exports
622 OST_NEXP1="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
623 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
624 zconf_umount `hostname` $MOUNT2 -f
625 # evictor takes up to 2.25x to evict. But if there's a
626 # race to start the evictor from various obds, the loser
627 # might have to wait for the next ping.
628 echo Waiting for $(($TIMEOUT * 4)) secs
629 sleep $(($TIMEOUT * 4))
630 OST_NEXP2="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
631 MDS_NEXP2="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
632 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
633 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
634 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
637 run_test 26b "evict dead exports"
640 remote_mds && { skip "remote MDS" && return 0; }
642 writemany -q -a $DIR/$tdir/$tfile 0 5 &
646 facet_failover $SINGLEMDS
647 #define OBD_FAIL_OSC_SHUTDOWN 0x407
648 sysctl -w lustre.fail_loc=0x80000407
649 # need to wait for reconnect
650 echo -n waiting for fail_loc
651 while [ `sysctl -n lustre.fail_loc` -eq -2147482617 ]; do
655 facet_failover $SINGLEMDS
657 kill -USR1 $CLIENT_PID
661 run_test 27 "fail LOV while using OSC's"
663 test_28() { # bug 6086 - error adding new clients
664 do_facet client mcreate $MOUNT/$tfile || return 1
665 drop_bl_callback "chmod 0777 $MOUNT/$tfile" ||echo "evicted as expected"
666 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
667 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x8000012f"
668 # fail once (evicted), reconnect fail (fail_loc), ok
669 df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
671 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
673 run_test 28 "handle error adding new clients (bug 6086)"
677 # put a load of file creates/writes/deletes
678 writemany -q $DIR/$tdir/$tfile 0 5 &
680 echo writemany pid $CLIENT_PID
684 # wait for client to reconnect to MDS
689 # client process should see no problems even though MDS went down
691 kill -USR1 $CLIENT_PID
694 echo writemany returned $rc
695 #these may fail because of eviction due to slow AST response.
696 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
698 run_test 50 "failover MDS under load"
702 # put a load of file creates/writes/deletes
703 writemany -q $DIR/$tdir/$tfile 0 5 &
707 facet_failover $SINGLEMDS
708 # failover at various points during recovery
709 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
710 echo will failover at $SEQ
713 echo failover in $i sec
715 facet_failover $SINGLEMDS
717 # client process should see no problems even though MDS went down
718 # and recovery was interrupted
720 kill -USR1 $CLIENT_PID
723 echo writemany returned $rc
724 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
726 run_test 51 "failover MDS during recovery"
729 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
731 echo writemany pid $CLIENT_PID
736 wait $CLIENT_PID || rc=$?
737 # active client process should see an EIO for down OST
738 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
739 # but timing or failover setup may allow success
740 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
741 echo "writemany returned $rc"
749 [ $rc -ne 0 ] && { return $rc; }
750 # wait for client to reconnect to OST
754 [ $rc -ne 0 ] && { return $rc; }
761 run_test 52 "failover OST under load"
763 # test of open reconstruct
766 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
769 run_test 53 "touch: drop rep"
772 zconf_mount `hostname` $MOUNT2
776 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
779 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
780 [ x"$ERROR" == x ] || error "back in time occured"
782 run_test 54 "back in time"
784 # bug 11330 - liblustre application death during I/O locks up OST
786 remote_ost && { skip "remote OST" && return 0; }
790 # first dd should be finished quickly
791 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
794 echo "step1: testing ......"
796 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
798 if [ $count -gt 64 ]; then
799 error "dd should be finished!"
803 echo "(dd_pid=$DDPID, time=$count)successful"
805 #define OBD_FAIL_OST_DROP_REQ 0x21d
806 do_facet ost sysctl -w lustre.fail_loc=0x0000021d
807 # second dd will be never finished
808 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
811 echo "step2: testing ......"
812 while [ $count -le 64 ]; do
813 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
814 if [ -z $dd_name ]; then
816 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
817 error "dd shouldn't be finished!"
822 echo "(dd_pid=$DDPID, time=$count)successful"
824 #Recover fail_loc and dd will finish soon
825 do_facet ost sysctl -w lustre.fail_loc=0
827 echo "step3: testing ......"
829 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
831 if [ $count -gt 500 ]; then
832 error "dd should be finished!"
836 echo "(dd_pid=$DDPID, time=$count)successful"
840 run_test 55 "ost_brw_read/write drops timed-out read/write request"
842 test_56() { # b=11277
843 #define OBD_FAIL_MDS_RESEND 0x136
845 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0x80000136"
847 do_facet $SINGLEMDS "sysctl -w lustre.fail_loc=0"
850 run_test 56 "do not allow reconnect to busy exports"
853 # no oscs means no client or mdt
854 while lctl get_param osc.*.* > /dev/null 2>&1; do
855 : # loop until proc file is removed
859 test_57() { # bug 10866
863 #define OBD_FAIL_LPROC_REMOVE 0xB00
864 sysctl -w lustre.fail_loc=0x80000B00
865 zconf_umount `hostname` $DIR
866 sysctl -w lustre.fail_loc=0x80000B00
867 fail_abort $SINGLEMDS
869 sysctl -w lustre.fail_loc=0
871 do_facet client "df $DIR"
873 run_test 57 "read procfs entries causes kernel crash"
875 test_58() { # bug 11546
876 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
879 sysctl -w lustre.fail_loc=0x80000801
880 cp $MOUNT/$tfile /dev/null &
883 sysctl -w lustre.fail_loc=0
884 drop_bl_callback rm -f $MOUNT/$tfile
886 do_facet client "df $DIR"
888 run_test 58 "Eviction in the middle of open RPC reply processing"
890 test_59() { # bug 10589
891 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
892 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
893 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
894 sysctl -w lustre.fail_loc=0x311
895 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
896 [ $? = 0 ] || error "dd write failed"
897 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
898 sysctl -w lustre.fail_loc=0
900 zconf_umount `hostname` $MOUNT2 -f
901 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
902 [ $? = 0 ] || error "dd read failed"
903 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
904 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
906 run_test 59 "Read cancel race on client eviction"
908 equals_msg `basename $0`: test complete, cleaning up
909 check_and_cleanup_lustre
910 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true