Whamcloud - gitweb
LU-3529 lod: create striped directory
[fs/lustre-release.git] / lustre / tests / recovery-small.sh
1 #!/bin/bash
2
3 set -e
4
5 #         bug  5493  LU2034
6 ALWAYS_EXCEPT="52    60      $RECOVERY_SMALL_EXCEPT"
7
8 export MULTIOP=${MULTIOP:-multiop}
9 PTLDEBUG=${PTLDEBUG:--1}
10 LUSTRE=${LUSTRE:-`dirname $0`/..}
11 . $LUSTRE/tests/test-framework.sh
12 init_test_env $@
13 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
14 init_logging
15
16 require_dsh_mds || exit 0
17
18 # also long tests: 19, 21a, 21e, 21f, 23, 27
19 #                                   1  2.5  2.5    4    4          (min)"
20 [ "$SLOW" = "no" ] && EXCEPT_SLOW="17  26a  26b    50   51     57"
21
22 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
23 # bug number for skipped test:        LU-2194 LU-2547
24         ALWAYS_EXCEPT="$ALWAYS_EXCEPT 19b     24a 24b"
25
26 build_test_filter
27
28 # Allow us to override the setup if we already have a mounted system by
29 # setting SETUP=" " and CLEANUP=" "
30 SETUP=${SETUP:-""}
31 CLEANUP=${CLEANUP:-""}
32
33 check_and_setup_lustre
34
35 assert_DIR
36 rm -rf $DIR/d[0-9]* $DIR/f.${TESTSUITE}*
37
38 test_1() {
39         local f1="$DIR/$tfile"
40         local f2="$DIR/$tfile.2"
41
42         drop_request "mcreate $f1" ||
43                 error_noexit "create '$f1': drop req"
44
45         drop_reint_reply "mcreate $f2" ||
46                 error_noexit "create '$f2': drop rep"
47
48         drop_request "tchmod 111 $f2" ||
49                 error_noexit "chmod '$f2': drop req"
50
51         drop_reint_reply "tchmod 666 $f2" ||
52                 error_noexit "chmod '$f2': drop rep"
53
54         drop_request "statone $f2" ||
55                 error_noexit "stat '$f2': drop req"
56
57         drop_reply  "statone $f2" ||
58                 error_noexit "stat '$f2': drop rep"
59 }
60 run_test 1 "create, chmod, stat: drop req, drop rep"
61
62 test_4() {
63         local t=$DIR/$tfile
64         do_facet_create_file client $t 10K ||
65                 error_noexit "Create file $t"
66
67         drop_request "cat $t > /dev/null" ||
68                 error_noexit "Open request for $t file"
69
70         drop_reply "cat $t > /dev/null" ||
71                 error_noexit "Open replay for $t file"
72 }
73 run_test 4 "open: drop req, drop rep"
74
75 test_5() {
76         local T=$DIR/$tfile
77         local R="$T-renamed"
78         local RR="$T-renamed-again"
79         do_facet_create_file client $T 10K ||
80                 error_noexit "Create file $T"
81
82         drop_request "mv $T $R" ||
83                 error_noexit "Rename $T"
84
85         drop_reint_reply "mv $R $RR" ||
86                 error_noexit "Failed rename replay on $R"
87
88         do_facet client "checkstat -v $RR" ||
89                 error_noexit "checkstat error on $RR"
90
91         do_facet client "rm $RR" ||
92                 error_noexit "Can't remove file $RR"
93 }
94 run_test 5 "rename: drop req, drop rep"
95
96 test_6() {
97         local T=$DIR/$tfile
98         local LINK1=$DIR/$tfile.link1
99         local LINK2=$DIR/$tfile.link2
100
101         do_facet_create_file client $T 10K ||
102                 error_noexit "Create file $T"
103
104         drop_request "mlink $T $LINK1" ||
105                 error_noexit "mlink request for $T"
106
107         drop_reint_reply "mlink $T $LINK2" ||
108                 error_noexit "mlink reply for $T"
109
110         drop_request "munlink $LINK1" ||
111                 error_noexit "munlink request for $T"
112
113         drop_reint_reply "munlink $LINK2" ||
114                 error_noexit "munlink reply for $T"
115
116         do_facet client "rm $T" ||
117                 error_noexit "Can't remove file $T"
118 }
119 run_test 6 "link, unlink: drop req, drop rep"
120
121 #bug 1423
122 test_8() {
123     drop_reint_reply "touch $DIR/$tfile"    || return 1
124 }
125 run_test 8 "touch: drop rep (bug 1423)"
126
127 #bug 1420
128 test_9() {
129         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
130
131         local t1=${tfile}.1
132         local t2=${tfile}.2
133         do_facet_random_file client $TMP/$tfile 1K ||
134                 error_noexit "Create random file $TMP/$tfile"
135         # make this big, else test 9 doesn't wait for bulk -- bz 5595
136         do_facet_create_file client $TMP/$t1 4M ||
137                 error_noexit "Create file $TMP/$t1"
138         do_facet client "cp $TMP/$t1 $DIR/$t1" ||
139                 error_noexit "Can't copy to $DIR/$t1 file"
140         pause_bulk "cp $TMP/$tfile $DIR/$tfile" ||
141                 error_noexit "Can't pause_bulk copy"
142         do_facet client "cp $TMP/$t1 $DIR/$t2" ||
143                 error_noexit "Can't copy file"
144         do_facet client "sync"
145         do_facet client "rm $DIR/$tfile $DIR/$t2 $DIR/$t1" ||
146                 error_noexit "Can't remove files"
147         do_facet client "rm $TMP/$t1 $TMP/$tfile"
148 }
149 run_test 9 "pause bulk on OST (bug 1420)"
150
151 #bug 1521
152 test_10() {
153         do_facet client mcreate $DIR/$tfile ||
154                 { error "mcreate failed: $?"; return 1; }
155         drop_bl_callback "chmod 0777 $DIR/$tfile"  || echo "evicted as expected"
156         # wait for the mds to evict the client
157         #echo "sleep $(($TIMEOUT*2))"
158         #sleep $(($TIMEOUT*2))
159         do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
160         do_facet client checkstat -v -p 0777 $DIR/$tfile ||
161                 { error "client checkstat failed: $?"; return 3; }
162         do_facet client "munlink $DIR/$tfile"
163         # allow recovery to complete
164         client_up || client_up || sleep $TIMEOUT
165 }
166 run_test 10 "finish request on server after client eviction (bug 1521)"
167
168 #bug 2460
169 # wake up a thread waiting for completion after eviction
170 test_11(){
171         do_facet client $MULTIOP $DIR/$tfile Ow  ||
172                 { error "multiop write failed: $?"; return 1; }
173         do_facet client $MULTIOP $DIR/$tfile or  ||
174                 { error "multiop read failed: $?"; return 2; }
175
176         cancel_lru_locks osc
177
178         do_facet client $MULTIOP $DIR/$tfile or  ||
179                 { error "multiop read failed: $?"; return 3; }
180         drop_bl_callback $MULTIOP $DIR/$tfile Ow || echo "evicted as expected"
181
182         do_facet client munlink $DIR/$tfile ||
183                 { error "munlink failed: $?"; return 4; }
184         # allow recovery to complete
185         client_up || client_up || sleep $TIMEOUT
186 }
187 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
188
189 #b=2494
190 test_12(){
191         $LCTL mark $MULTIOP $DIR/$tfile OS_c
192         do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
193         clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
194         multiop_bg_pause $DIR/$tfile OS_c ||
195                 { error "multiop failed: $?"; return 1; }
196         PID=$!
197 #define OBD_FAIL_MDS_CLOSE_NET           0x115
198         kill -USR1 $PID
199         echo "waiting for multiop $PID"
200         wait $PID || { error "wait for multiop faile: $?"; return 2; }
201         do_facet client munlink $DIR/$tfile ||
202                 { error "client munlink failed: $?"; return 3; }
203         # allow recovery to complete
204         client_up || client_up || sleep $TIMEOUT
205 }
206 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
207
208 # Bug 113, check that readdir lost recv timeout works.
209 test_13() {
210         mkdir -p $DIR/$tdir || { error "mkdir failed: $?"; return 1; }
211         touch $DIR/$tdir/newentry || { error "touch failed: $?"; return 2; }
212 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
213         do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
214         ls $DIR/$tdir || { error "ls failed: $?"; return 3; }
215         do_facet $SINGLEMDS "lctl set_param fail_loc=0"
216         rm -rf $DIR/$tdir || { error "remove test dir failed: $?"; return 4; }
217 }
218 run_test 13 "mdc_readpage restart test (bug 1138)"
219
220 # Bug 113, check that readdir lost send timeout works.
221 test_14() {
222     mkdir -p $DIR/$tdir
223     touch $DIR/$tdir/newentry
224 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
225     do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
226     ls $DIR/$tdir || return 1
227     do_facet $SINGLEMDS "lctl set_param fail_loc=0"
228 }
229 run_test 14 "mdc_readpage resend test (bug 1138)"
230
231 test_15() {
232     do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
233     touch $DIR/$tfile && return 1
234     return 0
235 }
236 run_test 15 "failed open (-ENOMEM)"
237
238 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
239 stop_read_ahead() {
240    lctl set_param -n llite.*.max_read_ahead_mb 0
241 }
242
243 start_read_ahead() {
244    lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
245 }
246
247 test_16() {
248         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
249
250         do_facet_random_file client $TMP/$tfile 100K ||
251                 { error_noexit "Create random file $TMP/$T" ; return 0; }
252         do_facet client "cp $TMP/$tfile $DIR/$tfile" ||
253                 { error_noexit "Copy to $DIR/$tfile file" ; return 0; }
254         sync
255         stop_read_ahead
256
257 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
258         do_facet ost1 "lctl set_param fail_loc=0x80000504"
259         cancel_lru_locks osc
260         # OST bulk will time out here, client resends
261         do_facet client "cmp $TMP/$tfile $DIR/$tfile" || return 1
262         do_facet ost1 lctl set_param fail_loc=0
263         # give recovery a chance to finish (shouldn't take long)
264         sleep $TIMEOUT
265         do_facet client "cmp $TMP/$tfile $DIR/$tfile" || return 2
266         start_read_ahead
267 }
268 run_test 16 "timeout bulk put, don't evict client (2732)"
269
270 test_17() {
271     local at_max_saved=0
272
273     remote_ost_nodsh && skip "remote OST with nodsh" && return 0
274
275         local SAMPLE_FILE=$TMP/$tfile
276         do_facet_random_file client $SAMPLE_FILE 20K ||
277                 { error_noexit "Create random file $SAMPLE_FILE" ; return 0; }
278
279     # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
280     if at_is_enabled; then
281         at_max_saved=$(at_max_get ost1)
282         at_max_set $TIMEOUT ost1
283     fi
284
285     # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
286     # OST bulk will time out here, client retries
287     do_facet ost1 lctl set_param fail_loc=0x80000503
288     # need to ensure we send an RPC
289     do_facet client cp $SAMPLE_FILE $DIR/$tfile
290     sync
291
292     # with AT, client will wait adaptive_max*factor+net_latency before
293     # expiring the req, hopefully timeout*2 is enough
294     sleep $(($TIMEOUT*2))
295
296     do_facet ost1 lctl set_param fail_loc=0
297     do_facet client "df $DIR"
298     # expect cmp to succeed, client resent bulk
299     do_facet client "cmp $SAMPLE_FILE $DIR/$tfile" || return 3
300     do_facet client "rm $DIR/$tfile" || return 4
301     [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved ost1
302     return 0
303 }
304 run_test 17 "timeout bulk get, don't evict client (2732)"
305
306 test_18a() {
307     [ -z ${ost2_svc} ] && skip_env "needs 2 osts" && return 0
308
309         do_facet_create_file client $TMP/$tfile 20K ||
310                 { error_noexit "Create file $TMP/$tfile" ; return 0; }
311
312     do_facet client mkdir -p $DIR/$tdir
313     f=$DIR/$tdir/$tfile
314
315     cancel_lru_locks osc
316     pgcache_empty || return 1
317
318     # 1 stripe on ost2
319     $LFS setstripe -i 1 -c 1 $f
320     stripe_index=$($LFS getstripe -i $f)
321     if [ $stripe_index -ne 1 ]; then
322         $LFS getstripe $f
323         error "$f: stripe_index $stripe_index != 1" && return
324     fi
325
326     do_facet client cp $TMP/$tfile $f
327     sync
328     local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
329     $LCTL --device $osc2dev deactivate || return 3
330     # my understanding is that there should be nothing in the page
331     # cache after the client reconnects?     
332     rc=0
333     pgcache_empty || rc=2
334     $LCTL --device $osc2dev activate
335     rm -f $f
336     return $rc
337 }
338 run_test 18a "manual ost invalidate clears page cache immediately"
339
340 test_18b() {
341     remote_ost_nodsh && skip "remote OST with nodsh" && return 0
342
343         do_facet_create_file client $TMP/$tfile 20K ||
344                 { error_noexit "Create file $TMP/$tfile" ; return 0; }
345
346     do_facet client mkdir -p $DIR/$tdir
347     f=$DIR/$tdir/$tfile
348
349     cancel_lru_locks osc
350     pgcache_empty || return 1
351
352     $LFS setstripe -i 0 -c 1 $f
353     stripe_index=$($LFS getstripe -i $f)
354     if [ $stripe_index -ne 0 ]; then
355         $LFS getstripe $f
356         error "$f: stripe_index $stripe_index != 0" && return
357     fi
358
359     do_facet client cp $TMP/$tfile $f
360     sync
361     ost_evict_client
362     # allow recovery to complete
363     sleep $((TIMEOUT + 2))
364     # my understanding is that there should be nothing in the page
365     # cache after the client reconnects?     
366     rc=0
367     pgcache_empty || rc=2
368     rm -f $f
369     return $rc
370 }
371 run_test 18b "eviction and reconnect clears page cache (2766)"
372
373 test_18c() {
374     remote_ost_nodsh && skip "remote OST with nodsh" && return 0
375
376         do_facet_create_file client $TMP/$tfile 20K ||
377                 { error_noexit "Create file $TMP/$tfile" ; return 0; }
378
379     do_facet client mkdir -p $DIR/$tdir
380     f=$DIR/$tdir/$tfile
381
382     cancel_lru_locks osc
383     pgcache_empty || return 1
384
385     $LFS setstripe -i 0 -c 1 $f
386     stripe_index=$($LFS getstripe -i $f)
387     if [ $stripe_index -ne 0 ]; then
388         $LFS getstripe $f
389         error "$f: stripe_index $stripe_index != 0" && return
390     fi
391
392     do_facet client cp $TMP/$tfile $f
393     sync
394     ost_evict_client
395
396     # OBD_FAIL_OST_CONNECT_NET2
397     # lost reply to connect request
398     do_facet ost1 lctl set_param fail_loc=0x80000225
399     # force reconnect
400     sleep 1
401     df $MOUNT > /dev/null 2>&1
402     sleep 2
403     # my understanding is that there should be nothing in the page
404     # cache after the client reconnects?     
405     rc=0
406     pgcache_empty || rc=2
407     rm -f $f
408     return $rc
409 }
410 run_test 18c "Dropped connect reply after eviction handing (14755)"
411
412 test_19a() {
413         local BEFORE=`date +%s`
414         local EVICT
415
416         mount_client $DIR2 || error "failed to mount $DIR2"
417
418         # cancel cached locks from OST to avoid eviction from it
419         cancel_lru_locks osc
420
421         do_facet client "stat $DIR > /dev/null"  ||
422                 error "failed to stat $DIR: $?"
423         drop_ldlm_cancel "chmod 0777 $DIR2" ||
424                 error "failed to chmod $DIR2"
425
426         umount_client $DIR2
427
428         # let the client reconnect
429         client_reconnect
430         EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state | \
431             awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
432
433         [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
434                 (do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state;
435                     error "no eviction: $EVICT before:$BEFORE")
436 }
437 run_test 19a "test expired_lock_main on mds (2867)"
438
439 test_19b() {
440         local BEFORE=`date +%s`
441         local EVICT
442
443         mount_client $DIR2 || error "failed to mount $DIR2: $?"
444
445         # cancel cached locks from MDT to avoid eviction from it
446         cancel_lru_locks mdc
447
448         do_facet client $MULTIOP $DIR/$tfile Ow ||
449                 error "failed to run multiop: $?"
450         drop_ldlm_cancel $MULTIOP $DIR2/$tfile Ow ||
451                 error "failed to ldlm_cancel: $?"
452
453         umount_client $DIR2 || error "failed to unmount $DIR2: $?"
454         do_facet client munlink $DIR/$tfile ||
455                 error "failed to unlink $DIR/$tfile: $?"
456
457         # let the client reconnect
458         client_reconnect
459         EVICT=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state | \
460             awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
461
462         [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
463                 (do_facet client $LCTL get_param osc.$FSNAME-OST*.state;
464                     error "no eviction: $EVICT before:$BEFORE")
465 }
466 run_test 19b "test expired_lock_main on ost (2867)"
467
468 test_19c() {
469         local BEFORE=`date +%s`
470
471         mount_client $DIR2
472         $LCTL set_param ldlm.namespaces.*.early_lock_cancel=0
473
474         mkdir -p $DIR1/$tfile
475         stat $DIR1/$tfile
476
477 #define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x516
478         do_facet mds $LCTL set_param fail_loc=0x80000516
479
480         touch $DIR2/$tfile/file1 &
481         PID1=$!
482         # let touch to get blocked on the server
483         sleep 2
484
485         wait $PID1
486         $LCTL set_param ldlm.namespaces.*.early_lock_cancel=1
487         umount_client $DIR2
488
489         # let the client reconnect
490         sleep 5
491         EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
492            awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
493
494         [ -z "$EVICT" ] || [[ $EVICT -le $BEFORE ]] || error "eviction happened"
495 }
496 run_test 19c "check reconnect and lock resend do not trigger expired_lock_main"
497
498 test_20a() {    # bug 2983 - ldlm_handle_enqueue cleanup
499         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
500
501         mkdir -p $DIR/$tdir
502         $LFS setstripe -i 0 -c 1 $DIR/$tdir/${tfile}
503         multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
504         MULTI_PID=$!
505         cancel_lru_locks osc
506 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
507         do_facet ost1 lctl set_param fail_loc=0x80000308
508         kill -USR1 $MULTI_PID
509         wait $MULTI_PID
510         rc=$?
511         [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
512 }
513 run_test 20a "ldlm_handle_enqueue error (should return error)" 
514
515 test_20b() {    # bug 2986 - ldlm_handle_enqueue error during open
516         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
517
518         mkdir -p $DIR/$tdir
519         $LFS setstripe -i 0 -c 1 $DIR/$tdir/${tfile}
520         cancel_lru_locks osc
521 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
522         do_facet ost1 lctl set_param fail_loc=0x80000308
523         dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
524                 error "didn't fail open enqueue" || true
525 }
526 run_test 20b "ldlm_handle_enqueue error (should return error)"
527
528 test_21a() {
529        mkdir -p $DIR/$tdir-1
530        mkdir -p $DIR/$tdir-2
531        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
532        close_pid=$!
533
534        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
535        $MULTIOP $DIR/$tdir-2/f Oc &
536        open_pid=$!
537        sleep 1
538        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
539
540        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
541        kill -USR1 $close_pid
542        cancel_lru_locks mdc
543        wait $close_pid || return 1
544        wait $open_pid || return 2
545        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
546
547        $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
548        $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
549
550        rm -rf $DIR/$tdir-*
551 }
552 run_test 21a "drop close request while close and open are both in flight"
553
554 test_21b() {
555        mkdir -p $DIR/$tdir-1
556        mkdir -p $DIR/$tdir-2
557        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
558        close_pid=$!
559
560        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
561        mcreate $DIR/$tdir-2/f &
562        open_pid=$!
563        sleep 1
564        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
565
566        kill -USR1 $close_pid
567        cancel_lru_locks mdc
568        wait $close_pid || return 1
569        wait $open_pid || return 3
570
571        $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
572        $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
573        rm -rf $DIR/$tdir-*
574 }
575 run_test 21b "drop open request while close and open are both in flight"
576
577 test_21c() {
578        mkdir -p $DIR/$tdir-1
579        mkdir -p $DIR/$tdir-2
580        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
581        close_pid=$!
582
583        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
584        mcreate $DIR/$tdir-2/f &
585        open_pid=$!
586        sleep 3
587        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
588
589        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
590        kill -USR1 $close_pid
591        cancel_lru_locks mdc
592        wait $close_pid || return 1
593        wait $open_pid || return 2
594
595        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
596
597        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
598        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
599        rm -rf $DIR/$tdir-*
600 }
601 run_test 21c "drop both request while close and open are both in flight"
602
603 test_21d() {
604        mkdir -p $DIR/$tdir-1
605        mkdir -p $DIR/$tdir-2
606        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
607        pid=$!
608
609        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
610        $MULTIOP $DIR/$tdir-2/f Oc &
611        sleep 1
612        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
613
614        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
615        kill -USR1 $pid
616        cancel_lru_locks mdc
617        wait $pid || return 1
618        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
619
620        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
621        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
622
623        rm -rf $DIR/$tdir-*
624 }
625 run_test 21d "drop close reply while close and open are both in flight"
626
627 test_21e() {
628        mkdir -p $DIR/$tdir-1
629        mkdir -p $DIR/$tdir-2
630        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
631        pid=$!
632
633        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
634        touch $DIR/$tdir-2/f &
635        sleep 1
636        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
637
638        kill -USR1 $pid
639        cancel_lru_locks mdc
640        wait $pid || return 1
641
642        sleep $TIMEOUT
643        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
644        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
645        rm -rf $DIR/$tdir-*
646 }
647 run_test 21e "drop open reply while close and open are both in flight"
648
649 test_21f() {
650        mkdir -p $DIR/$tdir-1
651        mkdir -p $DIR/$tdir-2
652        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
653        pid=$!
654
655        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
656        touch $DIR/$tdir-2/f &
657        sleep 1
658        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
659
660        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
661        kill -USR1 $pid
662        cancel_lru_locks mdc
663        wait $pid || return 1
664        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
665
666        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
667        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
668        rm -rf $DIR/$tdir-*
669 }
670 run_test 21f "drop both reply while close and open are both in flight"
671
672 test_21g() {
673        mkdir -p $DIR/$tdir-1
674        mkdir -p $DIR/$tdir-2
675        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
676        pid=$!
677
678        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
679        touch $DIR/$tdir-2/f &
680        sleep 1
681        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
682
683        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
684        kill -USR1 $pid
685        cancel_lru_locks mdc
686        wait $pid || return 1
687        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
688
689        $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
690        $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
691        rm -rf $DIR/$tdir-*
692 }
693 run_test 21g "drop open reply and close request while close and open are both in flight"
694
695 test_21h() {
696        mkdir -p $DIR/$tdir-1
697        mkdir -p $DIR/$tdir-2
698        multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
699        pid=$!
700
701        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
702        touch $DIR/$tdir-2/f &
703        touch_pid=$!
704        sleep 1
705        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
706
707        do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
708        cancel_lru_locks mdc
709        kill -USR1 $pid
710        wait $pid || return 1
711        do_facet $SINGLEMDS "lctl set_param fail_loc=0"
712
713        wait $touch_pid || return 2
714
715        $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
716        $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
717        rm -rf $DIR/$tdir-*
718 }
719 run_test 21h "drop open request and close reply while close and open are both in flight"
720
721 # bug 3462 - multiple MDC requests
722 test_22() {
723     f1=$DIR/${tfile}-1
724     f2=$DIR/${tfile}-2
725     
726     do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
727     $MULTIOP $f2 Oc &
728     close_pid=$!
729
730     sleep 1
731     $MULTIOP $f1 msu || return 1
732
733     cancel_lru_locks mdc
734     do_facet $SINGLEMDS "lctl set_param fail_loc=0"
735
736     wait $close_pid || return 2
737     rm -rf $f2 || return 4
738 }
739 run_test 22 "drop close request and do mknod"
740
741 test_23() { #b=4561
742     multiop_bg_pause $DIR/$tfile O_c || return 1
743     pid=$!
744     # give a chance for open
745     sleep 5
746
747     # try the close
748     drop_request "kill -USR1 $pid"
749
750     fail $SINGLEMDS
751     wait $pid || return 1
752     return 0
753 }
754 run_test 23 "client hang when close a file after mds crash"
755
756 test_24a() { # bug 11710 details correct fsync() behavior
757         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
758
759         mkdir -p $DIR/$tdir
760         $LFS setstripe -i 0 -c 1 $DIR/$tdir
761         cancel_lru_locks osc
762         multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
763         MULTI_PID=$!
764         ost_evict_client
765         kill -USR1 $MULTI_PID
766         wait $MULTI_PID
767         rc=$?
768         lctl set_param fail_loc=0x0
769         client_reconnect
770         [ $rc -eq 0 ] &&
771                 error_ignore bz5494 "multiop didn't fail fsync: rc $rc" || true
772 }
773 run_test 24a "fsync error (should return error)"
774
775 wait_client_evicted () {
776         local facet=$1
777         local exports=$2
778         local varsvc=${facet}_svc
779
780         wait_update $(facet_active_host $facet) \
781                 "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" \
782                 $((exports - 1)) $3
783 }
784
785 test_24b() {
786         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
787
788         dmesg -c > /dev/null
789         mkdir -p $DIR/$tdir
790         lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
791         cancel_lru_locks osc
792         multiop_bg_pause $DIR/$tdir/$tfile-1 Ow8192_yc ||
793                 error "mulitop Ow8192_yc failed"
794
795         MULTI_PID1=$!
796         multiop_bg_pause $DIR/$tdir/$tfile-2 Ow8192_c ||
797                 error "mulitop Ow8192_c failed"
798
799         MULTI_PID2=$!
800         ost_evict_client
801
802         kill -USR1 $MULTI_PID1
803         wait $MULTI_PID1
804         rc1=$?
805         kill -USR1 $MULTI_PID2
806         wait $MULTI_PID2
807         rc2=$?
808         lctl set_param fail_loc=0x0
809         client_reconnect
810         [ $rc1 -eq 0 -o $rc2 -eq 0 ] &&
811         error_ignore bz5494 "multiop didn't fail fsync: $rc1 or close: $rc2" ||
812                 true
813
814         dmesg | grep "dirty page discard:" ||
815                 error "no discarded dirty page found!"
816 }
817 run_test 24b "test dirty page discard due to client eviction"
818
819 test_26a() {      # was test_26 bug 5921 - evict dead exports by pinger
820 # this test can only run from a client on a separate node.
821         remote_ost || { skip "local OST" && return 0; }
822         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
823         remote_mds || { skip "local MDS" && return 0; }
824
825         if [ $(facet_host mgs) = $(facet_host ost1) ]; then
826                 skip "msg and ost1 are at the same node"
827                 return 0
828         fi
829
830         check_timeout || return 1
831
832         local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
833
834         echo starting with $OST_NEXP OST exports
835 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
836         do_facet client lctl set_param fail_loc=0x505
837         # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
838         # But if there's a race to start the evictor from various obds,
839         # the loser might have to wait for the next ping.
840
841         local rc=0
842         wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 2 + TIMEOUT * 3 / 4))
843         rc=$?
844         do_facet client lctl set_param fail_loc=0x0
845         [ $rc -eq 0 ] || error "client not evicted from OST"
846 }
847 run_test 26a "evict dead exports"
848
849 test_26b() {      # bug 10140 - evict dead exports by pinger
850         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
851
852         if [ $(facet_host mgs) = $(facet_host ost1) ]; then
853                 skip "msg and ost1 are at the same node"
854                 return 0
855         fi
856
857         check_timeout || return 1
858         clients_up
859         zconf_mount `hostname` $MOUNT2 ||
860                 { error "Failed to mount $MOUNT2"; return 2; }
861         sleep 1 # wait connections being established
862
863         local MDS_NEXP=$(do_facet $SINGLEMDS lctl get_param -n mdt.${mds1_svc}.num_exports | cut -d' ' -f2)
864         local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
865
866         echo starting with $OST_NEXP OST and $MDS_NEXP MDS exports
867
868         zconf_umount `hostname` $MOUNT2 -f
869
870         # PING_INTERVAL max(obd_timeout / 4, 1U)
871         # PING_EVICT_TIMEOUT (PING_INTERVAL * 6)
872
873         # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.  
874         # But if there's a race to start the evictor from various obds, 
875         # the loser might have to wait for the next ping.
876         # = 9 * PING_INTERVAL + PING_INTERVAL
877         # = 10 PING_INTERVAL = 10 obd_timeout / 4 = 2.5 obd_timeout
878         # let's wait $((TIMEOUT * 3)) # bug 19887
879         local rc=0
880         wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 3)) || \
881                 error "Client was not evicted by ost" rc=1
882         wait_client_evicted $SINGLEMDS $MDS_NEXP $((TIMEOUT * 3)) || \
883                 error "Client was not evicted by mds"
884 }
885 run_test 26b "evict dead exports"
886
887 test_27() {
888         mkdir -p $DIR/$tdir
889         writemany -q -a $DIR/$tdir/$tfile 0 5 &
890         CLIENT_PID=$!
891         sleep 1
892         local save_FAILURE_MODE=$FAILURE_MODE
893         FAILURE_MODE="SOFT"
894         facet_failover $SINGLEMDS
895 #define OBD_FAIL_OSC_SHUTDOWN            0x407
896         do_facet $SINGLEMDS lctl set_param fail_loc=0x80000407
897         # need to wait for reconnect
898         echo waiting for fail_loc
899         wait_update_facet $SINGLEMDS "lctl get_param -n fail_loc" "-2147482617"
900         facet_failover $SINGLEMDS
901         #no crashes allowed!
902         kill -USR1 $CLIENT_PID
903         wait $CLIENT_PID 
904         true
905         FAILURE_MODE=$save_FAILURE_MODE
906 }
907 run_test 27 "fail LOV while using OSC's"
908
909 test_28() {      # bug 6086 - error adding new clients
910         do_facet client mcreate $DIR/$tfile       || return 1
911         drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
912         #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
913         do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
914         # fail once (evicted), reconnect fail (fail_loc), ok
915         client_up || (sleep 10; client_up) || (sleep 10; client_up) || error "reconnect failed"
916         rm -f $DIR/$tfile
917         fail $SINGLEMDS         # verify MDS last_rcvd can be loaded
918 }
919 run_test 28 "handle error adding new clients (bug 6086)"
920
921 test_29a() { # bug 22273 - error adding new clients
922         #define OBD_FAIL_TGT_CLIENT_ADD 0x711
923         do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000711"
924         # fail abort so client will be new again
925         fail_abort $SINGLEMDS
926         client_up || error "reconnect failed"
927         wait_osc_import_state $SINGLEMDS ost FULL
928         return 0
929 }
930 run_test 29a "error adding new clients doesn't cause LBUG (bug 22273)"
931
932 test_29b() { # bug 22273 - error adding new clients
933         #define OBD_FAIL_TGT_CLIENT_ADD 0x711
934         do_facet ost1 "lctl set_param fail_loc=0x80000711"
935         # fail abort so client will be new again
936         fail_abort ost1
937         client_up || error "reconnect failed"
938         return 0
939 }
940 run_test 29b "error adding new clients doesn't cause LBUG (bug 22273)"
941
942 test_50() {
943         mkdir -p $DIR/$tdir
944         # put a load of file creates/writes/deletes
945         writemany -q $DIR/$tdir/$tfile 0 5 &
946         CLIENT_PID=$!
947         echo writemany pid $CLIENT_PID
948         sleep 10
949         FAILURE_MODE="SOFT"
950         fail $SINGLEMDS
951         # wait for client to reconnect to MDS
952         sleep 60
953         fail $SINGLEMDS
954         sleep 60
955         fail $SINGLEMDS
956         # client process should see no problems even though MDS went down
957         sleep $TIMEOUT
958         kill -USR1 $CLIENT_PID
959         wait $CLIENT_PID 
960         rc=$?
961         echo writemany returned $rc
962         #these may fail because of eviction due to slow AST response.
963         [ $rc -eq 0 ] ||
964                 error_ignore bz13652 "writemany returned rc $rc" || true
965 }
966 run_test 50 "failover MDS under load"
967
968 test_51() {
969         #define OBD_FAIL_MDS_SYNC_CAPA_SL                    0x1310
970         do_facet ost1 lctl set_param fail_loc=0x00001310
971
972         mkdir -p $DIR/$tdir
973         # put a load of file creates/writes/deletes
974         writemany -q $DIR/$tdir/$tfile 0 5 &
975         CLIENT_PID=$!
976         sleep 1
977         FAILURE_MODE="SOFT"
978         facet_failover $SINGLEMDS
979         # failover at various points during recovery
980         SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
981         echo will failover at $SEQ
982         for i in $SEQ
983         do
984                 #echo failover in $i sec
985                 log "test_$testnum: failover in $i sec"
986                 sleep $i
987                 facet_failover $SINGLEMDS
988         done
989         # client process should see no problems even though MDS went down
990         # and recovery was interrupted
991         sleep $TIMEOUT
992         kill -USR1 $CLIENT_PID
993         wait $CLIENT_PID
994         rc=$?
995         echo writemany returned $rc
996         [ $rc -eq 0 ] ||
997                 error_ignore bz13652 "writemany returned rc $rc" || true
998 }
999 run_test 51 "failover MDS during recovery"
1000
1001 test_52_guts() {
1002         do_facet client "mkdir -p $DIR/$tdir"
1003         do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
1004         CLIENT_PID=$!
1005         echo writemany pid $CLIENT_PID
1006         sleep 10
1007         FAILURE_MODE="SOFT"
1008         fail ost1
1009         rc=0
1010         wait $CLIENT_PID || rc=$?
1011         # active client process should see an EIO for down OST
1012         [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
1013         # but timing or failover setup may allow success
1014         [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
1015         echo "writemany returned $rc"
1016         return $rc
1017 }
1018
1019 test_52() {
1020         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1021
1022         mkdir -p $DIR/$tdir
1023         test_52_guts
1024         rc=$?
1025         [ $rc -ne 0 ] && { return $rc; }
1026         # wait for client to reconnect to OST
1027         sleep 30
1028         test_52_guts
1029         rc=$?
1030         [ $rc -ne 0 ] && { return $rc; }
1031         sleep 30
1032         test_52_guts
1033         rc=$?
1034         client_reconnect
1035         #return $rc
1036 }
1037 run_test 52 "failover OST under load"
1038
1039 # test of open reconstruct
1040 test_53() {
1041         touch $DIR/$tfile
1042         drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
1043                 return 2
1044 }
1045 run_test 53 "touch: drop rep"
1046
1047 test_54() {
1048         zconf_mount `hostname` $MOUNT2
1049         touch $DIR/$tfile
1050         touch $DIR2/$tfile.1
1051         sleep 10
1052         cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
1053         fail $SINGLEMDS
1054         umount $MOUNT2
1055         ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
1056         [ x"$ERROR" == x ] || error "back in time occured"
1057 }
1058 run_test 54 "back in time"
1059
1060 # bug 11330 - liblustre application death during I/O locks up OST
1061 test_55() {
1062         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1063
1064         mkdir -p $DIR/$tdir
1065
1066         # Minimum pass speed is 2MBps
1067         local ddtimeout=64
1068         # LU-2887/LU-3089 - set min pass speed to 500KBps
1069         [ "$(facet_fstype ost1)" = "zfs" ] && ddtimeout=256
1070
1071         # first dd should be finished quickly
1072         $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile-1
1073         dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
1074         DDPID=$!
1075         count=0
1076         echo  "step1: testing ......"
1077         while kill -0 $DDPID 2> /dev/null; do
1078                 let count++
1079                 if [ $count -gt $ddtimeout ]; then
1080                         error "dd should be finished!"
1081                 fi
1082                 sleep 1
1083         done
1084         echo "(dd_pid=$DDPID, time=$count)successful"
1085
1086         $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile-2
1087         #define OBD_FAIL_OST_DROP_REQ            0x21d
1088         do_facet ost1 lctl set_param fail_loc=0x0000021d
1089         # second dd will be never finished
1090         dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
1091         DDPID=$!
1092         count=0
1093         echo  "step2: testing ......"
1094         while [ $count -le $ddtimeout ]; do
1095                 if ! kill -0 $DDPID 2> /dev/null; then
1096                         ls -l $DIR/$tdir
1097                         error "dd shouldn't be finished! (time=$count)"
1098                 fi
1099                 let count++
1100                 sleep 1
1101         done
1102         echo "(dd_pid=$DDPID, time=$count)successful"
1103
1104         #Recover fail_loc and dd will finish soon
1105         do_facet ost1 lctl set_param fail_loc=0
1106         count=0
1107         echo  "step3: testing ......"
1108         while kill -0 $DDPID 2> /dev/null; do
1109                 let count++
1110                 if [ $count -gt $((ddtimeout + 440)) ]; then
1111                         error "dd should be finished!"
1112                 fi
1113                 sleep 1
1114         done
1115         echo "(dd_pid=$DDPID, time=$count)successful"
1116
1117         rm -rf $DIR/$tdir
1118 }
1119 run_test 55 "ost_brw_read/write drops timed-out read/write request"
1120
1121 test_56() { # b=11277
1122 #define OBD_FAIL_MDS_RESEND      0x136
1123         touch $DIR/$tfile
1124         do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
1125         stat $DIR/$tfile
1126         do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1127         rm -f $DIR/$tfile
1128 }
1129 run_test 56 "do not allow reconnect to busy exports"
1130
1131 test_57_helper() {
1132         # no oscs means no client or mdt 
1133         while lctl get_param osc.*.* > /dev/null 2>&1; do
1134                 : # loop until proc file is removed
1135         done
1136 }
1137
1138 test_57() { # bug 10866
1139         test_57_helper &
1140         pid=$!
1141         sleep 1
1142 #define OBD_FAIL_LPROC_REMOVE            0xB00
1143         lctl set_param fail_loc=0x80000B00
1144         zconf_umount `hostname` $DIR
1145         lctl set_param fail_loc=0x80000B00
1146         fail_abort $SINGLEMDS
1147         kill -9 $pid
1148         lctl set_param fail_loc=0
1149         mount_client $DIR
1150         do_facet client "df $DIR"
1151 }
1152 run_test 57 "read procfs entries causes kernel crash"
1153
1154 test_58() { # bug 11546
1155 #define OBD_FAIL_MDC_ENQUEUE_PAUSE        0x801
1156         touch $DIR/$tfile
1157         ls -la $DIR/$tfile
1158         lctl set_param fail_loc=0x80000801
1159         cp $DIR/$tfile /dev/null &
1160         pid=$!
1161         sleep 1
1162         lctl set_param fail_loc=0
1163         drop_bl_callback rm -f $DIR/$tfile
1164         wait $pid
1165         # the first 'df' could tigger the eviction caused by
1166         # 'drop_bl_callback', and it's normal case.
1167         # but the next 'df' should return successfully.
1168         do_facet client "df $DIR" || do_facet client "df $DIR"
1169 }
1170 run_test 58 "Eviction in the middle of open RPC reply processing"
1171
1172 test_59() { # bug 10589
1173         zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
1174         echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
1175 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE  0x311
1176         lctl set_param fail_loc=0x311
1177         writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
1178         [ $? = 0 ] || error "dd write failed"
1179         writes=$(echo $writes | awk  -F '+' '/out/ {print $1}')
1180         lctl set_param fail_loc=0
1181         sync
1182         zconf_umount `hostname` $MOUNT2 -f
1183         reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
1184         [ $? = 0 ] || error "dd read failed"
1185         reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
1186         [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
1187 }
1188 run_test 59 "Read cancel race on client eviction"
1189
1190 err17935 () {
1191         # we assume that all md changes are in the MDT0 changelog
1192         if [ $MDSCOUNT -gt 1 ]; then
1193                 error_ignore bz17935 $*
1194         else
1195                 error $*
1196         fi
1197 }
1198
1199 test_60() {
1200         MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
1201             awk '{gsub(/_UUID/,""); print $1}' | head -1)
1202
1203         NUM_FILES=15000
1204         mkdir -p $DIR/$tdir
1205
1206         # Register (and start) changelog
1207         USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
1208         echo "Registered as $MDT0 changelog user $USER"
1209
1210         # Generate a large number of changelog entries
1211         createmany -o $DIR/$tdir/$tfile $NUM_FILES
1212         sync
1213         sleep 5
1214
1215         # Unlink files in the background
1216         unlinkmany $DIR/$tdir/$tfile $NUM_FILES &
1217         CLIENT_PID=$!
1218         sleep 1
1219
1220         # Failover the MDS while unlinks are happening
1221         facet_failover $SINGLEMDS
1222
1223         # Wait for unlinkmany to finish
1224         wait $CLIENT_PID
1225
1226         # Check if all the create/unlink events were recorded
1227         # in the changelog
1228         $LFS changelog $MDT0 >> $DIR/$tdir/changelog
1229         local cl_count=$(grep UNLNK $DIR/$tdir/changelog | wc -l)
1230         echo "$cl_count unlinks in $MDT0 changelog"
1231
1232         do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $USER
1233         USERS=$(( $(do_facet $SINGLEMDS lctl get_param -n \
1234             mdd.$MDT0.changelog_users | wc -l) - 2 ))
1235         if [ $USERS -eq 0 ]; then
1236             [ $cl_count -eq $NUM_FILES ] || \
1237                 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1238             # Also make sure we can clear large changelogs
1239             cl_count=$($LFS changelog $FSNAME | wc -l)
1240             [ $cl_count -le 2 ] || \
1241                 error "Changelog not empty: $cl_count entries"
1242         else
1243             # If there are other users, there may be other unlinks in the log
1244             [ $cl_count -ge $NUM_FILES ] || \
1245                 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1246             echo "$USERS other changelog users; can't verify clear"
1247         fi
1248 }
1249 run_test 60 "Add Changelog entries during MDS failover"
1250
1251 test_61()
1252 {
1253         local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0000)
1254         mdtosc=${mdtosc/-MDT*/-MDT\*}
1255         local cflags="osc.$mdtosc.connect_flags"
1256         do_facet $SINGLEMDS "lctl get_param -n $cflags" |grep -q skip_orphan
1257         [ $? -ne 0 ] && skip "don't have skip orphan feature" && return
1258
1259         mkdir -p $DIR/$tdir || error "mkdir dir $DIR/$tdir failed"
1260         # Set the default stripe of $DIR/$tdir to put the files to ost1
1261         $LFS setstripe -c 1 -i 0 $DIR/$tdir
1262
1263         replay_barrier $SINGLEMDS
1264         createmany -o $DIR/$tdir/$tfile-%d 10 
1265         local oid=`do_facet ost1 "lctl get_param -n obdfilter.${ost1_svc}.last_id"`
1266
1267         fail_abort $SINGLEMDS
1268         
1269         touch $DIR/$tdir/$tfile
1270         local id=`$LFS getstripe $DIR/$tdir/$tfile | awk '$1 == 0 { print $2 }'`
1271         [ $id -le $oid ] && error "the orphan objid was reused, failed"
1272
1273         # Cleanup
1274         rm -rf $DIR/$tdir
1275 }
1276 run_test 61 "Verify to not reuse orphan objects - bug 17025"
1277
1278 # test_62 as seen it b2_1 please do not reuse test_62
1279 #test_62()
1280 #{
1281 #       zconf_umount `hostname` $DIR
1282 #       #define OBD_FAIL_PTLRPC_DELAY_IMP_FULL   0x516
1283 #       lctl set_param fail_loc=0x516
1284 #       mount_client $DIR
1285 #}
1286 #run_test 62 "Verify connection flags race - bug LU-1716"
1287
1288 check_cli_ir_state()
1289 {
1290         local NODE=${1:-$HOSTNAME}
1291         local st
1292         st=$(do_node $NODE "lctl get_param mgc.*.ir_state |
1293                             awk '/imperative_recovery:/ { print \\\$2}'")
1294         [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
1295                 error "Error state $st, must be ENABLED or DISABLED"
1296         echo -n $st
1297 }
1298
1299 check_target_ir_state()
1300 {
1301         local target=${1}
1302         local name=${target}_svc
1303         local recovery_proc=obdfilter.${!name}.recovery_status
1304         local st
1305
1306         st=$(do_facet $target "lctl get_param -n $recovery_proc |
1307                                awk '/IR:/{ print \\\$2}'")
1308         [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
1309                 error "Error state $st, must be ENABLED or DISABLED"
1310         echo -n $st
1311 }
1312
1313 set_ir_status()
1314 {
1315         do_facet mgs lctl set_param -n mgs.MGS.live.$FSNAME="state=$1"
1316 }
1317
1318 get_ir_status()
1319 {
1320         local state=$(do_facet mgs "lctl get_param -n mgs.MGS.live.$FSNAME |
1321                                     awk '/state:/{ print \\\$2 }'")
1322         echo -n ${state/,/}
1323 }
1324
1325 nidtbl_version_mgs()
1326 {
1327         local ver=$(do_facet mgs "lctl get_param -n mgs.MGS.live.$FSNAME |
1328                                   awk '/nidtbl_version:/{ print \\\$2 }'")
1329         echo -n $ver
1330 }
1331
1332 # nidtbl_version_client <mds1|client> [node]
1333 nidtbl_version_client()
1334 {
1335         local cli=$1
1336         local node=${2:-$HOSTNAME}
1337
1338         if [ X$cli = Xclient ]; then
1339                 cli=$FSNAME-client
1340         else
1341                 local obdtype=${cli/%[0-9]*/}
1342                 [ $obdtype != mds ] && error "wrong parameters $cli"
1343
1344                 node=$(facet_active_host $cli)
1345                 local t=${cli}_svc
1346                 cli=${!t}
1347         fi
1348
1349         local vers=$(do_node $node "lctl get_param -n mgc.*.ir_state" |
1350                      awk "/$cli/{print \$6}" |sort -u)
1351
1352         # in case there are multiple mounts on the client node
1353         local arr=($vers)
1354         [ ${#arr[@]} -ne 1 ] && error "versions on client node mismatch"
1355         echo -n $vers
1356 }
1357
1358 nidtbl_versions_match()
1359 {
1360         [ $(nidtbl_version_mgs) -eq $(nidtbl_version_client ${1:-client}) ]
1361 }
1362
1363 target_instance_match()
1364 {
1365         local srv=$1
1366         local obdtype
1367         local cliname
1368
1369         obdtype=${srv/%[0-9]*/}
1370         case $obdtype in
1371         mds)
1372                 obdname="mdt"
1373                 cliname="mdc"
1374                 ;;
1375         ost)
1376                 obdname="obdfilter"
1377                 cliname="osc"
1378                 ;;
1379         *)
1380                 error "invalid target type" $srv
1381                 return 1
1382                 ;;
1383         esac
1384
1385         local target=${srv}_svc
1386         local si=$(do_facet $srv lctl get_param -n $obdname.${!target}.instance)
1387         local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import | \
1388                   awk '/instance/{ print $2 }' |head -1)
1389
1390         return $([ $si -eq $ci ])
1391 }
1392
1393 test_100()
1394 {
1395         do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1396                 { skip "MGS without IR support"; return 0; }
1397
1398         # MDT was just restarted in the previous test, make sure everything
1399         # is all set.
1400         local cnt=30
1401         while [ $cnt -gt 0 ]; do
1402                 nidtbl_versions_match && break
1403                 sleep 1
1404                 cnt=$((cnt - 1))
1405         done
1406
1407         # disable IR
1408         set_ir_status disabled
1409
1410         local prev_ver=$(nidtbl_version_client client)
1411
1412         local saved_FAILURE_MODE=$FAILURE_MODE
1413         [ $(facet_host mgs) = $(facet_host ost1) ] && FAILURE_MODE="SOFT"
1414         fail ost1
1415
1416         # valid check
1417         [ $(nidtbl_version_client client) -eq $prev_ver ] ||
1418                 error "version must not change due to IR disabled"
1419         target_instance_match ost1 || error "instance mismatch"
1420
1421         # restore env
1422         set_ir_status full
1423         FAILURE_MODE=$saved_FAILURE_MODE
1424 }
1425 run_test 100 "IR: Make sure normal recovery still works w/o IR"
1426
1427 test_101()
1428 {
1429         do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1430                 { skip "MGS without IR support"; return 0; }
1431
1432         set_ir_status full
1433
1434         local OST1_IMP=$(get_osc_import_name client ost1)
1435
1436         # disable pinger recovery
1437         lctl set_param -n osc.$OST1_IMP.pinger_recov=0
1438
1439         fail ost1
1440
1441         target_instance_match ost1 || error "instance mismatch"
1442         nidtbl_versions_match || error "version must match"
1443
1444         lctl set_param -n osc.$OST1_IMP.pinger_recov=1
1445 }
1446 run_test 101 "IR: Make sure IR works w/o normal recovery"
1447
1448 test_102()
1449 {
1450         do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1451                 { skip "MGS without IR support"; return 0; }
1452
1453         local clients=${CLIENTS:-$HOSTNAME}
1454         local old_version
1455         local new_version
1456         local mgsdev=mgs
1457
1458         set_ir_status full
1459
1460         # let's have a new nidtbl version
1461         fail ost1
1462
1463         # sleep for a while so that clients can see the failure of ost
1464         # it must be MGC_TIMEOUT_MIN_SECONDS + MGC_TIMEOUT_RAND_CENTISEC.
1465         # int mgc_request.c:
1466         # define MGC_TIMEOUT_MIN_SECONDS   5
1467         # define MGC_TIMEOUT_RAND_CENTISEC 0x1ff /* ~500 *
1468         local count=30  # 20 seconds at most
1469         while [ $count -gt 0 ]; do
1470                 nidtbl_versions_match && break
1471                 sleep 1
1472                 count=$((count-1))
1473         done
1474
1475         nidtbl_versions_match || error "nidtbl mismatch"
1476
1477         # get the version #
1478         old_version=$(nidtbl_version_client client)
1479
1480         zconf_umount_clients $clients $MOUNT || error "Cannot umount client"
1481
1482         # restart mgs
1483         combined_mgs_mds && mgsdev=mds1
1484         remount_facet $mgsdev
1485         fail ost1
1486
1487         zconf_mount_clients $clients $MOUNT || error "Cannot mount client"
1488
1489         # check new version
1490         new_version=$(nidtbl_version_client client)
1491         [ $new_version -lt $old_version ] &&
1492                 error "nidtbl version wrong after mgs restarts"
1493         return 0
1494 }
1495 run_test 102 "IR: New client gets updated nidtbl after MGS restart"
1496
1497 test_103()
1498 {
1499         do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1500                 { skip "MGS without IR support"; return 0; }
1501
1502         combined_mgs_mds && skip "mgs and mds on the same target" && return 0
1503
1504         # workaround solution to generate config log on the mds
1505         remount_facet mds1
1506
1507         stop mgs
1508         stop mds1
1509
1510         # We need this test because mds is like a client in IR context.
1511         start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS ||
1512                 error "MDS should start w/o mgs"
1513
1514         # start mgs and remount mds w/ ir
1515         start mgs $(mgsdevname) $MGS_MOUNT_OPTS
1516         clients_up
1517
1518         # remount client so that fsdb will be created on the MGS
1519         umount_client $MOUNT || error "umount failed"
1520         mount_client $MOUNT || error "mount failed"
1521
1522         # sleep 30 seconds so the MDS has a chance to detect MGS restarting
1523         local count=30
1524         while [ $count -gt 0 ]; do
1525                 [ $(nidtbl_version_client mds1) -ne 0 ] && break
1526                 sleep 1
1527                 count=$((count-1))
1528         done
1529
1530         # after a while, mds should be able to reconnect to mgs and fetch
1531         # up-to-date nidtbl version
1532         nidtbl_versions_match mds1 || error "mds nidtbl mismatch"
1533
1534         # reset everything
1535         set_ir_status full
1536 }
1537 run_test 103 "IR: MDS can start w/o MGS and get updated nidtbl later"
1538
1539 test_104()
1540 {
1541         do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1542                 { skip "MGS without IR support"; return 0; }
1543
1544         set_ir_status full
1545
1546         stop ost1
1547         start ost1 $(ostdevname 1) "$OST_MOUNT_OPTS -onoir" ||
1548                 error "OST1 cannot start"
1549         clients_up
1550
1551         local ir_state=$(check_target_ir_state ost1)
1552         [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1553                 error "ir status on ost1 should be DISABLED"
1554 }
1555 run_test 104 "IR: ost can disable IR voluntarily"
1556
1557 test_105()
1558 {
1559         [ -z "$RCLIENTS" ] && skip "Needs multiple clients" && return 0
1560         do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1561                 { skip "MGS without IR support"; return 0; }
1562
1563         set_ir_status full
1564
1565         # get one of the clients from client list
1566         local rcli=$(echo $RCLIENTS |cut -d' ' -f 1)
1567
1568         local old_MOUNTOPT=$MOUNTOPT
1569         MOUNTOPT=${MOUNTOPT},noir
1570         zconf_umount $rcli $MOUNT || error "umount failed"
1571         zconf_mount $rcli $MOUNT || error "mount failed"
1572
1573         # make sure lustre mount at $rcli disabling IR
1574         local ir_state=$(check_cli_ir_state $rcli)
1575         [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1576                 error "IR state must be DISABLED at $rcli"
1577
1578         # Since the client just mounted, its last_rcvd entry is not on disk.
1579         # Send an RPC so exp_need_sync forces last_rcvd to commit this export
1580         # so the client can reconnect during OST recovery (LU-924, LU-1582)
1581         $SETSTRIPE -i 0 $DIR/$tfile
1582         dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 conv=sync
1583
1584         # make sure MGS's state is Partial
1585         [ $(get_ir_status) = "partial" ] || error "MGS IR state must be partial"
1586
1587         fail ost1
1588         # make sure IR on ost1 is DISABLED
1589         local ir_state=$(check_target_ir_state ost1)
1590         [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1591                 error "IR status on ost1 should be DISABLED"
1592
1593         # restore it
1594         MOUNTOPT=$old_MOUNTOPT
1595         zconf_umount $rcli $MOUNT || error "umount failed"
1596         zconf_mount $rcli $MOUNT || error "mount failed"
1597
1598         # make sure MGS's state is full
1599         [ $(get_ir_status) = "full" ] || error "MGS IR status must be full"
1600
1601         fail ost1
1602         # make sure IR on ost1 is ENABLED
1603         local ir_state=$(check_target_ir_state ost1)
1604         [ $ir_state = "ENABLED" -o $ir_state = "ON" ] ||
1605                 error "IR status on ost1 should be ENABLED"
1606
1607         return 0
1608 }
1609 run_test 105 "IR: NON IR clients support"
1610
1611 cleanup_106() {
1612         trap 0
1613         umount_client $DIR2
1614         debugrestore
1615 }
1616
1617 test_106() { # LU-1789
1618         [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.50) ]] ||
1619                 { skip "Need MDS version at least 2.3.50"; return 0; }
1620
1621 #define OBD_FAIL_MDC_LIGHTWEIGHT         0x805
1622         $LCTL set_param fail_loc=0x805
1623
1624         debugsave
1625         trap cleanup_106 EXIT
1626
1627         # enable lightweight flag on mdc connection
1628         mount_client $DIR2
1629
1630         local MDS_NEXP=$(do_facet $SINGLEMDS \
1631                          lctl get_param -n mdt.${mds1_svc}.num_exports |
1632                          cut -d' ' -f2)
1633         $LCTL set_param fail_loc=0
1634
1635         touch $DIR2/$tfile || error "failed to create empty file"
1636         replay_barrier $SINGLEMDS
1637
1638         $LCTL set_param debug=console
1639         $LCTL clear
1640         facet_failover $SINGLEMDS
1641
1642         # lightweight connection must be evicted
1643         touch -c $DIR2/$tfile || true
1644         $LCTL dk $TMP/lustre-log-$TESTNAME.log
1645         evicted=`awk '/This client was evicted by .*MDT0000/ {
1646                                       print;
1647                       }' $TMP/lustre-log-$TESTNAME.log`
1648         [ -z "$evicted" ] && error "lightweight client not evicted by mds"
1649
1650         # and all operations performed by lightweight client should be
1651         # synchronous, so the file created before mds restart should be there
1652         $CHECKSTAT -t file $DIR/$tfile || error "file not present"
1653         rm -f $DIR/$tfile
1654
1655         cleanup_106
1656 }
1657 run_test 106 "lightweight connection support"
1658
1659 test_107 () {
1660         local CLIENT_PID
1661         local close_pid
1662
1663         mkdir -p $DIR/$tdir
1664         # OBD_FAIL_MDS_REINT_NET_REP   0x119
1665         do_facet $SINGLEMDS lctl set_param fail_loc=0x119
1666         multiop $DIR/$tdir D_c &
1667         close_pid=$!
1668         mkdir $DIR/$tdir/dir_106 &
1669         CLIENT_PID=$!
1670         do_facet $SINGLEMDS lctl set_param fail_loc=0
1671         fail $SINGLEMDS
1672
1673         wait $CLIENT_PID || rc=$?
1674         checkstat -t dir $DIR/$tdir/dir_106 || return 1
1675
1676         kill -USR1 $close_pid
1677         wait $close_pid || return 2
1678
1679         return $rc
1680 }
1681 run_test 107 "drop reint reply, then restart MDT"
1682
1683 test_110a () {
1684         [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1685         local remote_dir=$DIR/$tdir/remote_dir
1686         local MDTIDX=1
1687
1688         mkdir -p $DIR/$tdir
1689         drop_request "$LFS mkdir -i $MDTIDX $remote_dir" ||
1690                                         error "lfs mkdir failed"
1691         local diridx=$($GETSTRIPE -M $remote_dir)
1692         [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1693
1694         rm -rf $DIR/$tdir || error "rmdir failed"
1695 }
1696 run_test 110a "create remote directory: drop client req"
1697
1698 test_110b () {
1699         [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1700         local remote_dir=$DIR/$tdir/remote_dir
1701         local MDTIDX=1
1702
1703         mkdir -p $DIR/$tdir
1704         drop_reint_reply "$LFS mkdir -i $MDTIDX $remote_dir" ||
1705                                         error "lfs mkdir failed"
1706
1707         diridx=$($GETSTRIPE -M $remote_dir)
1708         [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1709
1710         rm -rf $DIR/$tdir || error "rmdir failed"
1711 }
1712 run_test 110b "create remote directory: drop Master rep"
1713
1714 test_110c () {
1715         [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1716         local remote_dir=$DIR/$tdir/remote_dir
1717         local MDTIDX=1
1718
1719         mkdir -p $DIR/$tdir
1720         drop_update_reply $MDTIDX "$LFS mkdir -i $MDTIDX $remote_dir" ||
1721                                                 error "lfs mkdir failed"
1722
1723         diridx=$($GETSTRIPE -M $remote_dir)
1724         [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1725
1726         rm -rf $DIR/$tdir || error "rmdir failed"
1727 }
1728 run_test 110c "create remote directory: drop update rep on slave MDT"
1729
1730 test_110d () {
1731         [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1732         local remote_dir=$DIR/$tdir/remote_dir
1733         local MDTIDX=1
1734
1735         mkdir -p $DIR/$tdir
1736         $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1737
1738         drop_request "rm -rf $remote_dir" || error "rm remote dir failed"
1739
1740         rm -rf $DIR/$tdir || error "rmdir failed"
1741
1742         return 0
1743 }
1744 run_test 110d "remove remote directory: drop client req"
1745
1746 test_110e () {
1747         [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1748         local remote_dir=$DIR/$tdir/remote_dir
1749         local MDTIDX=1
1750
1751         mkdir -p $DIR/$tdir
1752         $LFS mkdir -i $MDTIDX $remote_dir  || error "lfs mkdir failed"
1753         drop_reint_reply "rm -rf $remote_dir" || error "rm remote dir failed"
1754
1755         rm -rf $DIR/$tdir || error "rmdir failed"
1756
1757         return 0
1758 }
1759 run_test 110e "remove remote directory: drop master rep"
1760
1761 test_110f () {
1762         [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1763         local remote_dir=$DIR/$tdir/remote_dir
1764         local MDTIDX=1
1765
1766         mkdir -p $DIR/$tdir
1767         $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1768         drop_update_reply $MDTIDX "rm -rf $remote_dir" ||
1769                                         error "rm remote dir failed"
1770
1771         rm -rf $DIR/$tdir || error "rmdir failed"
1772 }
1773 run_test 110f "remove remote directory: drop slave rep"
1774
1775 # LU-2844 mdt prepare fail should not cause umount oops
1776 test_111 ()
1777 {
1778         [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.62) ]] ||
1779                 { skip "Need MDS version at least 2.3.62"; return 0; }
1780
1781         local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
1782 #define OBD_FAIL_MDS_CHANGELOG_INIT 0x151
1783         do_facet $SINGLEMDS lctl set_param fail_loc=0x151
1784         stop $SINGLEMDS || error "stop MDS failed"
1785         start $SINGLEMDS $mdsdev && error "start MDS should fail"
1786         do_facet $SINGLEMDS lctl set_param fail_loc=0
1787         start $SINGLEMDS $mdsdev || error "start MDS failed"
1788 }
1789 run_test 111 "mdd setup fail should not cause umount oops"
1790
1791 # LU-793
1792 test_112a() {
1793         remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1794
1795         do_facet_random_file client $TMP/$tfile 100K ||
1796                 error_noexit "Create random file $TMP/$tfile"
1797
1798         pause_bulk "cp $TMP/$tfile $DIR/$tfile" $TIMEOUT ||
1799                 error_noexit "Can't pause_bulk copy"
1800
1801         df $DIR
1802         # expect cmp to succeed, client resent bulk
1803         cmp $TMP/$tfile $DIR/$tfile ||
1804                 error_noexit "Wrong data has been written"
1805         rm $DIR/$tfile ||
1806                 error_noexit "Can't remove file"
1807         rm $TMP/$tfile
1808 }
1809 run_test 112a "bulk resend while orignal request is in progress"
1810
1811 complete $SECONDS
1812 check_and_cleanup_lustre
1813 exit_status