6 ALWAYS_EXCEPT="52 60 $RECOVERY_SMALL_EXCEPT"
8 export MULTIOP=${MULTIOP:-multiop}
9 PTLDEBUG=${PTLDEBUG:--1}
10 LUSTRE=${LUSTRE:-`dirname $0`/..}
11 . $LUSTRE/tests/test-framework.sh
13 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
16 require_dsh_mds || exit 0
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"
22 [ $(facet_fstype $SINGLEMDS) = "zfs" ] &&
23 # bug number for skipped test: LU-2194 LU-2547
24 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 19b 24a 24b"
28 # Allow us to override the setup if we already have a mounted system by
29 # setting SETUP=" " and CLEANUP=" "
31 CLEANUP=${CLEANUP:-""}
33 check_and_setup_lustre
36 rm -rf $DIR/d[0-9]* $DIR/f.${TESTSUITE}*
39 local f1="$DIR/$tfile"
40 local f2="$DIR/$tfile.2"
42 drop_request "mcreate $f1" ||
43 error_noexit "create '$f1': drop req"
45 drop_reint_reply "mcreate $f2" ||
46 error_noexit "create '$f2': drop rep"
48 drop_request "tchmod 111 $f2" ||
49 error_noexit "chmod '$f2': drop req"
51 drop_reint_reply "tchmod 666 $f2" ||
52 error_noexit "chmod '$f2': drop rep"
54 drop_request "statone $f2" ||
55 error_noexit "stat '$f2': drop req"
57 drop_reply "statone $f2" ||
58 error_noexit "stat '$f2': drop rep"
60 run_test 1 "create, chmod, stat: drop req, drop rep"
64 do_facet_create_file client $t 10K ||
65 error_noexit "Create file $t"
67 drop_request "cat $t > /dev/null" ||
68 error_noexit "Open request for $t file"
70 drop_reply "cat $t > /dev/null" ||
71 error_noexit "Open replay for $t file"
73 run_test 4 "open: drop req, drop rep"
78 local RR="$T-renamed-again"
79 do_facet_create_file client $T 10K ||
80 error_noexit "Create file $T"
82 drop_request "mv $T $R" ||
83 error_noexit "Rename $T"
85 drop_reint_reply "mv $R $RR" ||
86 error_noexit "Failed rename replay on $R"
88 do_facet client "checkstat -v $RR" ||
89 error_noexit "checkstat error on $RR"
91 do_facet client "rm $RR" ||
92 error_noexit "Can't remove file $RR"
94 run_test 5 "rename: drop req, drop rep"
98 local LINK1=$DIR/$tfile.link1
99 local LINK2=$DIR/$tfile.link2
101 do_facet_create_file client $T 10K ||
102 error_noexit "Create file $T"
104 drop_request "mlink $T $LINK1" ||
105 error_noexit "mlink request for $T"
107 drop_reint_reply "mlink $T $LINK2" ||
108 error_noexit "mlink reply for $T"
110 drop_request "munlink $LINK1" ||
111 error_noexit "munlink request for $T"
113 drop_reint_reply "munlink $LINK2" ||
114 error_noexit "munlink reply for $T"
116 do_facet client "rm $T" ||
117 error_noexit "Can't remove file $T"
119 run_test 6 "link, unlink: drop req, drop rep"
123 drop_reint_reply "touch $DIR/$tfile" || return 1
125 run_test 8 "touch: drop rep (bug 1423)"
129 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
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"
149 run_test 9 "pause bulk on OST (bug 1420)"
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
166 run_test 10 "finish request on server after client eviction (bug 1521)"
169 # wake up a thread waiting for completion after eviction
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; }
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"
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
187 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
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; }
197 #define OBD_FAIL_MDS_CLOSE_NET 0x115
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
206 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
208 # Bug 113, check that readdir lost recv timeout works.
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; }
218 run_test 13 "mdc_readpage restart test (bug 1138)"
220 # Bug 113, check that readdir lost send timeout works.
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"
229 run_test 14 "mdc_readpage resend test (bug 1138)"
232 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
233 touch $DIR/$tfile && return 1
236 run_test 15 "failed open (-ENOMEM)"
238 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
240 lctl set_param -n llite.*.max_read_ahead_mb 0
244 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
248 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
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; }
257 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
258 do_facet ost1 "lctl set_param fail_loc=0x80000504"
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)
265 do_facet client "cmp $TMP/$tfile $DIR/$tfile" || return 2
269 run_test 16 "timeout bulk put, don't evict client (2732)"
274 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
276 local SAMPLE_FILE=$TMP/$tfile
277 do_facet_random_file client $SAMPLE_FILE 20K ||
278 { error_noexit "Create random file $SAMPLE_FILE" ; return 0; }
280 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
281 if at_is_enabled; then
282 at_max_saved=$(at_max_get ost1)
283 at_max_set $TIMEOUT ost1
286 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
287 # OST bulk will time out here, client retries
288 do_facet ost1 lctl set_param fail_loc=0x80000503
289 # need to ensure we send an RPC
290 do_facet client cp $SAMPLE_FILE $DIR/$tfile
293 # with AT, client will wait adaptive_max*factor+net_latency before
294 # expiring the req, hopefully timeout*2 is enough
295 sleep $(($TIMEOUT*2))
297 do_facet ost1 lctl set_param fail_loc=0
298 do_facet client "df $DIR"
299 # expect cmp to succeed, client resent bulk
300 do_facet client "cmp $SAMPLE_FILE $DIR/$tfile" || return 3
301 do_facet client "rm $DIR/$tfile" || return 4
302 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved ost1
305 run_test 17 "timeout bulk get, don't evict client (2732)"
308 [ -z ${ost2_svc} ] && skip_env "needs 2 osts" && return 0
310 do_facet_create_file client $TMP/$tfile 20K ||
311 { error_noexit "Create file $TMP/$tfile" ; return 0; }
313 do_facet client mkdir -p $DIR/$tdir
317 pgcache_empty || return 1
320 $LFS setstripe -i 1 -c 1 $f
321 stripe_index=$($LFS getstripe -i $f)
322 if [ $stripe_index -ne 1 ]; then
324 error "$f: stripe_index $stripe_index != 1" && return
327 do_facet client cp $TMP/$tfile $f
329 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
330 $LCTL --device $osc2dev deactivate || return 3
331 # my understanding is that there should be nothing in the page
332 # cache after the client reconnects?
334 pgcache_empty || rc=2
335 $LCTL --device $osc2dev activate
339 run_test 18a "manual ost invalidate clears page cache immediately"
342 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
344 do_facet_create_file client $TMP/$tfile 20K ||
345 { error_noexit "Create file $TMP/$tfile" ; return 0; }
347 do_facet client mkdir -p $DIR/$tdir
351 pgcache_empty || return 1
353 $LFS setstripe -i 0 -c 1 $f
354 stripe_index=$($LFS getstripe -i $f)
355 if [ $stripe_index -ne 0 ]; then
357 error "$f: stripe_index $stripe_index != 0" && return
360 do_facet client cp $TMP/$tfile $f
363 # allow recovery to complete
364 sleep $((TIMEOUT + 2))
365 # my understanding is that there should be nothing in the page
366 # cache after the client reconnects?
368 pgcache_empty || rc=2
372 run_test 18b "eviction and reconnect clears page cache (2766)"
375 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
377 do_facet_create_file client $TMP/$tfile 20K ||
378 { error_noexit "Create file $TMP/$tfile" ; return 0; }
380 do_facet client mkdir -p $DIR/$tdir
384 pgcache_empty || return 1
386 $LFS setstripe -i 0 -c 1 $f
387 stripe_index=$($LFS getstripe -i $f)
388 if [ $stripe_index -ne 0 ]; then
390 error "$f: stripe_index $stripe_index != 0" && return
393 do_facet client cp $TMP/$tfile $f
397 # OBD_FAIL_OST_CONNECT_NET2
398 # lost reply to connect request
399 do_facet ost1 lctl set_param fail_loc=0x80000225
402 df $MOUNT > /dev/null 2>&1
404 # my understanding is that there should be nothing in the page
405 # cache after the client reconnects?
407 pgcache_empty || rc=2
411 run_test 18c "Dropped connect reply after eviction handing (14755)"
414 local BEFORE=`date +%s`
417 mount_client $DIR2 || error "failed to mount $DIR2"
419 # cancel cached locks from OST to avoid eviction from it
422 do_facet client "stat $DIR > /dev/null" ||
423 error "failed to stat $DIR: $?"
424 drop_ldlm_cancel "chmod 0777 $DIR2" ||
425 error "failed to chmod $DIR2"
429 # let the client reconnect
431 EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state | \
432 awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
434 [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
435 (do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state;
436 error "no eviction: $EVICT before:$BEFORE")
438 run_test 19a "test expired_lock_main on mds (2867)"
441 local BEFORE=`date +%s`
444 mount_client $DIR2 || error "failed to mount $DIR2: $?"
446 # cancel cached locks from MDT to avoid eviction from it
449 do_facet client $MULTIOP $DIR/$tfile Ow ||
450 error "failed to run multiop: $?"
451 drop_ldlm_cancel $MULTIOP $DIR2/$tfile Ow ||
452 error "failed to ldlm_cancel: $?"
454 umount_client $DIR2 || error "failed to unmount $DIR2: $?"
455 do_facet client munlink $DIR/$tfile ||
456 error "failed to unlink $DIR/$tfile: $?"
458 # let the client reconnect
460 EVICT=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state | \
461 awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
463 [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
464 (do_facet client $LCTL get_param osc.$FSNAME-OST*.state;
465 error "no eviction: $EVICT before:$BEFORE")
467 run_test 19b "test expired_lock_main on ost (2867)"
470 local BEFORE=`date +%s`
473 $LCTL set_param ldlm.namespaces.*.early_lock_cancel=0
475 mkdir -p $DIR1/$tfile
478 #define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x516
479 do_facet mds $LCTL set_param fail_loc=0x80000516
481 touch $DIR2/$tfile/file1 &
483 # let touch to get blocked on the server
487 $LCTL set_param ldlm.namespaces.*.early_lock_cancel=1
490 # let the client reconnect
492 EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
493 awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
495 [ -z "$EVICT" ] || [[ $EVICT -le $BEFORE ]] || error "eviction happened"
497 run_test 19c "check reconnect and lock resend do not trigger expired_lock_main"
499 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
500 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
503 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${tfile}
504 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
507 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
508 do_facet ost1 lctl set_param fail_loc=0x80000308
509 kill -USR1 $MULTI_PID
512 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
514 run_test 20a "ldlm_handle_enqueue error (should return error)"
516 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
517 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
520 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${tfile}
522 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
523 do_facet ost1 lctl set_param fail_loc=0x80000308
524 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
525 error "didn't fail open enqueue" || true
527 run_test 20b "ldlm_handle_enqueue error (should return error)"
530 mkdir -p $DIR/$tdir-1
531 mkdir -p $DIR/$tdir-2
532 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
535 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
536 $MULTIOP $DIR/$tdir-2/f Oc &
539 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
541 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
542 kill -USR1 $close_pid
544 wait $close_pid || return 1
545 wait $open_pid || return 2
546 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
548 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
549 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
553 run_test 21a "drop close request while close and open are both in flight"
556 mkdir -p $DIR/$tdir-1
557 mkdir -p $DIR/$tdir-2
558 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
561 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
562 mcreate $DIR/$tdir-2/f &
565 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
567 kill -USR1 $close_pid
569 wait $close_pid || return 1
570 wait $open_pid || return 3
572 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
573 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
576 run_test 21b "drop open request while close and open are both in flight"
579 mkdir -p $DIR/$tdir-1
580 mkdir -p $DIR/$tdir-2
581 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
584 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
585 mcreate $DIR/$tdir-2/f &
588 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
590 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
591 kill -USR1 $close_pid
593 wait $close_pid || return 1
594 wait $open_pid || return 2
596 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
598 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
599 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
602 run_test 21c "drop both request while close and open are both in flight"
605 mkdir -p $DIR/$tdir-1
606 mkdir -p $DIR/$tdir-2
607 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
610 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
611 $MULTIOP $DIR/$tdir-2/f Oc &
613 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
615 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
618 wait $pid || return 1
619 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
621 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
622 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
626 run_test 21d "drop close reply while close and open are both in flight"
629 mkdir -p $DIR/$tdir-1
630 mkdir -p $DIR/$tdir-2
631 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
634 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
635 touch $DIR/$tdir-2/f &
637 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
641 wait $pid || return 1
644 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
645 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
648 run_test 21e "drop open reply while close and open are both in flight"
651 mkdir -p $DIR/$tdir-1
652 mkdir -p $DIR/$tdir-2
653 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
656 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
657 touch $DIR/$tdir-2/f &
659 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
661 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
664 wait $pid || return 1
665 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
667 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
668 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
671 run_test 21f "drop both reply while close and open are both in flight"
674 mkdir -p $DIR/$tdir-1
675 mkdir -p $DIR/$tdir-2
676 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
679 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
680 touch $DIR/$tdir-2/f &
682 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
684 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
687 wait $pid || return 1
688 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
690 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
691 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
694 run_test 21g "drop open reply and close request while close and open are both in flight"
697 mkdir -p $DIR/$tdir-1
698 mkdir -p $DIR/$tdir-2
699 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
702 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
703 touch $DIR/$tdir-2/f &
706 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
708 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
711 wait $pid || return 1
712 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
714 wait $touch_pid || return 2
716 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
717 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
720 run_test 21h "drop open request and close reply while close and open are both in flight"
722 # bug 3462 - multiple MDC requests
727 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
732 $MULTIOP $f1 msu || return 1
735 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
737 wait $close_pid || return 2
738 rm -rf $f2 || return 4
740 run_test 22 "drop close request and do mknod"
743 multiop_bg_pause $DIR/$tfile O_c || return 1
745 # give a chance for open
749 drop_request "kill -USR1 $pid"
752 wait $pid || return 1
755 run_test 23 "client hang when close a file after mds crash"
757 test_24a() { # bug 11710 details correct fsync() behavior
758 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
761 $LFS setstripe -i 0 -c 1 $DIR/$tdir
763 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
766 kill -USR1 $MULTI_PID
769 lctl set_param fail_loc=0x0
772 error_ignore bz5494 "multiop didn't fail fsync: rc $rc" || true
774 run_test 24a "fsync error (should return error)"
776 wait_client_evicted () {
779 local varsvc=${facet}_svc
781 wait_update $(facet_active_host $facet) \
782 "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" \
787 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
791 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
793 multiop_bg_pause $DIR/$tdir/$tfile-1 Ow8192_yc ||
794 error "mulitop Ow8192_yc failed"
797 multiop_bg_pause $DIR/$tdir/$tfile-2 Ow8192_c ||
798 error "mulitop Ow8192_c failed"
803 kill -USR1 $MULTI_PID1
806 kill -USR1 $MULTI_PID2
809 lctl set_param fail_loc=0x0
811 [ $rc1 -eq 0 -o $rc2 -eq 0 ] &&
812 error_ignore bz5494 "multiop didn't fail fsync: $rc1 or close: $rc2" ||
815 dmesg | grep "dirty page discard:" ||
816 error "no discarded dirty page found!"
818 run_test 24b "test dirty page discard due to client eviction"
820 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
821 # this test can only run from a client on a separate node.
822 remote_ost || { skip "local OST" && return 0; }
823 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
824 remote_mds || { skip "local MDS" && return 0; }
826 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
827 skip "msg and ost1 are at the same node"
831 check_timeout || return 1
833 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
835 echo starting with $OST_NEXP OST exports
836 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
837 do_facet client lctl set_param fail_loc=0x505
838 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
839 # But if there's a race to start the evictor from various obds,
840 # the loser might have to wait for the next ping.
843 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 2 + TIMEOUT * 3 / 4))
845 do_facet client lctl set_param fail_loc=0x0
846 [ $rc -eq 0 ] || error "client not evicted from OST"
848 run_test 26a "evict dead exports"
850 test_26b() { # bug 10140 - evict dead exports by pinger
851 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
853 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
854 skip "msg and ost1 are at the same node"
858 check_timeout || return 1
860 zconf_mount `hostname` $MOUNT2 ||
861 { error "Failed to mount $MOUNT2"; return 2; }
862 sleep 1 # wait connections being established
864 local MDS_NEXP=$(do_facet $SINGLEMDS lctl get_param -n mdt.${mds1_svc}.num_exports | cut -d' ' -f2)
865 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
867 echo starting with $OST_NEXP OST and $MDS_NEXP MDS exports
869 zconf_umount `hostname` $MOUNT2 -f
871 # PING_INTERVAL max(obd_timeout / 4, 1U)
872 # PING_EVICT_TIMEOUT (PING_INTERVAL * 6)
874 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
875 # But if there's a race to start the evictor from various obds,
876 # the loser might have to wait for the next ping.
877 # = 9 * PING_INTERVAL + PING_INTERVAL
878 # = 10 PING_INTERVAL = 10 obd_timeout / 4 = 2.5 obd_timeout
879 # let's wait $((TIMEOUT * 3)) # bug 19887
881 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 3)) || \
882 error "Client was not evicted by ost" rc=1
883 wait_client_evicted $SINGLEMDS $MDS_NEXP $((TIMEOUT * 3)) || \
884 error "Client was not evicted by mds"
886 run_test 26b "evict dead exports"
890 writemany -q -a $DIR/$tdir/$tfile 0 5 &
893 local save_FAILURE_MODE=$FAILURE_MODE
895 facet_failover $SINGLEMDS
896 #define OBD_FAIL_OSC_SHUTDOWN 0x407
897 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000407
898 # need to wait for reconnect
899 echo waiting for fail_loc
900 wait_update_facet $SINGLEMDS "lctl get_param -n fail_loc" "-2147482617"
901 facet_failover $SINGLEMDS
903 kill -USR1 $CLIENT_PID
906 FAILURE_MODE=$save_FAILURE_MODE
908 run_test 27 "fail LOV while using OSC's"
910 test_28() { # bug 6086 - error adding new clients
911 do_facet client mcreate $DIR/$tfile || return 1
912 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
913 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
914 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
915 # fail once (evicted), reconnect fail (fail_loc), ok
916 client_up || (sleep 10; client_up) || (sleep 10; client_up) || error "reconnect failed"
918 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
920 run_test 28 "handle error adding new clients (bug 6086)"
922 test_29a() { # bug 22273 - error adding new clients
923 #define OBD_FAIL_TGT_CLIENT_ADD 0x711
924 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000711"
925 # fail abort so client will be new again
926 fail_abort $SINGLEMDS
927 client_up || error "reconnect failed"
928 wait_osc_import_state $SINGLEMDS ost FULL
931 run_test 29a "error adding new clients doesn't cause LBUG (bug 22273)"
933 test_29b() { # bug 22273 - error adding new clients
934 #define OBD_FAIL_TGT_CLIENT_ADD 0x711
935 do_facet ost1 "lctl set_param fail_loc=0x80000711"
936 # fail abort so client will be new again
938 client_up || error "reconnect failed"
941 run_test 29b "error adding new clients doesn't cause LBUG (bug 22273)"
945 # put a load of file creates/writes/deletes
946 writemany -q $DIR/$tdir/$tfile 0 5 &
948 echo writemany pid $CLIENT_PID
952 # wait for client to reconnect to MDS
957 # client process should see no problems even though MDS went down
959 kill -USR1 $CLIENT_PID
962 echo writemany returned $rc
963 #these may fail because of eviction due to slow AST response.
965 error_ignore bz13652 "writemany returned rc $rc" || true
967 run_test 50 "failover MDS under load"
970 #define OBD_FAIL_MDS_SYNC_CAPA_SL 0x1310
971 do_facet ost1 lctl set_param fail_loc=0x00001310
974 # put a load of file creates/writes/deletes
975 writemany -q $DIR/$tdir/$tfile 0 5 &
979 facet_failover $SINGLEMDS
980 # failover at various points during recovery
981 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
982 echo will failover at $SEQ
985 #echo failover in $i sec
986 log "test_$testnum: failover in $i sec"
988 facet_failover $SINGLEMDS
990 # client process should see no problems even though MDS went down
991 # and recovery was interrupted
993 kill -USR1 $CLIENT_PID
996 echo writemany returned $rc
998 error_ignore bz13652 "writemany returned rc $rc" || true
1000 run_test 51 "failover MDS during recovery"
1003 do_facet client "mkdir -p $DIR/$tdir"
1004 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
1006 echo writemany pid $CLIENT_PID
1011 wait $CLIENT_PID || rc=$?
1012 # active client process should see an EIO for down OST
1013 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
1014 # but timing or failover setup may allow success
1015 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
1016 echo "writemany returned $rc"
1021 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1026 [ $rc -ne 0 ] && { return $rc; }
1027 # wait for client to reconnect to OST
1031 [ $rc -ne 0 ] && { return $rc; }
1038 run_test 52 "failover OST under load"
1040 # test of open reconstruct
1043 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
1046 run_test 53 "touch: drop rep"
1049 zconf_mount `hostname` $MOUNT2
1051 touch $DIR2/$tfile.1
1053 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
1056 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
1057 [ x"$ERROR" == x ] || error "back in time occured"
1059 run_test 54 "back in time"
1061 # bug 11330 - liblustre application death during I/O locks up OST
1063 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1067 # Minimum pass speed is 2MBps
1069 # LU-2887/LU-3089 - set min pass speed to 500KBps
1070 [ "$(facet_fstype ost1)" = "zfs" ] && ddtimeout=256
1072 # first dd should be finished quickly
1073 $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile-1
1074 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
1077 echo "step1: testing ......"
1078 while kill -0 $DDPID 2> /dev/null; do
1080 if [ $count -gt $ddtimeout ]; then
1081 error "dd should be finished!"
1085 echo "(dd_pid=$DDPID, time=$count)successful"
1087 $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile-2
1088 #define OBD_FAIL_OST_DROP_REQ 0x21d
1089 do_facet ost1 lctl set_param fail_loc=0x0000021d
1090 # second dd will be never finished
1091 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
1094 echo "step2: testing ......"
1095 while [ $count -le $ddtimeout ]; do
1096 if ! kill -0 $DDPID 2> /dev/null; then
1098 error "dd shouldn't be finished! (time=$count)"
1103 echo "(dd_pid=$DDPID, time=$count)successful"
1105 #Recover fail_loc and dd will finish soon
1106 do_facet ost1 lctl set_param fail_loc=0
1108 echo "step3: testing ......"
1109 while kill -0 $DDPID 2> /dev/null; do
1111 if [ $count -gt $((ddtimeout + 440)) ]; then
1112 error "dd should be finished!"
1116 echo "(dd_pid=$DDPID, time=$count)successful"
1120 run_test 55 "ost_brw_read/write drops timed-out read/write request"
1122 test_56() { # b=11277
1123 #define OBD_FAIL_MDS_RESEND 0x136
1125 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
1127 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1130 run_test 56 "do not allow reconnect to busy exports"
1133 # no oscs means no client or mdt
1134 while lctl get_param osc.*.* > /dev/null 2>&1; do
1135 : # loop until proc file is removed
1139 test_57() { # bug 10866
1143 #define OBD_FAIL_LPROC_REMOVE 0xB00
1144 lctl set_param fail_loc=0x80000B00
1145 zconf_umount `hostname` $DIR
1146 lctl set_param fail_loc=0x80000B00
1147 fail_abort $SINGLEMDS
1149 lctl set_param fail_loc=0
1151 do_facet client "df $DIR"
1153 run_test 57 "read procfs entries causes kernel crash"
1155 test_58() { # bug 11546
1156 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
1159 lctl set_param fail_loc=0x80000801
1160 cp $DIR/$tfile /dev/null &
1163 lctl set_param fail_loc=0
1164 drop_bl_callback rm -f $DIR/$tfile
1166 # the first 'df' could tigger the eviction caused by
1167 # 'drop_bl_callback', and it's normal case.
1168 # but the next 'df' should return successfully.
1169 do_facet client "df $DIR" || do_facet client "df $DIR"
1171 run_test 58 "Eviction in the middle of open RPC reply processing"
1173 test_59() { # bug 10589
1174 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
1175 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
1176 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
1177 lctl set_param fail_loc=0x311
1178 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
1179 [ $? = 0 ] || error "dd write failed"
1180 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
1181 lctl set_param fail_loc=0
1183 zconf_umount `hostname` $MOUNT2 -f
1184 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
1185 [ $? = 0 ] || error "dd read failed"
1186 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
1187 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
1189 run_test 59 "Read cancel race on client eviction"
1192 # we assume that all md changes are in the MDT0 changelog
1193 if [ $MDSCOUNT -gt 1 ]; then
1194 error_ignore bz17935 $*
1201 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
1202 awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
1207 # Register (and start) changelog
1208 USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
1209 echo "Registered as $MDT0 changelog user $USER"
1211 # Generate a large number of changelog entries
1212 createmany -o $DIR/$tdir/$tfile $NUM_FILES
1216 # Unlink files in the background
1217 unlinkmany $DIR/$tdir/$tfile $NUM_FILES &
1221 # Failover the MDS while unlinks are happening
1222 facet_failover $SINGLEMDS
1224 # Wait for unlinkmany to finish
1227 # Check if all the create/unlink events were recorded
1229 $LFS changelog $MDT0 >> $DIR/$tdir/changelog
1230 local cl_count=$(grep UNLNK $DIR/$tdir/changelog | wc -l)
1231 echo "$cl_count unlinks in $MDT0 changelog"
1233 do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $USER
1234 USERS=$(( $(do_facet $SINGLEMDS lctl get_param -n \
1235 mdd.$MDT0.changelog_users | wc -l) - 2 ))
1236 if [ $USERS -eq 0 ]; then
1237 [ $cl_count -eq $NUM_FILES ] || \
1238 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1239 # Also make sure we can clear large changelogs
1240 cl_count=$($LFS changelog $FSNAME | wc -l)
1241 [ $cl_count -le 2 ] || \
1242 error "Changelog not empty: $cl_count entries"
1244 # If there are other users, there may be other unlinks in the log
1245 [ $cl_count -ge $NUM_FILES ] || \
1246 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1247 echo "$USERS other changelog users; can't verify clear"
1250 run_test 60 "Add Changelog entries during MDS failover"
1254 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0000)
1255 mdtosc=${mdtosc/-MDT*/-MDT\*}
1256 local cflags="osc.$mdtosc.connect_flags"
1257 do_facet $SINGLEMDS "lctl get_param -n $cflags" |grep -q skip_orphan
1258 [ $? -ne 0 ] && skip "don't have skip orphan feature" && return
1260 mkdir -p $DIR/$tdir || error "mkdir dir $DIR/$tdir failed"
1261 # Set the default stripe of $DIR/$tdir to put the files to ost1
1262 $LFS setstripe -c 1 -i 0 $DIR/$tdir
1264 replay_barrier $SINGLEMDS
1265 createmany -o $DIR/$tdir/$tfile-%d 10
1266 local oid=`do_facet ost1 "lctl get_param -n obdfilter.${ost1_svc}.last_id"`
1268 fail_abort $SINGLEMDS
1270 touch $DIR/$tdir/$tfile
1271 local id=`$LFS getstripe $DIR/$tdir/$tfile | awk '$1 == 0 { print $2 }'`
1272 [ $id -le $oid ] && error "the orphan objid was reused, failed"
1277 run_test 61 "Verify to not reuse orphan objects - bug 17025"
1279 # test_62 as seen it b2_1 please do not reuse test_62
1282 # zconf_umount `hostname` $DIR
1283 # #define OBD_FAIL_PTLRPC_DELAY_IMP_FULL 0x516
1284 # lctl set_param fail_loc=0x516
1287 #run_test 62 "Verify connection flags race - bug LU-1716"
1289 check_cli_ir_state()
1291 local NODE=${1:-$HOSTNAME}
1293 st=$(do_node $NODE "lctl get_param mgc.*.ir_state |
1294 awk '/imperative_recovery:/ { print \\\$2}'")
1295 [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
1296 error "Error state $st, must be ENABLED or DISABLED"
1300 check_target_ir_state()
1303 local name=${target}_svc
1304 local recovery_proc=obdfilter.${!name}.recovery_status
1307 st=$(do_facet $target "lctl get_param -n $recovery_proc |
1308 awk '/IR:/{ print \\\$2}'")
1309 [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
1310 error "Error state $st, must be ENABLED or DISABLED"
1316 do_facet mgs lctl set_param -n mgs.MGS.live.$FSNAME="state=$1"
1321 local state=$(do_facet mgs "lctl get_param -n mgs.MGS.live.$FSNAME |
1322 awk '/state:/{ print \\\$2 }'")
1326 nidtbl_version_mgs()
1328 local ver=$(do_facet mgs "lctl get_param -n mgs.MGS.live.$FSNAME |
1329 awk '/nidtbl_version:/{ print \\\$2 }'")
1333 # nidtbl_version_client <mds1|client> [node]
1334 nidtbl_version_client()
1337 local node=${2:-$HOSTNAME}
1339 if [ X$cli = Xclient ]; then
1342 local obdtype=${cli/%[0-9]*/}
1343 [ $obdtype != mds ] && error "wrong parameters $cli"
1345 node=$(facet_active_host $cli)
1350 local vers=$(do_node $node "lctl get_param -n mgc.*.ir_state" |
1351 awk "/$cli/{print \$6}" |sort -u)
1353 # in case there are multiple mounts on the client node
1355 [ ${#arr[@]} -ne 1 ] && error "versions on client node mismatch"
1359 nidtbl_versions_match()
1361 [ $(nidtbl_version_mgs) -eq $(nidtbl_version_client ${1:-client}) ]
1364 target_instance_match()
1370 obdtype=${srv/%[0-9]*/}
1381 error "invalid target type" $srv
1386 local target=${srv}_svc
1387 local si=$(do_facet $srv lctl get_param -n $obdname.${!target}.instance)
1388 local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import |
1389 awk '/instance/{ print $2 }' | head -n1)
1391 return $([ $si -eq $ci ])
1396 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1397 { skip "MGS without IR support"; return 0; }
1399 # MDT was just restarted in the previous test, make sure everything
1402 while [ $cnt -gt 0 ]; do
1403 nidtbl_versions_match && break
1409 set_ir_status disabled
1411 local prev_ver=$(nidtbl_version_client client)
1413 local saved_FAILURE_MODE=$FAILURE_MODE
1414 [ $(facet_host mgs) = $(facet_host ost1) ] && FAILURE_MODE="SOFT"
1418 [ $(nidtbl_version_client client) -eq $prev_ver ] ||
1419 error "version must not change due to IR disabled"
1420 target_instance_match ost1 || error "instance mismatch"
1424 FAILURE_MODE=$saved_FAILURE_MODE
1426 run_test 100 "IR: Make sure normal recovery still works w/o IR"
1430 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1431 { skip "MGS without IR support"; return 0; }
1435 local OST1_IMP=$(get_osc_import_name client ost1)
1437 # disable pinger recovery
1438 lctl set_param -n osc.$OST1_IMP.pinger_recov=0
1442 target_instance_match ost1 || error "instance mismatch"
1443 nidtbl_versions_match || error "version must match"
1445 lctl set_param -n osc.$OST1_IMP.pinger_recov=1
1447 run_test 101 "IR: Make sure IR works w/o normal recovery"
1451 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1452 { skip "MGS without IR support"; return 0; }
1454 local clients=${CLIENTS:-$HOSTNAME}
1461 # let's have a new nidtbl version
1464 # sleep for a while so that clients can see the failure of ost
1465 # it must be MGC_TIMEOUT_MIN_SECONDS + MGC_TIMEOUT_RAND_CENTISEC.
1466 # int mgc_request.c:
1467 # define MGC_TIMEOUT_MIN_SECONDS 5
1468 # define MGC_TIMEOUT_RAND_CENTISEC 0x1ff /* ~500 *
1469 local count=30 # 20 seconds at most
1470 while [ $count -gt 0 ]; do
1471 nidtbl_versions_match && break
1476 nidtbl_versions_match || error "nidtbl mismatch"
1479 old_version=$(nidtbl_version_client client)
1481 zconf_umount_clients $clients $MOUNT || error "Cannot umount client"
1484 combined_mgs_mds && mgsdev=mds1
1485 remount_facet $mgsdev
1488 zconf_mount_clients $clients $MOUNT || error "Cannot mount client"
1491 new_version=$(nidtbl_version_client client)
1492 [ $new_version -lt $old_version ] &&
1493 error "nidtbl version wrong after mgs restarts"
1496 run_test 102 "IR: New client gets updated nidtbl after MGS restart"
1500 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1501 { skip "MGS without IR support"; return 0; }
1503 combined_mgs_mds && skip "mgs and mds on the same target" && return 0
1505 # workaround solution to generate config log on the mds
1511 # We need this test because mds is like a client in IR context.
1512 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS ||
1513 error "MDS should start w/o mgs"
1515 # start mgs and remount mds w/ ir
1516 start mgs $(mgsdevname) $MGS_MOUNT_OPTS
1519 # remount client so that fsdb will be created on the MGS
1520 umount_client $MOUNT || error "umount failed"
1521 mount_client $MOUNT || error "mount failed"
1523 # sleep 30 seconds so the MDS has a chance to detect MGS restarting
1525 while [ $count -gt 0 ]; do
1526 [ $(nidtbl_version_client mds1) -ne 0 ] && break
1531 # after a while, mds should be able to reconnect to mgs and fetch
1532 # up-to-date nidtbl version
1533 nidtbl_versions_match mds1 || error "mds nidtbl mismatch"
1538 run_test 103 "IR: MDS can start w/o MGS and get updated nidtbl later"
1542 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1543 { skip "MGS without IR support"; return 0; }
1548 start ost1 $(ostdevname 1) "$OST_MOUNT_OPTS -onoir" ||
1549 error "OST1 cannot start"
1552 local ir_state=$(check_target_ir_state ost1)
1553 [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1554 error "ir status on ost1 should be DISABLED"
1556 run_test 104 "IR: ost can disable IR voluntarily"
1560 [ -z "$RCLIENTS" ] && skip "Needs multiple clients" && return 0
1561 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1562 { skip "MGS without IR support"; return 0; }
1566 # get one of the clients from client list
1567 local rcli=$(echo $RCLIENTS |cut -d' ' -f 1)
1569 local old_MOUNTOPT=$MOUNTOPT
1570 MOUNTOPT=${MOUNTOPT},noir
1571 zconf_umount $rcli $MOUNT || error "umount failed"
1572 zconf_mount $rcli $MOUNT || error "mount failed"
1574 # make sure lustre mount at $rcli disabling IR
1575 local ir_state=$(check_cli_ir_state $rcli)
1576 [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1577 error "IR state must be DISABLED at $rcli"
1579 # Since the client just mounted, its last_rcvd entry is not on disk.
1580 # Send an RPC so exp_need_sync forces last_rcvd to commit this export
1581 # so the client can reconnect during OST recovery (LU-924, LU-1582)
1582 $SETSTRIPE -i 0 $DIR/$tfile
1583 dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 conv=sync
1585 # make sure MGS's state is Partial
1586 [ $(get_ir_status) = "partial" ] || error "MGS IR state must be partial"
1589 # make sure IR on ost1 is DISABLED
1590 local ir_state=$(check_target_ir_state ost1)
1591 [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1592 error "IR status on ost1 should be DISABLED"
1595 MOUNTOPT=$old_MOUNTOPT
1596 zconf_umount $rcli $MOUNT || error "umount failed"
1597 zconf_mount $rcli $MOUNT || error "mount failed"
1599 # make sure MGS's state is full
1600 [ $(get_ir_status) = "full" ] || error "MGS IR status must be full"
1603 # make sure IR on ost1 is ENABLED
1604 local ir_state=$(check_target_ir_state ost1)
1605 [ $ir_state = "ENABLED" -o $ir_state = "ON" ] ||
1606 error "IR status on ost1 should be ENABLED"
1610 run_test 105 "IR: NON IR clients support"
1618 test_106() { # LU-1789
1619 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.50) ]] ||
1620 { skip "Need MDS version at least 2.3.50"; return 0; }
1622 #define OBD_FAIL_MDC_LIGHTWEIGHT 0x805
1623 $LCTL set_param fail_loc=0x805
1626 trap cleanup_106 EXIT
1628 # enable lightweight flag on mdc connection
1631 local MDS_NEXP=$(do_facet $SINGLEMDS \
1632 lctl get_param -n mdt.${mds1_svc}.num_exports |
1634 $LCTL set_param fail_loc=0
1636 touch $DIR2/$tfile || error "failed to create empty file"
1637 replay_barrier $SINGLEMDS
1639 $LCTL set_param debug=console
1641 facet_failover $SINGLEMDS
1643 # lightweight connection must be evicted
1644 touch -c $DIR2/$tfile || true
1645 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1646 evicted=`awk '/This client was evicted by .*MDT0000/ {
1648 }' $TMP/lustre-log-$TESTNAME.log`
1649 [ -z "$evicted" ] && error "lightweight client not evicted by mds"
1651 # and all operations performed by lightweight client should be
1652 # synchronous, so the file created before mds restart should be there
1653 $CHECKSTAT -t file $DIR/$tfile || error "file not present"
1658 run_test 106 "lightweight connection support"
1665 # OBD_FAIL_MDS_REINT_NET_REP 0x119
1666 do_facet $SINGLEMDS lctl set_param fail_loc=0x119
1667 multiop $DIR/$tdir D_c &
1669 mkdir $DIR/$tdir/dir_106 &
1671 do_facet $SINGLEMDS lctl set_param fail_loc=0
1674 wait $CLIENT_PID || rc=$?
1675 checkstat -t dir $DIR/$tdir/dir_106 || return 1
1677 kill -USR1 $close_pid
1678 wait $close_pid || return 2
1682 run_test 107 "drop reint reply, then restart MDT"
1685 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1686 local remote_dir=$DIR/$tdir/remote_dir
1690 drop_request "$LFS mkdir -i $MDTIDX $remote_dir" ||
1691 error "lfs mkdir failed"
1692 local diridx=$($GETSTRIPE -M $remote_dir)
1693 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1695 rm -rf $DIR/$tdir || error "rmdir failed"
1697 run_test 110a "create remote directory: drop client req"
1700 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1701 local remote_dir=$DIR/$tdir/remote_dir
1705 drop_reint_reply "$LFS mkdir -i $MDTIDX $remote_dir" ||
1706 error "lfs mkdir failed"
1708 diridx=$($GETSTRIPE -M $remote_dir)
1709 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1711 rm -rf $DIR/$tdir || error "rmdir failed"
1713 run_test 110b "create remote directory: drop Master rep"
1716 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1717 local remote_dir=$DIR/$tdir/remote_dir
1721 drop_update_reply $MDTIDX "$LFS mkdir -i $MDTIDX $remote_dir" ||
1722 error "lfs mkdir failed"
1724 diridx=$($GETSTRIPE -M $remote_dir)
1725 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1727 rm -rf $DIR/$tdir || error "rmdir failed"
1729 run_test 110c "create remote directory: drop update rep on slave MDT"
1732 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1733 local remote_dir=$DIR/$tdir/remote_dir
1737 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1739 drop_request "rm -rf $remote_dir" || error "rm remote dir failed"
1741 rm -rf $DIR/$tdir || error "rmdir failed"
1745 run_test 110d "remove remote directory: drop client req"
1748 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1749 local remote_dir=$DIR/$tdir/remote_dir
1753 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1754 drop_reint_reply "rm -rf $remote_dir" || error "rm remote dir failed"
1756 rm -rf $DIR/$tdir || error "rmdir failed"
1760 run_test 110e "remove remote directory: drop master rep"
1763 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1764 local remote_dir=$DIR/$tdir/remote_dir
1768 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1769 drop_update_reply $MDTIDX "rm -rf $remote_dir" ||
1770 error "rm remote dir failed"
1772 rm -rf $DIR/$tdir || error "rmdir failed"
1774 run_test 110f "remove remote directory: drop slave rep"
1777 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1778 local remote_dir=$DIR/$tdir/remote_dir
1781 mkdir -p $remote_dir
1783 createmany -o $remote_dir/f 5000
1785 #define OBD_FAIL_MIGRATE_NET_REP 0x1702
1786 do_facet mds$MDTIDX lctl set_param fail_loc=0x1702
1787 $LFS mv -M $MDTIDX $remote_dir || error "migrate failed"
1788 do_facet mds$MDTIDX lctl set_param fail_loc=0x0
1790 for file in $(find $remote_dir); do
1791 mdt_index=$($LFS getstripe -M $file)
1792 [ $mdt_index == $MDTIDX ] ||
1793 error "$file is not on MDT${MDTIDX}"
1796 rm -rf $DIR/$tdir || error "rmdir failed"
1798 run_test 110g "drop reply during migration"
1800 # LU-2844 mdt prepare fail should not cause umount oops
1803 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.62) ]] ||
1804 { skip "Need MDS version at least 2.3.62"; return 0; }
1806 local mdsdev=$(mdsdevname ${SINGLEMDS//mds/})
1807 #define OBD_FAIL_MDS_CHANGELOG_INIT 0x151
1808 do_facet $SINGLEMDS lctl set_param fail_loc=0x151
1809 stop $SINGLEMDS || error "stop MDS failed"
1810 start $SINGLEMDS $mdsdev && error "start MDS should fail"
1811 do_facet $SINGLEMDS lctl set_param fail_loc=0
1812 start $SINGLEMDS $mdsdev || error "start MDS failed"
1814 run_test 111 "mdd setup fail should not cause umount oops"
1818 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1820 do_facet_random_file client $TMP/$tfile 100K ||
1821 error_noexit "Create random file $TMP/$tfile"
1823 pause_bulk "cp $TMP/$tfile $DIR/$tfile" $TIMEOUT ||
1824 error_noexit "Can't pause_bulk copy"
1827 # expect cmp to succeed, client resent bulk
1828 cmp $TMP/$tfile $DIR/$tfile ||
1829 error_noexit "Wrong data has been written"
1831 error_noexit "Can't remove file"
1834 run_test 112a "bulk resend while orignal request is in progress"
1837 check_and_cleanup_lustre