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 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
16 if [ "$FAILURE_MODE" = "HARD" ] && mixed_ost_devs; then
17 CONFIG_EXCEPTIONS="52"
18 echo -n "Several ost services on one ost node are used with FAILURE_MODE=$FAILURE_MODE. "
19 echo "Except the tests: $CONFIG_EXCEPTIONS"
20 ALWAYS_EXCEPT="$ALWAYS_EXCEPT $CONFIG_EXCEPTIONS"
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)"
102 SAMPLE_FILE=$TMP/recovery-small.junk
103 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
107 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
109 pause_bulk "cp /etc/profile $DIR/$tfile" || return 1
110 do_facet client "cp $SAMPLE_FILE $DIR/${tfile}.2" || return 2
111 do_facet client "sync"
112 do_facet client "rm $DIR/$tfile $DIR/${tfile}.2" || return 3
114 run_test 9 "pause bulk on OST (bug 1420)"
118 do_facet client mcreate $DIR/$tfile || return 1
119 drop_bl_callback "chmod 0777 $DIR/$tfile" || echo "evicted as expected"
120 # wait for the mds to evict the client
121 #echo "sleep $(($TIMEOUT*2))"
122 #sleep $(($TIMEOUT*2))
123 do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
124 do_facet client checkstat -v -p 0777 $DIR/$tfile || return 3
125 do_facet client "munlink $DIR/$tfile"
127 run_test 10 "finish request on server after client eviction (bug 1521)"
130 # wake up a thread waiting for completion after eviction
132 do_facet client multiop $DIR/$tfile Ow || return 1
133 do_facet client multiop $DIR/$tfile or || return 2
137 do_facet client multiop $DIR/$tfile or || return 3
138 drop_bl_callback multiop $DIR/$tfile Ow || echo "evicted as expected"
140 do_facet client munlink $DIR/$tfile || return 4
142 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
146 $LCTL mark multiop $DIR/$tfile OS_c
147 do_facet mds "lctl set_param fail_loc=0x115"
148 clear_failloc mds $((TIMEOUT * 2)) &
149 multiop_bg_pause $DIR/$tfile OS_c || return 1
151 #define OBD_FAIL_MDS_CLOSE_NET 0x115
153 echo "waiting for multiop $PID"
154 wait $PID || return 2
155 do_facet client munlink $DIR/$tfile || return 3
157 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
159 # Bug 113, check that readdir lost recv timeout works.
161 mkdir -p $DIR/$tdir || return 1
162 touch $DIR/$tdir/newentry || return
163 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
164 do_facet mds "lctl set_param fail_loc=0x80000104"
165 ls $DIR/$tdir || return 3
166 do_facet mds "lctl set_param fail_loc=0"
167 rm -rf $DIR/$tdir || return 4
169 run_test 13 "mdc_readpage restart test (bug 1138)"
171 # Bug 113, check that readdir lost send timeout works.
174 touch $DIR/$tdir/newentry
175 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
176 do_facet mds "lctl set_param fail_loc=0x80000106"
177 ls $DIR/$tdir || return 1
178 do_facet mds "lctl set_param fail_loc=0"
180 run_test 14 "mdc_readpage resend test (bug 1138)"
183 do_facet mds "lctl set_param fail_loc=0x80000128"
184 touch $DIR/$tfile && return 1
187 run_test 15 "failed open (-ENOMEM)"
189 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
191 lctl set_param -n llite.*.max_read_ahead_mb 0
195 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
199 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
201 do_facet client cp $SAMPLE_FILE $DIR
205 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
206 do_facet ost1 lctl set_param fail_loc=0x80000504
208 # OST bulk will time out here, client resends
209 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 1
210 do_facet ost1 lctl set_param fail_loc=0
211 # give recovery a chance to finish (shouldn't take long)
213 do_facet client "cmp $SAMPLE_FILE $DIR/${SAMPLE_FILE##*/}" || return 2
216 run_test 16 "timeout bulk put, don't evict client (2732)"
221 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
223 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
224 if at_is_enabled; then
225 at_max_saved=$(at_max_get ost1)
226 at_max_set $TIMEOUT ost1
229 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
230 # OST bulk will time out here, client retries
231 do_facet client lctl set_param fail_loc=0x80000503
232 # need to ensure we send an RPC
233 do_facet client cp $SAMPLE_FILE $DIR/$tfile
236 # with AT, client will wait adaptive_max*factor+net_latency before
237 # expiring the req, hopefully timeout*2 is enough
238 sleep $(($TIMEOUT*2))
240 do_facet ost1 lctl set_param fail_loc=0
241 do_facet client "df $DIR"
242 # expect cmp to succeed, client resent bulk
243 do_facet client "cmp $SAMPLE_FILE $DIR/$tfile" || return 3
244 do_facet client "rm $DIR/$tfile" || return 4
245 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved ost1
248 run_test 17 "timeout bulk get, don't evict client (2732)"
251 [ -z ${ost2_svc} ] && skip_env "needs 2 osts" && return 0
253 do_facet client mkdir -p $DIR/$tdir
257 pgcache_empty || return 1
260 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
261 get_stripe_info client $f
262 if [ $stripe_index -ne 1 ]; then
264 error "$f: different stripe offset ($stripe_index)" && return
267 do_facet client cp $SAMPLE_FILE $f
269 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | awk '{print $1}'`
270 $LCTL --device $osc2dev deactivate || return 3
271 # my understanding is that there should be nothing in the page
272 # cache after the client reconnects?
274 pgcache_empty || rc=2
275 $LCTL --device $osc2dev activate
279 run_test 18a "manual ost invalidate clears page cache immediately"
282 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
284 do_facet client mkdir -p $DIR/$tdir
288 pgcache_empty || return 1
290 # shouldn't have to set stripe size of count==1
291 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
292 get_stripe_info client $f
293 if [ $stripe_index -ne 0 ]; then
295 error "$f: different stripe offset ($stripe_index)" && return
298 do_facet client cp $SAMPLE_FILE $f
304 df $MOUNT > /dev/null 2>&1
306 # my understanding is that there should be nothing in the page
307 # cache after the client reconnects?
309 pgcache_empty || rc=2
313 run_test 18b "eviction and reconnect clears page cache (2766)"
316 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
318 do_facet client mkdir -p $DIR/$tdir
322 pgcache_empty || return 1
324 # shouldn't have to set stripe size of count==1
325 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
326 get_stripe_info client $f
327 if [ $stripe_index -ne 0 ]; then
329 error "$f: different stripe offset ($stripe_index)" && return
332 do_facet client cp $SAMPLE_FILE $f
336 # OBD_FAIL_OST_CONNECT_NET2
337 # lost reply to connect request
338 do_facet ost1 lctl set_param fail_loc=0x80000225
341 df $MOUNT > /dev/null 2>&1
343 # my understanding is that there should be nothing in the page
344 # cache after the client reconnects?
346 pgcache_empty || rc=2
350 run_test 18c "Dropped connect reply after eviction handing (14755)"
354 do_facet client mcreate $f || return 1
355 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
357 do_facet client checkstat -v -p 0777 $f || echo evicted
358 # let the client reconnect
360 do_facet client "munlink $f"
362 run_test 19a "test expired_lock_main on mds (2867)"
366 do_facet client multiop $f Ow || return 1
367 do_facet client multiop $f or || return 2
371 do_facet client multiop $f or || return 3
372 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
374 do_facet client munlink $f || return 4
376 run_test 19b "test expired_lock_main on ost (2867)"
378 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
379 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
382 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
383 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
386 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
387 do_facet ost1 lctl set_param fail_loc=0x80000308
388 kill -USR1 $MULTI_PID
391 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
393 run_test 20a "ldlm_handle_enqueue error (should return error)"
395 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
396 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
399 lfs setstripe $DIR/$tdir/${tfile} -i 0 -c 1
401 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
402 do_facet ost1 lctl set_param fail_loc=0x80000308
403 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
404 error "didn't fail open enqueue" || true
406 run_test 20b "ldlm_handle_enqueue error (should return error)"
409 # bug 19039 -- a race between ldlm_enqueue and lock
410 # destroying when the client export is disconnected
415 rm -f $DIR/$tdir/$tfile
416 # OBD_FAIL_LDLM_ENQUEUE_LOCAL 0x319
417 do_facet ost1 lctl set_param fail_loc=0x80000319
418 lfs setstripe -c 1 -o 0 $DIR/$tdir/$tfile
419 dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M conv=notrunc count=1 &
425 start ost1 $(ostdevname 1) $OST_MOUNT_OPTS
429 run_test 20c "ldlm_lock_enqueue is called for a destroyed lock (shouldn't LBUG)"
432 mkdir -p $DIR/$tdir-1
433 mkdir -p $DIR/$tdir-2
434 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
437 do_facet mds "lctl set_param fail_loc=0x80000129"
438 multiop $DIR/$tdir-2/f Oc &
441 do_facet mds "lctl set_param fail_loc=0"
443 do_facet mds "lctl set_param fail_loc=0x80000115"
444 kill -USR1 $close_pid
446 wait $close_pid || return 1
447 wait $open_pid || return 2
448 do_facet mds "lctl set_param fail_loc=0"
450 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
451 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
455 run_test 21a "drop close request while close and open are both in flight"
458 mkdir -p $DIR/$tdir-1
459 mkdir -p $DIR/$tdir-2
460 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
463 do_facet mds "lctl set_param fail_loc=0x80000107"
464 mcreate $DIR/$tdir-2/f &
467 do_facet mds "lctl set_param fail_loc=0"
469 kill -USR1 $close_pid
471 wait $close_pid || return 1
472 wait $open_pid || return 3
474 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
475 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
478 run_test 21b "drop open request while close and open are both in flight"
481 mkdir -p $DIR/$tdir-1
482 mkdir -p $DIR/$tdir-2
483 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
486 do_facet mds "lctl set_param fail_loc=0x80000107"
487 mcreate $DIR/$tdir-2/f &
490 do_facet mds "lctl set_param fail_loc=0"
492 do_facet mds "lctl set_param fail_loc=0x80000115"
493 kill -USR1 $close_pid
495 wait $close_pid || return 1
496 wait $open_pid || return 2
498 do_facet mds "lctl set_param fail_loc=0"
500 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
501 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
504 run_test 21c "drop both request while close and open are both in flight"
507 mkdir -p $DIR/$tdir-1
508 mkdir -p $DIR/$tdir-2
509 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
512 do_facet mds "lctl set_param fail_loc=0x80000129"
513 multiop $DIR/$tdir-2/f Oc &
515 do_facet mds "lctl set_param fail_loc=0"
517 do_facet mds "lctl set_param fail_loc=0x80000122"
520 wait $pid || return 1
521 do_facet mds "lctl set_param fail_loc=0"
523 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
524 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
528 run_test 21d "drop close reply while close and open are both in flight"
531 mkdir -p $DIR/$tdir-1
532 mkdir -p $DIR/$tdir-2
533 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
536 do_facet mds "lctl set_param fail_loc=0x80000119"
537 touch $DIR/$tdir-2/f &
539 do_facet mds "lctl set_param fail_loc=0"
543 wait $pid || return 1
546 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
547 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
550 run_test 21e "drop open reply while close and open are both in flight"
553 mkdir -p $DIR/$tdir-1
554 mkdir -p $DIR/$tdir-2
555 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
558 do_facet mds "lctl set_param fail_loc=0x80000119"
559 touch $DIR/$tdir-2/f &
561 do_facet mds "lctl set_param fail_loc=0"
563 do_facet mds "lctl set_param fail_loc=0x80000122"
566 wait $pid || return 1
567 do_facet mds "lctl set_param fail_loc=0"
569 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
570 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
573 run_test 21f "drop both reply while close and open are both in flight"
576 mkdir -p $DIR/$tdir-1
577 mkdir -p $DIR/$tdir-2
578 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
581 do_facet mds "lctl set_param fail_loc=0x80000119"
582 touch $DIR/$tdir-2/f &
584 do_facet mds "lctl set_param fail_loc=0"
586 do_facet mds "lctl set_param fail_loc=0x80000115"
589 wait $pid || return 1
590 do_facet mds "lctl set_param fail_loc=0"
592 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
593 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
596 run_test 21g "drop open reply and close request while close and open are both in flight"
599 mkdir -p $DIR/$tdir-1
600 mkdir -p $DIR/$tdir-2
601 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
604 do_facet mds "lctl set_param fail_loc=0x80000107"
605 touch $DIR/$tdir-2/f &
608 do_facet mds "lctl set_param fail_loc=0"
610 do_facet mds "lctl set_param fail_loc=0x80000122"
613 wait $pid || return 1
614 do_facet mds "lctl set_param fail_loc=0"
616 wait $touch_pid || return 2
618 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
619 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
622 run_test 21h "drop open request and close reply while close and open are both in flight"
624 # bug 3462 - multiple MDC requests
629 do_facet mds "lctl set_param fail_loc=0x80000115"
634 multiop $f1 msu || return 1
637 do_facet mds "lctl set_param fail_loc=0"
639 wait $close_pid || return 2
640 rm -rf $f2 || return 4
642 run_test 22 "drop close request and do mknod"
645 multiop_bg_pause $DIR/$tfile O_c || return 1
647 # give a chance for open
651 drop_request "kill -USR1 $pid"
654 wait $pid || return 1
657 run_test 23 "client hang when close a file after mds crash"
659 test_24() { # bug 11710 details correct fsync() behavior
660 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
663 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
665 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
668 kill -USR1 $MULTI_PID
671 lctl set_param fail_loc=0x0
673 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
675 run_test 24 "fsync error (should return error)"
677 wait_client_evicted () {
680 local varsvc=${facet}_svc
682 wait_update $(facet_host $facet) "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" $((exports - 1)) $3
685 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
686 # this test can only run from a client on a separate node.
687 remote_ost || { skip "local OST" && return 0; }
688 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
689 remote_mds || { skip "local MDS" && return 0; }
691 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
692 skip "mgs and ost1 are at the same node"
696 check_timeout || return 1
698 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
700 echo starting with $OST_NEXP OST exports
701 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
702 do_facet client lctl set_param fail_loc=0x505
703 # evictor takes up to 2.25x to evict. But if there's a
704 # race to start the evictor from various obds, the loser
705 # might have to wait for the next ping.
708 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 2 + TIMEOUT * 3 / 4))
710 do_facet client lctl set_param fail_loc=0x0
712 [ $rc -eq 0 ] || error "client not evicted from OST"
714 run_test 26a "evict dead exports"
716 test_26b() { # bug 10140 - evict dead exports by pinger
717 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
719 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
720 skip "mgs and ost1 are at the same node"
724 check_timeout || return 1
726 zconf_mount `hostname` $MOUNT2 ||
727 { error "Failed to mount $MOUNT2"; return 2; }
728 sleep 1 # wait connections being established
730 local dev=$(get_mds_mdt_device_proc_path)
731 local MDS_NEXP=$(do_facet mds lctl get_param -n $dev.${mds_svc}.num_exports | cut -d' ' -f2)
732 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
734 echo starting with $OST_NEXP OST and $MDS_NEXP MDS exports
736 #force umount a client; exports should get evicted
737 zconf_umount `hostname` $MOUNT2 -f
739 # PING_INTERVAL max(obd_timeout / 4, 1U)
740 # PING_EVICT_TIMEOUT (PING_INTERVAL * 6)
742 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
743 # But if there's a race to start the evictor from various obds,
744 # the loser might have to wait for the next ping.
745 # = 9 * PING_INTERVAL + PING_INTERVAL
746 # = 10 PING_INTERVAL = 10 obd_timeout / 4 = 2.5 obd_timeout
747 # let's wait $((TIMEOUT * 3)) # bug 19887
749 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 3)) || \
750 error "Client was not evicted by ost" rc=1
751 wait_client_evicted mds $MDS_NEXP $((TIMEOUT * 3)) || \
752 error "Client was not evicted by mds"
754 run_test 26b "evict dead exports"
758 writemany -q -a $DIR/$tdir/$tfile 0 5 &
761 local save_FAILURE_MODE=$FAILURE_MODE
764 #define OBD_FAIL_OSC_SHUTDOWN 0x407
765 do_facet mds lctl set_param fail_loc=0x80000407
766 # need to wait for reconnect
767 echo -n waiting for fail_loc
768 while [ $(do_facet mds lctl get_param -n fail_loc) -eq -2147482617 ]; do
772 do_facet mds lctl get_param -n fail_loc
775 kill -USR1 $CLIENT_PID
778 FAILURE_MODE=$save_FAILURE_MODE
780 run_test 27 "fail LOV while using OSC's"
782 test_28() { # bug 6086 - error adding new clients
783 do_facet client mcreate $DIR/$tfile || return 1
784 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
785 #define OBD_FAIL_MDS_ADD_CLIENT 0x12f
786 do_facet mds lctl set_param fail_loc=0x8000012f
787 # fail once (evicted), reconnect fail (fail_loc), ok
788 client_up || client_up || client_up || error "reconnect failed"
790 fail mds # verify MDS last_rcvd can be loaded
792 run_test 28 "handle error adding new clients (bug 6086)"
797 lctl set_param debug="-dlmtrace -ha"
798 # put a load of file creates/writes/deletes
799 writemany -q $DIR/$tdir/$tfile 0 5 &
801 echo writemany pid $CLIENT_PID
804 $LCTL mark "$TESTNAME fail mds 1"
806 # wait for client to reconnect to MDS
808 $LCTL mark "$TESTNAME fail mds 2"
811 $LCTL mark "$TESTNAME fail mds 3"
813 # client process should see no problems even though MDS went down
815 kill -USR1 $CLIENT_PID
818 echo writemany returned $rc
819 #these may fail because of eviction due to slow AST response.
821 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
823 run_test 50 "failover MDS under load"
827 # put a load of file creates/writes/deletes
828 writemany -q $DIR/$tdir/$tfile 0 5 &
833 # failover at various points during recovery
834 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
835 echo will failover at $SEQ
838 echo failover in $i sec
840 $LCTL mark "$TESTNAME fail mds $i"
843 # client process should see no problems even though MDS went down
844 # and recovery was interrupted
846 kill -USR1 $CLIENT_PID
849 echo writemany returned $rc
850 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
852 run_test 51 "failover MDS during recovery"
855 do_facet client "mkdir -p $DIR/$tdir"
856 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
858 echo writemany pid $CLIENT_PID
861 $LCTL mark "$TESTNAME fail ost $1"
864 wait $CLIENT_PID || rc=$?
865 # active client process should see an EIO for down OST
866 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
867 # but timing or failover setup may allow success
868 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
869 echo "writemany returned $rc"
874 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
879 [ $rc -ne 0 ] && { return $rc; }
880 # wait for client to reconnect to OST
884 [ $rc -ne 0 ] && { return $rc; }
891 run_test 52 "failover OST under load"
893 # test of open reconstruct
896 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
899 run_test 53 "touch: drop rep"
902 zconf_mount `hostname` $MOUNT2
906 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
909 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
910 [ x"$ERROR" == x ] || error "back in time occured"
912 run_test 54 "back in time"
914 # bug 11330 - liblustre application death during I/O locks up OST
916 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
920 # first dd should be finished quickly
921 lfs setstripe $DIR/$tdir/$tfile-1 -c 1 -i 0
922 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
925 echo "step1: testing ......"
927 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
929 if [ $count -gt 64 ]; then
930 error "dd should be finished!"
934 echo "(dd_pid=$DDPID, time=$count)successful"
936 lfs setstripe $DIR/$tdir/$tfile-2 -c 1 -i 0
937 #define OBD_FAIL_OST_DROP_REQ 0x21d
938 do_facet ost1 lctl set_param fail_loc=0x0000021d
939 # second dd will be never finished
940 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
943 echo "step2: testing ......"
944 while [ $count -le 64 ]; do
945 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
946 if [ -z $dd_name ]; then
948 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
949 error "dd shouldn't be finished!"
954 echo "(dd_pid=$DDPID, time=$count)successful"
956 #Recover fail_loc and dd will finish soon
957 do_facet ost1 lctl set_param fail_loc=0
959 echo "step3: testing ......"
961 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
963 if [ $count -gt 500 ]; then
964 error "dd should be finished!"
968 echo "(dd_pid=$DDPID, time=$count)successful"
972 run_test 55 "ost_brw_read/write drops timed-out read/write request"
974 test_56() { # b=11277
975 #define OBD_FAIL_MDS_RESEND 0x136
977 do_facet mds lctl set_param fail_loc=0x80000136
979 do_facet mds lctl set_param fail_loc=0
982 run_test 56 "do not allow reconnect to busy exports"
985 # no oscs means no client or mdt
986 while lctl get_param osc.*.* > /dev/null 2>&1; do
987 : # loop until proc file is removed
991 test_57() { # bug 10866
995 #define OBD_FAIL_LPROC_REMOVE 0xB00
996 lctl set_param fail_loc=0x80000B00
997 zconf_umount `hostname` $DIR
998 lctl set_param fail_loc=0x80000B00
1001 lctl set_param fail_loc=0
1003 do_facet client "df $DIR"
1005 run_test 57 "read procfs entries causes kernel crash"
1007 test_58() { # bug 11546
1008 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
1011 lctl set_param fail_loc=0x80000801
1012 cp $DIR/$tfile /dev/null &
1015 lctl set_param fail_loc=0
1016 drop_bl_callback rm -f $DIR/$tfile
1018 do_facet client "df $DIR"
1020 run_test 58 "Eviction in the middle of open RPC reply processing"
1022 test_59() { # bug 10589
1023 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
1024 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
1025 lctl set_param fail_loc=0x311
1026 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
1027 [ $? = 0 ] || error "dd write failed"
1028 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
1029 lctl set_param fail_loc=0
1031 zconf_umount `hostname` $MOUNT2 -f
1032 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
1033 [ $? = 0 ] || error "dd read failed"
1034 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
1035 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
1037 run_test 59 "Read cancel race on client eviction"
1042 local mdtosc=$(get_mdtosc_proc_path ${ost1_svc})
1043 local cflags=osc.$mdtosc.connect_flags
1044 do_facet mds "lctl get_param -n $cflags |grep -q skip_orphan"
1045 [ $? -ne 0 ] && skip "don't have skip orphan feature" && return
1047 mkdir -p $DIR/d61 || error "mkdir dir $DIR/d61 failed"
1048 # Set the default stripe of $DIR/d61 to put the files to ost1
1049 $LFS setstripe -c 1 --index 0 $DIR/d61
1052 createmany -o $DIR/d61/$tfile-%d 10
1053 local oid=`do_facet ost1 "lctl get_param -n obdfilter.${ost1_svc}.last_id"`
1057 touch $DIR/d61/$tfile
1058 local id=`$LFS getstripe $DIR/d61/$tfile | awk '($1 ~ 0 && $2 ~ /^[1-9]+/) {print $2}'`
1059 [ $id -le $oid ] && error "the orphan objid was reused, failed"
1064 run_test 61 "Verify to not reuse orphan objects - bug 17485"
1066 equals_msg `basename $0`: test complete, cleaning up
1067 check_and_cleanup_lustre
1068 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true