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}
15 if [ "$FAILURE_MODE" = "HARD" ] && mixed_ost_devs; then
16 CONFIG_EXCEPTIONS="52"
17 echo -n "Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. "
18 echo "Except the tests: $CONFIG_EXCEPTIONS"
19 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
22 require_dsh_mds || exit 0
24 # also long tests: 19, 21a, 21e, 21f, 23, 27
25 # 1 2.5 2.5 4 4 (min)"
26 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17 26a 26b 50 51 57"
30 # Allow us to override the setup if we already have a mounted system by
31 # setting SETUP=" " and CLEANUP=" "
33 CLEANUP=${CLEANUP:-""}
35 check_and_setup_lustre
38 rm -rf $DIR/[df][0-9]*
41 drop_request "mcreate $DIR/f1" || return 1
42 drop_reint_reply "mcreate $DIR/f2" || return 2
44 run_test 1 "mcreate: drop req, drop rep"
47 drop_request "tchmod 111 $DIR/f2" || return 1
48 drop_reint_reply "tchmod 666 $DIR/f2" || return 2
50 run_test 2 "chmod: drop req, drop rep"
53 drop_request "statone $DIR/f2" || return 1
54 drop_reply "statone $DIR/f2" || return 2
56 run_test 3 "stat: drop req, drop rep"
58 SAMPLE_NAME=f0.recovery-small.junk
59 SAMPLE_FILE=$TMP/$SAMPLE_NAME
60 # make this big, else test 9 doesn't wait for bulk -- bz 5595
61 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
64 do_facet client "cp $SAMPLE_FILE $DIR/$SAMPLE_NAME" || return 1
65 drop_request "cat $DIR/$SAMPLE_NAME > /dev/null" || return 2
66 drop_reply "cat $DIR/$SAMPLE_NAME > /dev/null" || return 3
68 run_test 4 "open: drop req, drop rep"
70 RENAMED_AGAIN=$DIR/f0.renamed-again
73 drop_request "mv $DIR/$SAMPLE_NAME $DIR/$tfile-renamed" || return 1
74 drop_reint_reply "mv $DIR/$tfile-renamed $RENAMED_AGAIN" || return 2
75 do_facet client "checkstat -v $RENAMED_AGAIN" || return 3
77 run_test 5 "rename: drop req, drop rep"
79 [ ! -e $RENAMED_AGAIN ] && cp $SAMPLE_FILE $RENAMED_AGAIN
84 drop_request "mlink $RENAMED_AGAIN $LINK1" || return 1
85 drop_reint_reply "mlink $RENAMED_AGAIN $LINK2" || return 2
87 run_test 6 "link: drop req, drop rep"
89 [ ! -e $LINK1 ] && mlink $RENAMED_AGAIN $LINK1
90 [ ! -e $LINK2 ] && mlink $RENAMED_AGAIN $LINK2
92 drop_request "munlink $LINK1" || return 1
93 drop_reint_reply "munlink $LINK2" || return 2
95 run_test 7 "unlink: drop req, drop rep"
99 drop_reint_reply "touch $DIR/$tfile" || return 1
101 run_test 8 "touch: drop rep (bug 1423)"
105 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
107 pause_bulk "cp /etc/profile $DIR/$tfile" || return 1
108 do_facet client "cp $SAMPLE_FILE $DIR/${tfile}.2" || return 2
109 do_facet client "sync"
110 do_facet client "rm $DIR/$tfile $DIR/${tfile}.2" || return 3
112 run_test 9 "pause bulk on OST (bug 1420)"
116 do_facet client mcreate $DIR/$tfile || return 1
117 drop_bl_callback "chmod 0777 $DIR/$tfile" || echo "evicted as expected"
118 # wait for the mds to evict the client
119 #echo "sleep $(($TIMEOUT*2))"
120 #sleep $(($TIMEOUT*2))
121 do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
122 do_facet client checkstat -v -p 0777 $DIR/$tfile || return 3
123 do_facet client "munlink $DIR/$tfile"
125 run_test 10 "finish request on server after client eviction (bug 1521)"
128 # wake up a thread waiting for completion after eviction
130 do_facet client multiop $DIR/$tfile Ow || return 1
131 do_facet client multiop $DIR/$tfile or || return 2
135 do_facet client multiop $DIR/$tfile or || return 3
136 drop_bl_callback multiop $DIR/$tfile Ow || echo "evicted as expected"
138 do_facet client munlink $DIR/$tfile || return 4
140 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
144 $LCTL mark multiop $DIR/$tfile OS_c
145 do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
146 clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
147 multiop_bg_pause $DIR/$tfile OS_c || return 1
149 #define OBD_FAIL_MDS_CLOSE_NET 0x115
151 echo "waiting for multiop $PID"
152 wait $PID || return 2
153 do_facet client munlink $DIR/$tfile || return 3
155 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
157 # Bug 113, check that readdir lost recv timeout works.
159 mkdir -p $DIR/$tdir || return 1
160 touch $DIR/$tdir/newentry || return
161 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
162 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
163 ls $DIR/$tdir || return 3
164 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
165 rm -rf $DIR/$tdir || return 4
167 run_test 13 "mdc_readpage restart test (bug 1138)"
169 # Bug 113, check that readdir lost send timeout works.
172 touch $DIR/$tdir/newentry
173 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
174 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
175 ls $DIR/$tdir || return 1
176 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
178 run_test 14 "mdc_readpage resend test (bug 1138)"
181 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
182 touch $DIR/$tfile && return 1
185 run_test 15 "failed open (-ENOMEM)"
187 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
189 lctl set_param -n llite.*.max_read_ahead_mb 0
193 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
197 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
199 do_facet client cp $SAMPLE_FILE $DIR
203 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
204 do_facet ost1 "lctl set_param fail_loc=0x80000504"
206 # OST bulk will time out here, client resends
207 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 1
208 do_facet ost1 lctl set_param fail_loc=0
209 # give recovery a chance to finish (shouldn't take long)
211 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 2
214 run_test 16 "timeout bulk put, don't evict client (2732)"
219 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
221 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
222 if at_is_enabled; then
223 at_max_saved=$(at_max_get ost1)
224 at_max_set $TIMEOUT ost1
227 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
228 # OST bulk will time out here, client retries
229 do_facet ost1 lctl set_param fail_loc=0x80000503
230 # need to ensure we send an RPC
231 do_facet client cp /etc/termcap $DIR/$tfile
234 # with AT, client will wait adaptive_max*factor+net_latency before
235 # expiring the req, hopefully timeout*2 is enough
236 sleep $(($TIMEOUT*2))
238 do_facet ost1 lctl set_param fail_loc=0
239 do_facet client "df $DIR"
240 # expect cmp to succeed, client resent bulk
241 do_facet client "cmp /etc/termcap $DIR/$tfile" || return 3
242 do_facet client "rm $DIR/$tfile" || return 4
243 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved ost1
246 run_test 17 "timeout bulk get, don't evict client (2732)"
249 [ -z ${ost2_svc} ] && skip_env "needs 2 osts" && return 0
251 do_facet client mkdir -p $DIR/$tdir
255 pgcache_empty || return 1
258 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
259 get_stripe_info client $f
260 if [ $stripe_index -ne 1 ]; then
262 error "$f: different stripe offset ($stripe_index)" && return
265 do_facet client cp $SAMPLE_FILE $f
267 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
268 $LCTL --device $osc2dev deactivate || return 3
269 # my understanding is that there should be nothing in the page
270 # cache after the client reconnects?
272 pgcache_empty || rc=2
273 $LCTL --device $osc2dev activate
277 run_test 18a "manual ost invalidate clears page cache immediately"
280 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
282 do_facet client mkdir -p $DIR/$tdir
286 pgcache_empty || return 1
288 # shouldn't have to set stripe size of count==1
289 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
290 get_stripe_info client $f
291 if [ $stripe_index -ne 0 ]; then
293 error "$f: different stripe offset ($stripe_index)" && return
296 do_facet client cp $SAMPLE_FILE $f
299 # allow recovery to complete
300 sleep $((TIMEOUT + 2))
301 # my understanding is that there should be nothing in the page
302 # cache after the client reconnects?
304 pgcache_empty || rc=2
308 run_test 18b "eviction and reconnect clears page cache (2766)"
311 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
313 do_facet client mkdir -p $DIR/$tdir
317 pgcache_empty || return 1
319 # shouldn't have to set stripe size of count==1
320 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
321 get_stripe_info client $f
322 if [ $stripe_index -ne 0 ]; then
324 error "$f: different stripe offset ($stripe_index)" && return
327 do_facet client cp $SAMPLE_FILE $f
331 # OBD_FAIL_OST_CONNECT_NET2
332 # lost reply to connect request
333 do_facet ost1 lctl set_param fail_loc=0x80000225
335 df $MOUNT > /dev/null 2>&1
337 # my understanding is that there should be nothing in the page
338 # cache after the client reconnects?
340 pgcache_empty || rc=2
344 run_test 18c "Dropped connect reply after eviction handing (14755)"
348 do_facet client mcreate $f || return 1
349 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
351 do_facet client checkstat -v -p 0777 $f || echo evicted
352 # let the client reconnect
354 do_facet client "munlink $f"
356 run_test 19a "test expired_lock_main on mds (2867)"
360 do_facet client multiop $f Ow || return 1
361 do_facet client multiop $f or || return 2
365 do_facet client multiop $f or || return 3
366 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
368 do_facet client munlink $f || return 4
370 run_test 19b "test expired_lock_main on ost (2867)"
372 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
373 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
376 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
377 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
380 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
381 do_facet ost1 lctl set_param fail_loc=0x80000308
382 kill -USR1 $MULTI_PID
385 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
387 run_test 20a "ldlm_handle_enqueue error (should return error)"
389 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
390 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
393 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
395 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
396 do_facet ost1 lctl set_param fail_loc=0x80000308
397 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
398 error "didn't fail open enqueue" || true
400 run_test 20b "ldlm_handle_enqueue error (should return error)"
403 mkdir -p $DIR/$tdir-1
404 mkdir -p $DIR/$tdir-2
405 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
408 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
409 multiop $DIR/$tdir-2/f Oc &
412 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
414 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
415 kill -USR1 $close_pid
417 wait $close_pid || return 1
418 wait $open_pid || return 2
419 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
421 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
422 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
426 run_test 21a "drop close request while close and open are both in flight"
429 mkdir -p $DIR/$tdir-1
430 mkdir -p $DIR/$tdir-2
431 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
434 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
435 mcreate $DIR/$tdir-2/f &
438 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
440 kill -USR1 $close_pid
442 wait $close_pid || return 1
443 wait $open_pid || return 3
445 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
446 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
449 run_test 21b "drop open request while close and open are both in flight"
452 mkdir -p $DIR/$tdir-1
453 mkdir -p $DIR/$tdir-2
454 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
457 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
458 mcreate $DIR/$tdir-2/f &
461 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
463 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
464 kill -USR1 $close_pid
466 wait $close_pid || return 1
467 wait $open_pid || return 2
469 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
471 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
472 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
475 run_test 21c "drop both request while close and open are both in flight"
478 mkdir -p $DIR/$tdir-1
479 mkdir -p $DIR/$tdir-2
480 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
483 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
484 multiop $DIR/$tdir-2/f Oc &
486 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
488 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
491 wait $pid || return 1
492 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
494 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
495 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
499 run_test 21d "drop close reply while close and open are both in flight"
502 mkdir -p $DIR/$tdir-1
503 mkdir -p $DIR/$tdir-2
504 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
507 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
508 touch $DIR/$tdir-2/f &
510 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
514 wait $pid || return 1
517 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
518 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
521 run_test 21e "drop open reply while close and open are both in flight"
524 mkdir -p $DIR/$tdir-1
525 mkdir -p $DIR/$tdir-2
526 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
529 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
530 touch $DIR/$tdir-2/f &
532 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
534 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
537 wait $pid || return 1
538 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
540 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
541 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
544 run_test 21f "drop both reply while close and open are both in flight"
547 mkdir -p $DIR/$tdir-1
548 mkdir -p $DIR/$tdir-2
549 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
552 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
553 touch $DIR/$tdir-2/f &
555 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
557 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
560 wait $pid || return 1
561 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
563 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
564 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
567 run_test 21g "drop open reply and close request while close and open are both in flight"
570 mkdir -p $DIR/$tdir-1
571 mkdir -p $DIR/$tdir-2
572 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
575 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
576 touch $DIR/$tdir-2/f &
579 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
581 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
584 wait $pid || return 1
585 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
587 wait $touch_pid || return 2
589 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
590 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
593 run_test 21h "drop open request and close reply while close and open are both in flight"
595 # bug 3462 - multiple MDC requests
600 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
605 multiop $f1 msu || return 1
608 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
610 wait $close_pid || return 2
611 rm -rf $f2 || return 4
613 run_test 22 "drop close request and do mknod"
616 multiop_bg_pause $DIR/$tfile O_c || return 1
618 # give a chance for open
622 drop_request "kill -USR1 $pid"
625 wait $pid || return 1
628 run_test 23 "client hang when close a file after mds crash"
630 test_24() { # bug 11710 details correct fsync() behavior
631 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
634 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
636 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
639 kill -USR1 $MULTI_PID
642 lctl set_param fail_loc=0x0
644 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
646 run_test 24 "fsync error (should return error)"
648 wait_client_evicted () {
651 local varsvc=${facet}_svc
653 wait_update $(facet_host $facet) "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" $((exports - 1)) $3
656 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
657 # this test can only run from a client on a separate node.
658 remote_ost || { skip "local OST" && return 0; }
659 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
660 remote_mds || { skip "local MDS" && return 0; }
662 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
663 skip "msg and ost1 are at the same node"
667 check_timeout || return 1
669 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
671 echo starting with $OST_NEXP OST exports
672 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
673 do_facet client lctl set_param fail_loc=0x505
674 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
675 # But if there's a race to start the evictor from various obds,
676 # the loser might have to wait for the next ping.
679 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 2 + TIMEOUT * 3 / 4))
681 do_facet client lctl set_param fail_loc=0x0
682 [ $rc -eq 0 ] || error "client not evicted from OST"
684 run_test 26a "evict dead exports"
686 test_26b() { # bug 10140 - evict dead exports by pinger
687 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
689 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
690 skip "msg and ost1 are at the same node"
694 check_timeout || return 1
696 zconf_mount `hostname` $MOUNT2 ||
697 { error "Failed to mount $MOUNT2"; return 2; }
698 sleep 1 # wait connections being established
700 local MDS_NEXP=$(do_facet $SINGLEMDS lctl get_param -n mdt.${mds1_svc}.num_exports | cut -d' ' -f2)
701 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
703 echo starting with $OST_NEXP OST and $MDS_NEXP MDS exports
705 zconf_umount `hostname` $MOUNT2 -f
707 # PING_INTERVAL max(obd_timeout / 4, 1U)
708 # PING_EVICT_TIMEOUT (PING_INTERVAL * 6)
710 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
711 # But if there's a race to start the evictor from various obds,
712 # the loser might have to wait for the next ping.
713 # = 9 * PING_INTERVAL + PING_INTERVAL
714 # = 10 PING_INTERVAL = 10 obd_timeout / 4 = 2.5 obd_timeout
715 # let's wait $((TIMEOUT * 3)) # bug 19887
717 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 3)) || \
718 error "Client was not evicted by ost" rc=1
719 wait_client_evicted $SINGLEMDS $MDS_NEXP $((TIMEOUT * 3)) || \
720 error "Client was not evicted by mds"
722 run_test 26b "evict dead exports"
726 writemany -q -a $DIR/$tdir/$tfile 0 5 &
729 local save_FAILURE_MODE=$FAILURE_MODE
731 facet_failover $SINGLEMDS
732 #define OBD_FAIL_OSC_SHUTDOWN 0x407
733 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000407
734 # need to wait for reconnect
735 echo -n waiting for fail_loc
736 while [ $(do_facet $SINGLEMDS lctl get_param -n fail_loc) -eq -2147482617 ]; do
740 do_facet $SINGLEMDS lctl get_param -n fail_loc
741 facet_failover $SINGLEMDS
743 kill -USR1 $CLIENT_PID
746 FAILURE_MODE=$save_FAILURE_MODE
748 run_test 27 "fail LOV while using OSC's"
750 test_28() { # bug 6086 - error adding new clients
751 do_facet client mcreate $DIR/$tfile || return 1
752 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
753 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
754 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
755 # fail once (evicted), reconnect fail (fail_loc), ok
756 client_up || (sleep 10; client_up) || (sleep 10; client_up) || error "reconnect failed"
758 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
760 run_test 28 "handle error adding new clients (bug 6086)"
764 # put a load of file creates/writes/deletes
765 writemany -q $DIR/$tdir/$tfile 0 5 &
767 echo writemany pid $CLIENT_PID
771 # wait for client to reconnect to MDS
776 # client process should see no problems even though MDS went down
778 kill -USR1 $CLIENT_PID
781 echo writemany returned $rc
782 #these may fail because of eviction due to slow AST response.
783 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
785 run_test 50 "failover MDS under load"
789 # put a load of file creates/writes/deletes
790 writemany -q $DIR/$tdir/$tfile 0 5 &
794 facet_failover $SINGLEMDS
795 # failover at various points during recovery
796 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
797 echo will failover at $SEQ
800 echo failover in $i sec
802 facet_failover $SINGLEMDS
804 # client process should see no problems even though MDS went down
805 # and recovery was interrupted
807 kill -USR1 $CLIENT_PID
810 echo writemany returned $rc
811 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
813 run_test 51 "failover MDS during recovery"
816 do_facet client "mkdir -p $DIR/$tdir"
817 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
819 echo writemany pid $CLIENT_PID
824 wait $CLIENT_PID || rc=$?
825 # active client process should see an EIO for down OST
826 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
827 # but timing or failover setup may allow success
828 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
829 echo "writemany returned $rc"
834 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
839 [ $rc -ne 0 ] && { return $rc; }
840 # wait for client to reconnect to OST
844 [ $rc -ne 0 ] && { return $rc; }
851 run_test 52 "failover OST under load"
853 # test of open reconstruct
856 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
859 run_test 53 "touch: drop rep"
862 zconf_mount `hostname` $MOUNT2
866 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
869 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
870 [ x"$ERROR" == x ] || error "back in time occured"
872 run_test 54 "back in time"
874 # bug 11330 - liblustre application death during I/O locks up OST
876 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
880 # first dd should be finished quickly
881 lfs setstripe $DIR/$tdir/$tfile-1 -c 1 -i 0
882 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
885 echo "step1: testing ......"
887 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
889 if [ $count -gt 64 ]; then
890 error "dd should be finished!"
894 echo "(dd_pid=$DDPID, time=$count)successful"
896 lfs setstripe $DIR/$tdir/$tfile-2 -c 1 -i 0
897 #define OBD_FAIL_OST_DROP_REQ 0x21d
898 do_facet ost1 lctl set_param fail_loc=0x0000021d
899 # second dd will be never finished
900 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
903 echo "step2: testing ......"
904 while [ $count -le 64 ]; do
905 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
906 if [ -z $dd_name ]; then
908 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
909 error "dd shouldn't be finished!"
914 echo "(dd_pid=$DDPID, time=$count)successful"
916 #Recover fail_loc and dd will finish soon
917 do_facet ost1 lctl set_param fail_loc=0
919 echo "step3: testing ......"
921 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
923 if [ $count -gt 500 ]; then
924 error "dd should be finished!"
928 echo "(dd_pid=$DDPID, time=$count)successful"
932 run_test 55 "ost_brw_read/write drops timed-out read/write request"
934 test_56() { # b=11277
935 #define OBD_FAIL_MDS_RESEND 0x136
937 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
939 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
942 run_test 56 "do not allow reconnect to busy exports"
945 # no oscs means no client or mdt
946 while lctl get_param osc.*.* > /dev/null 2>&1; do
947 : # loop until proc file is removed
951 test_57() { # bug 10866
955 #define OBD_FAIL_LPROC_REMOVE 0xB00
956 lctl set_param fail_loc=0x80000B00
957 zconf_umount `hostname` $DIR
958 lctl set_param fail_loc=0x80000B00
959 fail_abort $SINGLEMDS
961 lctl set_param fail_loc=0
963 do_facet client "df $DIR"
965 run_test 57 "read procfs entries causes kernel crash"
967 test_58() { # bug 11546
968 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
971 lctl set_param fail_loc=0x80000801
972 cp $DIR/$tfile /dev/null &
975 lctl set_param fail_loc=0
976 drop_bl_callback rm -f $DIR/$tfile
978 do_facet client "df $DIR"
980 run_test 58 "Eviction in the middle of open RPC reply processing"
982 test_59() { # bug 10589
983 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
984 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
985 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
986 lctl set_param fail_loc=0x311
987 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
988 [ $? = 0 ] || error "dd write failed"
989 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
990 lctl set_param fail_loc=0
992 zconf_umount `hostname` $MOUNT2 -f
993 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
994 [ $? = 0 ] || error "dd read failed"
995 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
996 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
998 run_test 59 "Read cancel race on client eviction"
1001 # we assume that all md changes are in the MDT0 changelog
1002 if [ $MDSCOUNT -gt 1 ]; then
1003 error_ignore 17935 $*
1010 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
1011 awk '{gsub(/_UUID/,""); print $1}' | head -1)
1016 # Register (and start) changelog
1017 USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
1018 echo "Registered as $MDT0 changelog user $USER"
1020 # Generate a large number of changelog entries
1021 createmany -o $DIR/$tdir/$tfile $NUM_FILES
1025 # Unlink files in the background
1026 unlinkmany $DIR/$tdir/$tfile $NUM_FILES &
1030 # Failover the MDS while unlinks are happening
1031 facet_failover $SINGLEMDS
1033 # Wait for unlinkmany to finish
1036 # Check if all the create/unlink events were recorded
1038 $LFS changelog $MDT0 >> $DIR/$tdir/changelog
1039 local cl_count=$(grep UNLNK $DIR/$tdir/changelog | wc -l)
1040 echo "$cl_count unlinks in $MDT0 changelog"
1042 do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $USER
1043 USERS=$(( $(do_facet $SINGLEMDS lctl get_param -n \
1044 mdd.$MDT0.changelog_users | wc -l) - 2 ))
1045 if [ $USERS -eq 0 ]; then
1046 [ $cl_count -eq $NUM_FILES ] || \
1047 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1048 # Also make sure we can clear large changelogs
1049 cl_count=$($LFS changelog $FSNAME | wc -l)
1050 [ $cl_count -le 2 ] || \
1051 error "Changelog not empty: $cl_count entries"
1053 # If there are other users, there may be other unlinks in the log
1054 [ $cl_count -ge $NUM_FILES ] || \
1055 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1056 echo "$USERS other changelog users; can't verify clear"
1059 run_test 60 "Add Changelog entries during MDS failover"
1063 local cflags='osc.*-OST0000-osc-MDT*.connect_flags'
1064 do_facet $SINGLEMDS "lctl get_param -n $cflags" |grep -q skip_orphan
1065 [ $? -ne 0 ] && skip "don't have skip orphan feature" && return
1067 mkdir -p $DIR/$tdir || error "mkdir dir $DIR/$tdir failed"
1068 # Set the default stripe of $DIR/$tdir to put the files to ost1
1069 $LFS setstripe -c 1 --index 0 $DIR/$tdir
1071 replay_barrier $SINGLEMDS
1072 createmany -o $DIR/$tdir/$tfile-%d 10
1073 local oid=`do_facet ost1 "lctl get_param -n obdfilter.*OST0000.last_id"`
1075 fail_abort $SINGLEMDS
1077 touch $DIR/$tdir/$tfile
1078 local id=`$LFS getstripe $DIR/$tdir/$tfile |awk '$2 ~ /^[1-9]+/ {print $2}'`
1079 [ $id -le $oid ] && error "the orphan objid was reused, failed"
1084 run_test 61 "Verify to not reuse orphan objects - bug 17025"
1086 equals_msg `basename $0`: test complete, cleaning up
1087 check_and_cleanup_lustre
1088 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true