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 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
23 # also long tests: 19, 21a, 21e, 21f, 23, 27
24 # 1 2.5 2.5 4 4 (min)"
25 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17 26a 26b 50 51 57"
29 # Allow us to override the setup if we already have a mounted system by
30 # setting SETUP=" " and CLEANUP=" "
32 CLEANUP=${CLEANUP:-""}
34 check_and_setup_lustre
37 rm -rf $DIR/[df][0-9]*
40 drop_request "mcreate $DIR/f1" || return 1
41 drop_reint_reply "mcreate $DIR/f2" || return 2
43 run_test 1 "mcreate: drop req, drop rep"
46 drop_request "tchmod 111 $DIR/f2" || return 1
47 drop_reint_reply "tchmod 666 $DIR/f2" || return 2
49 run_test 2 "chmod: drop req, drop rep"
52 drop_request "statone $DIR/f2" || return 1
53 drop_reply "statone $DIR/f2" || return 2
55 run_test 3 "stat: drop req, drop rep"
57 SAMPLE_NAME=f0.recovery-small.junk
58 SAMPLE_FILE=$TMP/$SAMPLE_NAME
59 # make this big, else test 9 doesn't wait for bulk -- bz 5595
60 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
63 do_facet client "cp $SAMPLE_FILE $DIR/$SAMPLE_NAME" || return 1
64 drop_request "cat $DIR/$SAMPLE_NAME > /dev/null" || return 2
65 drop_reply "cat $DIR/$SAMPLE_NAME > /dev/null" || return 3
67 run_test 4 "open: drop req, drop rep"
69 RENAMED_AGAIN=$DIR/f0.renamed-again
72 drop_request "mv $DIR/$SAMPLE_NAME $DIR/$tfile-renamed" || return 1
73 drop_reint_reply "mv $DIR/$tfile-renamed $RENAMED_AGAIN" || return 2
74 do_facet client "checkstat -v $RENAMED_AGAIN" || return 3
76 run_test 5 "rename: drop req, drop rep"
78 [ ! -e $RENAMED_AGAIN ] && cp $SAMPLE_FILE $RENAMED_AGAIN
83 drop_request "mlink $RENAMED_AGAIN $LINK1" || return 1
84 drop_reint_reply "mlink $RENAMED_AGAIN $LINK2" || return 2
86 run_test 6 "link: drop req, drop rep"
88 [ ! -e $LINK1 ] && mlink $RENAMED_AGAIN $LINK1
89 [ ! -e $LINK2 ] && mlink $RENAMED_AGAIN $LINK2
91 drop_request "munlink $LINK1" || return 1
92 drop_reint_reply "munlink $LINK2" || return 2
94 run_test 7 "unlink: drop req, drop rep"
98 drop_reint_reply "touch $DIR/$tfile" || return 1
100 run_test 8 "touch: drop rep (bug 1423)"
104 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
106 pause_bulk "cp /etc/profile $DIR/$tfile" || return 1
107 do_facet client "cp $SAMPLE_FILE $DIR/${tfile}.2" || return 2
108 do_facet client "sync"
109 do_facet client "rm $DIR/$tfile $DIR/${tfile}.2" || return 3
111 run_test 9 "pause bulk on OST (bug 1420)"
115 do_facet client mcreate $DIR/$tfile || return 1
116 drop_bl_callback "chmod 0777 $DIR/$tfile" || echo "evicted as expected"
117 # wait for the mds to evict the client
118 #echo "sleep $(($TIMEOUT*2))"
119 #sleep $(($TIMEOUT*2))
120 do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
121 do_facet client checkstat -v -p 0777 $DIR/$tfile || return 3
122 do_facet client "munlink $DIR/$tfile"
124 run_test 10 "finish request on server after client eviction (bug 1521)"
127 # wake up a thread waiting for completion after eviction
129 do_facet client multiop $DIR/$tfile Ow || return 1
130 do_facet client multiop $DIR/$tfile or || return 2
134 do_facet client multiop $DIR/$tfile or || return 3
135 drop_bl_callback multiop $DIR/$tfile Ow || echo "evicted as expected"
137 do_facet client munlink $DIR/$tfile || return 4
139 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
143 $LCTL mark multiop $DIR/$tfile OS_c
144 do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
145 clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
146 multiop_bg_pause $DIR/$tfile OS_c || return 1
148 #define OBD_FAIL_MDS_CLOSE_NET 0x115
150 echo "waiting for multiop $PID"
151 wait $PID || return 2
152 do_facet client munlink $DIR/$tfile || return 3
154 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
156 # Bug 113, check that readdir lost recv timeout works.
158 mkdir -p $DIR/$tdir || return 1
159 touch $DIR/$tdir/newentry || return
160 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
161 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
162 ls $DIR/$tdir || return 3
163 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
164 rm -rf $DIR/$tdir || return 4
166 run_test 13 "mdc_readpage restart test (bug 1138)"
168 # Bug 113, check that readdir lost send timeout works.
171 touch $DIR/$tdir/newentry
172 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
173 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
174 ls $DIR/$tdir || return 1
175 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
177 run_test 14 "mdc_readpage resend test (bug 1138)"
180 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
181 touch $DIR/$tfile && return 1
184 run_test 15 "failed open (-ENOMEM)"
186 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
188 lctl set_param -n llite.*.max_read_ahead_mb 0
192 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
196 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
198 do_facet client cp $SAMPLE_FILE $DIR
202 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
203 do_facet ost1 "lctl set_param fail_loc=0x80000504"
205 # OST bulk will time out here, client resends
206 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 1
207 do_facet ost1 lctl set_param fail_loc=0
208 # give recovery a chance to finish (shouldn't take long)
210 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 2
213 run_test 16 "timeout bulk put, don't evict client (2732)"
218 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
220 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
221 if at_is_valid && at_is_enabled; then
222 at_max_saved=$(at_max_get ost1)
223 at_max_set $TIMEOUT ost1
226 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
227 # OST bulk will time out here, client retries
228 do_facet ost1 lctl set_param fail_loc=0x80000503
229 # need to ensure we send an RPC
230 do_facet client cp /etc/termcap $DIR/$tfile
233 # with AT, client will wait adaptive_max*factor+net_latency before
234 # expiring the req, hopefully timeout*2 is enough
235 sleep $(($TIMEOUT*2))
237 do_facet ost1 lctl set_param fail_loc=0
238 do_facet client "df $DIR"
239 # expect cmp to succeed, client resent bulk
240 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
241 do_facet client "rm $DIR/$tfile" || return 4
242 [ $at_max_saved -ne 0 ] && $(at_max_set $at_max_saved ost1)
245 run_test 17 "timeout bulk get, don't evict client (2732)"
248 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
250 do_facet client mkdir -p $DIR/$tdir
254 pgcache_empty || return 1
257 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
259 do_facet client cp $SAMPLE_FILE $f
261 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
262 $LCTL --device $osc2dev deactivate || return 3
263 # my understanding is that there should be nothing in the page
264 # cache after the client reconnects?
266 pgcache_empty || rc=2
267 $LCTL --device $osc2dev activate
271 run_test 18a "manual ost invalidate clears page cache immediately"
274 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
276 do_facet client mkdir -p $DIR/$tdir
278 f2=$DIR/$tdir/${tfile}-2
281 pgcache_empty || return 1
283 # shouldn't have to set stripe size of count==1
284 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
285 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
287 do_facet client cp $SAMPLE_FILE $f
290 # allow recovery to complete
291 sleep $((TIMEOUT + 2))
292 # my understanding is that there should be nothing in the page
293 # cache after the client reconnects?
295 pgcache_empty || rc=2
299 run_test 18b "eviction and reconnect clears page cache (2766)"
302 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
304 do_facet client mkdir -p $DIR/$tdir
306 f2=$DIR/$tdir/${tfile}-2
309 pgcache_empty || return 1
311 # shouldn't have to set stripe size of count==1
312 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
313 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
315 do_facet client cp $SAMPLE_FILE $f
319 # OBD_FAIL_OST_CONNECT_NET2
320 # lost reply to connect request
321 do_facet ost1 lctl set_param fail_loc=0x80000225
323 df $MOUNT > /dev/null 2>&1
325 # my understanding is that there should be nothing in the page
326 # cache after the client reconnects?
328 pgcache_empty || rc=2
332 run_test 18c "Dropped connect reply after eviction handing (14755)"
336 do_facet client mcreate $f || return 1
337 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
339 do_facet client checkstat -v -p 0777 $f || echo evicted
340 # let the client reconnect
342 do_facet client "munlink $f"
344 run_test 19a "test expired_lock_main on mds (2867)"
348 do_facet client multiop $f Ow || return 1
349 do_facet client multiop $f or || return 2
353 do_facet client multiop $f or || return 3
354 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
356 do_facet client munlink $f || return 4
358 run_test 19b "test expired_lock_main on ost (2867)"
360 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
361 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
364 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
365 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
368 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
369 do_facet ost1 lctl set_param fail_loc=0x80000308
370 kill -USR1 $MULTI_PID
373 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
375 run_test 20a "ldlm_handle_enqueue error (should return error)"
377 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
378 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
381 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
383 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
384 do_facet ost1 lctl set_param fail_loc=0x80000308
385 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
386 error "didn't fail open enqueue" || true
388 run_test 20b "ldlm_handle_enqueue error (should return error)"
391 mkdir -p $DIR/$tdir-1
392 mkdir -p $DIR/$tdir-2
393 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
396 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
397 multiop $DIR/$tdir-2/f Oc &
400 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
402 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
403 kill -USR1 $close_pid
405 wait $close_pid || return 1
406 wait $open_pid || return 2
407 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
409 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
410 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
414 run_test 21a "drop close request while close and open are both in flight"
417 mkdir -p $DIR/$tdir-1
418 mkdir -p $DIR/$tdir-2
419 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
422 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
423 mcreate $DIR/$tdir-2/f &
426 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
428 kill -USR1 $close_pid
430 wait $close_pid || return 1
431 wait $open_pid || return 3
433 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
434 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
437 run_test 21b "drop open request while close and open are both in flight"
440 mkdir -p $DIR/$tdir-1
441 mkdir -p $DIR/$tdir-2
442 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
445 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
446 mcreate $DIR/$tdir-2/f &
449 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
451 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
452 kill -USR1 $close_pid
454 wait $close_pid || return 1
455 wait $open_pid || return 2
457 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
459 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
460 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
463 run_test 21c "drop both request 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=0x80000129"
472 multiop $DIR/$tdir-2/f Oc &
474 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
476 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
479 wait $pid || return 1
480 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
482 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
483 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
487 run_test 21d "drop close reply while close and open are both in flight"
490 mkdir -p $DIR/$tdir-1
491 mkdir -p $DIR/$tdir-2
492 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
495 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
496 touch $DIR/$tdir-2/f &
498 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
502 wait $pid || return 1
505 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
506 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
509 run_test 21e "drop open reply while close and open are both in flight"
512 mkdir -p $DIR/$tdir-1
513 mkdir -p $DIR/$tdir-2
514 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
517 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
518 touch $DIR/$tdir-2/f &
520 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
522 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
525 wait $pid || return 1
526 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
528 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
529 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
532 run_test 21f "drop both reply while close and open are both in flight"
535 mkdir -p $DIR/$tdir-1
536 mkdir -p $DIR/$tdir-2
537 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
540 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
541 touch $DIR/$tdir-2/f &
543 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
545 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
548 wait $pid || return 1
549 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
551 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
552 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
555 run_test 21g "drop open reply and close request while close and open are both in flight"
558 mkdir -p $DIR/$tdir-1
559 mkdir -p $DIR/$tdir-2
560 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
563 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
564 touch $DIR/$tdir-2/f &
567 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
569 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
572 wait $pid || return 1
573 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
575 wait $touch_pid || return 2
577 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
578 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
581 run_test 21h "drop open request and close reply while close and open are both in flight"
583 # bug 3462 - multiple MDC requests
588 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
593 multiop $f1 msu || return 1
596 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
598 wait $close_pid || return 2
599 rm -rf $f2 || return 4
601 run_test 22 "drop close request and do mknod"
604 multiop_bg_pause $DIR/$tfile O_c || return 1
606 # give a chance for open
610 drop_request "kill -USR1 $pid"
613 wait $pid || return 1
616 run_test 23 "client hang when close a file after mds crash"
618 test_24() { # bug 11710 details correct fsync() behavior
619 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
622 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
624 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
627 kill -USR1 $MULTI_PID
630 lctl set_param fail_loc=0x0
632 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
634 run_test 24 "fsync error (should return error)"
636 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
637 # this test can only run from a client on a separate node.
638 remote_ost || { skip "local OST" && return 0; }
639 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
640 remote_mds || { skip "local MDS" && return 0; }
641 OST_FILE=obdfilter.${ost1_svc}.num_exports
642 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
643 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
644 echo starting with $OST_NEXP1 OST exports
645 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
646 do_facet client lctl set_param fail_loc=0x505
647 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
648 # But if there's a race to start the evictor from various obds,
649 # the loser might have to wait for the next ping.
650 echo Waiting for $(($TIMEOUT * 8)) secs
651 sleep $(($TIMEOUT * 8))
652 OST_EXP="`do_facet ost1 lctl get_param -n $OST_FILE`"
653 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
654 echo ending with $OST_NEXP2 OST exports
655 do_facet client lctl set_param fail_loc=0x0
656 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
659 run_test 26a "evict dead exports"
661 test_26b() { # bug 10140 - evict dead exports by pinger
662 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
665 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
666 sleep 1 # wait connections being established
667 MDS_FILE=mdt.${mds1_svc}.num_exports
668 MDS_NEXP1="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
669 OST_FILE=obdfilter.${ost1_svc}.num_exports
670 OST_NEXP1="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
671 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
672 zconf_umount `hostname` $MOUNT2 -f
673 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
674 # But if there's a race to start the evictor from various obds,
675 # the loser might have to wait for the next ping.
676 echo Waiting for $(($TIMEOUT * 3)) secs
677 sleep $(($TIMEOUT * 3))
678 OST_NEXP2="`do_facet ost1 lctl get_param -n $OST_FILE | cut -d' ' -f2`"
679 MDS_NEXP2="`do_facet $SINGLEMDS lctl get_param -n $MDS_FILE | cut -d' ' -f2`"
680 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
681 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
682 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
685 run_test 26b "evict dead exports"
689 writemany -q -a $DIR/$tdir/$tfile 0 5 &
692 local save_FAILURE_MODE=$FAILURE_MODE
694 facet_failover $SINGLEMDS
695 #define OBD_FAIL_OSC_SHUTDOWN 0x407
696 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000407
697 # need to wait for reconnect
698 echo -n waiting for fail_loc
699 while [ $(do_facet $SINGLEMDS lctl get_param -n fail_loc) -eq -2147482617 ]; do
703 do_facet $SINGLEMDS lctl get_param -n fail_loc
704 facet_failover $SINGLEMDS
706 kill -USR1 $CLIENT_PID
709 FAILURE_MODE=$save_FAILURE_MODE
711 run_test 27 "fail LOV while using OSC's"
713 test_28() { # bug 6086 - error adding new clients
714 do_facet client mcreate $DIR/$tfile || return 1
715 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
716 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
717 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
718 # fail once (evicted), reconnect fail (fail_loc), ok
719 df || (sleep 10; df) || (sleep 10; df) || error "reconnect failed"
721 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
723 run_test 28 "handle error adding new clients (bug 6086)"
727 # put a load of file creates/writes/deletes
728 writemany -q $DIR/$tdir/$tfile 0 5 &
730 echo writemany pid $CLIENT_PID
734 # wait for client to reconnect to MDS
739 # client process should see no problems even though MDS went down
741 kill -USR1 $CLIENT_PID
744 echo writemany returned $rc
745 #these may fail because of eviction due to slow AST response.
746 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
748 run_test 50 "failover MDS under load"
752 # put a load of file creates/writes/deletes
753 writemany -q $DIR/$tdir/$tfile 0 5 &
757 facet_failover $SINGLEMDS
758 # failover at various points during recovery
759 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
760 echo will failover at $SEQ
763 echo failover in $i sec
765 facet_failover $SINGLEMDS
767 # client process should see no problems even though MDS went down
768 # and recovery was interrupted
770 kill -USR1 $CLIENT_PID
773 echo writemany returned $rc
774 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
776 run_test 51 "failover MDS during recovery"
779 do_facet client "mkdir -p $DIR/$tdir"
780 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
782 echo writemany pid $CLIENT_PID
787 wait $CLIENT_PID || rc=$?
788 # active client process should see an EIO for down OST
789 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
790 # but timing or failover setup may allow success
791 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
792 echo "writemany returned $rc"
797 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
802 [ $rc -ne 0 ] && { return $rc; }
803 # wait for client to reconnect to OST
807 [ $rc -ne 0 ] && { return $rc; }
814 run_test 52 "failover OST under load"
816 # test of open reconstruct
819 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
822 run_test 53 "touch: drop rep"
825 zconf_mount `hostname` $MOUNT2
829 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
832 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
833 [ x"$ERROR" == x ] || error "back in time occured"
835 run_test 54 "back in time"
837 # bug 11330 - liblustre application death during I/O locks up OST
839 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
843 # first dd should be finished quickly
844 lfs setstripe $DIR/$tdir/$tfile-1 -c 1 -i 0
845 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
848 echo "step1: testing ......"
850 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
852 if [ $count -gt 64 ]; then
853 error "dd should be finished!"
857 echo "(dd_pid=$DDPID, time=$count)successful"
859 lfs setstripe $DIR/$tdir/$tfile-2 -c 1 -i 0
860 #define OBD_FAIL_OST_DROP_REQ 0x21d
861 do_facet ost1 lctl set_param fail_loc=0x0000021d
862 # second dd will be never finished
863 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
866 echo "step2: testing ......"
867 while [ $count -le 64 ]; do
868 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
869 if [ -z $dd_name ]; then
871 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
872 error "dd shouldn't be finished!"
877 echo "(dd_pid=$DDPID, time=$count)successful"
879 #Recover fail_loc and dd will finish soon
880 do_facet ost1 lctl set_param fail_loc=0
882 echo "step3: testing ......"
884 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
886 if [ $count -gt 500 ]; then
887 error "dd should be finished!"
891 echo "(dd_pid=$DDPID, time=$count)successful"
895 run_test 55 "ost_brw_read/write drops timed-out read/write request"
897 test_56() { # b=11277
898 #define OBD_FAIL_MDS_RESEND 0x136
900 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
902 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
905 run_test 56 "do not allow reconnect to busy exports"
908 # no oscs means no client or mdt
909 while lctl get_param osc.*.* > /dev/null 2>&1; do
910 : # loop until proc file is removed
914 test_57() { # bug 10866
918 #define OBD_FAIL_LPROC_REMOVE 0xB00
919 lctl set_param fail_loc=0x80000B00
920 zconf_umount `hostname` $DIR
921 lctl set_param fail_loc=0x80000B00
922 fail_abort $SINGLEMDS
924 lctl set_param fail_loc=0
926 do_facet client "df $DIR"
928 run_test 57 "read procfs entries causes kernel crash"
930 test_58() { # bug 11546
931 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
934 lctl set_param fail_loc=0x80000801
935 cp $DIR/$tfile /dev/null &
938 lctl set_param fail_loc=0
939 drop_bl_callback rm -f $DIR/$tfile
941 do_facet client "df $DIR"
943 run_test 58 "Eviction in the middle of open RPC reply processing"
945 test_59() { # bug 10589
946 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
947 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
948 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
949 lctl set_param fail_loc=0x311
950 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
951 [ $? = 0 ] || error "dd write failed"
952 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
953 lctl set_param fail_loc=0
955 zconf_umount `hostname` $MOUNT2 -f
956 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
957 [ $? = 0 ] || error "dd read failed"
958 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
959 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
961 run_test 59 "Read cancel race on client eviction"
963 equals_msg `basename $0`: test complete, cleaning up
964 check_and_cleanup_lustre
965 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true