5 LUSTRE=${LUSTRE:-$(dirname $0)/..}
6 . $LUSTRE/tests/test-framework.sh
10 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
12 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
13 # bug number for skipped test: LU-11388
14 ALWAYS_EXCEPT+=" 131b"
15 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 # bug number for skipped tests: LU-9795 (all below)
19 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0b 0c 0d 34 45"
20 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 47 58b 58c 71a 85a"
21 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 85b 86 88 89 90"
22 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 93a 100a 100b 120"
27 CHECK_GRANT=${CHECK_GRANT:-"yes"}
28 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
30 require_dsh_mds || exit 0
31 check_and_setup_lustre
36 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
38 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
39 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
41 do_facet $SINGLEMDS sync
44 test_0a() { # was test_0
45 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
46 replay_barrier $SINGLEMDS
50 run_test 0a "empty replay"
53 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
55 # this test attempts to trigger a race in the precreation code,
56 # and must run before any other objects are created on the filesystem
58 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
59 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
61 run_test 0b "ensure object created after recover exists. (3284)"
64 replay_barrier $SINGLEMDS
67 facet_failover $SINGLEMDS
68 zconf_mount $(hostname) $MOUNT || error "mount fails"
69 client_up || error "post-failover df failed"
70 # file shouldn't exist if replay-barrier works as expected
71 rm $DIR/$tfile && error "File exists and it shouldn't"
74 run_test 0c "check replay-barrier"
77 replay_barrier $SINGLEMDS
79 facet_failover $SINGLEMDS
80 zconf_mount $(hostname) $MOUNT || error "mount fails"
81 client_up || error "post-failover df failed"
83 run_test 0d "expired recovery with no clients"
86 replay_barrier $SINGLEMDS
89 $CHECKSTAT -t file $DIR/$tfile ||
90 error "$CHECKSTAT $DIR/$tfile attribute check failed"
93 run_test 1 "simple create"
96 replay_barrier $SINGLEMDS
99 $CHECKSTAT -t file $DIR/$tfile ||
100 error "$CHECKSTAT $DIR/$tfile attribute check failed"
106 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
107 replay_barrier $SINGLEMDS
110 $CHECKSTAT -t file $DIR/$tfile ||
111 error "$CHECKSTAT $DIR/$tfile attribute check failed"
117 replay_barrier $SINGLEMDS
118 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
120 $CHECKSTAT -t file $DIR/$tfile ||
121 error "$CHECKSTAT $DIR/$tfile check failed"
123 run_test 2c "setstripe replay"
126 [[ $mds1_FSTYPE = "zfs" ]] &&
127 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
128 skip "requires LU-10143 fix on MDS"
129 replay_barrier $SINGLEMDS
130 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
132 $CHECKSTAT -t dir $DIR/$tdir ||
133 error "$CHECKSTAT $DIR/$tdir check failed"
135 run_test 2d "setdirstripe replay"
138 local file=$DIR/$tfile
139 replay_barrier $SINGLEMDS
141 openfile -f O_DIRECTORY $file
143 $CHECKSTAT -t file $file ||
144 error "$CHECKSTAT $file attribute check failed"
147 run_test 3a "replay failed open(O_DIRECTORY)"
150 replay_barrier $SINGLEMDS
151 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
152 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
154 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
156 $CHECKSTAT -t file $DIR/$tfile &&
157 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
160 run_test 3b "replay failed open -ENOMEM"
163 replay_barrier $SINGLEMDS
164 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
165 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
167 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
170 $CHECKSTAT -t file $DIR/$tfile &&
171 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
174 run_test 3c "replay failed open -ENOMEM"
176 test_4a() { # was test_4
177 replay_barrier $SINGLEMDS
178 for i in $(seq 10); do
179 echo "tag-$i" > $DIR/$tfile-$i
182 for i in $(seq 10); do
183 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
186 run_test 4a "|x| 10 open(O_CREAT)s"
189 for i in $(seq 10); do
190 echo "tag-$i" > $DIR/$tfile-$i
192 replay_barrier $SINGLEMDS
195 $CHECKSTAT -t file $DIR/$tfile-* &&
196 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
199 run_test 4b "|x| rm 10 files"
201 # The idea is to get past the first block of precreated files on both
202 # osts, and then replay.
204 replay_barrier $SINGLEMDS
205 for i in $(seq 220); do
206 echo "tag-$i" > $DIR/$tfile-$i
209 for i in $(seq 220); do
210 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
214 # waiting for commitment of removal
216 run_test 5 "|x| 220 open(O_CREAT)"
218 test_6a() { # was test_6
219 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
220 replay_barrier $SINGLEMDS
221 mcreate $DIR/$tdir/$tfile
223 $CHECKSTAT -t dir $DIR/$tdir ||
224 error "$CHECKSTAT $DIR/$tdir attribute check failed"
225 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
226 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
228 # waiting for log process thread
230 run_test 6a "mkdir + contained create"
233 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
234 replay_barrier $SINGLEMDS
237 $CHECKSTAT -t dir $DIR/$tdir &&
238 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
241 run_test 6b "|X| rmdir"
244 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
245 replay_barrier $SINGLEMDS
246 mcreate $DIR/$tdir/$tfile
248 $CHECKSTAT -t dir $DIR/$tdir ||
249 error "$CHECKSTAT $DIR/$tdir attribute check failed"
250 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
251 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
254 run_test 7 "mkdir |X| contained create"
257 replay_barrier $SINGLEMDS
258 multiop_bg_pause $DIR/$tfile mo_c ||
259 error "multiop mknod $DIR/$tfile failed"
263 $CHECKSTAT -t file $DIR/$tfile ||
264 error "$CHECKSTAT $DIR/$tfile attribute check failed"
265 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
266 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
269 run_test 8 "creat open |X| close"
272 replay_barrier $SINGLEMDS
274 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
276 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
278 echo " old_inum == $old_inum, new_inum == $new_inum"
279 if [ $old_inum -eq $new_inum ] ;
281 echo "old_inum and new_inum match"
283 echo " old_inum and new_inum do not match"
284 error "old index($old_inum) does not match new index($new_inum)"
288 run_test 9 "|X| create (same inum/gen)"
291 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
292 replay_barrier $SINGLEMDS
293 mv $DIR/$tfile $DIR/$tfile-2
296 $CHECKSTAT $DIR/$tfile &&
297 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
298 $CHECKSTAT $DIR/$tfile-2 ||
299 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
303 run_test 10 "create |X| rename unlink"
306 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
307 echo "old" > $DIR/$tfile
308 mv $DIR/$tfile $DIR/$tfile-2
309 replay_barrier $SINGLEMDS
310 echo "new" > $DIR/$tfile
312 grep old $DIR/$tfile-2
314 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
315 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
317 run_test 11 "create open write rename |X| create-old-name read"
320 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
321 multiop_bg_pause $DIR/$tfile o_tSc ||
322 error "multiop_bg_pause $DIR/$tfile failed"
325 replay_barrier $SINGLEMDS
326 kill -USR1 $pid || error "multiop $pid not running"
327 wait $pid || error "multiop $pid failed"
330 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
333 run_test 12 "open, unlink |X| close"
335 # 1777 - replay open after committed chmod that would make
336 # a regular open a failure
338 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
339 multiop_bg_pause $DIR/$tfile O_wc ||
340 error "multiop_bg_pause $DIR/$tfile failed"
343 $CHECKSTAT -p 0 $DIR/$tfile ||
344 error "$CHECKSTAT $DIR/$tfile attribute check failed"
345 replay_barrier $SINGLEMDS
347 kill -USR1 $pid || error "multiop $pid not running"
348 wait $pid || error "multiop $pid failed"
350 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
351 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
352 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
355 run_test 13 "open chmod 0 |x| write close"
358 multiop_bg_pause $DIR/$tfile O_tSc ||
359 error "multiop_bg_pause $DIR/$tfile failed"
362 replay_barrier $SINGLEMDS
363 kill -USR1 $pid || error "multiop $pid not running"
364 wait $pid || error "multiop $pid failed"
367 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
370 run_test 14 "open(O_CREAT), unlink |X| close"
373 multiop_bg_pause $DIR/$tfile O_tSc ||
374 error "multiop_bg_pause $DIR/$tfile failed"
377 replay_barrier $SINGLEMDS
378 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
379 kill -USR1 $pid || error "multiop $pid not running"
380 wait $pid || error "multiop $pid failed"
383 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
384 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
387 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
390 replay_barrier $SINGLEMDS
393 mcreate $DIR/$tfile-2
395 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
396 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
397 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
399 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
402 replay_barrier $SINGLEMDS
403 multiop_bg_pause $DIR/$tfile O_c ||
404 error "multiop_bg_pause $DIR/$tfile failed"
407 kill -USR1 $pid || error "multiop $pid not running"
408 wait $pid || error "multiop $pid failed"
409 $CHECKSTAT -t file $DIR/$tfile ||
410 error "$CHECKSTAT $DIR/$tfile attribute check failed"
413 run_test 17 "|X| open(O_CREAT), |replay| close"
416 replay_barrier $SINGLEMDS
417 multiop_bg_pause $DIR/$tfile O_tSc ||
418 error "multiop_bg_pause $DIR/$tfile failed"
421 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
422 echo "pid: $pid will close"
423 kill -USR1 $pid || error "multiop $pid not running"
424 wait $pid || error "multiop $pid failed"
427 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
428 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
429 # this touch frequently fails
430 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
431 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
432 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
435 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
437 # bug 1855 (a simpler form of test_11 above)
439 replay_barrier $SINGLEMDS
441 echo "old" > $DIR/$tfile
442 mv $DIR/$tfile $DIR/$tfile-2
443 grep old $DIR/$tfile-2
445 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
447 run_test 19 "mcreate, open, write, rename "
449 test_20a() { # was test_20
450 replay_barrier $SINGLEMDS
451 multiop_bg_pause $DIR/$tfile O_tSc ||
452 error "multiop_bg_pause $DIR/$tfile failed"
457 kill -USR1 $pid || error "multiop $pid not running"
458 wait $pid || error "multiop $pid failed"
459 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
462 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
464 test_20b() { # bug 10480
465 local wait_timeout=$((TIMEOUT * 4))
466 local extra=$(fs_log_size)
470 $LFS setstripe -i 0 -c 1 $DIR
472 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
474 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
475 while [ ! -e $DIR/$tfile ] ; do
476 usleep 60 # give dd a chance to start
479 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
481 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
483 client_up || client_up || true # reconnect
485 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
487 fail $SINGLEMDS # start orphan recovery
488 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
489 wait_delete_completed $wait_timeout || error "delete did not finish"
493 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
494 log "before $beforeused, after $afterused"
496 (( $beforeused + $extra >= $afterused )) && break
497 n_attempts=$((n_attempts + 1))
498 [ $n_attempts -gt 3 ] &&
499 error "after $afterused > before $beforeused + $extra"
501 wait_zfs_commit $SINGLEMDS 5
506 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
508 test_20c() { # bug 10480
509 multiop_bg_pause $DIR/$tfile Ow_c ||
510 error "multiop_bg_pause $DIR/$tfile failed"
516 client_up || client_up || true # reconnect
518 kill -USR1 $pid || error "multiop $pid not running"
519 wait $pid || error "multiop $pid failed"
520 [ -s $DIR/$tfile ] || error "File was truncated"
524 run_test 20c "check that client eviction does not affect file content"
527 replay_barrier $SINGLEMDS
528 multiop_bg_pause $DIR/$tfile O_tSc ||
529 error "multiop_bg_pause $DIR/$tfile failed"
532 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
535 kill -USR1 $pid || error "multiop $pid not running"
536 wait $pid || error "multiop $pid failed"
537 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
538 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
541 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
544 multiop_bg_pause $DIR/$tfile O_tSc ||
545 error "multiop_bg_pause $DIR/$tfile failed"
548 replay_barrier $SINGLEMDS
552 kill -USR1 $pid || error "multiop $pid not running"
553 wait $pid || error "multiop $pid failed"
554 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
557 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
560 multiop_bg_pause $DIR/$tfile O_tSc ||
561 error "multiop_bg_pause $DIR/$tfile failed"
564 replay_barrier $SINGLEMDS
566 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
569 kill -USR1 $pid || error "multiop $pid not running"
570 wait $pid || error "multiop $pid failed"
571 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
572 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
575 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
578 multiop_bg_pause $DIR/$tfile O_tSc ||
579 error "multiop_bg_pause $DIR/$tfile failed"
582 replay_barrier $SINGLEMDS
585 kill -USR1 $pid || error "multiop $pid not running"
586 wait $pid || error "multiop $pid failed"
587 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
590 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
593 multiop_bg_pause $DIR/$tfile O_tSc ||
594 error "multiop_bg_pause $DIR/$tfile failed"
598 replay_barrier $SINGLEMDS
600 kill -USR1 $pid || error "multiop $pid not running"
601 wait $pid || error "multiop $pid failed"
602 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
605 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
608 replay_barrier $SINGLEMDS
609 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
610 error "multiop_bg_pause $DIR/$tfile-1 failed"
612 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
613 error "multiop_bg_pause $DIR/$tfile-2 failed"
617 kill -USR1 $pid2 || error "second multiop $pid2 not running"
618 wait $pid2 || error "second multiop $pid2 failed"
621 kill -USR1 $pid1 || error "multiop $pid1 not running"
622 wait $pid1 || error "multiop $pid1 failed"
623 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
624 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
627 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
630 replay_barrier $SINGLEMDS
631 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
632 error "multiop_bg_pause $DIR/$tfile-1 failed"
634 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
635 error "multiop_bg_pause $DIR/$tfile-2 failed"
641 kill -USR1 $pid1 || error "multiop $pid1 not running"
642 wait $pid1 || error "multiop $pid1 failed"
643 kill -USR1 $pid2 || error "second multiop $pid2 not running"
644 wait $pid2 || error "second multiop $pid2 failed"
645 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
646 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
649 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
652 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
653 error "multiop_bg_pause $DIR/$tfile-1 failed"
655 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
656 error "multiop_bg_pause $DIR/$tfile-2 failed"
658 replay_barrier $SINGLEMDS
661 kill -USR1 $pid2 || error "second multiop $pid2 not running"
662 wait $pid2 || error "second multiop $pid2 failed"
665 kill -USR1 $pid1 || error "multiop $pid1 not running"
666 wait $pid1 || error "multiop $pid1 failed"
667 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
668 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
671 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
674 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
675 error "multiop_bg_pause $DIR/$tfile-1 failed"
677 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
678 error "multiop_bg_pause $DIR/$tfile-2 failed"
680 replay_barrier $SINGLEMDS
685 kill -USR1 $pid1 || error "multiop $pid1 not running"
686 wait $pid1 || error "multiop $pid1 failed"
687 kill -USR1 $pid2 || error "second multiop $pid2 not running"
688 wait $pid2 || error "second multiop $pid2 failed"
689 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
690 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
693 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
696 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
697 error "multiop_bg_pause $DIR/$tfile-1 failed"
699 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
700 error "multiop_bg_pause $DIR/$tfile-2 failed"
705 replay_barrier $SINGLEMDS
707 kill -USR1 $pid1 || error "multiop $pid1 not running"
708 wait $pid1 || error "multiop $pid1 failed"
709 kill -USR1 $pid2 || error "second multiop $pid2 not running"
710 wait $pid2 || error "second multiop $pid2 failed"
711 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
712 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
715 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
718 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
719 error "multiop_bg_pause $DIR/$tfile-1 failed"
721 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
722 error "multiop_bg_pause $DIR/$tfile-2 failed"
726 replay_barrier $SINGLEMDS
729 kill -USR1 $pid1 || error "multiop $pid1 not running"
730 wait $pid1 || error "multiop $pid1 failed"
731 kill -USR1 $pid2 || error "second multiop $pid2 not running"
732 wait $pid2 || error "second multiop $pid2 failed"
733 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
734 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
737 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
739 # tests for bug 2104; completion without crashing is success. The close is
740 # stale, but we always return 0 for close, so the app never sees it.
742 multiop_bg_pause $DIR/$tfile O_c ||
743 error "multiop_bg_pause $DIR/$tfile failed"
745 multiop_bg_pause $DIR/$tfile O_c ||
746 error "second multiop_bg_pause $DIR/$tfile failed"
749 client_up || client_up || error "client_up failed"
750 kill -USR1 $pid1 || error "multiop $pid1 not running"
751 kill -USR1 $pid2 || error "second multiop $pid2 not running"
752 wait $pid1 || error "multiop $pid1 failed"
753 wait $pid2 || error "second multiop $pid2 failed"
756 run_test 32 "close() notices client eviction; close() after client eviction"
759 createmany -o $DIR/$tfile-%d 10 ||
760 error "createmany create $DIR/$tfile failed"
761 replay_barrier_nosync $SINGLEMDS
762 fail_abort $SINGLEMDS
763 # recreate shouldn't fail
764 createmany -o $DIR/$tfile--%d 10 ||
765 error "createmany recreate $DIR/$tfile failed"
769 run_test 33a "fid seq shouldn't be reused after abort recovery"
772 #define OBD_FAIL_SEQ_ALLOC 0x1311
773 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
775 createmany -o $DIR/$tfile-%d 10
776 replay_barrier_nosync $SINGLEMDS
777 fail_abort $SINGLEMDS
778 # recreate shouldn't fail
779 createmany -o $DIR/$tfile--%d 10 ||
780 error "createmany recreate $DIR/$tfile failed"
784 run_test 33b "test fid seq allocation"
787 multiop_bg_pause $DIR/$tfile O_c ||
788 error "multiop_bg_pause $DIR/$tfile failed"
792 replay_barrier $SINGLEMDS
793 fail_abort $SINGLEMDS
794 kill -USR1 $pid || error "multiop $pid not running"
795 wait $pid || error "multiop $pid failed"
796 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
800 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
802 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
804 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
806 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
807 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
812 # give a chance to remove from MDS
813 fail_abort $SINGLEMDS
814 $CHECKSTAT -t file $DIR/$tfile &&
815 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
818 run_test 35 "test recovery from llog for unlink op"
820 # b=2432 resent cancel after replay uses wrong cookie,
821 # so don't resend cancels
823 replay_barrier $SINGLEMDS
825 checkstat $DIR/$tfile
826 facet_failover $SINGLEMDS
828 if dmesg | grep "unknown lock cookie"; then
829 error "cancel after replay failed"
832 run_test 36 "don't resend cancel"
835 # directory orphans can't be unlinked from PENDING directory
837 rmdir $DIR/$tfile 2>/dev/null
838 multiop_bg_pause $DIR/$tfile dD_c ||
839 error "multiop_bg_pause $DIR/$tfile failed"
843 replay_barrier $SINGLEMDS
844 # clear the dmesg buffer so we only see errors from this recovery
845 do_facet $SINGLEMDS dmesg -c >/dev/null
846 fail_abort $SINGLEMDS
847 kill -USR1 $pid || error "multiop $pid not running"
848 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
849 error "error unlinking files"
850 wait $pid || error "multiop $pid failed"
854 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
857 createmany -o $DIR/$tfile-%d 800 ||
858 error "createmany -o $DIR/$tfile failed"
859 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
860 replay_barrier $SINGLEMDS
862 unlinkmany $DIR/$tfile-%d 400 400 ||
863 error "unlinkmany $DIR/$tfile 400 failed"
865 $CHECKSTAT -t file $DIR/$tfile-* &&
866 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
869 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
871 test_39() { # bug 4176
872 createmany -o $DIR/$tfile-%d 800 ||
873 error "createmany -o $DIR/$tfile failed"
874 replay_barrier $SINGLEMDS
875 unlinkmany $DIR/$tfile-%d 0 400
877 unlinkmany $DIR/$tfile-%d 400 400 ||
878 error "unlinkmany $DIR/$tfile 400 failed"
880 $CHECKSTAT -t file $DIR/$tfile-* &&
881 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
884 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
887 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
892 # always need connection to MDS to verify layout during IO. LU-2628.
893 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
894 skip "layout_lock needs MDS connection for IO" && return 0
896 $LCTL mark multiop $MOUNT/$tfile OS_c
897 multiop $MOUNT/$tfile OS_c &
899 writeme -s $MOUNT/${tfile}-2 &
902 facet_failover $SINGLEMDS
903 #define OBD_FAIL_MDS_CONNECT_NET 0x117
904 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
906 stat1=$(count_ost_writes)
908 stat2=$(count_ost_writes)
909 echo "$stat1, $stat2"
910 if [ $stat1 -lt $stat2 ]; then
911 echo "writes continuing during recovery"
914 echo "writes not continuing during recovery, bug 2477"
917 echo "waiting for writeme $WRITE_PID"
921 echo "waiting for multiop $PID"
922 wait $PID || error "multiop $PID failed"
923 do_facet client munlink $MOUNT/$tfile ||
924 error "munlink $MOUNT/$tfile failed"
925 do_facet client munlink $MOUNT/${tfile}-2 ||
926 error "munlink $MOUNT/$tfile-2 failed"
929 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
932 # make sure that a read to one osc doesn't try to double-unlock its page just
933 # because another osc is invalid. trigger_group_io used to mistakenly return
934 # an error if any oscs were invalid even after having successfully put rpcs
935 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
936 # the page, guarnateeing that the unlock from the RPC completion would
937 # assert on trying to unlock the unlocked page.
939 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
941 local f=$MOUNT/$tfile
942 # make sure the start of the file is ost1
943 $LFS setstripe -S $((128 * 1024)) -i 0 $f
944 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
945 error "dd on client failed"
947 # fail ost2 and read from ost1
948 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
949 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
950 grep $mdtosc | awk '{print $1}')
951 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
952 lctl get_param -n devices &&
953 error "OST 2 $osc2dev does not exist"
954 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
955 error "deactive device on $SINGLEMDS failed"
956 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
957 error "second dd on client failed"
958 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
959 error "active device on $SINGLEMDS failed"
962 run_test 41 "read from a valid osc while other oscs are invalid"
964 # test MDS recovery after ost failure
966 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
967 createmany -o $DIR/$tfile-%d 800 ||
968 error "createmany -o $DIR/$tfile failed"
970 unlinkmany $DIR/$tfile-%d 0 400
972 lctl set_param debug=-1
975 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
976 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
977 #[ $blocks_after -lt $blocks ] || return 1
978 echo "wait for MDS to timeout and recover"
979 sleep $((TIMEOUT * 2))
981 unlinkmany $DIR/$tfile-%d 400 400 ||
982 error "unlinkmany $DIR/$tfile 400 failed"
983 $CHECKSTAT -t file $DIR/$tfile-* &&
984 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
987 run_test 42 "recovery after ost failure"
989 # timeout in MDS/OST recovery RPC will LBUG MDS
990 test_43() { # bug 2530
991 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
993 replay_barrier $SINGLEMDS
995 # OBD_FAIL_OST_CREATE_NET 0x204
996 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1002 run_test 43 "mds osc import failure during recovery; don't LBUG"
1004 test_44a() { # was test_44
1005 local at_max_saved=0
1007 local mdcdev=$($LCTL dl |
1008 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1009 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
1010 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1011 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1013 # adaptive timeouts slow this way down
1014 if at_is_enabled; then
1015 at_max_saved=$(at_max_get mds)
1019 for i in $(seq 1 10); do
1020 echo "$i of 10 ($(date +%s))"
1021 do_facet $SINGLEMDS \
1022 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1023 #define OBD_FAIL_TGT_CONN_RACE 0x701
1024 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1025 # lctl below may fail, it is valid case
1026 $LCTL --device $mdcdev recover
1029 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1030 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1033 run_test 44a "race in target handle connect"
1036 local mdcdev=$($LCTL dl |
1037 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1038 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1039 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1040 { echo mdcdev=$mdcdev; $LCTL dl;
1041 error "more than one ${FSNAME}-MDT0000-mdc"; }
1043 for i in $(seq 1 10); do
1044 echo "$i of 10 ($(date +%s))"
1045 do_facet $SINGLEMDS \
1046 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1047 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1048 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1049 # lctl below may fail, it is valid case
1050 $LCTL --device $mdcdev recover
1055 run_test 44b "race in target handle connect"
1058 replay_barrier $SINGLEMDS
1059 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1060 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1061 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1062 fail_abort $SINGLEMDS
1063 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1065 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1068 run_test 44c "race in target handle connect"
1070 # Handle failed close
1072 local mdcdev=$($LCTL get_param -n devices |
1073 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1074 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1075 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1076 { echo mdcdev=$mdcdev; $LCTL dl;
1077 error "more than one ${FSNAME}-MDT0000-mdc"; }
1079 $LCTL --device $mdcdev recover ||
1080 error "$LCTL --device $mdcdev recover failed"
1082 multiop_bg_pause $DIR/$tfile O_c ||
1083 error "multiop_bg_pause $DIR/$tfile failed"
1086 # This will cause the CLOSE to fail before even
1087 # allocating a reply buffer
1088 $LCTL --device $mdcdev deactivate ||
1089 error "$LCTL --device $mdcdev deactivate failed"
1092 kill -USR1 $pid || error "multiop $pid not running"
1093 wait $pid || error "multiop $pid failed"
1095 $LCTL --device $mdcdev activate ||
1096 error "$LCTL --device $mdcdev activate failed"
1099 $CHECKSTAT -t file $DIR/$tfile ||
1100 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1103 run_test 45 "Handle failed close"
1107 drop_reply "touch $DIR/$tfile"
1109 # ironically, the previous test, 45, will cause a real forced close,
1110 # so just look for one for this test
1111 dmesg | grep -i "force closing client file handle for $tfile" &&
1112 error "found force closing in dmesg"
1115 run_test 46 "Don't leak file handle after open resend (3325)"
1117 test_47() { # bug 2824
1118 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1120 # create some files to make sure precreate has been done on all
1121 # OSTs. (just in case this test is run independently)
1122 createmany -o $DIR/$tfile 20 ||
1123 error "createmany create $DIR/$tfile failed"
1125 # OBD_FAIL_OST_CREATE_NET 0x204
1127 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1128 client_up || error "client_up failed"
1130 # let the MDS discover the OST failure, attempt to recover, fail
1131 # and recover again.
1132 sleep $((3 * TIMEOUT))
1134 # Without 2824, this createmany would hang
1135 createmany -o $DIR/$tfile 20 ||
1136 error "createmany recraete $DIR/$tfile failed"
1137 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1141 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1144 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1145 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1147 replay_barrier $SINGLEMDS
1148 createmany -o $DIR/$tfile 20 ||
1149 error "createmany -o $DIR/$tfile failed"
1150 # OBD_FAIL_OST_EROFS 0x216
1151 facet_failover $SINGLEMDS
1152 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1153 client_up || error "client_up failed"
1155 # let the MDS discover the OST failure, attempt to recover, fail
1156 # and recover again.
1157 sleep $((3 * TIMEOUT))
1159 createmany -o $DIR/$tfile 20 20 ||
1160 error "createmany recraete $DIR/$tfile failed"
1161 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1164 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1167 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1168 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1169 grep $mdtosc | awk '{print $1}')
1170 [ "$oscdev" ] || error "could not find OSC device on MDS"
1171 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1172 error "OSC device $oscdev recovery failed"
1173 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1174 error "second OSC device $oscdev recovery failed"
1175 # give the mds_lov_sync threads a chance to run
1178 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1180 # b3764 timed out lock replay
1182 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.90) ] &&
1183 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly" &&
1186 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1187 cancel_lru_locks mdc
1189 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1192 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1193 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1194 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1196 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1198 wait $mpid || error "multiop_bg_pause pid failed"
1200 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1201 lctl set_param fail_loc=0x0
1202 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1205 run_test 52 "time out lock replay (3764)"
1207 # bug 3462 - simultaneous MDC requests
1209 [[ $(lctl get_param mdc.*.import |
1210 grep "connect_flags:.*multi_mod_rpc") ]] ||
1211 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1213 cancel_lru_locks mdc # cleanup locks from former test cases
1214 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1215 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1216 multiop $DIR/${tdir}-1/f O_c &
1218 # give multiop a change to open
1221 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1222 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1223 kill -USR1 $close_pid
1224 cancel_lru_locks mdc # force the close
1225 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1227 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1229 # close should still be here
1230 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1232 replay_barrier_nodf $SINGLEMDS
1234 wait $close_pid || error "close_pid $close_pid failed"
1236 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1237 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1238 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1239 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1240 rm -rf $DIR/${tdir}-*
1242 run_test 53a "|X| close request while two MDC requests in flight"
1245 cancel_lru_locks mdc # cleanup locks from former test cases
1247 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1248 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1249 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1250 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1253 #define OBD_FAIL_MDS_REINT_NET 0x107
1254 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1255 mcreate $DIR/${tdir}-2/f &
1259 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1260 kill -USR1 $close_pid
1261 cancel_lru_locks mdc # force the close
1262 wait $close_pid || error "close_pid $close_pid failed"
1263 # open should still be here
1264 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1266 replay_barrier_nodf $SINGLEMDS
1268 wait $open_pid || error "open_pid failed"
1270 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1271 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1272 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1273 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1274 rm -rf $DIR/${tdir}-*
1276 run_test 53b "|X| open request while two MDC requests in flight"
1279 cancel_lru_locks mdc # cleanup locks from former test cases
1281 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1282 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1283 multiop $DIR/${tdir}-1/f O_c &
1286 #define OBD_FAIL_MDS_REINT_NET 0x107
1287 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1288 mcreate $DIR/${tdir}-2/f &
1292 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1293 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1294 kill -USR1 $close_pid
1295 cancel_lru_locks mdc # force the close
1297 #bz20647: make sure all pids exist before failover
1298 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1299 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1300 replay_barrier_nodf $SINGLEMDS
1301 fail_nodf $SINGLEMDS
1302 wait $open_pid || error "open_pid failed"
1304 # close should be gone
1305 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1306 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1308 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1309 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1310 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1311 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1312 rm -rf $DIR/${tdir}-*
1314 run_test 53c "|X| open request and close request while two MDC requests in flight"
1317 [[ $(lctl get_param mdc.*.import |
1318 grep "connect_flags:.*multi_mod_rpc") ]] ||
1319 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1321 cancel_lru_locks mdc # cleanup locks from former test cases
1323 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1324 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1325 multiop $DIR/${tdir}-1/f O_c &
1327 # give multiop a chance to open
1330 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1331 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1332 kill -USR1 $close_pid
1333 cancel_lru_locks mdc # force the close
1334 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1335 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1337 # close should still be here
1338 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1340 wait $close_pid || error "close_pid failed"
1342 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1343 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1344 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1345 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1346 rm -rf $DIR/${tdir}-*
1348 run_test 53d "close reply while two MDC requests in flight"
1351 cancel_lru_locks mdc # cleanup locks from former test cases
1353 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1354 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1355 multiop $DIR/${tdir}-1/f O_c &
1358 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1359 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1360 mcreate $DIR/${tdir}-2/f &
1364 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1365 kill -USR1 $close_pid
1366 cancel_lru_locks mdc # force the close
1367 wait $close_pid || error "close_pid failed"
1368 # open should still be here
1369 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1371 replay_barrier_nodf $SINGLEMDS
1373 wait $open_pid || error "open_pid failed"
1375 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1376 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1377 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1378 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1379 rm -rf $DIR/${tdir}-*
1381 run_test 53e "|X| open reply while two MDC requests in flight"
1384 cancel_lru_locks mdc # cleanup locks from former test cases
1386 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1387 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1388 multiop $DIR/${tdir}-1/f O_c &
1391 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1392 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1393 mcreate $DIR/${tdir}-2/f &
1397 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1398 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1399 kill -USR1 $close_pid
1400 cancel_lru_locks mdc # force the close
1402 #bz20647: make sure all pids are exists before failover
1403 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1404 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1405 replay_barrier_nodf $SINGLEMDS
1406 fail_nodf $SINGLEMDS
1407 wait $open_pid || error "open_pid failed"
1409 # close should be gone
1410 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1411 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1413 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1414 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1415 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1416 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1417 rm -rf $DIR/${tdir}-*
1419 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1422 cancel_lru_locks mdc # cleanup locks from former test cases
1424 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1425 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1426 multiop $DIR/${tdir}-1/f O_c &
1429 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1430 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1431 mcreate $DIR/${tdir}-2/f &
1435 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1436 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1437 kill -USR1 $close_pid
1438 cancel_lru_locks mdc # force the close
1439 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1441 #bz20647: make sure all pids are exists before failover
1442 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1443 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1444 replay_barrier_nodf $SINGLEMDS
1445 fail_nodf $SINGLEMDS
1446 wait $open_pid || error "open_pid failed"
1448 # close should be gone
1449 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1451 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1452 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1453 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1454 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1455 rm -rf $DIR/${tdir}-*
1457 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1460 cancel_lru_locks mdc # cleanup locks from former test cases
1462 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1463 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1464 multiop $DIR/${tdir}-1/f O_c &
1467 #define OBD_FAIL_MDS_REINT_NET 0x107
1468 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1469 mcreate $DIR/${tdir}-2/f &
1473 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1474 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1475 kill -USR1 $close_pid
1476 cancel_lru_locks mdc # force the close
1479 #bz20647: make sure all pids are exists before failover
1480 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1481 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1482 replay_barrier_nodf $SINGLEMDS
1483 fail_nodf $SINGLEMDS
1484 wait $open_pid || error "open_pid failed"
1486 # close should be gone
1487 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1488 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1490 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1491 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1492 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1493 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1494 rm -rf $DIR/${tdir}-*
1496 run_test 53h "open request and close reply while two MDC requests in flight"
1498 #b3761 ASSERTION(hash != 0) failed
1500 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1501 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1503 # give touch a chance to run
1505 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1509 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1511 #b3440 ASSERTION(rec->ur_fid2->id) failed
1513 ln -s foo $DIR/$tfile
1514 replay_barrier $SINGLEMDS
1515 #drop_reply "cat $DIR/$tfile"
1519 run_test 56 "don't replay a symlink open request (3440)"
1521 #recovery one mds-ost setattr from llog
1523 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1524 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1525 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1526 replay_barrier $SINGLEMDS
1528 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1529 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1530 $CHECKSTAT -t file $DIR/$tfile ||
1531 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1532 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1535 run_test 57 "test recovery from llog for setattr op"
1538 zconf_umount $(hostname) $MOUNT2
1542 #recovery many mds-ost setattr from llog
1544 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1545 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1546 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1547 createmany -o $DIR/$tdir/$tfile-%d 2500
1548 replay_barrier $SINGLEMDS
1551 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1552 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1553 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1554 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1555 error "unlinkmany $DIR/$tfile failed"
1558 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1564 trap cleanup_58 EXIT
1566 large_xattr_enabled &&
1567 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1568 # Original extended attribute can be long. Print a small version of
1569 # attribute if an error occurs
1570 local sm_msg=$(printf "%.9s" $orig)
1572 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1573 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1574 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1575 replay_barrier $SINGLEMDS
1576 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1578 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1579 [[ "$new" = "$orig" ]] ||
1580 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1581 rm -f $DIR/$tdir/$tfile
1584 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1586 run_test 58b "test replay of setxattr op"
1588 test_58c() { # bug 16570
1593 trap cleanup_58 EXIT
1595 if large_xattr_enabled; then
1596 local xattr_size=$(max_xattr_size)
1597 orig="$(generate_string $((xattr_size / 2)))"
1598 orig1="$(generate_string $xattr_size)"
1604 # PING_INTERVAL max(obd_timeout / 4, 1U)
1605 sleep $((TIMEOUT / 4))
1607 # Original extended attribute can be long. Print a small version of
1608 # attribute if an error occurs
1609 local sm_msg=$(printf "%.9s" $orig)
1610 local sm_msg1=$(printf "%.9s" $orig1)
1612 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1613 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1614 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1615 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1616 error "drop_request for setfattr failed"
1617 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1618 [[ "$new" = "$orig" ]] ||
1619 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1620 drop_reint_reply "setfattr -n trusted.foo1 \
1621 -v $orig1 $DIR/$tdir/$tfile" ||
1622 error "drop_reint_reply for setfattr failed"
1623 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1624 [[ "$new" = "$orig1" ]] ||
1625 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1626 rm -f $DIR/$tdir/$tfile
1630 run_test 58c "resend/reconstruct setxattr op"
1632 # log_commit_thread vs filter_destroy race used to lead to import use after free
1635 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1637 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1638 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1639 error "createmany create files failed"
1641 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1642 error "unlinkmany $DIR/$tdir/$tfile failed"
1643 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1644 do_facet ost1 "lctl set_param fail_loc=0x507"
1647 do_facet ost1 "lctl set_param fail_loc=0x0"
1651 run_test 59 "test log_commit_thread vs filter_destroy race"
1653 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1654 # bug 12086: should no oops and No ctxt error for this test
1656 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1657 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1658 error "createmany create files failed"
1659 replay_barrier $SINGLEMDS
1660 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1662 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1663 local no_ctxt=$(dmesg | grep "No ctxt")
1664 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1666 run_test 60 "test llog post recovery init vs llog unlink"
1668 #test race llog recovery thread vs llog cleanup
1669 test_61a() { # was test_61
1670 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1672 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1673 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1674 error "createmany create files failed"
1676 unlinkmany $DIR/$tdir/$tfile-%d 800
1677 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1678 set_nodes_failloc "$(osts_nodes)" 0x80000221
1683 set_nodes_failloc "$(osts_nodes)" 0x0
1685 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1686 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1689 run_test 61a "test race llog recovery vs llog cleanup"
1691 #test race mds llog sync vs llog cleanup
1693 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1694 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1695 facet_failover $SINGLEMDS
1698 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1701 run_test 61b "test race mds llog sync vs llog cleanup"
1703 #test race cancel cookie cb vs llog cleanup
1705 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1707 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1708 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1709 set_nodes_failloc "$(osts_nodes)" 0x80000222
1713 set_nodes_failloc "$(osts_nodes)" 0x0
1715 run_test 61c "test race mds llog sync vs llog cleanup"
1717 test_61d() { # bug 16002 # bug 17466 # bug 22137
1718 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1720 do_facet mgs "lctl set_param fail_loc=0x80000605"
1721 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1722 error "mgs start should have failed"
1723 do_facet mgs "lctl set_param fail_loc=0"
1724 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1726 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1728 test_62() { # Bug 15756 - don't mis-drop resent replay
1729 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1730 replay_barrier $SINGLEMDS
1731 createmany -o $DIR/$tdir/$tfile- 25 ||
1732 error "createmany create files failed"
1733 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1734 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1736 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1737 unlinkmany $DIR/$tdir/$tfile- 25 ||
1738 error "unlinkmany $DIR/$tdir/$tfile failed"
1741 run_test 62 "don't mis-drop resent replay"
1743 #Adaptive Timeouts (bug 3055)
1751 echo "Cleaning up AT ..."
1752 if [ -n "$ATOLDBASE" ]; then
1753 local at_history=$($LCTL get_param -n at_history)
1754 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1755 do_facet ost1 "lctl set_param at_history=$at_history" || true
1758 if [ $AT_MAX_SET -ne 0 ]; then
1759 for facet in mds client ost; do
1760 var=AT_MAX_SAVE_${facet}
1761 echo restore AT on $facet to saved value ${!var}
1762 at_max_set ${!var} $facet
1763 at_new=$(at_max_get $facet)
1764 echo Restored AT value on $facet $at_new
1765 [ $at_new -eq ${!var} ] ||
1766 error "AT value not restored SAVED ${!var} NEW $at_new"
1773 local at_max_new=600
1775 # Save at_max original values
1777 if [ $AT_MAX_SET -eq 0 ]; then
1778 # Suppose that all osts have the same at_max
1779 for facet in mds client ost; do
1780 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1784 for facet in mds client ost; do
1785 at_max=$(at_max_get $facet)
1786 if [ $at_max -ne $at_max_new ]; then
1787 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1788 at_max_set $at_max_new $facet
1793 if [ -z "$ATOLDBASE" ]; then
1794 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1795 # speed up the timebase so we can check decreasing AT
1796 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1797 do_facet ost1 "lctl set_param at_history=8" || true
1799 # sleep for a while to cool down, should be > 8s and also allow
1800 # at least one ping to be sent. simply use TIMEOUT to be safe.
1805 test_65a() #bug 3055
1807 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1809 at_start || return 0
1810 $LCTL dk > /dev/null
1812 $LCTL set_param debug="other"
1813 # Slow down a request to the current service time, this is critical
1814 # because previous tests may have caused this value to increase.
1815 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1816 awk '/portal 12/ {print $5}'`
1817 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1819 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1820 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1821 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1822 createmany -o $DIR/$tfile 10 > /dev/null
1823 unlinkmany $DIR/$tfile 10 > /dev/null
1824 # check for log message
1825 $LCTL dk | grep "Early reply #" || error "No early reply"
1827 # client should show REQ_DELAY estimates
1828 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1830 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1832 run_test 65a "AT: verify early replies"
1834 test_65b() #bug 3055
1836 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1838 at_start || return 0
1841 $LCTL set_param debug="other trace"
1842 $LCTL dk > /dev/null
1843 # Slow down a request to the current service time, this is critical
1844 # because previous tests may have caused this value to increase.
1845 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1846 error "$LFS setstripe failed for $DIR/$tfile"
1848 multiop $DIR/$tfile Ow1yc
1849 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1850 awk '/portal 6/ {print $5}'`
1851 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1853 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1854 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1855 do_facet ost1 $LCTL set_param fail_loc=0x224
1858 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1859 error "$LFS setstripe failed"
1860 # force some real bulk transfer
1861 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1863 do_facet ost1 $LCTL set_param fail_loc=0
1864 # check for log message
1865 $LCTL dk | grep "Early reply #" || error "No early reply"
1867 # client should show REQ_DELAY estimates
1868 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1870 run_test 65b "AT: verify early replies on packed reply / bulk"
1872 test_66a() #bug 3055
1874 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1876 at_start || return 0
1877 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1878 # adjust 5s at a time so no early reply is sent (within deadline)
1879 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1880 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1881 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1882 createmany -o $DIR/$tfile 20 > /dev/null
1883 unlinkmany $DIR/$tfile 20 > /dev/null
1884 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1885 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1886 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1887 createmany -o $DIR/$tfile 20 > /dev/null
1888 unlinkmany $DIR/$tfile 20 > /dev/null
1889 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1890 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1892 createmany -o $DIR/$tfile 20 > /dev/null
1893 unlinkmany $DIR/$tfile 20 > /dev/null
1894 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1895 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1896 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1897 echo "Current MDT timeout $CUR, worst $WORST"
1898 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1900 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1902 test_66b() #bug 3055
1904 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1906 at_start || return 0
1907 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1908 awk '/network/ {print $4}')
1909 $LCTL set_param fail_val=$(($ORIG + 5))
1910 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1911 $LCTL set_param fail_loc=0x50c
1912 touch $DIR/$tfile > /dev/null 2>&1
1913 $LCTL set_param fail_loc=0
1914 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1915 awk '/network/ {print $4}')
1916 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1917 awk '/network/ {print $6}')
1918 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1919 [ $WORST -gt $ORIG ] ||
1920 error "Worst $WORST should be worse than orig $ORIG"
1922 run_test 66b "AT: verify net latency adjusts"
1924 test_67a() #bug 3055
1926 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1928 at_start || return 0
1929 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1930 # sleeping threads may drive values above this
1931 do_facet ost1 "$LCTL set_param fail_val=400"
1932 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1933 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1934 createmany -o $DIR/$tfile 20 > /dev/null
1935 unlinkmany $DIR/$tfile 20 > /dev/null
1936 do_facet ost1 "$LCTL set_param fail_loc=0"
1937 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1938 ATTEMPTS=$(($CONN2 - $CONN1))
1939 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1940 [ $ATTEMPTS -gt 0 ] &&
1941 error_ignore bz13721 "AT should have prevented reconnect"
1944 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1946 test_67b() #bug 3055
1948 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1950 at_start || return 0
1951 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1953 # exhaust precreations on ost1
1954 local OST=$(ostname_from_index 0)
1955 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1956 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1957 osp.$mdtosc.prealloc_last_id)
1958 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1959 osp.$mdtosc.prealloc_next_id)
1961 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1962 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${OST} ||
1963 error "$LFS setstripe failed"
1964 echo "Creating to objid $last_id on ost $OST..."
1965 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1966 do_facet ost1 "$LCTL set_param fail_val=20000"
1967 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1968 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1971 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1973 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1974 ATTEMPTS=$(($CONN2 - $CONN1))
1975 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1976 # do it again; should not timeout
1977 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1978 cp /etc/profile $DIR/$tfile || error "cp failed"
1979 do_facet ost1 "$LCTL set_param fail_loc=0"
1981 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1982 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1983 ATTEMPTS=$(($CONN3 - $CONN2))
1984 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1985 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1988 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1990 test_68 () #bug 13813
1992 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1994 at_start || return 0
1995 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1996 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1997 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1998 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
1999 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2000 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2001 echo $TIMEOUT >> $ldlm_enqueue_min
2002 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2004 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2005 $LFS setstripe --stripe-index=0 -c 1 $DIR/$tdir ||
2006 error "$LFS setstripe failed for $DIR/$tdir"
2007 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2008 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2009 $LCTL set_param fail_loc=0x80000312
2010 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2011 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2012 $LCTL set_param fail_loc=0x80000312
2013 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2014 $LCTL set_param fail_loc=0
2016 echo $ENQ_MIN >> $ldlm_enqueue_min
2017 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2021 run_test 68 "AT: verify slowing locks"
2024 # end of AT tests includes above lines
2026 # start multi-client tests
2028 [ -z "$CLIENTS" ] &&
2029 { skip "Need two or more clients." && return; }
2030 [ $CLIENTCOUNT -lt 2 ] &&
2031 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2033 echo "mount clients $CLIENTS ..."
2034 zconf_mount_clients $CLIENTS $MOUNT
2036 local clients=${CLIENTS//,/ }
2037 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2038 for CLIENT in $clients; do
2039 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2040 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2041 error "dd failed on $CLIENT"
2044 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2045 for C in ${CLIENTS//,/ }; do
2046 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2047 of=/dev/null 2>/dev/null ||
2048 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2054 run_test 70a "check multi client t-f"
2056 check_for_process () {
2061 killall_process $clients "$prog" -0
2065 local clients=${CLIENTS:-$HOSTNAME}
2067 zconf_mount_clients $clients $MOUNT
2070 [ "$SLOW" = "no" ] && duration=120
2071 # set duration to 900 because it takes some time to boot node
2072 [ "$FAILURE_MODE" = HARD ] && duration=900
2075 local start_ts=$(date +%s)
2076 local cmd="rundbench 1 -t $duration"
2078 if [ $MDSCOUNT -ge 2 ]; then
2079 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2080 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2082 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2083 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2084 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2085 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2088 #LU-1897 wait for all dbench copies to start
2089 while ! check_for_process $clients dbench; do
2090 elapsed=$(($(date +%s) - start_ts))
2091 if [ $elapsed -gt $duration ]; then
2092 killall_process $clients dbench
2093 error "dbench failed to start on $clients!"
2098 log "Started rundbench load pid=$pid ..."
2100 elapsed=$(($(date +%s) - start_ts))
2101 local num_failovers=0
2103 while [ $elapsed -lt $duration ]; do
2104 if ! check_for_process $clients dbench; then
2105 error_noexit "dbench stopped on some of $clients!"
2106 killall_process $clients dbench
2110 replay_barrier mds$fail_index
2111 sleep 1 # give clients a time to do operations
2112 # Increment the number of failovers
2113 num_failovers=$((num_failovers+1))
2114 log "$TESTNAME fail mds$fail_index $num_failovers times"
2116 elapsed=$(($(date +%s) - start_ts))
2117 if [ $fail_index -ge $MDSCOUNT ]; then
2120 fail_index=$((fail_index+1))
2124 wait $pid || error "rundbench load on $clients failed!"
2126 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2127 # end multi-client tests
2132 local monitor_pid=$3
2134 local start_ts=$(date +%s)
2135 local num_failovers=0
2138 elapsed=$(($(date +%s) - start_ts))
2139 while [ $elapsed -lt $duration ]; do
2140 fail_index=$((RANDOM%max_index+1))
2141 kill -0 $monitor_pid ||
2142 error "$monitor_pid stopped"
2144 replay_barrier mds$fail_index
2146 # Increment the number of failovers
2147 num_failovers=$((num_failovers+1))
2148 log "$TESTNAME fail mds$fail_index $num_failovers times"
2150 elapsed=$(($(date +%s) - start_ts))
2156 rm -f $DIR/replay-single.70c.lck
2161 local clients=${CLIENTS:-$HOSTNAME}
2164 zconf_mount_clients $clients $MOUNT
2167 [ "$SLOW" = "no" ] && duration=180
2168 # set duration to 900 because it takes some time to boot node
2169 [ "$FAILURE_MODE" = HARD ] && duration=600
2172 local start_ts=$(date +%s)
2174 trap cleanup_70c EXIT
2176 while [ ! -e $DIR/replay-single.70c.lck ]; do
2177 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2178 if [ $MDSCOUNT -ge 2 ]; then
2179 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2180 error "set default dirstripe failed"
2182 cd $DIR/$tdir || break
2183 tar cf - /etc | tar xf - || error "tar failed in loop"
2187 echo "Started tar $tar_70c_pid"
2189 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2190 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2192 touch $DIR/replay-single.70c.lck
2193 wait $tar_70c_pid || error "$?: tar failed"
2198 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2202 kill -9 $mkdir_70d_pid
2206 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2207 local clients=${CLIENTS:-$HOSTNAME}
2210 zconf_mount_clients $clients $MOUNT
2213 [ "$SLOW" = "no" ] && duration=180
2214 # set duration to 900 because it takes some time to boot node
2215 [ "$FAILURE_MODE" = HARD ] && duration=900
2220 local start_ts=$(date +%s)
2222 trap cleanup_70d EXIT
2225 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2229 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2234 touch $DIR/$tdir/test/a || {
2238 mkdir $DIR/$tdir/test/b || {
2242 rm -rf $DIR/$tdir/test || {
2248 touch $DIR/$tdir/test1/a || {
2252 mkdir $DIR/$tdir/test1/b || {
2257 rm -rf $DIR/$tdir/test1 || {
2259 ls -lR $DIR/$tdir/test1
2265 echo "Started $mkdir_70d_pid"
2267 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2268 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2273 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2276 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2277 local clients=${CLIENTS:-$HOSTNAME}
2280 lctl set_param debug=+ha
2281 zconf_mount_clients $clients $MOUNT
2284 [ "$SLOW" = "no" ] && duration=180
2285 # set duration to 900 because it takes some time to boot node
2286 [ "$FAILURE_MODE" = HARD ] && duration=900
2289 $LFS mkdir -i0 $DIR/$tdir/test_0
2290 $LFS mkdir -i0 $DIR/$tdir/test_1
2291 touch $DIR/$tdir/test_0/a
2292 touch $DIR/$tdir/test_1/b
2295 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2300 checkstat $DIR/$tdir/test_0/a && {
2301 echo "a still exists"
2305 checkstat $DIR/$tdir/test_1/b || {
2306 echo "b still exists"
2310 touch $DIR/$tdir/test_0/a || {
2311 echo "touch a fails"
2315 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2322 stack_trap "kill -9 $rename_70e_pid" EXIT
2323 echo "Started PID=$rename_70e_pid"
2325 random_fail_mdt 2 $duration $rename_70e_pid
2326 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2328 run_test 70e "rename cross-MDT with random fails"
2330 test_70f_write_and_read(){
2335 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2336 for client in ${CLIENTS//,/ }; do
2337 [ -f $stopflag ] || return
2339 local tgtfile=$DIR/$tdir/$tfile.$client
2340 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2341 of=$tgtfile 2>/dev/null ||
2342 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2343 "of=$tgtfile failed on $client, rc=$?"
2346 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2349 for client in ${CLIENTS//,/ }; do
2350 [ -f $stopflag ] || return
2352 # flush client cache in case test is running on only one client
2353 # do_node $client cancel_lru_locks osc
2354 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2356 tgtfile=$DIR/$tdir/$tfile.$client
2357 local md5=$(do_node $prev_client "md5sum $tgtfile")
2358 [ ${checksum[$index]// */} = ${md5// */} ] ||
2359 error "$tgtfile: checksum doesn't match on $prev_client"
2360 index=$((index + 1))
2370 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2371 $LFS setstripe -c -1 $DIR/$tdir ||
2372 error "cannot $LFS setstripe $DIR/$tdir"
2375 while [ -f $stopflag ]; do
2376 test_70f_write_and_read $srcfile $stopflag
2377 # use direct IO and buffer cache in turns if loop
2378 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2382 test_70f_cleanup() {
2384 rm -f $TMP/$tfile.stop
2385 do_nodes $CLIENTS rm -f $TMP/$tfile
2386 rm -f $DIR/$tdir/$tfile.*
2390 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2391 # { skip "Failover host not defined" && return; }
2392 # [ -z "$CLIENTS" ] &&
2393 # { skip "CLIENTS are not specified." && return; }
2394 # [ $CLIENTCOUNT -lt 2 ] &&
2395 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2397 [[ $(lustre_version_code ost1) -lt $(version_code 2.9.53) ]] &&
2398 skip "Need server version at least 2.9.53" && return
2400 echo "mount clients $CLIENTS ..."
2401 zconf_mount_clients $CLIENTS $MOUNT
2403 local srcfile=$TMP/$tfile
2407 trap test_70f_cleanup EXIT
2408 # create a different source file local to each client node so we can
2409 # detect if the file wasn't written out properly after failover
2410 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2411 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2412 for client in ${CLIENTS//,/ }; do
2413 checksum[$index]=$(do_node $client "md5sum $srcfile")
2414 index=$((index + 1))
2418 [ "$SLOW" = "no" ] && duration=60
2419 # set duration to 900 because it takes some time to boot node
2420 [ "$FAILURE_MODE" = HARD ] && duration=900
2422 local stopflag=$TMP/$tfile.stop
2423 test_70f_loop $srcfile $stopflag &
2427 local num_failovers=0
2428 local start_ts=$SECONDS
2429 while [ $elapsed -lt $duration ]; do
2433 num_failovers=$((num_failovers + 1))
2434 log "$TESTNAME failing OST $num_failovers times"
2437 elapsed=$((SECONDS - start_ts))
2444 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2448 kill -9 $mkdir_71a_pid
2451 random_double_fail_mdt() {
2454 local monitor_pid=$3
2456 local start_ts=$(date +%s)
2457 local num_failovers=0
2461 elapsed=$(($(date +%s) - start_ts))
2462 while [ $elapsed -lt $duration ]; do
2463 fail_index=$((RANDOM%max_index + 1))
2464 if [ $fail_index -eq $max_index ]; then
2467 second_index=$((fail_index + 1))
2469 kill -0 $monitor_pid ||
2470 error "$monitor_pid stopped"
2472 replay_barrier mds$fail_index
2473 replay_barrier mds$second_index
2475 # Increment the number of failovers
2476 num_failovers=$((num_failovers+1))
2477 log "fail mds$fail_index mds$second_index $num_failovers times"
2478 fail mds${fail_index},mds${second_index}
2479 elapsed=$(($(date +%s) - start_ts))
2484 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2485 local clients=${CLIENTS:-$HOSTNAME}
2488 zconf_mount_clients $clients $MOUNT
2491 [ "$SLOW" = "no" ] && duration=180
2492 # set duration to 900 because it takes some time to boot node
2493 [ "$FAILURE_MODE" = HARD ] && duration=900
2498 local start_ts=$(date +%s)
2500 trap cleanup_71a EXIT
2503 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2504 rmdir $DIR/$tdir/test
2508 echo "Started $mkdir_71a_pid"
2510 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2511 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2516 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2519 multiop_bg_pause $DIR/$tfile O_tSc ||
2520 error "multiop_bg_pause $DIR/$tfile failed"
2524 replay_barrier $SINGLEMDS
2525 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2526 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2529 wait $pid || error "multiop pid failed"
2530 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2533 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2536 multiop_bg_pause $DIR/$tfile O_tSc ||
2537 error "multiop_bg_pause $DIR/$tfile failed"
2541 replay_barrier $SINGLEMDS
2542 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
2543 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
2546 wait $pid || error "multiop pid failed"
2547 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2550 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2554 local clients=${CLIENTS:-$HOSTNAME}
2556 zconf_umount_clients $clients $MOUNT
2558 facet_failover $SINGLEMDS
2559 zconf_mount_clients $clients $MOUNT
2561 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2562 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2563 clients_up || error "client evicted: $?"
2566 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2568 remote_dir_check_80() {
2573 diridx=$($LFS getstripe -m $remote_dir) ||
2574 error "$LFS getstripe -m $remote_dir failed"
2575 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2577 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2578 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2579 error "$LFS getstripe -m $remote_dir/f-1 failed"
2580 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2586 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2587 ([ $FAILURE_MODE == "HARD" ] &&
2588 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2589 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2593 local remote_dir=$DIR/$tdir/remote_dir
2595 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2596 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2597 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2598 $LFS mkdir -i $MDTIDX $remote_dir &
2604 wait $CLIENT_PID || error "remote creation failed"
2606 remote_dir_check_80 || error "remote dir check failed"
2607 rm -rf $DIR/$tdir || error "rmdir failed"
2611 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2614 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2615 ([ $FAILURE_MODE == "HARD" ] &&
2616 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2617 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2621 local remote_dir=$DIR/$tdir/remote_dir
2623 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2624 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2625 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2626 $LFS mkdir -i $MDTIDX $remote_dir &
2631 fail mds$((MDTIDX + 1))
2633 wait $CLIENT_PID || error "remote creation failed"
2635 remote_dir_check_80 || error "remote dir check failed"
2636 rm -rf $DIR/$tdir || error "rmdir failed"
2640 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2643 [[ $mds1_FSTYPE = "zfs" ]] &&
2644 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2645 skip "requires LU-10143 fix on MDS"
2646 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2647 ([ $FAILURE_MODE == "HARD" ] &&
2648 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2649 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2653 local remote_dir=$DIR/$tdir/remote_dir
2655 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2656 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2657 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2658 $LFS mkdir -i $MDTIDX $remote_dir &
2664 fail mds$((MDTIDX + 1))
2666 wait $CLIENT_PID || error "remote creation failed"
2668 remote_dir_check_80 || error "remote dir check failed"
2669 rm -rf $DIR/$tdir || error "rmdir failed"
2673 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2676 [[ $mds1_FSTYPE = "zfs" ]] &&
2677 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2678 skip "requires LU-10143 fix on MDS"
2679 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2681 local remote_dir=$DIR/$tdir/remote_dir
2683 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2684 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2685 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2686 $LFS mkdir -i $MDTIDX $remote_dir &
2689 # sleep 3 seconds to make sure MDTs are failed after
2690 # lfs mkdir -i has finished on all of MDTs.
2695 fail mds${MDTIDX},mds$((MDTIDX + 1))
2697 wait $CLIENT_PID || error "remote creation failed"
2699 remote_dir_check_80 || error "remote dir check failed"
2700 rm -rf $DIR/$tdir || error "rmdir failed"
2704 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2707 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2708 ([ $FAILURE_MODE == "HARD" ] &&
2709 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2710 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2714 local remote_dir=$DIR/$tdir/remote_dir
2716 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2717 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2718 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2719 $LFS mkdir -i $MDTIDX $remote_dir &
2722 # sleep 3 seconds to make sure MDTs are failed after
2723 # lfs mkdir -i has finished on all of MDTs.
2729 wait $CLIENT_PID || error "remote creation failed"
2731 remote_dir_check_80 || error "remote dir check failed"
2732 rm -rf $DIR/$tdir || error "rmdir failed"
2736 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2739 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2740 ([ $FAILURE_MODE == "HARD" ] &&
2741 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2742 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2745 local remote_dir=$DIR/$tdir/remote_dir
2747 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2748 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2749 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2750 $LFS mkdir -i $MDTIDX $remote_dir &
2754 fail mds$((MDTIDX + 1))
2756 wait $CLIENT_PID || error "remote creation failed"
2758 remote_dir_check_80 || error "remote dir check failed"
2759 rm -rf $DIR/$tdir || error "rmdir failed"
2763 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2766 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2767 ([ $FAILURE_MODE == "HARD" ] &&
2768 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2769 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2773 local remote_dir=$DIR/$tdir/remote_dir
2775 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2776 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2777 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2778 $LFS mkdir -i $MDTIDX $remote_dir &
2781 # sleep 3 seconds to make sure MDTs are failed after
2782 # lfs mkdir -i has finished on all of MDTs.
2788 fail mds$((MDTIDX + 1))
2790 wait $CLIENT_PID || error "remote creation failed"
2792 remote_dir_check_80 || error "remote dir check failed"
2793 rm -rf $DIR/$tdir || error "rmdir failed"
2797 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2800 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2802 local remote_dir=$DIR/$tdir/remote_dir
2804 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2805 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2806 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2807 $LFS mkdir -i $MDTIDX $remote_dir &
2810 # sleep 3 seconds to make sure MDTs are failed after
2811 # lfs mkdir -i has finished on all of MDTs.
2816 fail mds${MDTIDX},mds$((MDTIDX + 1))
2818 wait $CLIENT_PID || error "remote dir creation failed"
2820 remote_dir_check_80 || error "remote dir check failed"
2821 rm -rf $DIR/$tdir || error "rmdir failed"
2825 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2828 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2829 ([ $FAILURE_MODE == "HARD" ] &&
2830 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2831 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2835 local remote_dir=$DIR/$tdir/remote_dir
2837 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2838 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2840 touch $remote_dir || error "touch $remote_dir failed"
2841 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2842 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2847 fail mds$((MDTIDX + 1))
2849 wait $CLIENT_PID || error "rm remote dir failed"
2851 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2853 rm -rf $DIR/$tdir || error "rmdir failed"
2857 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2860 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2861 ([ $FAILURE_MODE == "HARD" ] &&
2862 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2863 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2866 local remote_dir=$DIR/$tdir/remote_dir
2868 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2869 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2871 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2872 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2879 wait $CLIENT_PID || error "rm remote dir failed"
2881 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2883 rm -rf $DIR/$tdir || error "rmdir failed"
2887 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2890 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2891 ([ $FAILURE_MODE == "HARD" ] &&
2892 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2893 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2897 local remote_dir=$DIR/$tdir/remote_dir
2899 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2900 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2902 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2903 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2910 fail mds$((MDTIDX + 1))
2912 wait $CLIENT_PID || error "rm remote dir failed"
2914 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2916 rm -rf $DIR/$tdir || error "rmdir failed"
2920 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2923 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2925 local remote_dir=$DIR/$tdir/remote_dir
2927 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2928 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2930 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2931 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2937 fail mds${MDTIDX},mds$((MDTIDX + 1))
2939 wait $CLIENT_PID || error "rm remote dir failed"
2941 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2943 rm -rf $DIR/$tdir || error "rmdir failed"
2947 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2950 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2951 ([ $FAILURE_MODE == "HARD" ] &&
2952 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2953 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2957 local remote_dir=$DIR/$tdir/remote_dir
2959 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2960 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2962 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2963 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2966 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2971 wait $CLIENT_PID || error "rm remote dir failed"
2973 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2975 rm -rf $DIR/$tdir || error "rmdir failed"
2979 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2982 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2983 ([ $FAILURE_MODE == "HARD" ] &&
2984 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2985 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2989 local remote_dir=$DIR/$tdir/remote_dir
2991 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2992 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2994 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2995 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3000 fail mds$((MDTIDX + 1))
3002 wait $CLIENT_PID || error "rm remote dir failed"
3004 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3006 rm -rf $DIR/$tdir || error "rmdir failed"
3010 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3013 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3014 ([ $FAILURE_MODE == "HARD" ] &&
3015 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3016 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3020 local remote_dir=$DIR/$tdir/remote_dir
3022 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3023 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3025 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3026 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3033 fail mds$((MDTIDX + 1))
3035 wait $CLIENT_PID || error "rm remote dir failed"
3037 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3039 rm -rf $DIR/$tdir || error "rmdir failed"
3043 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3046 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3048 local remote_dir=$DIR/$tdir/remote_dir
3050 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3051 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3053 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3054 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3060 fail mds${MDTIDX},mds$((MDTIDX + 1))
3062 wait $CLIENT_PID || error "rm remote dir failed"
3064 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3066 rm -rf $DIR/$tdir || error "rmdir failed"
3070 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3073 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3074 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3075 createmany -o $DIR/$tfile- 1 &
3079 client_up || client_up || true # reconnect
3081 run_test 84a "stale open during export disconnect"
3083 test_85a() { #bug 16774
3084 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3086 for i in $(seq 100); do
3087 echo "tag-$i" > $DIR/$tfile-$i
3088 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3091 lov_id=$(lctl dl | grep "clilov")
3092 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3093 count=$(lctl get_param -n \
3094 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3095 echo "before recovery: unused locks count = $count"
3099 count2=$(lctl get_param -n \
3100 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3101 echo "after recovery: unused locks count = $count2"
3103 if [ $count2 -ge $count ]; then
3104 error "unused locks are not canceled"
3107 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3109 test_85b() { #bug 16774
3113 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3115 if ! combined_mgs_mds ; then
3119 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3121 for i in $(seq 100); do
3122 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3123 count=32 >/dev/null 2>&1
3126 cancel_lru_locks osc
3128 for i in $(seq 100); do
3129 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3130 count=32 >/dev/null 2>&1
3133 lov_id=$(lctl dl | grep "clilov")
3134 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3135 count=$(lctl get_param -n \
3136 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3137 echo "before recovery: unused locks count = $count"
3138 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3142 count2=$(lctl get_param \
3143 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3144 echo "after recovery: unused locks count = $count2"
3146 if ! combined_mgs_mds ; then
3150 if [ $count2 -ge $count ]; then
3151 error "unused locks are not canceled"
3156 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3159 local clients=${CLIENTS:-$HOSTNAME}
3161 zconf_umount_clients $clients $MOUNT
3162 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3163 remount_facet $SINGLEMDS
3164 zconf_mount_clients $clients $MOUNT
3166 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3169 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3172 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3173 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3174 error "dd to $DIR/$tfile failed"
3175 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3176 cancel_lru_locks osc
3178 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3179 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3180 if [ $cksum != $cksum2 ] ; then
3181 error "New checksum $cksum2 does not match original $cksum"
3184 run_test 87a "write replay"
3187 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3190 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3191 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3192 error "dd to $DIR/$tfile failed"
3193 sleep 1 # Give it a chance to flush dirty data
3194 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3195 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3196 cancel_lru_locks osc
3198 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3199 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3200 if [ $cksum != $cksum2 ] ; then
3201 error "New checksum $cksum2 does not match original $cksum"
3204 run_test 87b "write replay with changed data (checksum resend)"
3206 test_88() { #bug 17485
3207 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3208 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3210 $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "$LFS setstripe failed"
3213 replay_barrier $SINGLEMDS
3215 # exhaust precreations on ost1
3216 local OST=$(ostname_from_index 0)
3217 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3218 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3219 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3220 echo "before test: last_id = $last_id, next_id = $next_id"
3222 echo "Creating to objid $last_id on ost $OST..."
3223 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3224 error "createmany create files to last_id failed"
3226 #create some files to use some uncommitted objids
3227 last_id=$(($last_id + 1))
3228 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3229 error "createmany create files with uncommitted objids failed"
3231 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3232 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3233 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3235 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3236 # it has to take care about the affected facets, bug20407
3237 local affected_mds1=$(affected_facets mds1)
3238 local affected_ost1=$(affected_facets ost1)
3240 shutdown_facet $SINGLEMDS
3243 reboot_facet $SINGLEMDS
3244 change_active $affected_mds1
3245 wait_for_facet $affected_mds1
3246 mount_facets $affected_mds1 || error "Restart of mds failed"
3249 change_active $affected_ost1
3250 wait_for_facet $affected_ost1
3251 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3255 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3256 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3257 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3259 # create new files, which should use new objids, and ensure the orphan
3260 # cleanup phase for ost1 is completed at the same time
3261 for i in $(seq 8); do
3262 file_id=$(($last_id + 10 + $i))
3263 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3266 # if the objids were not recreated, then "ls" will fail with -ENOENT
3267 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3270 # write into previously created files
3271 for i in $(seq 8); do
3272 file_id=$(($last_id + $i))
3273 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3274 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3277 # compare the content
3278 for i in $(seq 8); do
3279 file_id=$(($last_id + $i))
3280 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3281 error "the content of file is modified!"
3286 run_test 88 "MDS should not assign same objid to different files "
3288 function calc_osc_kbytes_used() {
3289 local kbtotal=$(calc_osc_kbytes kbytestotal)
3290 local kbfree=$(calc_osc_kbytes kbytesfree)
3291 echo $((kbtotal-kbfree))
3295 cancel_lru_locks osc
3296 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3297 rm -f $DIR/$tdir/$tfile
3298 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3299 wait_delete_completed || error "initial wait delete timed out"
3300 local blocks1=$(calc_osc_kbytes_used)
3301 local write_size=$(fs_log_size)
3303 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile
3304 [ $write_size -lt 1024 ] && write_size=1024
3305 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3308 facet_failover $SINGLEMDS
3309 rm $DIR/$tdir/$tfile
3312 zconf_mount $(hostname) $MOUNT || error "mount fails"
3313 client_up || error "client_up failed"
3315 # wait for the remounted client to connect to ost1
3316 local target=$(get_osc_import_name client ost1)
3317 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3318 $(max_recovery_time)
3320 wait_mds_ost_sync || error "MDS-OST sync timed out"
3321 wait_delete_completed || error "wait delete timed out"
3322 local blocks2=$(calc_osc_kbytes_used)
3324 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3325 error $((blocks2 - blocks1)) blocks leaked
3327 run_test 89 "no disk space leak on late ost connection"
3334 change_active $facet
3335 wait_for_facet $facet
3336 mount_facet $facet || error "Restart of $facet failed"
3340 test_90() { # bug 19494
3341 local dir=$DIR/$tdir
3342 local ostfail=$(get_random_entry $(get_facets OST))
3344 if [[ $FAILURE_MODE = HARD ]]; then
3345 local affected=$(affected_facets $ostfail);
3346 if [[ "$affected" != $ostfail ]]; then
3347 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
3351 # ensure all OSTs are active to allow allocations
3354 mkdir $dir || error "mkdir $dir failed"
3356 echo "Create the files"
3358 # file "f${index}" striped over 1 OST
3359 # file "all" striped over all OSTs
3361 $LFS setstripe -c $OSTCOUNT $dir/all ||
3362 error "setstripe failed to create $dir/all"
3364 for ((i = 0; i < $OSTCOUNT; i++)); do
3367 $LFS setstripe -i $i -c 1 $f ||
3368 error "$LFS setstripe failed to create $f"
3370 # confirm setstripe actually created stripe on requested OST
3371 local uuid=$(ostuuid_from_index $i)
3373 for file in f$i all; do
3374 local found=$($LFS find --obd $uuid --name $file $dir)
3376 if [[ $dir/$file != $found ]]; then
3377 $LFS getstripe $dir/$file
3378 error "wrong stripe: $file, uuid: $uuid"
3383 # Before failing an OST, get its obd name and index
3384 local varsvc=${ostfail}_svc
3385 local obd=$(do_facet $ostfail lctl get_param \
3386 -n obdfilter.${!varsvc}.uuid)
3387 local index=$(($(facet_number $ostfail) - 1))
3389 echo "Fail $ostfail $obd, display the list of affected files"
3390 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3392 trap "cleanup_90 $ostfail" EXIT INT
3393 echo "General Query: lfs find $dir"
3394 local list=$($LFS find $dir)
3396 for (( i=0; i<$OSTCOUNT; i++ )); do
3397 list_member "$list" $dir/f$i ||
3398 error_noexit "lfs find $dir: no file f$i"
3400 list_member "$list" $dir/all ||
3401 error_noexit "lfs find $dir: no file all"
3403 # focus on the missing OST,
3404 # we expect to see only two files affected: "f$(index)" and "all"
3406 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3407 list=$($LFS find --obd $obd $dir)
3409 for file in all f$index; do
3410 list_member "$list" $dir/$file ||
3411 error_noexit "lfs find does not report the affected $obd for $file"
3414 [[ $(echo $list | wc -w) -eq 2 ]] ||
3415 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3417 echo "Check getstripe: $LFS getstripe -r --obd $obd"
3418 list=$($LFS getstripe -r --obd $obd $dir)
3420 for file in all f$index; do
3421 echo "$list" | grep $dir/$file ||
3422 error_noexit "lfs getsripe does not report the affected $obd for $file"
3427 run_test 90 "lfs find identifies the missing striped file segments"
3430 local server_version=$(lustre_version_code $SINGLEMDS)
3431 [[ $server_version -ge $(version_code 2.6.90) ]] ||
3432 [[ $server_version -ge $(version_code 2.5.4) &&
3433 $server_version -lt $(version_code 2.5.50) ]] ||
3434 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
3436 cancel_lru_locks osc
3438 $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
3439 error "$LFS setstripe $DIR/$tfile failed"
3440 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3441 error "dd to $DIR/$tfile failed"
3442 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3443 # We need to emulate a state that OST is waiting for other clients
3444 # not completing the recovery. Final ping is queued, but reply will be
3445 # sent on the recovery completion. It is done by sleep before
3446 # processing final pings
3447 do_facet ost1 "$LCTL set_param fail_val=40"
3448 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3451 run_test 93a "replay + reconnect"
3454 local server_version=$(lustre_version_code $SINGLEMDS)
3455 [[ $server_version -ge $(version_code 2.7.90) ]] ||
3456 { skip "Need MDS version 2.7.90+"; return; }
3458 cancel_lru_locks mdc
3460 createmany -o $DIR/$tfile 20 ||
3461 error "createmany -o $DIR/$tfile failed"
3463 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3464 # We need to emulate a state that MDT is waiting for other clients
3465 # not completing the recovery. Final ping is queued, but reply will be
3466 # sent on the recovery completion. It is done by sleep before
3467 # processing final pings
3468 do_facet mds1 "$LCTL set_param fail_val=80"
3469 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3472 run_test 93b "replay + reconnect on mds"
3474 striped_dir_check_100() {
3475 local striped_dir=$DIR/$tdir/striped_dir
3476 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3478 $LFS getdirstripe $striped_dir
3479 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3481 createmany -o $striped_dir/f-%d 20 ||
3482 error "creation failed under striped dir"
3486 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3487 ([ $FAILURE_MODE == "HARD" ] &&
3488 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3489 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3492 local striped_dir=$DIR/$tdir/striped_dir
3495 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3497 #To make sure MDT1 and MDT0 are connected
3498 #otherwise it may create single stripe dir here
3499 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3501 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3502 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3503 $LFS setdirstripe -i0 -c2 $striped_dir &
3506 fail mds$((MDTIDX + 1))
3508 wait $CLIENT_PID || error "striped dir creation failed"
3510 striped_dir_check_100 || error "striped dir check failed"
3511 rm -rf $DIR/$tdir || error "rmdir failed"
3513 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3516 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3517 ([ $FAILURE_MODE == "HARD" ] &&
3518 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3519 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3522 local striped_dir=$DIR/$tdir/striped_dir
3525 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3527 #To make sure MDT1 and MDT0 are connected
3528 #otherwise it may create single stripe dir here
3529 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3531 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3532 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3533 $LFS mkdir -i0 -c2 $striped_dir &
3538 wait $CLIENT_PID || error "striped dir creation failed"
3540 striped_dir_check_100 || error "striped dir check failed"
3541 rm -rf $DIR/$tdir || error "rmdir failed"
3543 run_test 100b "DNE: create striped dir, fail MDT0"
3545 test_101() { #LU-5648
3546 mkdir -p $DIR/$tdir/d1
3547 mkdir -p $DIR/$tdir/d2
3548 touch $DIR/$tdir/file0
3551 replay_barrier $SINGLEMDS
3552 for i in $(seq $num) ; do
3553 echo test$i > $DIR/$tdir/d1/file$i
3556 fail_abort $SINGLEMDS
3557 for i in $(seq $num) ; do
3558 touch $DIR/$tdir/d2/file$i
3559 test -s $DIR/$tdir/d2/file$i &&
3560 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3565 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3574 [[ $(lctl get_param mdc.*.import |
3575 grep "connect_flags:.*multi_mod_rpc") ]] ||
3576 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3578 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3579 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3580 facet="mds$((0x$idx + 1))"
3582 # get current value of max_mod_rcps_in_flight
3583 num=$($LCTL get_param -n \
3584 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3585 # set default value if client does not support multi mod RPCs
3586 [ -z "$num" ] && num=1
3588 echo "creating $num files ..."
3590 for i in $(seq $num); do
3591 touch $DIR/$tdir/file-$i
3594 # drop request on MDT to force resend
3595 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3596 do_facet $facet "$LCTL set_param fail_loc=0x159"
3597 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3598 for i in $(seq $num); do
3599 chmod 0600 $DIR/$tdir/file-$i &
3603 do_facet $facet "$LCTL set_param fail_loc=0"
3604 for pid in $pids; do
3605 wait $pid || error "chmod failed"
3607 echo "done ($(date +%H:%M:%S))"
3609 # check chmod succeed
3610 for i in $(seq $num); do
3611 checkstat -vp 0600 $DIR/$tdir/file-$i
3616 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3625 [[ $(lctl get_param mdc.*.import |
3626 grep "connect_flags:.*multi_mod_rpc") ]] ||
3627 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3629 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3630 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3631 facet="mds$((0x$idx + 1))"
3633 # get current value of max_mod_rcps_in_flight
3634 num=$($LCTL get_param -n \
3635 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3636 # set default value if client does not support multi mod RPCs
3637 [ -z "$num" ] && num=1
3639 echo "creating $num files ..."
3641 for i in $(seq $num); do
3642 touch $DIR/$tdir/file-$i
3645 # drop reply on MDT to force reconstruction
3646 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3647 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3648 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3649 for i in $(seq $num); do
3650 chmod 0600 $DIR/$tdir/file-$i &
3654 do_facet $facet "$LCTL set_param fail_loc=0"
3655 for pid in $pids; do
3656 wait $pid || error "chmod failed"
3658 echo "done ($(date +%H:%M:%S))"
3660 # check chmod succeed
3661 for i in $(seq $num); do
3662 checkstat -vp 0600 $DIR/$tdir/file-$i
3667 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3676 [[ $(lctl get_param mdc.*.import |
3677 grep "connect_flags:.*multi_mod_rpc") ]] ||
3678 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3680 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3681 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3682 facet="mds$((0x$idx + 1))"
3684 # get current value of max_mod_rcps_in_flight
3685 num=$($LCTL get_param -n \
3686 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3687 # set default value if client does not support multi mod RPCs
3688 [ -z "$num" ] && num=1
3690 echo "creating $num files ..."
3692 for i in $(seq $num); do
3693 touch $DIR/$tdir/file-$i
3696 replay_barrier $facet
3699 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3700 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3701 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3702 for i in $(seq $num); do
3703 chmod 0600 $DIR/$tdir/file-$i &
3707 do_facet $facet "$LCTL set_param fail_loc=0"
3712 for pid in $pids; do
3713 wait $pid || error "chmod failed"
3715 echo "done ($(date +%H:%M:%S))"
3717 # check chmod succeed
3718 for i in $(seq $num); do
3719 checkstat -vp 0600 $DIR/$tdir/file-$i
3724 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3733 [[ $(lctl get_param mdc.*.import |
3734 grep "connect_flags:.*multi_mod_rpc") ]] ||
3735 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3737 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3738 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3739 facet="mds$((0x$idx + 1))"
3741 # get current value of max_mod_rcps_in_flight
3742 num=$($LCTL get_param -n \
3743 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3744 # set default value if client does not support multi mod RPCs
3745 [ -z "$num" ] && num=1
3747 echo "creating $num files ..."
3749 for i in $(seq $num); do
3750 touch $DIR/$tdir/file-$i
3754 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3755 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3756 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3757 for i in $(seq $num); do
3758 chmod 0600 $DIR/$tdir/file-$i &
3763 # write MDT transactions to disk
3764 do_facet $facet "sync; sync; sync"
3766 do_facet $facet "$LCTL set_param fail_loc=0"
3771 for pid in $pids; do
3772 wait $pid || error "chmod failed"
3774 echo "done ($(date +%H:%M:%S))"
3776 # check chmod succeed
3777 for i in $(seq $num); do
3778 checkstat -vp 0600 $DIR/$tdir/file-$i
3783 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3786 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3787 local mds_version=$(lustre_version_code $SINGLEMDS)
3788 [[ $mds_version -gt $(version_code 2.8.54) ]] ||
3789 { skip "Need MDS version 2.8.54+"; return; }
3791 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3792 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3795 createmany -o $DIR/$tdir/t- 30 ||
3796 error "create files on remote directory failed"
3798 rm -rf $DIR/$tdir/t-*
3800 #MDS should crash with tr->otr_next_id overflow
3803 run_test 103 "Check otr_next_id overflow"
3806 check_striped_dir_110()
3808 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3809 error "create striped dir failed"
3810 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3811 [ $stripe_count -eq $MDSCOUNT ] ||
3812 error "$stripe_count != 2 after recovery"
3816 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3817 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3818 skip "Need MDS version at least 2.7.56"
3820 ([ $FAILURE_MODE == "HARD" ] &&
3821 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3822 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3827 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3830 check_striped_dir_110 || error "check striped_dir failed"
3831 rm -rf $DIR/$tdir || error "rmdir failed"
3835 run_test 110a "DNE: create striped dir, fail MDT1"
3838 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3839 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3840 skip "Need MDS version at least 2.7.56"
3842 ([ $FAILURE_MODE == "HARD" ] &&
3843 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3844 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3849 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3852 zconf_mount $(hostname) $MOUNT
3853 client_up || return 1
3855 check_striped_dir_110 || error "check striped_dir failed"
3857 rm -rf $DIR/$tdir || error "rmdir failed"
3861 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3864 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3865 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3866 skip "Need MDS version at least 2.7.56"
3868 ([ $FAILURE_MODE == "HARD" ] &&
3869 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3870 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3875 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3878 check_striped_dir_110 || error "check striped_dir failed"
3880 rm -rf $DIR/$tdir || error "rmdir failed"
3884 run_test 110c "DNE: create striped dir, fail MDT2"
3887 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3888 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3889 skip "Need MDS version at least 2.7.56"
3891 ([ $FAILURE_MODE == "HARD" ] &&
3892 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3893 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3898 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3901 zconf_mount $(hostname) $MOUNT
3902 client_up || return 1
3904 check_striped_dir_110 || error "check striped_dir failed"
3906 rm -rf $DIR/$tdir || error "rmdir failed"
3910 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3913 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3914 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3915 skip "Need MDS version at least 2.7.56"
3917 ([ $FAILURE_MODE == "HARD" ] &&
3918 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3919 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3924 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3928 zconf_mount $(hostname) $MOUNT
3929 client_up || return 1
3931 check_striped_dir_110 || error "check striped_dir failed"
3933 rm -rf $DIR/$tdir || error "rmdir failed"
3937 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3940 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3941 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3942 skip "Need MDS version at least 2.7.56"
3944 ([ $FAILURE_MODE == "HARD" ] &&
3945 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3946 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3952 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3955 check_striped_dir_110 || error "check striped_dir failed"
3957 rm -rf $DIR/$tdir || error "rmdir failed"
3961 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3964 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3965 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3966 skip "Need MDS version at least 2.7.56"
3968 ([ $FAILURE_MODE == "HARD" ] &&
3969 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3970 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3975 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3979 zconf_mount $(hostname) $MOUNT
3980 client_up || return 1
3982 check_striped_dir_110 || error "check striped_dir failed"
3984 rm -rf $DIR/$tdir || error "rmdir failed"
3988 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
3991 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3992 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3993 skip "Need MDS version at least 2.7.56"
3995 ([ $FAILURE_MODE == "HARD" ] &&
3996 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3997 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4001 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4003 rm -rf $DIR/$tdir/striped_dir
4006 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4007 error "striped dir still exists"
4010 run_test 111a "DNE: unlink striped dir, fail MDT1"
4013 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4014 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4015 skip "Need MDS version at least 2.7.56"
4017 ([ $FAILURE_MODE == "HARD" ] &&
4018 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4019 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4023 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4025 rm -rf $DIR/$tdir/striped_dir
4028 zconf_mount $(hostname) $MOUNT
4029 client_up || return 1
4031 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4032 error "striped dir still exists"
4035 run_test 111b "DNE: unlink striped dir, fail MDT2"
4038 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4039 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4040 skip "Need MDS version at least 2.7.56"
4042 ([ $FAILURE_MODE == "HARD" ] &&
4043 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4044 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4048 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4050 rm -rf $DIR/$tdir/striped_dir
4054 zconf_mount $(hostname) $MOUNT
4055 client_up || return 1
4056 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4057 error "striped dir still exists"
4060 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4063 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4064 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4065 skip "Need MDS version at least 2.7.56"
4067 ([ $FAILURE_MODE == "HARD" ] &&
4068 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4069 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4073 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4075 rm -rf $DIR/$tdir/striped_dir
4079 zconf_mount $(hostname) $MOUNT
4080 client_up || return 1
4081 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4082 error "striped dir still exists"
4086 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4089 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4090 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4091 skip "Need MDS version at least 2.7.56"
4093 ([ $FAILURE_MODE == "HARD" ] &&
4094 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4095 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4099 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4101 rm -rf $DIR/$tdir/striped_dir
4104 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4105 error "striped dir still exists"
4108 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4111 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4112 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4113 skip "Need MDS version at least 2.7.56"
4115 ([ $FAILURE_MODE == "HARD" ] &&
4116 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4117 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4121 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4123 rm -rf $DIR/$tdir/striped_dir
4126 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4127 error "striped dir still exists"
4130 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4133 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4134 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4135 skip "Need MDS version at least 2.7.56"
4137 ([ $FAILURE_MODE == "HARD" ] &&
4138 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4139 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4143 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4146 rm -rf $DIR/$tdir/striped_dir
4148 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4149 error "striped dir still exists"
4152 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4154 test_112_rename_prepare() {
4155 mkdir -p $DIR/$tdir/src_dir
4156 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4157 error "create remote source failed"
4159 touch $DIR/$tdir/src_dir/src_child/a
4161 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4162 error "create remote target dir failed"
4164 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4165 error "create remote target child failed"
4170 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4171 error "src_child still exists after rename"
4173 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4174 error "missing file(a) after rename"
4178 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4179 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4180 skip "Need MDS version at least 2.7.56"
4182 ([ $FAILURE_MODE == "HARD" ] &&
4183 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4184 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4187 test_112_rename_prepare
4190 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4191 error "rename dir cross MDT failed!"
4195 rm -rf $DIR/$tdir || error "rmdir failed"
4197 run_test 112a "DNE: cross MDT rename, fail MDT1"
4200 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4201 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4202 skip "Need MDS version at least 2.7.56"
4204 ([ $FAILURE_MODE == "HARD" ] &&
4205 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4206 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4209 test_112_rename_prepare
4212 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4213 error "rename dir cross MDT failed!"
4218 rm -rf $DIR/$tdir || error "rmdir failed"
4220 run_test 112b "DNE: cross MDT rename, fail MDT2"
4223 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4224 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4225 skip "Need MDS version at least 2.7.56"
4227 ([ $FAILURE_MODE == "HARD" ] &&
4228 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4229 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4232 test_112_rename_prepare
4235 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4236 error "rename dir cross MDT failed!"
4241 rm -rf $DIR/$tdir || error "rmdir failed"
4243 run_test 112c "DNE: cross MDT rename, fail MDT3"
4246 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4247 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4248 skip "Need MDS version at least 2.7.56"
4250 ([ $FAILURE_MODE == "HARD" ] &&
4251 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4252 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4255 test_112_rename_prepare
4258 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4259 error "rename dir cross MDT failed!"
4264 rm -rf $DIR/$tdir || error "rmdir failed"
4266 run_test 112d "DNE: cross MDT rename, fail MDT4"
4269 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4270 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4271 skip "Need MDS version at least 2.7.56"
4273 ([ $FAILURE_MODE == "HARD" ] &&
4274 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4275 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4278 test_112_rename_prepare
4282 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4283 error "rename dir cross MDT failed!"
4288 rm -rf $DIR/$tdir || error "rmdir failed"
4290 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4293 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4294 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4295 skip "Need MDS version at least 2.7.56"
4297 ([ $FAILURE_MODE == "HARD" ] &&
4298 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4299 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4302 test_112_rename_prepare
4306 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4307 error "rename dir cross MDT failed!"
4312 rm -rf $DIR/$tdir || error "rmdir failed"
4314 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4317 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4318 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4319 skip "Need MDS version at least 2.7.56"
4321 ([ $FAILURE_MODE == "HARD" ] &&
4322 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4323 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4326 test_112_rename_prepare
4330 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4331 error "rename dir cross MDT failed!"
4336 rm -rf $DIR/$tdir || error "rmdir failed"
4338 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4341 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4342 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4343 skip "Need MDS version at least 2.7.56"
4345 ([ $FAILURE_MODE == "HARD" ] &&
4346 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4347 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4350 test_112_rename_prepare
4354 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4355 error "rename dir cross MDT failed!"
4360 rm -rf $DIR/$tdir || error "rmdir failed"
4362 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4365 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4366 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4367 skip "Need MDS version at least 2.7.56"
4369 ([ $FAILURE_MODE == "HARD" ] &&
4370 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4371 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4374 test_112_rename_prepare
4378 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4379 error "rename dir cross MDT failed!"
4384 rm -rf $DIR/$tdir || error "rmdir failed"
4386 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4389 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4390 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4391 skip "Need MDS version at least 2.7.56"
4393 ([ $FAILURE_MODE == "HARD" ] &&
4394 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4395 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4398 test_112_rename_prepare
4402 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4403 error "rename dir cross MDT failed!"
4408 rm -rf $DIR/$tdir || error "rmdir failed"
4410 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4413 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4414 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4415 skip "Need MDS version at least 2.7.56"
4417 ([ $FAILURE_MODE == "HARD" ] &&
4418 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4419 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4422 test_112_rename_prepare
4427 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4428 error "rename dir cross MDT failed!"
4433 rm -rf $DIR/$tdir || error "rmdir failed"
4435 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4438 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4439 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4440 skip "Need MDS version at least 2.7.56"
4442 ([ $FAILURE_MODE == "HARD" ] &&
4443 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4444 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4447 test_112_rename_prepare
4452 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4453 error "rename dir cross MDT failed!"
4458 rm -rf $DIR/$tdir || error "rmdir failed"
4460 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4463 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4464 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4465 skip "Need MDS version at least 2.7.56"
4467 ([ $FAILURE_MODE == "HARD" ] &&
4468 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4469 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4472 test_112_rename_prepare
4477 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4478 error "rename dir cross MDT failed!"
4483 rm -rf $DIR/$tdir || error "rmdir failed"
4485 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4488 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4489 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4490 skip "Need MDS version at least 2.7.56"
4492 ([ $FAILURE_MODE == "HARD" ] &&
4493 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4494 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4497 test_112_rename_prepare
4502 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4503 error "rename dir cross MDT failed!"
4508 rm -rf $DIR/$tdir || error "rmdir failed"
4510 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4513 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4514 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4515 skip "Need MDS version at least 2.7.56"
4517 ([ $FAILURE_MODE == "HARD" ] &&
4518 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4519 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4527 for ((j=0;j<$((MDSCOUNT));j++)); do
4528 fail_index=$((fail_index+1))
4529 index=$((fail_index % MDSCOUNT))
4530 replay_barrier mds$((index + 1))
4531 for ((i=0;i<5;i++)); do
4532 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4533 error "create striped dir $DIR/$tdir/test_$i"
4536 fail mds$((index + 1))
4537 for ((i=0;i<5;i++)); do
4538 checkstat -t dir $DIR/$tdir/test_$i ||
4539 error "$DIR/$tdir/test_$i does not exist!"
4541 rm -rf $DIR/$tdir/test_* ||
4545 run_test 115 "failover for create/unlink striped directory"
4548 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4549 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4550 skip "Do not support large update log before 2.7.55" &&
4552 ([ $FAILURE_MODE == "HARD" ] &&
4553 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4554 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4561 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4562 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4563 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4566 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4567 error "stried_dir does not exists"
4569 run_test 116a "large update log master MDT recovery"
4572 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4573 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4574 skip "Do not support large update log before 2.7.55" &&
4577 ([ $FAILURE_MODE == "HARD" ] &&
4578 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4579 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4586 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4587 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4588 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4591 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4592 error "stried_dir does not exists"
4594 run_test 116b "large update log slave MDT recovery"
4597 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4598 ([ $FAILURE_MODE == "HARD" ] &&
4599 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4600 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4606 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4607 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4610 # Let's set rdonly on all MDTs, so client will send
4611 # replay requests on all MDTs and replay these requests
4612 # at the same time. This test will verify the recovery
4613 # will not be deadlock in this case, LU-7531.
4614 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4615 replay_barrier mds$((index + 1))
4616 if [ -z $mds_indexs ]; then
4617 mds_indexs="${mds_indexs}mds$((index+1))"
4619 mds_indexs="${mds_indexs},mds$((index+1))"
4623 rm -rf $DIR/$tdir/remote_dir
4624 rm -rf $DIR/$tdir/remote_dir_1
4628 rm -rf $DIR/$tdir || error "rmdir failed"
4630 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4633 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4634 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4635 skip "Do not support large update log before 2.7.64" &&
4640 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4641 error "setdirstripe fails"
4642 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4643 error "setdirstripe fails 1"
4644 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4646 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4647 do_facet mds1 "lctl set_param fail_loc=0x1705"
4648 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4649 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4650 do_facet mds1 "lctl set_param fail_loc=0x0"
4653 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4654 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4659 run_test 118 "invalidate osp update will not cause update log corruption"
4662 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4663 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4664 skip "Do not support large update log before 2.7.64" &&
4667 local hard_timeout=$(do_facet mds1 \
4668 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4670 local clients=${CLIENTS:-$HOSTNAME}
4671 local time_min=$(recovery_time_min)
4674 mkdir $DIR/$tdir/tmp
4675 rmdir $DIR/$tdir/tmp
4678 mkdir $DIR/$tdir/dir_1
4679 for ((i = 0; i < 20; i++)); do
4680 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4687 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4688 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4689 #sleep (timeout + 5), so mds will evict the client exports,
4690 #but DNE update recovery will keep going.
4691 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4693 mount_facet mds1 "-o recovery_time_hard=$time_min"
4695 wait_clients_import_state "$clients" mds1 FULL
4697 clients_up || clients_up || error "failover df: $?"
4699 #revert back the hard timeout
4700 do_facet mds1 $LCTL set_param \
4701 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4703 for ((i = 0; i < 20; i++)); do
4704 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4705 [ $stripe_count == 2 ] || {
4706 error "stripe_dir-$i creation replay fails"
4711 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4714 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4715 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4716 skip "Do not support large update log before 2.7.64" &&
4720 replay_barrier_nosync mds1
4721 for ((i = 0; i < 20; i++)); do
4722 mkdir $DIR/$tdir/dir-$i || {
4723 error "create dir-$i fails"
4726 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4727 error "create stripe_dir-$i fails"
4734 for ((i = 0; i < 20; i++)); do
4735 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4736 error "dir-$i still exists"
4739 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4740 error "stripe_dir-$i still exists"
4745 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4748 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4749 skip "Don't support it before 2.11" &&
4752 local at_max_saved=$(at_max_get mds)
4754 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4755 cancel_lru_locks mdc
4757 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4760 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4766 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4767 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4771 wait_clients_import_state "$clients" mds1 FULL
4772 clients_up || clients_up || error "failover df: $?"
4775 wait $mpid || error "multiop_bg_pause pid failed"
4777 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4778 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4779 at_max_set $at_max_saved mds
4782 run_test 121 "lock replay timed out and race"
4785 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4786 skip "Do not support Data-on-MDT before 2.11"
4788 replay_barrier $SINGLEMDS
4789 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4792 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4793 error "Fail to replay DoM file creation"
4795 run_test 130a "DoM file create (setstripe) replay"
4798 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4799 skip "Do not support Data-on-MDT before 2.11"
4802 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4803 replay_barrier $SINGLEMDS
4804 touch $DIR/$tdir/$tfile
4807 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4808 error "Fail to replay DoM file creation"
4810 run_test 130b "DoM file create (inherited) replay"
4813 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4814 skip "Do not support Data-on-MDT before 2.11"
4816 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4817 replay_barrier $SINGLEMDS
4818 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4819 # lock is not canceled and will be replayed
4822 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4823 error "Wrong file content after failover"
4825 run_test 131a "DoM file write lock replay"
4828 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4829 skip "Do not support Data-on-MDT before 2.11"
4831 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4832 replay_barrier $SINGLEMDS
4833 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4834 cancel_lru_locks mdc
4838 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4839 error "Wrong file content after failover"
4841 run_test 131b "DoM file write replay"
4844 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.90) ] &&
4845 skip "Do not support PFL files before 2.10"
4847 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4848 replay_barrier $SINGLEMDS
4849 # write over the first component size cause next component instantiation
4850 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4851 error "dd to $DIR/$tfile failed"
4852 lfs getstripe $DIR/$tfile
4854 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4855 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4856 error "Component #1 was not instantiated"
4860 lfs getstripe $DIR/$tfile
4861 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4862 error "Component #1 instantiation was not replayed"
4863 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4864 if [ $cksum != $cksum2 ] ; then
4865 error_noexit "New cksum $cksum2 does not match original $cksum"
4868 run_test 132a "PFL new component instantiate replay"
4871 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4872 ([ $FAILURE_MODE == "HARD" ] &&
4873 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4874 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4877 local remote_dir=$DIR/$tdir/remote_dir
4879 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4880 $LFS mkdir -i 1 $remote_dir
4883 do_facet mds2 $LCTL set_param seq.srv*MDT0001.space=clear
4885 zconf_mount $(hostname) $MOUNT
4886 client_up || return 1
4888 #define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123
4890 do_facet mds1 $LCTL set_param fail_val=700 fail_loc=0x80000123
4891 cp /etc/hosts $remote_dir/file &
4897 wait $pid || error "cp failed"
4898 rm -rf $DIR/$tdir || error "rmdir failed"
4902 run_test 133 "check resend of ongoing requests for lwp during failover"
4905 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return 0
4908 pool_add_targets pool_134 1 1
4911 $LFS setstripe -p pool_134 $DIR/$tdir
4915 touch $DIR/$tdir/$tfile
4919 [ -f $DIR/$tdir/$tfile ] || error "file does not exist"
4921 run_test 134 "replay creation of a file created in a pool"
4924 check_and_cleanup_lustre