6 ALWAYS_EXCEPT="52 $RECOVERY_SMALL_EXCEPT"
8 # also long tests: 19, 21a, 21e, 21f, 23, 27
10 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17 26b 50 51 57"
12 #PTLDEBUG=${PTLDEBUG:--1}
13 LUSTRE=${LUSTRE:-`dirname $0`/..}
14 . $LUSTRE/tests/test-framework.sh
16 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
20 # Allow us to override the setup if we already have a mounted system by
21 # setting SETUP=" " and CLEANUP=" "
23 CLEANUP=${CLEANUP:-""}
25 cleanup_and_setup_lustre
26 rm -rf $DIR/[df][0-9]*
29 drop_request "mcreate $MOUNT/1" || return 1
30 drop_reint_reply "mcreate $MOUNT/2" || return 2
32 run_test 1 "mcreate: drop req, drop rep"
35 drop_request "tchmod 111 $MOUNT/2" || return 1
36 drop_reint_reply "tchmod 666 $MOUNT/2" || return 2
38 run_test 2 "chmod: drop req, drop rep"
41 drop_request "statone $MOUNT/2" || return 1
42 drop_reply "statone $MOUNT/2" || return 2
44 run_test 3 "stat: drop req, drop rep"
46 SAMPLE_NAME=recovery-small.junk
47 SAMPLE_FILE=$TMP/$SAMPLE_NAME
48 # make this big, else test 9 doesn't wait for bulk -- bz 5595
49 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
52 do_facet client "cp $SAMPLE_FILE $MOUNT/$SAMPLE_NAME" || return 1
53 drop_request "cat $MOUNT/$SAMPLE_NAME > /dev/null" || return 2
54 drop_reply "cat $MOUNT/$SAMPLE_NAME > /dev/null" || return 3
56 run_test 4 "open: drop req, drop rep"
59 drop_request "mv $MOUNT/$SAMPLE_NAME $MOUNT/renamed" || return 1
60 drop_reint_reply "mv $MOUNT/renamed $MOUNT/renamed-again" || return 2
61 do_facet client "checkstat -v $MOUNT/renamed-again" || return 3
63 run_test 5 "rename: drop req, drop rep"
65 [ ! -e $MOUNT/renamed-again ] && cp $SAMPLE_FILE $MOUNT/renamed-again
67 drop_request "mlink $MOUNT/renamed-again $MOUNT/link1" || return 1
68 drop_reint_reply "mlink $MOUNT/renamed-again $MOUNT/link2" || return 2
70 run_test 6 "link: drop req, drop rep"
72 [ ! -e $MOUNT/link1 ] && mlink $MOUNT/renamed-again $MOUNT/link1
73 [ ! -e $MOUNT/link2 ] && mlink $MOUNT/renamed-again $MOUNT/link2
75 drop_request "munlink $MOUNT/link1" || return 1
76 drop_reint_reply "munlink $MOUNT/link2" || return 2
78 run_test 7 "unlink: drop req, drop rep"
82 drop_reint_reply "touch $MOUNT/$tfile" || return 1
84 run_test 8 "touch: drop rep (bug 1423)"
86 SAMPLE_FILE=$TMP/recovery-small.junk
87 dd if=/dev/urandom of=$SAMPLE_FILE bs=1M count=4
91 pause_bulk "cp /etc/profile $MOUNT/$tfile" || return 1
92 do_facet client "cp $SAMPLE_FILE $MOUNT/${tfile}.2" || return 2
93 do_facet client "sync"
94 do_facet client "rm $MOUNT/$tfile $MOUNT/${tfile}.2" || return 3
96 run_test 9 "pause bulk on OST (bug 1420)"
100 do_facet client mcreate $MOUNT/$tfile || return 1
101 drop_bl_callback "chmod 0777 $MOUNT/$tfile" || echo "evicted as expected"
102 # wait for the mds to evict the client
103 #echo "sleep $(($TIMEOUT*2))"
104 #sleep $(($TIMEOUT*2))
105 do_facet client touch $MOUNT/$tfile || echo "touch failed, evicted"
106 do_facet client checkstat -v -p 0777 $MOUNT/$tfile || return 3
107 do_facet client "munlink $MOUNT/$tfile"
109 run_test 10 "finish request on server after client eviction (bug 1521)"
112 # wake up a thread waiting for completion after eviction
114 do_facet client multiop $MOUNT/$tfile Ow || return 1
115 do_facet client multiop $MOUNT/$tfile or || return 2
119 do_facet client multiop $MOUNT/$tfile or || return 3
120 drop_bl_callback multiop $MOUNT/$tfile Ow || echo "evicted as expected"
122 do_facet client munlink $MOUNT/$tfile || return 4
124 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
128 $LCTL mark multiop $MOUNT/$tfile OS_c
129 do_facet mds "sysctl -w lustre.fail_loc=0x115"
130 clear_failloc mds $((TIMEOUT * 2)) &
131 multiop $MOUNT/$tfile OS_c &
133 #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 "sysctl -w lustre.fail_loc=0x80000104"
148 ls $MOUNT/readdir || return 3
149 do_facet mds "sysctl -w lustre.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 "sysctl -w lustre.fail_loc=0x80000106"
160 ls $MOUNT/readdir || return 1
161 do_facet mds "sysctl -w lustre.fail_loc=0"
163 run_test 14 "mdc_readpage resend test (bug 1138)"
166 do_facet mds "sysctl -w lustre.fail_loc=0x80000128"
167 touch $DIR/$tfile && return 1
170 run_test 15 "failed open (-ENOMEM)"
172 READ_AHEAD=`cat $LPROC/llite/*/max_read_ahead_mb | head -n 1`
174 for f in $LPROC/llite/*/max_read_ahead_mb; do
180 for f in $LPROC/llite/*/max_read_ahead_mb; do
181 echo $READ_AHEAD > $f
186 do_facet client cp $SAMPLE_FILE $MOUNT
190 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
191 do_facet ost1 sysctl -w lustre.fail_loc=0x80000504
193 # OST bulk will time out here, client resends
194 do_facet client "cmp $SAMPLE_FILE $MOUNT/${SAMPLE_FILE##*/}" || return 1
195 do_facet ost1 sysctl -w lustre.fail_loc=0
196 # give recovery a chance to finish (shouldn't take long)
198 do_facet client "cmp $SAMPLE_FILE $MOUNT/${SAMPLE_FILE##*/}" || return 2
201 run_test 16 "timeout bulk put, don't evict client (2732)"
204 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
205 local at_max=$(do_facet ost1 "find /sys/ -name at_max")
206 [ -z "$at_max" ] && skip "missing /sys/.../at_max" && return 0
207 OST_AT_MAX=$(do_facet ost1 "cat $at_max")
208 do_facet ost1 "echo $TIMEOUT >> $at_max"
210 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
211 # OST bulk will time out here, client retries
212 do_facet ost1 sysctl -w lustre.fail_loc=0x80000503
213 # need to ensure we send an RPC
214 do_facet client cp $SAMPLE_FILE $DIR/$tfile
217 # with AT, client will wait adaptive_max*factor+net_latency before
218 # expiring the req, hopefully timeout*2 is enough
219 sleep $(($TIMEOUT*2))
221 do_facet ost1 sysctl -w lustre.fail_loc=0
222 do_facet client "df $DIR"
223 # expect cmp to succeed, client resent bulk
224 do_facet client "cmp $SAMPLE_FILE $DIR/$tfile" || return 3
225 do_facet client "rm $DIR/$tfile" || return 4
226 do_facet ost1 "echo $OST_AT_MAX >> $at_max"
229 run_test 17 "timeout bulk get, don't evict client (2732)"
232 [ -z ${ost2_svc} ] && skip "needs 2 osts" && return 0
234 do_facet client mkdir -p $MOUNT/$tdir
235 f=$MOUNT/$tdir/$tfile
238 pgcache_empty || return 1
241 lfs setstripe $f -s $((128 * 1024)) -i 1 -c 1
243 do_facet client cp $SAMPLE_FILE $f
245 local osc2dev=`grep ${ost2_svc}-osc- $LPROC/devices | awk '{print $1}'`
246 $LCTL --device $osc2dev deactivate || return 3
247 # my understanding is that there should be nothing in the page
248 # cache after the client reconnects?
250 pgcache_empty || rc=2
251 $LCTL --device $osc2dev activate
255 run_test 18a "manual ost invalidate clears page cache immediately"
258 do_facet client mkdir -p $MOUNT/$tdir
259 f=$MOUNT/$tdir/$tfile
260 f2=$MOUNT/$tdir/${tfile}-2
263 pgcache_empty || return 1
265 # shouldn't have to set stripe size of count==1
266 lfs setstripe $f -s $((128 * 1024)) -i 0 -c 1
267 lfs setstripe $f2 -s $((128 * 1024)) -i 0 -c 1
269 do_facet client cp $SAMPLE_FILE $f
273 df $MOUNT > /dev/null 2>&1
275 # my understanding is that there should be nothing in the page
276 # cache after the client reconnects?
278 pgcache_empty || rc=2
282 run_test 18b "eviction and reconnect clears page cache (2766)"
286 do_facet client mcreate $f || return 1
287 drop_ldlm_cancel "chmod 0777 $f" || echo "evicted as expected"
289 do_facet client checkstat -v -p 0777 $f || echo evicted
290 # let the client reconnect
292 do_facet client "munlink $f"
294 run_test 19a "test expired_lock_main on mds (2867)"
298 do_facet client multiop $f Ow || return 1
299 do_facet client multiop $f or || return 2
303 do_facet client multiop $f or || return 3
304 drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
306 do_facet client munlink $f || return 4
308 run_test 19b "test expired_lock_main on ost (2867)"
310 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
312 multiop $DIR/$tdir/${tfile} O_wc &
316 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
317 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
318 kill -USR1 $MULTI_PID
321 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
323 run_test 20a "ldlm_handle_enqueue error (should return error)"
325 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
327 touch $DIR/$tdir/${tfile}
329 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
330 do_facet ost1 sysctl -w lustre.fail_loc=0x80000308
331 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
332 error "didn't fail open enqueue" || true
334 run_test 20b "ldlm_handle_enqueue error (should return error)"
337 mkdir -p $DIR/$tdir-1
338 mkdir -p $DIR/$tdir-2
339 multiop $DIR/$tdir-1/f O_c &
342 do_facet mds "sysctl -w lustre.fail_loc=0x80000129"
343 multiop $DIR/$tdir-2/f Oc &
346 do_facet mds "sysctl -w lustre.fail_loc=0"
348 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
349 kill -USR1 $close_pid
351 wait $close_pid || return 1
352 wait $open_pid || return 2
353 do_facet mds "sysctl -w lustre.fail_loc=0"
355 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
356 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
360 run_test 21a "drop close request while close and open are both in flight"
363 mkdir -p $DIR/$tdir-1
364 mkdir -p $DIR/$tdir-2
365 multiop $DIR/$tdir-1/f O_c &
368 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
369 mcreate $DIR/$tdir-2/f &
372 do_facet mds "sysctl -w lustre.fail_loc=0"
374 kill -USR1 $close_pid
376 wait $close_pid || return 1
377 wait $open_pid || return 3
379 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
380 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
383 run_test 21b "drop open request while close and open are both in flight"
386 mkdir -p $DIR/$tdir-1
387 mkdir -p $DIR/$tdir-2
388 multiop $DIR/$tdir-1/f O_c &
391 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
392 mcreate $DIR/$tdir-2/f &
395 do_facet mds "sysctl -w lustre.fail_loc=0"
397 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
398 kill -USR1 $close_pid
400 wait $close_pid || return 1
401 wait $open_pid || return 2
403 do_facet mds "sysctl -w lustre.fail_loc=0"
405 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
406 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
409 run_test 21c "drop both request while close and open are both in flight"
412 mkdir -p $DIR/$tdir-1
413 mkdir -p $DIR/$tdir-2
414 multiop $DIR/$tdir-1/f O_c &
417 do_facet mds "sysctl -w lustre.fail_loc=0x80000129"
418 multiop $DIR/$tdir-2/f Oc &
420 do_facet mds "sysctl -w lustre.fail_loc=0"
422 do_facet mds "sysctl -w lustre.fail_loc=0x80000122"
425 wait $pid || return 1
426 do_facet mds "sysctl -w lustre.fail_loc=0"
428 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
429 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
433 run_test 21d "drop close reply while close and open are both in flight"
436 mkdir -p $DIR/$tdir-1
437 mkdir -p $DIR/$tdir-2
438 multiop $DIR/$tdir-1/f O_c &
441 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
442 touch $DIR/$tdir-2/f &
444 do_facet mds "sysctl -w lustre.fail_loc=0"
448 wait $pid || return 1
451 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
452 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
455 run_test 21e "drop open reply while close and open are both in flight"
458 mkdir -p $DIR/$tdir-1
459 mkdir -p $DIR/$tdir-2
460 multiop $DIR/$tdir-1/f O_c &
463 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
464 touch $DIR/$tdir-2/f &
466 do_facet mds "sysctl -w lustre.fail_loc=0"
468 do_facet mds "sysctl -w lustre.fail_loc=0x80000122"
471 wait $pid || return 1
472 do_facet mds "sysctl -w lustre.fail_loc=0"
474 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
475 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
478 run_test 21f "drop both reply while close and open are both in flight"
481 mkdir -p $DIR/$tdir-1
482 mkdir -p $DIR/$tdir-2
483 multiop $DIR/$tdir-1/f O_c &
486 do_facet mds "sysctl -w lustre.fail_loc=0x80000119"
487 touch $DIR/$tdir-2/f &
489 do_facet mds "sysctl -w lustre.fail_loc=0"
491 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
494 wait $pid || return 1
495 do_facet mds "sysctl -w lustre.fail_loc=0"
497 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
498 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
501 run_test 21g "drop open reply and close request while close and open are both in flight"
504 mkdir -p $DIR/$tdir-1
505 mkdir -p $DIR/$tdir-2
506 multiop $DIR/$tdir-1/f O_c &
509 do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
510 touch $DIR/$tdir-2/f &
513 do_facet mds "sysctl -w lustre.fail_loc=0"
515 do_facet mds "sysctl -w lustre.fail_loc=0x80000122"
518 wait $pid || return 1
519 do_facet mds "sysctl -w lustre.fail_loc=0"
521 wait $touch_pid || return 2
523 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
524 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
527 run_test 21h "drop open request and close reply while close and open are both in flight"
529 # bug 3462 - multiple MDC requests
534 do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
539 multiop $f1 msu || return 1
542 do_facet mds "sysctl -w lustre.fail_loc=0"
544 wait $close_pid || return 2
545 rm -rf $f2 || return 4
547 run_test 22 "drop close request and do mknod"
550 multiop $DIR/$tfile O_c &
552 # give a chance for open
556 drop_request "kill -USR1 $pid"
559 wait $pid || return 1
562 run_test 23 "client hang when close a file after mds crash"
564 test_24() { # bug 2248 - eviction fails writeback but app doesn't see it
567 multiop $DIR/$tdir/$tfile Owy_wyc &
572 kill -USR1 $MULTI_PID
575 sysctl -w lustre.fail_loc=0x0
577 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
579 run_test 24 "fsync error (should return error)"
581 test_26() { # bug 5921 - evict dead exports by pinger
582 # this test can only run from a client on a separate node.
583 remote_ost || skip "local OST" && return
584 remote_mds || skip "local MDS" && return
585 OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports
586 OST_EXP="`do_facet ost1 cat $OST_FILE`"
587 OST_NEXP1=`echo $OST_EXP | cut -d' ' -f2`
588 echo starting with $OST_NEXP1 OST exports
589 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
590 do_facet client sysctl -w lustre.fail_loc=0x505
591 # evictor takes up to 2.25x to evict. But if there's a
592 # race to start the evictor from various obds, the loser
593 # might have to wait for the next ping.
594 echo Waiting for $(($TIMEOUT * 4)) secs
595 sleep $(($TIMEOUT * 4))
596 OST_EXP="`do_facet ost1 cat $OST_FILE`"
597 OST_NEXP2=`echo $OST_EXP | cut -d' ' -f2`
598 echo ending with $OST_NEXP2 OST exports
599 do_facet client sysctl -w lustre.fail_loc=0x0
600 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted"
603 run_test 26 "evict dead exports"
605 test_26b() { # bug 10140 - evict dead exports by pinger
607 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
608 MDS_FILE=$LPROC/mds/${mds_svc}/num_exports
609 MDS_NEXP1="`do_facet mds cat $MDS_FILE | cut -d' ' -f2`"
610 OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports
611 OST_NEXP1="`do_facet ost1 cat $OST_FILE | cut -d' ' -f2`"
612 echo starting with $OST_NEXP1 OST and $MDS_NEXP1 MDS exports
613 #force umount a client; exports should get evicted
614 zconf_umount `hostname` $MOUNT2 -f
615 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
616 # But if there's a race to start the evictor from various obds,
617 # the loser might have to wait for the next ping.
618 echo Waiting for $(($TIMEOUT * 8)) secs
619 sleep $(($TIMEOUT * 8))
620 OST_NEXP2="`do_facet ost1 cat $OST_FILE | cut -d' ' -f2`"
621 MDS_NEXP2="`do_facet mds cat $MDS_FILE | cut -d' ' -f2`"
622 echo ending with $OST_NEXP2 OST and $MDS_NEXP2 MDS exports
623 [ $OST_NEXP1 -le $OST_NEXP2 ] && error "client not evicted from OST"
624 [ $MDS_NEXP1 -le $MDS_NEXP2 ] && error "client not evicted from MDS"
627 run_test 26b "evict dead exports"
630 remote_mds && { skip "remote MDS" && return 0; }
632 writemany -q -a $DIR/$tdir/$tfile 0 5 &
637 #define OBD_FAIL_OSC_SHUTDOWN 0x407
638 sysctl -w lustre.fail_loc=0x80000407
639 # need to wait for reconnect
640 echo -n waiting for fail_loc
641 while [ `sysctl -n lustre.fail_loc` -eq -2147482617 ]; do
647 kill -USR1 $CLIENT_PID
651 run_test 27 "fail LOV while using OSC's"
653 test_28() { # bug 6086 - error adding new clients
654 do_facet client mcreate $MOUNT/$tfile || return 1
655 drop_bl_callback "chmod 0777 $MOUNT/$tfile" ||echo "evicted as expected"
656 #define OBD_FAIL_MDS_ADD_CLIENT 0x12f
657 do_facet mds sysctl -w lustre.fail_loc=0x8000012f
658 # fail once (evicted), reconnect fail (fail_loc), ok
659 df || (sleep 1; df) || (sleep 1; df) || error "reconnect failed"
661 fail mds # verify MDS last_rcvd can be loaded
663 run_test 28 "handle error adding new clients (bug 6086)"
668 sysctl -w lnet.debug="-dlmtrace -ha"
669 # put a load of file creates/writes/deletes
670 writemany -q $DIR/$tdir/$tfile 0 5 &
672 echo writemany pid $CLIENT_PID
675 $LCTL mark "$TESTNAME fail mds 1"
677 # wait for client to reconnect to MDS
679 $LCTL mark "$TESTNAME fail mds 2"
682 $LCTL mark "$TESTNAME fail mds 3"
684 # client process should see no problems even though MDS went down
686 kill -USR1 $CLIENT_PID
689 echo writemany returned $rc
690 #these may fail because of eviction due to slow AST response.
692 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
694 run_test 50 "failover MDS under load"
698 # put a load of file creates/writes/deletes
699 writemany -q $DIR/$tdir/$tfile 0 5 &
704 # failover at various points during recovery
705 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
706 echo will failover at $SEQ
709 echo failover in $i sec
711 $LCTL mark "$TESTNAME fail mds $i"
714 # client process should see no problems even though MDS went down
715 # and recovery was interrupted
717 kill -USR1 $CLIENT_PID
720 echo writemany returned $rc
721 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
723 run_test 51 "failover MDS during recovery"
726 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
728 echo writemany pid $CLIENT_PID
731 $LCTL mark "$TESTNAME fail ost $1"
734 wait $CLIENT_PID || rc=$?
735 # active client process should see an EIO for down OST
736 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
737 # but timing or failover setup may allow success
738 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
739 echo "writemany returned $rc"
747 [ $rc -ne 0 ] && { return $rc; }
748 # wait for client to reconnect to OST
752 [ $rc -ne 0 ] && { return $rc; }
759 run_test 52 "failover OST under load"
761 # test of open reconstruct
764 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
767 run_test 53 "touch: drop rep"
770 zconf_mount `hostname` $MOUNT2
774 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
777 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
778 [ x"$ERROR" == x ] || error "back in time occured"
780 run_test 54 "back in time"
782 # bug 11330 - liblustre application death during I/O locks up OST
784 remote_ost && { skip "remote OST" && return 0; }
788 # first dd should be finished quickly
789 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
792 echo "step1: testing ......"
794 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
796 if [ $count -gt 64 ]; then
797 error "dd should be finished!"
801 echo "(dd_pid=$DDPID, time=$count)successful"
803 #define OBD_FAIL_OST_DROP_REQ 0x21d
804 do_facet ost sysctl -w lustre.fail_loc=0x0000021d
805 # second dd will be never finished
806 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
809 echo "step2: testing ......"
810 while [ $count -le 64 ]; do
811 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
812 if [ -z $dd_name ]; then
814 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
815 error "dd shouldn't be finished!"
820 echo "(dd_pid=$DDPID, time=$count)successful"
822 #Recover fail_loc and dd will finish soon
823 do_facet ost sysctl -w lustre.fail_loc=0
825 echo "step3: testing ......"
827 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
829 if [ $count -gt 500 ]; then
830 error "dd should be finished!"
834 echo "(dd_pid=$DDPID, time=$count)successful"
838 run_test 55 "ost_brw_read/write drops timed-out read/write request"
840 test_56() { # b=11277
841 #define OBD_FAIL_MDS_RESEND 0x136
843 do_facet mds sysctl -w lustre.fail_loc=0x80000136
845 do_facet mds sysctl -w lustre.fail_loc=0
848 run_test 56 "do not allow reconnect to busy exports"
851 # no oscs means no client or mdt
852 while [ -e $LPROC/osc ]; do
853 for f in `find $LPROC -type f`; do
854 cat $f > /dev/null 2>&1
859 test_57() { # bug 10866
863 #define OBD_FAIL_LPROC_REMOVE 0xB00
864 sysctl -w lustre.fail_loc=0x80000B00
865 zconf_umount `hostname` $DIR
866 sysctl -w lustre.fail_loc=0x80000B00
869 sysctl -w lustre.fail_loc=0
871 do_facet client "df $DIR"
873 run_test 57 "read procfs entries causes kernel crash"
875 test_58() { # bug 11546
876 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
879 sysctl -w lustre.fail_loc=0x80000801
880 cp $MOUNT/$tfile /dev/null &
883 sysctl -w lustre.fail_loc=0
884 drop_bl_callback rm -f $MOUNT/$tfile
886 do_facet client "df $DIR"
888 run_test 58 "Eviction in the middle of open RPC reply processing"
890 test_59() { # bug 10589
891 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
892 sysctl -w lustre.fail_loc=0x311
893 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1 | awk -F '+' '/out/ {print $1}')
894 sysctl -w lustre.fail_loc=0
896 zconf_umount `hostname` $DIR2 -f
897 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1 | awk -F '+' '/in/ {print $1}')
898 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
900 run_test 59 "Read cancel race on client eviction"
902 equals_msg `basename $0`: test complete, cleaning up
903 check_and_cleanup_lustre
904 [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG || true