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"
24 # Allow us to override the setup if we already have a mounted system by
25 # setting SETUP=" " and CLEANUP=" "
27 CLEANUP=${CLEANUP:-""}
29 check_and_setup_lustre
32 rm -rf $DIR/d[0-9]* $DIR/f.${TESTSUITE}*
35 local f1="$DIR/$tfile"
36 local f2="$DIR/$tfile.2"
38 drop_request "mcreate $f1" ||
39 error_noexit "create '$f1': drop req"
41 drop_reint_reply "mcreate $f2" ||
42 error_noexit "create '$f2': drop rep"
44 drop_request "tchmod 111 $f2" ||
45 error_noexit "chmod '$f2': drop req"
47 drop_reint_reply "tchmod 666 $f2" ||
48 error_noexit "chmod '$f2': drop rep"
50 drop_request "statone $f2" ||
51 error_noexit "stat '$f2': drop req"
53 drop_reply "statone $f2" ||
54 error_noexit "stat '$f2': drop rep"
56 run_test 1 "create, chmod, stat: drop req, drop rep"
60 do_facet_create_file client $t 10K ||
61 error_noexit "Create file $t"
63 drop_request "cat $t > /dev/null" ||
64 error_noexit "Open request for $t file"
66 drop_reply "cat $t > /dev/null" ||
67 error_noexit "Open replay for $t file"
69 run_test 4 "open: drop req, drop rep"
74 local RR="$T-renamed-again"
75 do_facet_create_file client $T 10K ||
76 error_noexit "Create file $T"
78 drop_request "mv $T $R" ||
79 error_noexit "Rename $T"
81 drop_reint_reply "mv $R $RR" ||
82 error_noexit "Failed rename replay on $R"
84 do_facet client "checkstat -v $RR" ||
85 error_noexit "checkstat error on $RR"
87 do_facet client "rm $RR" ||
88 error_noexit "Can't remove file $RR"
90 run_test 5 "rename: drop req, drop rep"
94 local LINK1=$DIR/$tfile.link1
95 local LINK2=$DIR/$tfile.link2
97 do_facet_create_file client $T 10K ||
98 error_noexit "Create file $T"
100 drop_request "mlink $T $LINK1" ||
101 error_noexit "mlink request for $T"
103 drop_reint_reply "mlink $T $LINK2" ||
104 error_noexit "mlink reply for $T"
106 drop_request "munlink $LINK1" ||
107 error_noexit "munlink request for $T"
109 drop_reint_reply "munlink $LINK2" ||
110 error_noexit "munlink reply for $T"
112 do_facet client "rm $T" ||
113 error_noexit "Can't remove file $T"
115 run_test 6 "link, unlink: drop req, drop rep"
119 drop_reint_reply "touch $DIR/$tfile" || return 1
121 run_test 8 "touch: drop rep (bug 1423)"
125 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
129 do_facet_random_file client $TMP/$tfile 1K ||
130 error_noexit "Create random file $TMP/$tfile"
131 # make this big, else test 9 doesn't wait for bulk -- bz 5595
132 do_facet_create_file client $TMP/$t1 4M ||
133 error_noexit "Create file $TMP/$t1"
134 do_facet client "cp $TMP/$t1 $DIR/$t1" ||
135 error_noexit "Can't copy to $DIR/$t1 file"
136 pause_bulk "cp $TMP/$tfile $DIR/$tfile" ||
137 error_noexit "Can't pause_bulk copy"
138 do_facet client "cp $TMP/$t1 $DIR/$t2" ||
139 error_noexit "Can't copy file"
140 do_facet client "sync"
141 do_facet client "rm $DIR/$tfile $DIR/$t2 $DIR/$t1" ||
142 error_noexit "Can't remove files"
143 do_facet client "rm $TMP/$t1 $TMP/$tfile"
145 run_test 9 "pause bulk on OST (bug 1420)"
149 do_facet client mcreate $DIR/$tfile ||
150 { error "mcreate failed: $?"; return 1; }
151 drop_bl_callback "chmod 0777 $DIR/$tfile" || echo "evicted as expected"
152 # wait for the mds to evict the client
153 #echo "sleep $(($TIMEOUT*2))"
154 #sleep $(($TIMEOUT*2))
155 do_facet client touch $DIR/$tfile || echo "touch failed, evicted"
156 do_facet client checkstat -v -p 0777 $DIR/$tfile ||
157 { error "client checkstat failed: $?"; return 3; }
158 do_facet client "munlink $DIR/$tfile"
159 # allow recovery to complete
160 client_up || client_up || sleep $TIMEOUT
162 run_test 10 "finish request on server after client eviction (bug 1521)"
165 # wake up a thread waiting for completion after eviction
167 do_facet client $MULTIOP $DIR/$tfile Ow ||
168 { error "multiop write failed: $?"; return 1; }
169 do_facet client $MULTIOP $DIR/$tfile or ||
170 { error "multiop read failed: $?"; return 2; }
174 do_facet client $MULTIOP $DIR/$tfile or ||
175 { error "multiop read failed: $?"; return 3; }
176 drop_bl_callback $MULTIOP $DIR/$tfile Ow || echo "evicted as expected"
178 do_facet client munlink $DIR/$tfile ||
179 { error "munlink failed: $?"; return 4; }
180 # allow recovery to complete
181 client_up || client_up || sleep $TIMEOUT
183 run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
187 $LCTL mark $MULTIOP $DIR/$tfile OS_c
188 do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
189 clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
190 multiop_bg_pause $DIR/$tfile OS_c ||
191 { error "multiop failed: $?"; return 1; }
193 #define OBD_FAIL_MDS_CLOSE_NET 0x115
195 echo "waiting for multiop $PID"
196 wait $PID || { error "wait for multiop faile: $?"; return 2; }
197 do_facet client munlink $DIR/$tfile ||
198 { error "client munlink failed: $?"; return 3; }
199 # allow recovery to complete
200 client_up || client_up || sleep $TIMEOUT
202 run_test 12 "recover from timed out resend in ptlrpcd (b=2494)"
204 # Bug 113, check that readdir lost recv timeout works.
206 mkdir -p $DIR/$tdir || { error "mkdir failed: $?"; return 1; }
207 touch $DIR/$tdir/newentry || { error "touch failed: $?"; return 2; }
208 # OBD_FAIL_MDS_READPAGE_NET|OBD_FAIL_ONCE
209 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000104"
210 ls $DIR/$tdir || { error "ls failed: $?"; return 3; }
211 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
212 rm -rf $DIR/$tdir || { error "remove test dir failed: $?"; return 4; }
214 run_test 13 "mdc_readpage restart test (bug 1138)"
216 # Bug 113, check that readdir lost send timeout works.
219 touch $DIR/$tdir/newentry
220 # OBD_FAIL_MDS_SENDPAGE|OBD_FAIL_ONCE
221 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000106"
222 ls $DIR/$tdir || return 1
223 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
225 run_test 14 "mdc_readpage resend test (bug 1138)"
228 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
229 touch $DIR/$tfile && return 1
232 run_test 15 "failed open (-ENOMEM)"
234 READ_AHEAD=`lctl get_param -n llite.*.max_read_ahead_mb | head -n 1`
236 lctl set_param -n llite.*.max_read_ahead_mb 0
240 lctl set_param -n llite.*.max_read_ahead_mb $READ_AHEAD
244 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
246 do_facet_random_file client $TMP/$tfile 100K ||
247 { error_noexit "Create random file $TMP/$T" ; return 0; }
248 do_facet client "cp $TMP/$tfile $DIR/$tfile" ||
249 { error_noexit "Copy to $DIR/$tfile file" ; return 0; }
253 #define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
254 do_facet ost1 "lctl set_param fail_loc=0x80000504"
256 # OST bulk will time out here, client resends
257 do_facet client "cmp $TMP/$tfile $DIR/$tfile" || return 1
258 do_facet ost1 lctl set_param fail_loc=0
259 # give recovery a chance to finish (shouldn't take long)
261 do_facet client "cmp $TMP/$tfile $DIR/$tfile" || return 2
264 run_test 16 "timeout bulk put, don't evict client (2732)"
269 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
271 local SAMPLE_FILE=$TMP/$tfile
272 do_facet_random_file client $SAMPLE_FILE 20K ||
273 { error_noexit "Create random file $SAMPLE_FILE" ; return 0; }
275 # With adaptive timeouts, bulk_get won't expire until adaptive_timeout_max
276 if at_is_enabled; then
277 at_max_saved=$(at_max_get ost1)
278 at_max_set $TIMEOUT ost1
281 # OBD_FAIL_PTLRPC_BULK_GET_NET 0x0503 | OBD_FAIL_ONCE
282 # OST bulk will time out here, client retries
283 do_facet ost1 lctl set_param fail_loc=0x80000503
284 # need to ensure we send an RPC
285 do_facet client cp $SAMPLE_FILE $DIR/$tfile
288 # with AT, client will wait adaptive_max*factor+net_latency before
289 # expiring the req, hopefully timeout*2 is enough
290 sleep $(($TIMEOUT*2))
292 do_facet ost1 lctl set_param fail_loc=0
293 do_facet client "df $DIR"
294 # expect cmp to succeed, client resent bulk
295 do_facet client "cmp $SAMPLE_FILE $DIR/$tfile" || return 3
296 do_facet client "rm $DIR/$tfile" || return 4
297 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved ost1
300 run_test 17 "timeout bulk get, don't evict client (2732)"
303 [ -z ${ost2_svc} ] && skip_env "needs 2 osts" && return 0
305 do_facet_create_file client $TMP/$tfile 20K ||
306 { error_noexit "Create file $TMP/$tfile" ; return 0; }
308 do_facet client mkdir -p $DIR/$tdir
312 pgcache_empty || return 1
315 $LFS setstripe -i 1 -c 1 $f
316 stripe_index=$($LFS getstripe -i $f)
317 if [ $stripe_index -ne 1 ]; then
319 error "$f: stripe_index $stripe_index != 1" && return
322 do_facet client cp $TMP/$tfile $f
324 local osc2dev=`lctl get_param -n devices | grep ${ost2_svc}-osc- | egrep -v 'MDT' | awk '{print $1}'`
325 $LCTL --device $osc2dev deactivate || return 3
326 # my understanding is that there should be nothing in the page
327 # cache after the client reconnects?
329 pgcache_empty || rc=2
330 $LCTL --device $osc2dev activate
334 run_test 18a "manual ost invalidate clears page cache immediately"
337 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
339 do_facet_create_file client $TMP/$tfile 20K ||
340 { error_noexit "Create file $TMP/$tfile" ; return 0; }
342 do_facet client mkdir -p $DIR/$tdir
346 pgcache_empty || return 1
348 $LFS setstripe -i 0 -c 1 $f
349 stripe_index=$($LFS getstripe -i $f)
350 if [ $stripe_index -ne 0 ]; then
352 error "$f: stripe_index $stripe_index != 0" && return
355 do_facet client cp $TMP/$tfile $f
358 # allow recovery to complete
359 sleep $((TIMEOUT + 2))
360 # my understanding is that there should be nothing in the page
361 # cache after the client reconnects?
363 pgcache_empty || rc=2
367 run_test 18b "eviction and reconnect clears page cache (2766)"
370 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
372 do_facet_create_file client $TMP/$tfile 20K ||
373 { error_noexit "Create file $TMP/$tfile" ; return 0; }
375 do_facet client mkdir -p $DIR/$tdir
379 pgcache_empty || return 1
381 $LFS setstripe -i 0 -c 1 $f
382 stripe_index=$($LFS getstripe -i $f)
383 if [ $stripe_index -ne 0 ]; then
385 error "$f: stripe_index $stripe_index != 0" && return
388 do_facet client cp $TMP/$tfile $f
392 # OBD_FAIL_OST_CONNECT_NET2
393 # lost reply to connect request
394 do_facet ost1 lctl set_param fail_loc=0x80000225
397 df $MOUNT > /dev/null 2>&1
399 # my understanding is that there should be nothing in the page
400 # cache after the client reconnects?
402 pgcache_empty || rc=2
406 run_test 18c "Dropped connect reply after eviction handing (14755)"
409 local BEFORE=`date +%s`
412 mount_client $DIR2 || error "failed to mount $DIR2"
414 do_facet client "stat $DIR > /dev/null" ||
415 error "failed to stat $DIR: $?"
416 drop_ldlm_cancel "chmod 0777 $DIR2" ||
417 error "failed to chmod $DIR2"
421 # let the client reconnect
423 EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state | \
424 awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
426 [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
427 (do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state;
428 error "no eviction: $EVICT before:$BEFORE")
430 run_test 19a "test expired_lock_main on mds (2867)"
433 local BEFORE=`date +%s`
436 mount_client $DIR2 || error "failed to mount $DIR2: $?"
438 do_facet client $MULTIOP $DIR/$tfile Ow ||
439 error "failed to run multiop: $?"
440 drop_ldlm_cancel $MULTIOP $DIR2/$tfile Ow ||
441 error "failed to ldlm_cancel: $?"
443 umount_client $DIR2 || error "failed to unmount $DIR2: $?"
444 do_facet client munlink $DIR/$tfile ||
445 error "failed to unlink $DIR/$tfile: $?"
447 # let the client reconnect
449 EVICT=$(do_facet client $LCTL get_param osc.$FSNAME-OST*.state | \
450 awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
452 [ ! -z "$EVICT" ] && [[ $EVICT -gt $BEFORE ]] ||
453 (do_facet client $LCTL get_param osc.$FSNAME-OST*.state;
454 error "no eviction: $EVICT before:$BEFORE")
456 run_test 19b "test expired_lock_main on ost (2867)"
459 local BEFORE=`date +%s`
462 $LCTL set_param ldlm.namespaces.*.early_lock_cancel=0
464 mkdir -p $DIR1/$tfile
467 #define OBD_FAIL_PTLRPC_CANCEL_RESEND 0x516
468 do_facet mds $LCTL set_param fail_loc=0x80000516
470 touch $DIR2/$tfile/file1 &
472 # let touch to get blocked on the server
476 $LCTL set_param ldlm.namespaces.*.early_lock_cancel=1
479 # let the client reconnect
481 EVICT=$(do_facet client $LCTL get_param mdc.$FSNAME-MDT*.state |
482 awk -F"[ [,]" '/EVICTED]$/ { if (mx<$4) {mx=$4;} } END { print mx }')
484 [ -z "$EVICT" ] || [[ $EVICT -le $BEFORE ]] || error "eviction happened"
486 run_test 19c "check reconnect and lock resend do not trigger expired_lock_main"
488 test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
489 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
492 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${tfile}
493 multiop_bg_pause $DIR/$tdir/${tfile} O_wc || return 1
496 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
497 do_facet ost1 lctl set_param fail_loc=0x80000308
498 kill -USR1 $MULTI_PID
501 [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
503 run_test 20a "ldlm_handle_enqueue error (should return error)"
505 test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
506 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
509 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${tfile}
511 #define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
512 do_facet ost1 lctl set_param fail_loc=0x80000308
513 dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
514 error "didn't fail open enqueue" || true
516 run_test 20b "ldlm_handle_enqueue error (should return error)"
519 mkdir -p $DIR/$tdir-1
520 mkdir -p $DIR/$tdir-2
521 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
524 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
525 $MULTIOP $DIR/$tdir-2/f Oc &
528 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
530 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
531 kill -USR1 $close_pid
533 wait $close_pid || return 1
534 wait $open_pid || return 2
535 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
537 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
538 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
542 run_test 21a "drop close request while close and open are both in flight"
545 mkdir -p $DIR/$tdir-1
546 mkdir -p $DIR/$tdir-2
547 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
550 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
551 mcreate $DIR/$tdir-2/f &
554 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
556 kill -USR1 $close_pid
558 wait $close_pid || return 1
559 wait $open_pid || return 3
561 $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
562 $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
565 run_test 21b "drop open request while close and open are both in flight"
568 mkdir -p $DIR/$tdir-1
569 mkdir -p $DIR/$tdir-2
570 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
573 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
574 mcreate $DIR/$tdir-2/f &
577 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
579 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
580 kill -USR1 $close_pid
582 wait $close_pid || return 1
583 wait $open_pid || return 2
585 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
587 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
588 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
591 run_test 21c "drop both request while close and open are both in flight"
594 mkdir -p $DIR/$tdir-1
595 mkdir -p $DIR/$tdir-2
596 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
599 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000129"
600 $MULTIOP $DIR/$tdir-2/f Oc &
602 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
604 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
607 wait $pid || return 1
608 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
610 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
611 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
615 run_test 21d "drop close reply while close and open are both in flight"
618 mkdir -p $DIR/$tdir-1
619 mkdir -p $DIR/$tdir-2
620 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
623 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
624 touch $DIR/$tdir-2/f &
626 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
630 wait $pid || return 1
633 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
634 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
637 run_test 21e "drop open reply while close and open are both in flight"
640 mkdir -p $DIR/$tdir-1
641 mkdir -p $DIR/$tdir-2
642 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
645 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
646 touch $DIR/$tdir-2/f &
648 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
650 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
653 wait $pid || return 1
654 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
656 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
657 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
660 run_test 21f "drop both reply while close and open are both in flight"
663 mkdir -p $DIR/$tdir-1
664 mkdir -p $DIR/$tdir-2
665 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
668 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
669 touch $DIR/$tdir-2/f &
671 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
673 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
676 wait $pid || return 1
677 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
679 $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
680 $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
683 run_test 21g "drop open reply and close request while close and open are both in flight"
686 mkdir -p $DIR/$tdir-1
687 mkdir -p $DIR/$tdir-2
688 multiop_bg_pause $DIR/$tdir-1/f O_c || return 1
691 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
692 touch $DIR/$tdir-2/f &
695 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
697 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000122"
700 wait $pid || return 1
701 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
703 wait $touch_pid || return 2
705 $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
706 $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
709 run_test 21h "drop open request and close reply while close and open are both in flight"
711 # bug 3462 - multiple MDC requests
716 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
721 $MULTIOP $f1 msu || return 1
724 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
726 wait $close_pid || return 2
727 rm -rf $f2 || return 4
729 run_test 22 "drop close request and do mknod"
732 multiop_bg_pause $DIR/$tfile O_c || return 1
734 # give a chance for open
738 drop_request "kill -USR1 $pid"
741 wait $pid || return 1
744 run_test 23 "client hang when close a file after mds crash"
746 test_24a() { # bug 11710 details correct fsync() behavior
747 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
750 $LFS setstripe -i 0 -c 1 $DIR/$tdir
752 multiop_bg_pause $DIR/$tdir/$tfile Owy_wyc || return 1
755 kill -USR1 $MULTI_PID
758 lctl set_param fail_loc=0x0
760 [ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
762 run_test 24a "fsync error (should return error)"
764 wait_client_evicted () {
767 local varsvc=${facet}_svc
769 wait_update $(facet_active_host $facet) \
770 "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" \
775 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
779 lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
781 multiop_bg_pause $DIR/$tdir/$tfile-1 Ow8192_yc ||
782 error "mulitop Ow8192_yc failed"
785 multiop_bg_pause $DIR/$tdir/$tfile-2 Ow8192_c ||
786 error "mulitop Ow8192_c failed"
791 kill -USR1 $MULTI_PID1
794 kill -USR1 $MULTI_PID2
797 lctl set_param fail_loc=0x0
799 [ $rc1 -eq 0 -o $rc2 -eq 0 ] &&
800 error_ignore 5494 "multiop didn't fail fsync: $rc1 or close: $rc2" ||
803 dmesg | grep "dirty page discard:" || \
804 error "no discarded dirty page found!"
806 run_test 24b "test dirty page discard due to client eviction"
808 test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
809 # this test can only run from a client on a separate node.
810 remote_ost || { skip "local OST" && return 0; }
811 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
812 remote_mds || { skip "local MDS" && return 0; }
814 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
815 skip "msg and ost1 are at the same node"
819 check_timeout || return 1
821 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
823 echo starting with $OST_NEXP OST exports
824 # OBD_FAIL_PTLRPC_DROP_RPC 0x505
825 do_facet client lctl set_param fail_loc=0x505
826 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
827 # But if there's a race to start the evictor from various obds,
828 # the loser might have to wait for the next ping.
831 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 2 + TIMEOUT * 3 / 4))
833 do_facet client lctl set_param fail_loc=0x0
834 [ $rc -eq 0 ] || error "client not evicted from OST"
836 run_test 26a "evict dead exports"
838 test_26b() { # bug 10140 - evict dead exports by pinger
839 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
841 if [ $(facet_host mgs) = $(facet_host ost1) ]; then
842 skip "msg and ost1 are at the same node"
846 check_timeout || return 1
848 zconf_mount `hostname` $MOUNT2 ||
849 { error "Failed to mount $MOUNT2"; return 2; }
850 sleep 1 # wait connections being established
852 local MDS_NEXP=$(do_facet $SINGLEMDS lctl get_param -n mdt.${mds1_svc}.num_exports | cut -d' ' -f2)
853 local OST_NEXP=$(do_facet ost1 lctl get_param -n obdfilter.${ost1_svc}.num_exports | cut -d' ' -f2)
855 echo starting with $OST_NEXP OST and $MDS_NEXP MDS exports
857 zconf_umount `hostname` $MOUNT2 -f
859 # PING_INTERVAL max(obd_timeout / 4, 1U)
860 # PING_EVICT_TIMEOUT (PING_INTERVAL * 6)
862 # evictor takes PING_EVICT_TIMEOUT + 3 * PING_INTERVAL to evict.
863 # But if there's a race to start the evictor from various obds,
864 # the loser might have to wait for the next ping.
865 # = 9 * PING_INTERVAL + PING_INTERVAL
866 # = 10 PING_INTERVAL = 10 obd_timeout / 4 = 2.5 obd_timeout
867 # let's wait $((TIMEOUT * 3)) # bug 19887
869 wait_client_evicted ost1 $OST_NEXP $((TIMEOUT * 3)) || \
870 error "Client was not evicted by ost" rc=1
871 wait_client_evicted $SINGLEMDS $MDS_NEXP $((TIMEOUT * 3)) || \
872 error "Client was not evicted by mds"
874 run_test 26b "evict dead exports"
878 writemany -q -a $DIR/$tdir/$tfile 0 5 &
881 local save_FAILURE_MODE=$FAILURE_MODE
883 facet_failover $SINGLEMDS
884 #define OBD_FAIL_OSC_SHUTDOWN 0x407
885 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000407
886 # need to wait for reconnect
887 echo waiting for fail_loc
888 wait_update_facet $SINGLEMDS "lctl get_param -n fail_loc" "-2147482617"
889 facet_failover $SINGLEMDS
891 kill -USR1 $CLIENT_PID
894 FAILURE_MODE=$save_FAILURE_MODE
896 run_test 27 "fail LOV while using OSC's"
898 test_28() { # bug 6086 - error adding new clients
899 do_facet client mcreate $DIR/$tfile || return 1
900 drop_bl_callback "chmod 0777 $DIR/$tfile" ||echo "evicted as expected"
901 #define OBD_FAIL_MDS_CLIENT_ADD 0x12f
902 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012f"
903 # fail once (evicted), reconnect fail (fail_loc), ok
904 client_up || (sleep 10; client_up) || (sleep 10; client_up) || error "reconnect failed"
906 fail $SINGLEMDS # verify MDS last_rcvd can be loaded
908 run_test 28 "handle error adding new clients (bug 6086)"
910 test_29a() { # bug 22273 - error adding new clients
911 #define OBD_FAIL_TGT_CLIENT_ADD 0x711
912 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000711"
913 # fail abort so client will be new again
914 fail_abort $SINGLEMDS
915 client_up || error "reconnect failed"
916 wait_osc_import_state mds ost FULL
919 run_test 29a "error adding new clients doesn't cause LBUG (bug 22273)"
921 test_29b() { # bug 22273 - error adding new clients
922 #define OBD_FAIL_TGT_CLIENT_ADD 0x711
923 do_facet ost1 "lctl set_param fail_loc=0x80000711"
924 # fail abort so client will be new again
926 client_up || error "reconnect failed"
929 run_test 29b "error adding new clients doesn't cause LBUG (bug 22273)"
933 # put a load of file creates/writes/deletes
934 writemany -q $DIR/$tdir/$tfile 0 5 &
936 echo writemany pid $CLIENT_PID
940 # wait for client to reconnect to MDS
945 # client process should see no problems even though MDS went down
947 kill -USR1 $CLIENT_PID
950 echo writemany returned $rc
951 #these may fail because of eviction due to slow AST response.
952 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
954 run_test 50 "failover MDS under load"
957 #define OBD_FAIL_MDS_SYNC_CAPA_SL 0x1310
958 do_facet ost1 lctl set_param fail_loc=0x00001310
961 # put a load of file creates/writes/deletes
962 writemany -q $DIR/$tdir/$tfile 0 5 &
966 facet_failover $SINGLEMDS
967 # failover at various points during recovery
968 SEQ="1 5 10 $(seq $TIMEOUT 5 $(($TIMEOUT+10)))"
969 echo will failover at $SEQ
972 #echo failover in $i sec
973 log "test_$testnum: failover in $i sec"
975 facet_failover $SINGLEMDS
977 # client process should see no problems even though MDS went down
978 # and recovery was interrupted
980 kill -USR1 $CLIENT_PID
983 echo writemany returned $rc
984 [ $rc -eq 0 ] || error_ignore 13652 "writemany returned rc $rc" || true
986 run_test 51 "failover MDS during recovery"
989 do_facet client "mkdir -p $DIR/$tdir"
990 do_facet client "writemany -q -a $DIR/$tdir/$tfile 300 5" &
992 echo writemany pid $CLIENT_PID
997 wait $CLIENT_PID || rc=$?
998 # active client process should see an EIO for down OST
999 [ $rc -eq 5 ] && { echo "writemany correctly failed $rc" && return 0; }
1000 # but timing or failover setup may allow success
1001 [ $rc -eq 0 ] && { echo "writemany succeeded" && return 0; }
1002 echo "writemany returned $rc"
1007 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1012 [ $rc -ne 0 ] && { return $rc; }
1013 # wait for client to reconnect to OST
1017 [ $rc -ne 0 ] && { return $rc; }
1024 run_test 52 "failover OST under load"
1026 # test of open reconstruct
1029 drop_ldlm_reply "openfile -f O_RDWR:O_CREAT -m 0755 $DIR/$tfile" ||\
1032 run_test 53 "touch: drop rep"
1035 zconf_mount `hostname` $MOUNT2
1037 touch $DIR2/$tfile.1
1039 cat $DIR2/$tfile.missing # save transno = 0, rc != 0 into last_rcvd
1042 ERROR=`dmesg | egrep "(test 54|went back in time)" | tail -n1 | grep "went back in time"`
1043 [ x"$ERROR" == x ] || error "back in time occured"
1045 run_test 54 "back in time"
1047 # bug 11330 - liblustre application death during I/O locks up OST
1049 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1053 # first dd should be finished quickly
1054 $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile-1
1055 dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=32M count=4 &
1058 echo "step1: testing ......"
1060 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
1062 if [ $count -gt 64 ]; then
1063 error "dd should be finished!"
1067 echo "(dd_pid=$DDPID, time=$count)successful"
1069 $LFS setstripe -c 1 -i 0 $DIR/$tdir/$tfile-2
1070 #define OBD_FAIL_OST_DROP_REQ 0x21d
1071 do_facet ost1 lctl set_param fail_loc=0x0000021d
1072 # second dd will be never finished
1073 dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=32M count=4 &
1076 echo "step2: testing ......"
1077 while [ $count -le 64 ]; do
1078 dd_name="`ps x | awk '$1 == '$DDPID' { print $5 }'`"
1079 if [ -z $dd_name ]; then
1081 echo "debug: (dd_name=$dd_name, dd_pid=$DDPID, time=$count)"
1082 error "dd shouldn't be finished!"
1087 echo "(dd_pid=$DDPID, time=$count)successful"
1089 #Recover fail_loc and dd will finish soon
1090 do_facet ost1 lctl set_param fail_loc=0
1092 echo "step3: testing ......"
1094 if [ -z `ps x | awk '$1 == '$DDPID' { print $5 }'` ]; then break; fi
1096 if [ $count -gt 500 ]; then
1097 error "dd should be finished!"
1101 echo "(dd_pid=$DDPID, time=$count)successful"
1105 run_test 55 "ost_brw_read/write drops timed-out read/write request"
1107 test_56() { # b=11277
1108 #define OBD_FAIL_MDS_RESEND 0x136
1110 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000136"
1112 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1115 run_test 56 "do not allow reconnect to busy exports"
1118 # no oscs means no client or mdt
1119 while lctl get_param osc.*.* > /dev/null 2>&1; do
1120 : # loop until proc file is removed
1124 test_57() { # bug 10866
1128 #define OBD_FAIL_LPROC_REMOVE 0xB00
1129 lctl set_param fail_loc=0x80000B00
1130 zconf_umount `hostname` $DIR
1131 lctl set_param fail_loc=0x80000B00
1132 fail_abort $SINGLEMDS
1134 lctl set_param fail_loc=0
1136 do_facet client "df $DIR"
1138 run_test 57 "read procfs entries causes kernel crash"
1140 test_58() { # bug 11546
1141 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
1144 lctl set_param fail_loc=0x80000801
1145 cp $DIR/$tfile /dev/null &
1148 lctl set_param fail_loc=0
1149 drop_bl_callback rm -f $DIR/$tfile
1151 # the first 'df' could tigger the eviction caused by
1152 # 'drop_bl_callback', and it's normal case.
1153 # but the next 'df' should return successfully.
1154 do_facet client "df $DIR" || do_facet client "df $DIR"
1156 run_test 58 "Eviction in the middle of open RPC reply processing"
1158 test_59() { # bug 10589
1159 zconf_mount `hostname` $MOUNT2 || error "Failed to mount $MOUNT2"
1160 echo $DIR2 | grep -q $MOUNT2 || error "DIR2 is not set properly: $DIR2"
1161 #define OBD_FAIL_LDLM_CANCEL_EVICT_RACE 0x311
1162 lctl set_param fail_loc=0x311
1163 writes=$(LANG=C dd if=/dev/zero of=$DIR2/$tfile count=1 2>&1)
1164 [ $? = 0 ] || error "dd write failed"
1165 writes=$(echo $writes | awk -F '+' '/out/ {print $1}')
1166 lctl set_param fail_loc=0
1168 zconf_umount `hostname` $MOUNT2 -f
1169 reads=$(LANG=C dd if=$DIR/$tfile of=/dev/null 2>&1)
1170 [ $? = 0 ] || error "dd read failed"
1171 reads=$(echo $reads | awk -F '+' '/in/ {print $1}')
1172 [ "$reads" -eq "$writes" ] || error "read" $reads "blocks, must be" $writes
1174 run_test 59 "Read cancel race on client eviction"
1177 # we assume that all md changes are in the MDT0 changelog
1178 if [ $MDSCOUNT -gt 1 ]; then
1179 error_ignore 17935 $*
1186 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid | \
1187 awk '{gsub(/_UUID/,""); print $1}' | head -1)
1192 # Register (and start) changelog
1193 USER=$(do_facet $SINGLEMDS lctl --device $MDT0 changelog_register -n)
1194 echo "Registered as $MDT0 changelog user $USER"
1196 # Generate a large number of changelog entries
1197 createmany -o $DIR/$tdir/$tfile $NUM_FILES
1201 # Unlink files in the background
1202 unlinkmany $DIR/$tdir/$tfile $NUM_FILES &
1206 # Failover the MDS while unlinks are happening
1207 facet_failover $SINGLEMDS
1209 # Wait for unlinkmany to finish
1212 # Check if all the create/unlink events were recorded
1214 $LFS changelog $MDT0 >> $DIR/$tdir/changelog
1215 local cl_count=$(grep UNLNK $DIR/$tdir/changelog | wc -l)
1216 echo "$cl_count unlinks in $MDT0 changelog"
1218 do_facet $SINGLEMDS lctl --device $MDT0 changelog_deregister $USER
1219 USERS=$(( $(do_facet $SINGLEMDS lctl get_param -n \
1220 mdd.$MDT0.changelog_users | wc -l) - 2 ))
1221 if [ $USERS -eq 0 ]; then
1222 [ $cl_count -eq $NUM_FILES ] || \
1223 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1224 # Also make sure we can clear large changelogs
1225 cl_count=$($LFS changelog $FSNAME | wc -l)
1226 [ $cl_count -le 2 ] || \
1227 error "Changelog not empty: $cl_count entries"
1229 # If there are other users, there may be other unlinks in the log
1230 [ $cl_count -ge $NUM_FILES ] || \
1231 err17935 "Recorded ${cl_count} unlinks out of $NUM_FILES"
1232 echo "$USERS other changelog users; can't verify clear"
1235 run_test 60 "Add Changelog entries during MDS failover"
1239 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0000)
1240 mdtosc=${mdtosc/-MDT*/-MDT\*}
1241 local cflags="osc.$mdtosc.connect_flags"
1242 do_facet $SINGLEMDS "lctl get_param -n $cflags" |grep -q skip_orphan
1243 [ $? -ne 0 ] && skip "don't have skip orphan feature" && return
1245 mkdir -p $DIR/$tdir || error "mkdir dir $DIR/$tdir failed"
1246 # Set the default stripe of $DIR/$tdir to put the files to ost1
1247 $LFS setstripe -c 1 -i 0 $DIR/$tdir
1249 replay_barrier $SINGLEMDS
1250 createmany -o $DIR/$tdir/$tfile-%d 10
1251 local oid=`do_facet ost1 "lctl get_param -n obdfilter.${ost1_svc}.last_id"`
1253 fail_abort $SINGLEMDS
1255 touch $DIR/$tdir/$tfile
1256 local id=`$LFS getstripe $DIR/$tdir/$tfile | awk '$1 == 0 { print $2 }'`
1257 [ $id -le $oid ] && error "the orphan objid was reused, failed"
1262 run_test 61 "Verify to not reuse orphan objects - bug 17025"
1264 # test_62 as seen it b2_1 please do not reuse test_62
1267 # zconf_umount `hostname` $DIR
1268 # #define OBD_FAIL_PTLRPC_DELAY_IMP_FULL 0x516
1269 # lctl set_param fail_loc=0x516
1272 #run_test 62 "Verify connection flags race - bug LU-1716"
1274 check_cli_ir_state()
1276 local NODE=${1:-$HOSTNAME}
1278 st=$(do_node $NODE "lctl get_param mgc.*.ir_state |
1279 awk '/imperative_recovery:/ { print \\\$2}'")
1280 [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
1281 error "Error state $st, must be ENABLED or DISABLED"
1285 check_target_ir_state()
1288 local name=${target}_svc
1289 local recovery_proc=obdfilter.${!name}.recovery_status
1292 st=$(do_facet $target "lctl get_param -n $recovery_proc |
1293 awk '/IR:/{ print \\\$2}'")
1294 [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
1295 error "Error state $st, must be ENABLED or DISABLED"
1301 do_facet mgs lctl set_param -n mgs.MGS.live.$FSNAME="state=$1"
1306 local state=$(do_facet mgs "lctl get_param -n mgs.MGS.live.$FSNAME |
1307 awk '/state:/{ print \\\$2 }'")
1311 nidtbl_version_mgs()
1313 local ver=$(do_facet mgs "lctl get_param -n mgs.MGS.live.$FSNAME |
1314 awk '/nidtbl_version:/{ print \\\$2 }'")
1318 # nidtbl_version_client <mds1|client> [node]
1319 nidtbl_version_client()
1322 local node=${2:-$HOSTNAME}
1324 if [ X$cli = Xclient ]; then
1327 local obdtype=${cli/%[0-9]*/}
1328 [ $obdtype != mds ] && error "wrong parameters $cli"
1330 node=$(facet_active_host $cli)
1335 local vers=$(do_node $node "lctl get_param -n mgc.*.ir_state" |
1336 awk "/$cli/{print \$6}" |sort -u)
1338 # in case there are multiple mounts on the client node
1340 [ ${#arr[@]} -ne 1 ] && error "versions on client node mismatch"
1344 nidtbl_versions_match()
1346 [ $(nidtbl_version_mgs) -eq $(nidtbl_version_client ${1:-client}) ]
1349 target_instance_match()
1355 obdtype=${srv/%[0-9]*/}
1366 error "invalid target type" $srv
1371 local target=${srv}_svc
1372 local si=$(do_facet $srv lctl get_param -n $obdname.${!target}.instance)
1373 local ci=$(lctl get_param -n $cliname.${!target}-${cliname}-*.import | \
1374 awk '/instance/{ print $2 }' |head -1)
1376 return $([ $si -eq $ci ])
1381 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1382 { skip "MGS without IR support"; return 0; }
1384 # MDT was just restarted in the previous test, make sure everything
1387 while [ $cnt -gt 0 ]; do
1388 nidtbl_versions_match && break
1394 set_ir_status disabled
1396 local prev_ver=$(nidtbl_version_client client)
1398 local saved_FAILURE_MODE=$FAILURE_MODE
1399 [ $(facet_host mgs) = $(facet_host ost1) ] && FAILURE_MODE="SOFT"
1403 [ $(nidtbl_version_client client) -eq $prev_ver ] ||
1404 error "version must not change due to IR disabled"
1405 target_instance_match ost1 || error "instance mismatch"
1409 FAILURE_MODE=$saved_FAILURE_MODE
1411 run_test 100 "IR: Make sure normal recovery still works w/o IR"
1415 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1416 { skip "MGS without IR support"; return 0; }
1420 local OST1_IMP=$(get_osc_import_name client ost1)
1422 # disable pinger recovery
1423 lctl set_param -n osc.$OST1_IMP.pinger_recov=0
1427 target_instance_match ost1 || error "instance mismatch"
1428 nidtbl_versions_match || error "version must match"
1430 lctl set_param -n osc.$OST1_IMP.pinger_recov=1
1432 run_test 101 "IR: Make sure IR works w/o normal recovery"
1436 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1437 { skip "MGS without IR support"; return 0; }
1439 local clients=${CLIENTS:-$HOSTNAME}
1446 # let's have a new nidtbl version
1449 # sleep for a while so that clients can see the failure of ost
1450 # it must be MGC_TIMEOUT_MIN_SECONDS + MGC_TIMEOUT_RAND_CENTISEC.
1451 # int mgc_request.c:
1452 # define MGC_TIMEOUT_MIN_SECONDS 5
1453 # define MGC_TIMEOUT_RAND_CENTISEC 0x1ff /* ~500 *
1454 local count=30 # 20 seconds at most
1455 while [ $count -gt 0 ]; do
1456 nidtbl_versions_match && break
1461 nidtbl_versions_match || error "nidtbl mismatch"
1464 old_version=$(nidtbl_version_client client)
1466 zconf_umount_clients $clients $MOUNT || error "Cannot umount client"
1469 combined_mgs_mds && mgsdev=mds1
1470 remount_facet $mgsdev
1473 zconf_mount_clients $clients $MOUNT || error "Cannot mount client"
1476 new_version=$(nidtbl_version_client client)
1477 [ $new_version -lt $old_version ] &&
1478 error "nidtbl version wrong after mgs restarts"
1481 run_test 102 "IR: New client gets updated nidtbl after MGS restart"
1485 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1486 { skip "MGS without IR support"; return 0; }
1488 combined_mgs_mds && skip "mgs and mds on the same target" && return 0
1490 # workaround solution to generate config log on the mds
1496 # We need this test because mds is like a client in IR context.
1497 start mds1 $MDSDEV1 || error "MDS should start w/o mgs"
1499 # start mgs and remount mds w/ ir
1503 # remount client so that fsdb will be created on the MGS
1504 umount_client $MOUNT || error "umount failed"
1505 mount_client $MOUNT || error "mount failed"
1507 # sleep 30 seconds so the MDS has a chance to detect MGS restarting
1509 while [ $count -gt 0 ]; do
1510 [ $(nidtbl_version_client mds1) -ne 0 ] && break
1515 # after a while, mds should be able to reconnect to mgs and fetch
1516 # up-to-date nidtbl version
1517 nidtbl_versions_match mds1 || error "mds nidtbl mismatch"
1522 run_test 103 "IR: MDS can start w/o MGS and get updated nidtbl later"
1526 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1527 { skip "MGS without IR support"; return 0; }
1532 start ost1 $(ostdevname 1) "$OST_MOUNT_OPTS -onoir" ||
1533 error "OST1 cannot start"
1536 local ir_state=$(check_target_ir_state ost1)
1537 [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1538 error "ir status on ost1 should be DISABLED"
1540 run_test 104 "IR: ost can disable IR voluntarily"
1544 [ -z "$RCLIENTS" ] && skip "Needs multiple clients" && return 0
1545 do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
1546 { skip "MGS without IR support"; return 0; }
1550 # get one of the clients from client list
1551 local rcli=$(echo $RCLIENTS |cut -d' ' -f 1)
1553 local old_MOUNTOPT=$MOUNTOPT
1554 MOUNTOPT=${MOUNTOPT},noir
1555 zconf_umount $rcli $MOUNT || error "umount failed"
1556 zconf_mount $rcli $MOUNT || error "mount failed"
1558 # make sure lustre mount at $rcli disabling IR
1559 local ir_state=$(check_cli_ir_state $rcli)
1560 [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1561 error "IR state must be DISABLED at $rcli"
1563 # Since the client just mounted, its last_rcvd entry is not on disk.
1564 # Send an RPC so exp_need_sync forces last_rcvd to commit this export
1565 # so the client can reconnect during OST recovery (LU-924, LU-1582)
1566 $SETSTRIPE -i 0 $DIR/$tfile
1567 dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 conv=sync
1569 # make sure MGS's state is Partial
1570 [ $(get_ir_status) = "partial" ] || error "MGS IR state must be partial"
1573 # make sure IR on ost1 is DISABLED
1574 local ir_state=$(check_target_ir_state ost1)
1575 [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
1576 error "IR status on ost1 should be DISABLED"
1579 MOUNTOPT=$old_MOUNTOPT
1580 zconf_umount $rcli $MOUNT || error "umount failed"
1581 zconf_mount $rcli $MOUNT || error "mount failed"
1583 # make sure MGS's state is full
1584 [ $(get_ir_status) = "full" ] || error "MGS IR status must be full"
1587 # make sure IR on ost1 is ENABLED
1588 local ir_state=$(check_target_ir_state ost1)
1589 [ $ir_state = "ENABLED" -o $ir_state = "ON" ] ||
1590 error "IR status on ost1 should be ENABLED"
1594 run_test 105 "IR: NON IR clients support"
1602 test_106() { # LU-1789
1603 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.50) ]] ||
1604 { skip "Need MDS version at least 2.3.50"; return 0; }
1606 #define OBD_FAIL_MDC_LIGHTWEIGHT 0x805
1607 $LCTL set_param fail_loc=0x805
1610 trap cleanup_106 EXIT
1612 # enable lightweight flag on mdc connection
1615 local MDS_NEXP=$(do_facet $SINGLEMDS \
1616 lctl get_param -n mdt.${mds1_svc}.num_exports |
1618 $LCTL set_param fail_loc=0
1620 touch $DIR2/$tfile || error "failed to create empty file"
1621 replay_barrier $SINGLEMDS
1623 $LCTL set_param debug=console
1625 facet_failover $SINGLEMDS
1627 # lightweight connection must be evicted
1628 touch -c $DIR2/$tfile || true
1629 $LCTL dk $TMP/lustre-log-$TESTNAME.log
1630 evicted=`awk '/This client was evicted by .*MDT0000/ {
1632 }' $TMP/lustre-log-$TESTNAME.log`
1633 [ -z "$evicted" ] && error "lightweight client not evicted by mds"
1635 # and all operations performed by lightweight client should be
1636 # synchronous, so the file created before mds restart should be there
1637 $CHECKSTAT -t file $DIR/$tfile || error "file not present"
1642 run_test 106 "lightweight connection support"
1649 # OBD_FAIL_MDS_REINT_NET_REP 0x119
1650 do_facet $SINGLEMDS lctl set_param fail_loc=0x119
1651 multiop $DIR/$tdir D_c &
1653 mkdir $DIR/$tdir/dir_106 &
1655 do_facet $SINGLEMDS lctl set_param fail_loc=0
1658 wait $CLIENT_PID || rc=$?
1659 checkstat -t dir $DIR/$tdir/dir_106 || return 1
1661 kill -USR1 $close_pid
1662 wait $close_pid || return 2
1666 run_test 107 "drop reint reply, then restart MDT"
1669 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1670 local remote_dir=$DIR/$tdir/remote_dir
1674 drop_request "$LFS mkdir -i $MDTIDX $remote_dir" ||
1675 error "lfs mkdir failed"
1676 local diridx=$($GETSTRIPE -M $remote_dir)
1677 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1679 rm -rf $DIR/$tdir || error "rmdir failed"
1681 run_test 110a "create remote directory: drop client req"
1684 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1685 local remote_dir=$DIR/$tdir/remote_dir
1689 drop_reint_reply "$LFS mkdir -i $MDTIDX $remote_dir" ||
1690 error "lfs mkdir failed"
1692 diridx=$($GETSTRIPE -M $remote_dir)
1693 [ $diridx -eq $MDTIDX ] || error "$diridx != $MDTIDX"
1695 rm -rf $DIR/$tdir || error "rmdir failed"
1697 run_test 110b "create remote directory: drop Master rep"
1700 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1701 local remote_dir=$DIR/$tdir/remote_dir
1705 drop_update_reply $((MDTIDX + 1)) "$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 110c "create remote directory: drop update rep on slave MDT"
1716 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1717 local remote_dir=$DIR/$tdir/remote_dir
1721 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1723 drop_request "rm -rf $remote_dir" || error "rm remote dir failed"
1725 rm -rf $DIR/$tdir || error "rmdir failed"
1729 run_test 110d "remove remote directory: drop client req"
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"
1738 drop_reint_reply "rm -rf $remote_dir" || error "rm remote dir failed"
1740 rm -rf $DIR/$tdir || error "rmdir failed"
1744 run_test 110e "remove remote directory: drop master rep"
1747 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
1748 local remote_dir=$DIR/$tdir/remote_dir
1752 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
1753 drop_update_reply $MDTIDX "rm -rf $remote_dir" ||
1754 error "rm remote dir failed"
1756 rm -rf $DIR/$tdir || error "rmdir failed"
1758 run_test 110f "remove remote directory: drop slave rep"
1761 check_and_cleanup_lustre