6 ALWAYS_EXCEPT="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 $MOUNT/1" || return 1
31 drop_reint_reply "mcreate $MOUNT/2" || return 2
33 run_test 1 "mcreate: drop req, drop rep"
36 drop_request "tchmod 111 $MOUNT/2" || return 1
37 drop_reint_reply "tchmod 666 $MOUNT/2" || return 2
39 run_test 2 "chmod: drop req, drop rep"
42 drop_request "statone $MOUNT/2" || return 1
43 drop_reply "statone $MOUNT/2" || return 2
45 run_test 3 "stat: drop req, drop rep"
47 SAMPLE_NAME=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 $MOUNT/$SAMPLE_NAME" || return 1
54 drop_request "cat $MOUNT/$SAMPLE_NAME > /dev/null" || return 2
55 drop_reply "cat $MOUNT/$SAMPLE_NAME > /dev/null" || return 3
57 run_test 4 "open: drop req, drop rep"
60 drop_request "mv $MOUNT/$SAMPLE_NAME $MOUNT/renamed" || return 1
61 drop_reint_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
62 do_facet client "checkstat -v $MOUNT/renamed-again" || return 3
64 run_test 5 "rename: drop req, drop rep"
66 [ ! -e $MOUNT/renamed-again ] && cp $SAMPLE_FILE $MOUNT/renamed-again
68 drop_request "mlink $MOUNT/renamed-again $MOUNT/link1" || return 1
69 drop_reint_reply "mlink $MOUNT/renamed-again $MOUNT/link2" || return 2
71 run_test 6 "link: drop req, drop rep"
73 [ ! -e $MOUNT/link1 ] && mlink $MOUNT/renamed-again $MOUNT/link1
74 [ ! -e $MOUNT/link2 ] && mlink $MOUNT/renamed-again $MOUNT/link2
76 drop_request "munlink $MOUNT/link1" || return 1
77 drop_reint_reply "munlink $MOUNT/link2" || return 2
79 run_test 7 "unlink: drop req, drop rep"
83 drop_reint_reply "touch $MOUNT/$tfile" || return 1
85 run_test 8 "touch: drop rep (bug 1423)"
87 SAMPLE_FILE=$TMP/recovery-small.junk
88 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
92 pause_bulk "cp /etc/profile $MOUNT/$tfile" || return 1
93 do_facet client "cp $SAMPLE_FILE $MOUNT/${tfile}.2" || return 2
94 do_facet client "sync"
95 do_facet client "rm $MOUNT/$tfile $MOUNT/${tfile}.2" || return 3
97 run_test 9 "pause bulk on OST (bug 1420)"
101 do_facet client mcreate $MOUNT/$tfile || return 1
102 drop_bl_callback "chmod 0777 $MOUNT/$tfile" || echo "evicted as expected"
103 # wait for the mds to evict the client
104 #echo "sleep $(($TIMEOUT*2))"
105 #sleep $(($TIMEOUT*2))
106 do_facet client touch $MOUNT/$tfile || echo "touch failed, evicted"
107 do_facet client checkstat -v -p 0777 $MOUNT/$tfile || return 3
108 do_facet client "munlink $MOUNT/$tfile"
110 run_test 10 "finish request on server after client eviction (bug 1521)"
113 # wake up a thread waiting for completion after eviction
115 do_facet client multiop $MOUNT/$tfile Ow || return 1
116 do_facet client multiop $MOUNT/$tfile or || return 2
120 do_facet client multiop $MOUNT/$tfile or || return 3
121 drop_bl_callback multiop $MOUNT/$tfile Ow || echo "evicted as expected"
123 do_facet client munlink $MOUNT/$tfile || return 4
125 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
129 $LCTL mark multiop $MOUNT/$tfile OS_c
130 do_facet mds "lctl set_param fail_loc=0x115"
131 clear_failloc mds $((TIMEOUT * 2)) &
132 multiop_bg_pause $MOUNT/$tfile OS_c || return 1
134 #define OBD_FAIL_MDS_CLOSE_NET 0x115
136 echo "waiting for multiop $PID"
137 wait $PID || return 2
138 do_facet client munlink $MOUNT/$tfile || return 3
140 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
142 # Bug 113, check that readdir lost recv timeout works.
144 mkdir $MOUNT/readdir || return 1
145 touch $MOUNT/readdir/newentry || return
146 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
147 do_facet mds "lctl set_param fail_loc=0x80000104"
148 ls $MOUNT/readdir || return 3
149 do_facet mds "lctl set_param fail_loc=0"
150 rm -rf $MOUNT/readdir || return 4
152 run_test 13 "mdc_readpage restart test (bug 1138)"
154 # Bug 113, check that readdir lost send timeout works.
157 touch $MOUNT/readdir/newentry
158 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
159 do_facet mds "lctl set_param fail_loc=0x80000106"
160 ls $MOUNT/readdir || return 1
161 do_facet mds "lctl set_param fail_loc=0"
163 run_test 14 "mdc_readpage resend test (bug 1138)"
166 do_facet mds "lctl set_param fail_loc=0x80000128"
167 touch $DIR/$tfile && return 1
170 run_test 15 "failed open (-ENOMEM)"
172 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
174 lctl set_param -n llite.*.max_read_ahead_mb 0
178 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
182 do_facet client cp $SAMPLE_FILE $MOUNT
186 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
187 do_facet ost1 lctl set_param fail_loc=0x80000504
189 # OST bulk will time out here, client resends
190 do_facet client "cmp $SAMPLE_FILE $MOUNT/${SAMPLE_FILE##*/}" || return 1
191 do_facet ost1 lctl set_param fail_loc=0
192 # give recovery a chance to finish (shouldn't take long)
194 do_facet client "cmp $SAMPLE_FILE $MOUNT/${SAMPLE_FILE##*/}" || return 2
197 run_test 16 "timeout bulk put, don't evict client (2732)"
202 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
203 if at_is_valid && at_is_enabled; then
204 at_max_saved=$(at_max_get ost1)
205 at_max_set $TIMEOUT ost1
208 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
209 # OST bulk will time out here, client retries
210 do_facet ost1 lctl set_param fail_loc=0x80000503
211 # need to ensure we send an RPC
212 do_facet client cp $SAMPLE_FILE $DIR/$tfile
215 # with AT, client will wait adaptive_max*factor+net_latency before
216 # expiring the req, hopefully timeout*2 is enough
217 sleep $(($TIMEOUT*2))
219 do_facet ost1 lctl set_param fail_loc=0
220 do_facet client "df $DIR"
221 # expect cmp to succeed, client resent bulk
222 do_facet client "cmp $SAMPLE_FILE $DIR/$tfile" || return 3
223 do_facet client "rm $DIR/$tfile" || return 4
224 [ $at_max_saved -ne 0 ] && $(at_max_set $at_max_saved ost1)
227 run_test 17 "timeout bulk get, don't evict client (2732)"
230 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
232 do_facet client mkdir -p $MOUNT/$tdir
233 f=$MOUNT/$tdir/$tfile
236 pgcache_empty || return 1
239 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
241 do_facet client cp $SAMPLE_FILE $f
243 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | awk '{print $1}'`
244 $LCTL --device $osc2dev deactivate || return 3
245 # my understanding is that there should be nothing in the page
246 # cache after the client reconnects?
248 pgcache_empty || rc=2
249 $LCTL --device $osc2dev activate
253 run_test 18a "manual ost invalidate clears page cache immediately"
256 do_facet client mkdir -p $MOUNT/$tdir
257 f=$MOUNT/$tdir/$tfile
258 f2=$MOUNT/$tdir/${tfile}-2
261 pgcache_empty || return 1
263 # shouldn't have to set stripe size of count==1
264 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
265 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
267 do_facet client cp $SAMPLE_FILE $f
272 df $MOUNT > /dev/null 2>&1
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 $MOUNT/$tdir
285 f=$MOUNT/$tdir/$tfile
286 f2=$MOUNT/$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 mds "lctl set_param fail_loc=0x80000129"
373 multiop $DIR/$tdir-2/f Oc &
376 do_facet mds "lctl set_param fail_loc=0"
378 do_facet mds "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 mds "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 mds "lctl set_param fail_loc=0x80000107"
399 mcreate $DIR/$tdir-2/f &
402 do_facet mds "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 mds "lctl set_param fail_loc=0x80000107"
422 mcreate $DIR/$tdir-2/f &
425 do_facet mds "lctl set_param fail_loc=0"
427 do_facet mds "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 mds "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 mds "lctl set_param fail_loc=0x80000129"
448 multiop $DIR/$tdir-2/f Oc &
450 do_facet mds "lctl set_param fail_loc=0"
452 do_facet mds "lctl set_param fail_loc=0x80000122"
455 wait $pid || return 1
456 do_facet mds "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 mds "lctl set_param fail_loc=0x80000119"
472 touch $DIR/$tdir-2/f &
474 do_facet mds "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 mds "lctl set_param fail_loc=0x80000119"
494 touch $DIR/$tdir-2/f &
496 do_facet mds "lctl set_param fail_loc=0"
498 do_facet mds "lctl set_param fail_loc=0x80000122"
501 wait $pid || return 1
502 do_facet mds "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 mds "lctl set_param fail_loc=0x80000119"
517 touch $DIR/$tdir-2/f &
519 do_facet mds "lctl set_param fail_loc=0"
521 do_facet mds "lctl set_param fail_loc=0x80000115"
524 wait $pid || return 1
525 do_facet mds "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 mds "lctl set_param fail_loc=0x80000107"
540 touch $DIR/$tdir-2/f &
543 do_facet mds "lctl set_param fail_loc=0"
545 do_facet mds "lctl set_param fail_loc=0x80000122"
548 wait $pid || return 1
549 do_facet mds "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 mds "lctl set_param fail_loc=0x80000115"
569 multiop $f1 msu || return 1
572 do_facet mds "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 2248 - eviction fails writeback but app doesn't see it
597 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
600 kill -USR1 $MULTI_PID
603 lctl set_param fail_loc=0x0
605 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
607 run_test 24 "fsync error (should return error)"
609 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
610 # this test can only run from a client on a separate node.
611 remote_ost || { skip "local OST" && return 0; }
612 remote_mds || { skip "local MDS" && return 0; }
613 OST_FILE=obdfilter.${ost1_svc}.num_exports
614 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
615 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
616 echo starting with $OST_NEXP1 OST exports
617 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
618 do_facet client lctl set_param fail_loc=0x505
619 # evictor takes up to 2.25x to evict. But if there's a
620 # race to start the evictor from various obds, the loser
621 # might have to wait for the next ping.
622 echo Waiting for $(($TIMEOUT * 4)) secs
623 sleep $(($TIMEOUT * 4))
624 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
625 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
626 echo ending with $OST_NEXP2 OST exports
627 do_facet client lctl set_param fail_loc=0x0
628 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
631 run_test 26a "evict dead exports"
633 test_26b() { # bug 10140 - evict dead exports by pinger
635 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
636 MDS_FILE=mds.${mds_svc}.num_exports
637 MDS_NEXP1="`do_facet mds lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
638 OST_FILE=obdfilter.${ost1_svc}.num_exports
639 OST_NEXP1="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
640 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
641 #force umount a client; exports should get evicted
642 zconf_umount `hostname` $MOUNT2 -f
643 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
644 # But if there's a race to start the evictor from various obds,
645 # the loser might have to wait for the next ping.
646 echo Waiting for $(($TIMEOUT * 3)) secs
647 sleep $(($TIMEOUT * 3))
648 OST_NEXP2="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
649 MDS_NEXP2="`do_facet mds lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
650 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
651 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
652 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
655 run_test 26b "evict dead exports"
658 remote_mds && { skip "remote MDS" && return 0; }
660 writemany -q -a $DIR/$tdir/$tfile 0 5 &
665 #define OBD_FAIL_OSC_SHUTDOWN 0x407
666 lctl set_param fail_loc=0x80000407
667 # need to wait for reconnect
668 echo -n waiting for fail_loc
669 while [ `lctl get_param -n fail_loc` -eq -2147482617 ]; do
675 kill -USR1 $CLIENT_PID
679 run_test 27 "fail LOV while using OSC's"
681 test_28() { # bug 6086 - error adding new clients
682 do_facet client mcreate $MOUNT/$tfile || return 1
683 drop_bl_callback "chmod 0777 $MOUNT/$tfile" ||echo "evicted as expected"
684 #define OBD_FAIL_MDS_ADD_CLIENT 0x12f
685 do_facet mds lctl set_param fail_loc=0x8000012f
686 # fail once (evicted), reconnect fail (fail_loc), ok
687 df || (sleep 1; df) || (sleep 1; df) || error "reconnect failed"
689 fail mds # verify MDS last_rcvd can be loaded
691 run_test 28 "handle error adding new clients (bug 6086)"
696 lctl set_param debug="-dlmtrace -ha"
697 # put a load of file creates/writes/deletes
698 writemany -q $DIR/$tdir/$tfile 0 5 &
700 echo writemany pid $CLIENT_PID
703 $LCTL mark "$TESTNAME fail mds 1"
705 # wait for client to reconnect to MDS
707 $LCTL mark "$TESTNAME fail mds 2"
710 $LCTL mark "$TESTNAME fail mds 3"
712 # client process should see no problems even though MDS went down
714 kill -USR1 $CLIENT_PID
717 echo writemany returned $rc
718 #these may fail because of eviction due to slow AST response.
720 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
722 run_test 50 "failover MDS under load"
726 # put a load of file creates/writes/deletes
727 writemany -q $DIR/$tdir/$tfile 0 5 &
732 # failover at various points during recovery
733 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
734 echo will failover at $SEQ
737 echo failover in $i sec
739 $LCTL mark "$TESTNAME fail mds $i"
742 # client process should see no problems even though MDS went down
743 # and recovery was interrupted
745 kill -USR1 $CLIENT_PID
748 echo writemany returned $rc
749 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
751 run_test 51 "failover MDS during recovery"
754 do_facet client "mkdir -p $DIR/$tdir"
755 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
757 echo writemany pid $CLIENT_PID
760 $LCTL mark "$TESTNAME fail ost $1"
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 mds lctl set_param fail_loc=0x80000136
874 do_facet mds 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
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 $MOUNT/$tfile /dev/null &
910 lctl set_param fail_loc=0
911 drop_bl_callback rm -f $MOUNT/$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 lctl set_param fail_loc=0x311
921 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
922 [ $? = 0 ] || error "dd write failed"
923 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
924 lctl set_param fail_loc=0
926 zconf_umount `hostname` $MOUNT2 -f
927 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
928 [ $? = 0 ] || error "dd read failed"
929 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
930 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
932 run_test 59 "Read cancel race on client eviction"
934 equals_msg `basename $0`: test complete, cleaning up
935 check_and_cleanup_lustre
936 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true