5 LUSTRE=${LUSTRE:-$(dirname $0)/..}
6 . $LUSTRE/tests/test-framework.sh
10 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
11 if [ "$mds1_FSTYPE" = zfs ]; then
15 always_except LU-13614 59
16 always_except LU-12805 36
18 always_except LU-9795 121
23 CHECK_GRANT=${CHECK_GRANT:-"yes"}
24 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
26 require_dsh_mds || exit 0
27 check_and_setup_lustre
32 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
34 # new sequence needed for MDS < v2_15_61-226-gf00d2467fc
35 if (( $MDS1_VERSION < $(version_code 2.15.61.226) )); then
39 test_0a() { # was test_0
40 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
41 replay_barrier $SINGLEMDS
45 run_test 0a "empty replay"
48 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
50 # this test attempts to trigger a race in the precreation code,
51 # and must run before any other objects are created on the filesystem
53 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
54 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
56 run_test 0b "ensure object created after recover exists. (3284)"
59 replay_barrier $SINGLEMDS
62 facet_failover $SINGLEMDS
63 zconf_mount $(hostname) $MOUNT || error "mount fails"
64 client_up || error "post-failover df failed"
65 # file shouldn't exist if replay-barrier works as expected
66 rm $DIR/$tfile && error "File exists and it shouldn't"
69 run_test 0c "check replay-barrier"
72 replay_barrier $SINGLEMDS
74 facet_failover $SINGLEMDS
75 zconf_mount $(hostname) $MOUNT || error "mount fails"
76 client_up || error "post-failover df failed"
78 run_test 0d "expired recovery with no clients"
81 replay_barrier $SINGLEMDS
84 $CHECKSTAT -t file $DIR/$tfile ||
85 error "$CHECKSTAT $DIR/$tfile attribute check failed"
88 run_test 1 "simple create"
91 replay_barrier $SINGLEMDS
94 $CHECKSTAT -t file $DIR/$tfile ||
95 error "$CHECKSTAT $DIR/$tfile attribute check failed"
101 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
102 replay_barrier $SINGLEMDS
105 $CHECKSTAT -t file $DIR/$tfile ||
106 error "$CHECKSTAT $DIR/$tfile attribute check failed"
112 replay_barrier $SINGLEMDS
113 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
115 $CHECKSTAT -t file $DIR/$tfile ||
116 error "$CHECKSTAT $DIR/$tfile check failed"
118 run_test 2c "setstripe replay"
121 [[ "$mds1_FSTYPE" = zfs ]] &&
122 [[ "$MDS1_VERSION" -lt $(version_code 2.12.51) ]] &&
123 skip "requires LU-10143 fix on MDS"
124 replay_barrier $SINGLEMDS
125 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
127 $CHECKSTAT -t dir $DIR/$tdir ||
128 error "$CHECKSTAT $DIR/$tdir check failed"
130 run_test 2d "setdirstripe replay"
133 testid=$(echo $TESTNAME | tr '_' ' ')
134 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
135 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000013b"
136 openfile -f O_CREAT:O_EXCL $DIR/$tfile &
138 replay_barrier $SINGLEMDS
141 $CHECKSTAT -t file $DIR/$tfile ||
142 error "$CHECKSTAT $DIR/$tfile attribute check failed"
143 dmesg | tac | sed "/$testid/,$ d" | \
144 grep "Open request replay failed with -17" &&
145 error "open replay failed" || true
147 run_test 2e "O_CREAT|O_EXCL create replay"
150 local file=$DIR/$tfile
151 replay_barrier $SINGLEMDS
153 openfile -f O_DIRECTORY $file
155 $CHECKSTAT -t file $file ||
156 error "$CHECKSTAT $file attribute check failed"
159 run_test 3a "replay failed open(O_DIRECTORY)"
162 replay_barrier $SINGLEMDS
163 #define OBD_FAIL_MDS_OPEN_PACK | CFS_FAIL_ONCE
164 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
166 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
168 $CHECKSTAT -t file $DIR/$tfile &&
169 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
172 run_test 3b "replay failed open -ENOMEM"
175 replay_barrier $SINGLEMDS
176 #define OBD_FAIL_MDS_ALLOC_OBDO | CFS_FAIL_ONCE
177 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
179 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
182 $CHECKSTAT -t file $DIR/$tfile &&
183 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
186 run_test 3c "replay failed open -ENOMEM"
188 test_4a() { # was test_4
189 replay_barrier $SINGLEMDS
190 for i in $(seq 10); do
191 echo "tag-$i" > $DIR/$tfile-$i
194 for i in $(seq 10); do
195 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
198 run_test 4a "|x| 10 open(O_CREAT)s"
201 for i in $(seq 10); do
202 echo "tag-$i" > $DIR/$tfile-$i
204 replay_barrier $SINGLEMDS
207 $CHECKSTAT -t file $DIR/$tfile-* &&
208 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
211 run_test 4b "|x| rm 10 files"
213 # The idea is to get past the first block of precreated files on both
214 # osts, and then replay.
216 replay_barrier $SINGLEMDS
217 for i in $(seq 220); do
218 echo "tag-$i" > $DIR/$tfile-$i
221 for i in $(seq 220); do
222 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
226 # waiting for commitment of removal
228 run_test 5 "|x| 220 open(O_CREAT)"
230 test_6a() { # was test_6
231 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
232 replay_barrier $SINGLEMDS
233 mcreate $DIR/$tdir/$tfile
235 $CHECKSTAT -t dir $DIR/$tdir ||
236 error "$CHECKSTAT $DIR/$tdir attribute check failed"
237 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
238 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
240 # waiting for log process thread
242 run_test 6a "mkdir + contained create"
245 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
246 replay_barrier $SINGLEMDS
249 $CHECKSTAT -t dir $DIR/$tdir &&
250 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
253 run_test 6b "|X| rmdir"
256 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
257 replay_barrier $SINGLEMDS
258 mcreate $DIR/$tdir/$tfile
260 $CHECKSTAT -t dir $DIR/$tdir ||
261 error "$CHECKSTAT $DIR/$tdir attribute check failed"
262 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
263 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
266 run_test 7 "mkdir |X| contained create"
269 replay_barrier $SINGLEMDS
270 multiop_bg_pause $DIR/$tfile mo_c ||
271 error "multiop mknod $DIR/$tfile failed"
275 $CHECKSTAT -t file $DIR/$tfile ||
276 error "$CHECKSTAT $DIR/$tfile attribute check failed"
277 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
278 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
281 run_test 8 "creat open |X| close"
284 replay_barrier $SINGLEMDS
286 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
288 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
290 echo " old_inum == $old_inum, new_inum == $new_inum"
291 if [ $old_inum -eq $new_inum ] ;
293 echo "old_inum and new_inum match"
295 echo " old_inum and new_inum do not match"
296 error "old index($old_inum) does not match new index($new_inum)"
300 run_test 9 "|X| create (same inum/gen)"
303 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
304 replay_barrier $SINGLEMDS
305 mv $DIR/$tfile $DIR/$tfile-2
308 $CHECKSTAT $DIR/$tfile &&
309 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
310 $CHECKSTAT $DIR/$tfile-2 ||
311 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
315 run_test 10 "create |X| rename unlink"
318 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
319 echo "old" > $DIR/$tfile
320 mv $DIR/$tfile $DIR/$tfile-2
321 replay_barrier $SINGLEMDS
322 echo "new" > $DIR/$tfile
324 grep old $DIR/$tfile-2
326 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
327 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
329 run_test 11 "create open write rename |X| create-old-name read"
332 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
333 multiop_bg_pause $DIR/$tfile o_tSc ||
334 error "multiop_bg_pause $DIR/$tfile failed"
337 replay_barrier $SINGLEMDS
338 kill -USR1 $pid || error "multiop $pid not running"
339 wait $pid || error "multiop $pid failed"
342 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
345 run_test 12 "open, unlink |X| close"
347 # 1777 - replay open after committed chmod that would make
348 # a regular open a failure
350 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
351 multiop_bg_pause $DIR/$tfile O_wc ||
352 error "multiop_bg_pause $DIR/$tfile failed"
355 $CHECKSTAT -p 0 $DIR/$tfile ||
356 error "$CHECKSTAT $DIR/$tfile attribute check failed"
357 replay_barrier $SINGLEMDS
359 kill -USR1 $pid || error "multiop $pid not running"
360 wait $pid || error "multiop $pid failed"
362 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
363 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
364 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
367 run_test 13 "open chmod 0 |x| write close"
370 multiop_bg_pause $DIR/$tfile O_tSc ||
371 error "multiop_bg_pause $DIR/$tfile failed"
374 replay_barrier $SINGLEMDS
375 kill -USR1 $pid || error "multiop $pid not running"
376 wait $pid || error "multiop $pid failed"
379 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
382 run_test 14 "open(O_CREAT), unlink |X| close"
385 multiop_bg_pause $DIR/$tfile O_tSc ||
386 error "multiop_bg_pause $DIR/$tfile failed"
389 replay_barrier $SINGLEMDS
390 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
391 kill -USR1 $pid || error "multiop $pid not running"
392 wait $pid || error "multiop $pid failed"
395 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
396 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
399 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
402 replay_barrier $SINGLEMDS
405 mcreate $DIR/$tfile-2
407 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
408 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
409 unlink $DIR/$tfile-2 || error "unlink $DIR/$tfile-2 failed"
411 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
414 replay_barrier $SINGLEMDS
415 multiop_bg_pause $DIR/$tfile O_c ||
416 error "multiop_bg_pause $DIR/$tfile failed"
419 kill -USR1 $pid || error "multiop $pid not running"
420 wait $pid || error "multiop $pid failed"
421 $CHECKSTAT -t file $DIR/$tfile ||
422 error "$CHECKSTAT $DIR/$tfile attribute check failed"
425 run_test 17 "|X| open(O_CREAT), |replay| close"
428 replay_barrier $SINGLEMDS
429 multiop_bg_pause $DIR/$tfile O_tSc ||
430 error "multiop_bg_pause $DIR/$tfile failed"
433 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
434 echo "pid: $pid will close"
435 kill -USR1 $pid || error "multiop $pid not running"
436 wait $pid || error "multiop $pid failed"
439 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
440 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
441 # this touch frequently fails
442 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
443 unlink $DIR/$tfile-2 || error "unlink $DIR/$tfile-2 failed"
444 unlink $DIR/$tfile-3 || error "unlink $DIR/$tfile-3 failed"
447 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
449 # bug 1855 (a simpler form of test_11 above)
451 replay_barrier $SINGLEMDS
453 echo "old" > $DIR/$tfile
454 mv $DIR/$tfile $DIR/$tfile-2
455 grep old $DIR/$tfile-2
457 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
459 run_test 19 "mcreate, open, write, rename "
461 test_20a() { # was test_20
462 replay_barrier $SINGLEMDS
463 multiop_bg_pause $DIR/$tfile O_tSc ||
464 error "multiop_bg_pause $DIR/$tfile failed"
469 kill -USR1 $pid || error "multiop $pid not running"
470 wait $pid || error "multiop $pid failed"
471 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
474 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
476 test_20b() { # bug 10480
477 local wait_timeout=$((TIMEOUT * 4))
478 local extra=$(fs_log_size)
482 save_layout_restore_at_exit $MOUNT
483 $LFS setstripe -i 0 -c 1 $DIR
485 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
487 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
488 while [ ! -e $DIR/$tfile ] ; do
489 sleep 0.01 # give dd a chance to start
492 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
494 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
496 client_up || client_up || true # reconnect
498 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
500 fail $SINGLEMDS # start orphan recovery
501 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
502 wait_delete_completed $wait_timeout || error "delete did not finish"
506 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
507 log "before $beforeused, after $afterused"
509 (( $beforeused + $extra >= $afterused )) && break
510 n_attempts=$((n_attempts + 1))
511 [ $n_attempts -gt 3 ] &&
512 error "after $afterused > before $beforeused + $extra"
514 wait_zfs_commit $SINGLEMDS 5
519 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
521 test_20c() { # bug 10480
522 multiop_bg_pause $DIR/$tfile Ow_c ||
523 error "multiop_bg_pause $DIR/$tfile failed"
529 client_up || client_up || true # reconnect
531 kill -USR1 $pid || error "multiop $pid not running"
532 wait $pid || error "multiop $pid failed"
533 [ -s $DIR/$tfile ] || error "File was truncated"
537 run_test 20c "check that client eviction does not affect file content"
540 replay_barrier $SINGLEMDS
541 multiop_bg_pause $DIR/$tfile O_tSc ||
542 error "multiop_bg_pause $DIR/$tfile failed"
545 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
548 kill -USR1 $pid || error "multiop $pid not running"
549 wait $pid || error "multiop $pid failed"
550 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
551 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
554 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
557 multiop_bg_pause $DIR/$tfile O_tSc ||
558 error "multiop_bg_pause $DIR/$tfile failed"
561 replay_barrier $SINGLEMDS
565 kill -USR1 $pid || error "multiop $pid not running"
566 wait $pid || error "multiop $pid failed"
567 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
570 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
573 multiop_bg_pause $DIR/$tfile O_tSc ||
574 error "multiop_bg_pause $DIR/$tfile failed"
577 replay_barrier $SINGLEMDS
579 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
582 kill -USR1 $pid || error "multiop $pid not running"
583 wait $pid || error "multiop $pid failed"
584 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
585 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
588 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
591 multiop_bg_pause $DIR/$tfile O_tSc ||
592 error "multiop_bg_pause $DIR/$tfile failed"
595 replay_barrier $SINGLEMDS
598 kill -USR1 $pid || error "multiop $pid not running"
599 wait $pid || error "multiop $pid failed"
600 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
603 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
606 multiop_bg_pause $DIR/$tfile O_tSc ||
607 error "multiop_bg_pause $DIR/$tfile failed"
611 replay_barrier $SINGLEMDS
613 kill -USR1 $pid || error "multiop $pid not running"
614 wait $pid || error "multiop $pid failed"
615 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
618 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
621 replay_barrier $SINGLEMDS
622 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
623 error "multiop_bg_pause $DIR/$tfile-1 failed"
625 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
626 error "multiop_bg_pause $DIR/$tfile-2 failed"
630 kill -USR1 $pid2 || error "second multiop $pid2 not running"
631 wait $pid2 || error "second multiop $pid2 failed"
634 kill -USR1 $pid1 || error "multiop $pid1 not running"
635 wait $pid1 || error "multiop $pid1 failed"
636 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
637 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
640 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
643 replay_barrier $SINGLEMDS
644 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
645 error "multiop_bg_pause $DIR/$tfile-1 failed"
647 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
648 error "multiop_bg_pause $DIR/$tfile-2 failed"
654 kill -USR1 $pid1 || error "multiop $pid1 not running"
655 wait $pid1 || error "multiop $pid1 failed"
656 kill -USR1 $pid2 || error "second multiop $pid2 not running"
657 wait $pid2 || error "second multiop $pid2 failed"
658 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
659 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
662 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
665 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
666 error "multiop_bg_pause $DIR/$tfile-1 failed"
668 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
669 error "multiop_bg_pause $DIR/$tfile-2 failed"
671 replay_barrier $SINGLEMDS
674 kill -USR1 $pid2 || error "second multiop $pid2 not running"
675 wait $pid2 || error "second multiop $pid2 failed"
678 kill -USR1 $pid1 || error "multiop $pid1 not running"
679 wait $pid1 || error "multiop $pid1 failed"
680 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
681 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
684 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
687 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
688 error "multiop_bg_pause $DIR/$tfile-1 failed"
690 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
691 error "multiop_bg_pause $DIR/$tfile-2 failed"
693 replay_barrier $SINGLEMDS
698 kill -USR1 $pid1 || error "multiop $pid1 not running"
699 wait $pid1 || error "multiop $pid1 failed"
700 kill -USR1 $pid2 || error "second multiop $pid2 not running"
701 wait $pid2 || error "second multiop $pid2 failed"
702 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
703 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
706 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
709 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
710 error "multiop_bg_pause $DIR/$tfile-1 failed"
712 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
713 error "multiop_bg_pause $DIR/$tfile-2 failed"
718 replay_barrier $SINGLEMDS
720 kill -USR1 $pid1 || error "multiop $pid1 not running"
721 wait $pid1 || error "multiop $pid1 failed"
722 kill -USR1 $pid2 || error "second multiop $pid2 not running"
723 wait $pid2 || error "second multiop $pid2 failed"
724 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
725 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
728 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
731 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
732 error "multiop_bg_pause $DIR/$tfile-1 failed"
734 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
735 error "multiop_bg_pause $DIR/$tfile-2 failed"
739 replay_barrier $SINGLEMDS
742 kill -USR1 $pid1 || error "multiop $pid1 not running"
743 wait $pid1 || error "multiop $pid1 failed"
744 kill -USR1 $pid2 || error "second multiop $pid2 not running"
745 wait $pid2 || error "second multiop $pid2 failed"
746 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
747 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
750 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
752 # tests for bug 2104; completion without crashing is success. The close is
753 # stale, but we always return 0 for close, so the app never sees it.
755 multiop_bg_pause $DIR/$tfile O_c ||
756 error "multiop_bg_pause $DIR/$tfile failed"
758 multiop_bg_pause $DIR/$tfile O_c ||
759 error "second multiop_bg_pause $DIR/$tfile failed"
762 client_up || client_up || error "client_up failed"
763 kill -USR1 $pid1 || error "multiop $pid1 not running"
764 kill -USR1 $pid2 || error "second multiop $pid2 not running"
765 wait $pid1 || error "multiop $pid1 failed"
766 wait $pid2 || error "second multiop $pid2 failed"
769 run_test 32 "close() notices client eviction; close() after client eviction"
772 createmany -o $DIR/$tfile-%d 10 ||
773 error "createmany create $DIR/$tfile failed"
774 replay_barrier_nosync $SINGLEMDS
775 fail_abort $SINGLEMDS
776 # recreate shouldn't fail
777 createmany -o $DIR/$tfile--%d 10 ||
778 error "createmany recreate $DIR/$tfile failed"
782 run_test 33a "fid seq shouldn't be reused after abort recovery"
785 #define OBD_FAIL_SEQ_ALLOC 0x1311
786 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
788 createmany -o $DIR/$tfile-%d 10
789 replay_barrier_nosync $SINGLEMDS
790 fail_abort $SINGLEMDS
791 # recreate shouldn't fail
792 createmany -o $DIR/$tfile--%d 10 ||
793 error "createmany recreate $DIR/$tfile failed"
797 run_test 33b "test fid seq allocation"
800 multiop_bg_pause $DIR/$tfile O_c ||
801 error "multiop_bg_pause $DIR/$tfile failed"
805 replay_barrier $SINGLEMDS
806 fail_abort $SINGLEMDS
807 kill -USR1 $pid || error "multiop $pid not running"
808 wait $pid || error "multiop $pid failed"
809 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
813 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
815 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
817 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
819 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
820 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
825 # give a chance to remove from MDS
826 fail_abort $SINGLEMDS
827 $CHECKSTAT -t file $DIR/$tfile &&
828 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
831 run_test 35 "test recovery from llog for unlink op"
833 # b=2432 resent cancel after replay uses wrong cookie,
834 # so don't resend cancels
836 replay_barrier $SINGLEMDS
838 checkstat $DIR/$tfile
839 facet_failover $SINGLEMDS
841 if do_facet $SINGLEMDS $LCTL dk | grep "stale lock .*cookie"; then
842 error "cancel after replay failed"
845 run_test 36 "don't resend cancel"
848 # directory orphans can't be unlinked from PENDING directory
850 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
851 rmdir $DIR/$tdir/$tfile 2>/dev/null
852 multiop_bg_pause $DIR/$tdir/$tfile dD_c ||
853 error "multiop_bg_pause $tfile failed"
855 rmdir $DIR/$tdir/$tfile
857 replay_barrier $SINGLEMDS
858 # clear the dmesg buffer so we only see errors from this recovery
859 do_facet $SINGLEMDS dmesg -c >/dev/null
860 fail_abort $SINGLEMDS
861 kill -USR1 $pid || error "multiop $pid not running"
862 do_facet $SINGLEMDS dmesg | grep "error unlinking orphan" &&
863 error "error unlinking files"
864 wait $pid || error "multiop $pid failed"
868 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
871 createmany -o $DIR/$tfile-%d 800 ||
872 error "createmany -o $DIR/$tfile failed"
873 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
874 replay_barrier $SINGLEMDS
876 unlinkmany $DIR/$tfile-%d 400 400 ||
877 error "unlinkmany $DIR/$tfile 400 failed"
879 $CHECKSTAT -t file $DIR/$tfile-* &&
880 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
883 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
885 test_39() { # bug 4176
886 createmany -o $DIR/$tfile-%d 800 ||
887 error "createmany -o $DIR/$tfile failed"
888 replay_barrier $SINGLEMDS
889 unlinkmany $DIR/$tfile-%d 0 400
891 unlinkmany $DIR/$tfile-%d 400 400 ||
892 error "unlinkmany $DIR/$tfile 400 failed"
894 $CHECKSTAT -t file $DIR/$tfile-* &&
895 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
898 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
901 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
905 # make sure that a read to one osc doesn't try to double-unlock its page just
906 # because another osc is invalid. trigger_group_io used to mistakenly return
907 # an error if any oscs were invalid even after having successfully put rpcs
908 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
909 # the page, guarnateeing that the unlock from the RPC completion would
910 # assert on trying to unlock the unlocked page.
912 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
914 local f=$MOUNT/$tfile
915 # make sure the start of the file is ost1
916 $LFS setstripe -S $((128 * 1024)) -i 0 $f
917 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
918 error "dd on client failed"
920 # fail ost2 and read from ost1
921 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
922 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
923 grep $mdtosc | awk '{print $1}')
924 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
925 lctl get_param -n devices &&
926 error "OST 2 $osc2dev does not exist"
927 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
928 error "deactive device on $SINGLEMDS failed"
929 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
930 error "second dd on client failed"
931 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
932 error "active device on $SINGLEMDS failed"
935 run_test 41 "read from a valid osc while other oscs are invalid"
937 # test MDS recovery after ost failure
939 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
940 createmany -o $DIR/$tfile-%d 800 ||
941 error "createmany -o $DIR/$tfile failed"
943 unlinkmany $DIR/$tfile-%d 0 400
945 lctl set_param debug=-1
948 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
949 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
950 #[ $blocks_after -lt $blocks ] || return 1
951 echo "wait for MDS to timeout and recover"
952 sleep $((TIMEOUT * 2))
954 unlinkmany $DIR/$tfile-%d 400 400 ||
955 error "unlinkmany $DIR/$tfile 400 failed"
956 $CHECKSTAT -t file $DIR/$tfile-* &&
957 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
960 run_test 42 "recovery after ost failure"
962 # timeout in MDS/OST recovery RPC will LBUG MDS
963 test_43() { # bug 2530
964 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
966 replay_barrier $SINGLEMDS
968 # OBD_FAIL_OST_CREATE_NET 0x204
969 do_facet ost1 "lctl set_param fail_loc=0x80000204"
975 run_test 43 "mds osc import failure during recovery; don't LBUG"
977 test_44a() { # was test_44
980 local mdcdev=$($LCTL dl |
981 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
982 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
983 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
984 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
986 # adaptive timeouts slow this way down
987 if at_is_enabled; then
988 at_max_saved=$(at_max_get mds)
992 for i in $(seq 1 10); do
993 echo "$i of 10 ($(date +%s))"
994 do_facet $SINGLEMDS \
995 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
996 #define OBD_FAIL_TGT_CONN_RACE 0x701
997 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
998 # lctl below may fail, it is valid case
999 $LCTL --device $mdcdev recover
1002 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1003 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1006 run_test 44a "race in target handle connect"
1009 local mdcdev=$($LCTL dl |
1010 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1011 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1012 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1013 { echo mdcdev=$mdcdev; $LCTL dl;
1014 error "more than one ${FSNAME}-MDT0000-mdc"; }
1016 for i in $(seq 1 10); do
1017 echo "$i of 10 ($(date +%s))"
1018 do_facet $SINGLEMDS \
1019 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1020 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1021 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1022 # lctl below may fail, it is valid case
1023 $LCTL --device $mdcdev recover
1028 run_test 44b "race in target handle connect"
1031 replay_barrier $SINGLEMDS
1032 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1033 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1034 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1035 fail_abort $SINGLEMDS
1036 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1038 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1041 run_test 44c "race in target handle connect"
1043 # Handle failed close
1045 local mdcdev=$($LCTL get_param -n devices |
1046 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1047 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1048 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1049 { echo mdcdev=$mdcdev; $LCTL dl;
1050 error "more than one ${FSNAME}-MDT0000-mdc"; }
1052 $LCTL --device $mdcdev recover ||
1053 error "$LCTL --device $mdcdev recover failed"
1055 multiop_bg_pause $DIR/$tfile O_c ||
1056 error "multiop_bg_pause $DIR/$tfile failed"
1059 # This will cause the CLOSE to fail before even
1060 # allocating a reply buffer
1061 $LCTL --device $mdcdev deactivate ||
1062 error "$LCTL --device $mdcdev deactivate failed"
1065 kill -USR1 $pid || error "multiop $pid not running"
1066 wait $pid || error "multiop $pid failed"
1068 $LCTL --device $mdcdev activate ||
1069 error "$LCTL --device $mdcdev activate failed"
1072 $CHECKSTAT -t file $DIR/$tfile ||
1073 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1076 run_test 45 "Handle failed close"
1079 drop_reply "touch $DIR/$tfile"
1081 # ironically, the previous test, 45, will cause a real forced close,
1082 # so just look for one for this test
1083 local FID=$($LFS path2fid $tfile)
1084 $LCTL dk | grep -i "force closing file handle $FID" &&
1085 error "found force closing in dmesg"
1088 run_test 46 "Don't leak file handle after open resend (3325)"
1090 test_47() { # bug 2824
1091 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1093 # create some files to make sure precreate has been done on all
1094 # OSTs. (just in case this test is run independently)
1095 createmany -o $DIR/$tfile 20 ||
1096 error "createmany create $DIR/$tfile failed"
1098 # OBD_FAIL_OST_CREATE_NET 0x204
1100 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1101 client_up || error "client_up failed"
1103 # let the MDS discover the OST failure, attempt to recover, fail
1104 # and recover again.
1105 sleep $((3 * TIMEOUT))
1107 # Without 2824, this createmany would hang
1108 createmany -o $DIR/$tfile 20 ||
1109 error "createmany recraete $DIR/$tfile failed"
1110 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1114 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1117 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1118 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1120 replay_barrier $SINGLEMDS
1121 createmany -o $DIR/$tfile 20 ||
1122 error "createmany -o $DIR/$tfile failed"
1123 # OBD_FAIL_OST_EROFS 0x216
1124 facet_failover $SINGLEMDS
1125 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1126 client_up || error "client_up failed"
1128 # let the MDS discover the OST failure, attempt to recover, fail
1129 # and recover again.
1130 sleep $((3 * TIMEOUT))
1132 createmany -o $DIR/$tfile 20 20 ||
1133 error "createmany recraete $DIR/$tfile failed"
1134 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1137 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1140 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1141 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1142 grep $mdtosc | awk '{print $1}')
1143 [ "$oscdev" ] || error "could not find OSC device on MDS"
1144 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1145 error "OSC device $oscdev recovery failed"
1146 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1147 error "second OSC device $oscdev recovery failed"
1148 # give the mds_lov_sync threads a chance to run
1151 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1153 # b3764 timed out lock replay
1155 [ "$MDS1_VERSION" -lt $(version_code 2.6.90) ] &&
1156 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly"
1158 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1159 cancel_lru_locks mdc
1161 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1164 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1165 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1166 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1168 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1170 wait $mpid || error "multiop_bg_pause pid failed"
1172 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1173 lctl set_param fail_loc=0x0
1174 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1177 run_test 52 "time out lock replay (3764)"
1179 # bug 3462 - simultaneous MDC requests
1181 [[ $(lctl get_param mdc.*.import |
1182 grep "connect_flags:.*multi_mod_rpc") ]] ||
1183 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1185 cancel_lru_locks mdc # cleanup locks from former test cases
1186 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1187 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1188 multiop $DIR/${tdir}-1/f O_c &
1190 # give multiop a change to open
1193 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1194 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1195 kill -USR1 $close_pid
1196 cancel_lru_locks mdc # force the close
1197 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1199 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1201 # close should still be here
1202 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1204 replay_barrier_nodf $SINGLEMDS
1206 wait $close_pid || error "close_pid $close_pid failed"
1208 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1209 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1210 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1211 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1212 rm -rf $DIR/${tdir}-*
1214 run_test 53a "|X| close request while two MDC requests in flight"
1217 cancel_lru_locks mdc # cleanup locks from former test cases
1219 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1220 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1221 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1222 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1225 #define OBD_FAIL_MDS_REINT_NET 0x107
1226 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1227 mcreate $DIR/${tdir}-2/f &
1231 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1232 kill -USR1 $close_pid
1233 cancel_lru_locks mdc # force the close
1234 wait $close_pid || error "close_pid $close_pid failed"
1235 # open should still be here
1236 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1238 replay_barrier_nodf $SINGLEMDS
1240 wait $open_pid || error "open_pid failed"
1242 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1243 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1244 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1245 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1246 rm -rf $DIR/${tdir}-*
1248 run_test 53b "|X| open request while two MDC requests in flight"
1251 cancel_lru_locks mdc # cleanup locks from former test cases
1253 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1254 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1255 multiop $DIR/${tdir}-1/f O_c &
1258 #define OBD_FAIL_MDS_REINT_NET 0x107
1259 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1260 mcreate $DIR/${tdir}-2/f &
1264 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1265 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1266 kill -USR1 $close_pid
1267 cancel_lru_locks mdc # force the close
1269 #bz20647: make sure all pids exist before failover
1270 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1271 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1272 replay_barrier_nodf $SINGLEMDS
1273 fail_nodf $SINGLEMDS
1274 wait $open_pid || error "open_pid failed"
1276 # close should be gone
1277 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1278 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1280 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1281 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1282 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1283 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1284 rm -rf $DIR/${tdir}-*
1286 run_test 53c "|X| open request and close request while two MDC requests in flight"
1289 [[ $(lctl get_param mdc.*.import |
1290 grep "connect_flags:.*multi_mod_rpc") ]] ||
1291 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1293 cancel_lru_locks mdc # cleanup locks from former test cases
1295 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1296 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1297 multiop $DIR/${tdir}-1/f O_c &
1299 # give multiop a chance to open
1302 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1303 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1304 kill -USR1 $close_pid
1305 cancel_lru_locks mdc # force the close
1306 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1307 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1309 # close should still be here
1310 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1312 wait $close_pid || error "close_pid failed"
1314 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1315 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1316 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1317 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1318 rm -rf $DIR/${tdir}-*
1320 run_test 53d "close reply while two MDC requests in flight"
1323 cancel_lru_locks mdc # cleanup locks from former test cases
1325 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1326 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1327 multiop $DIR/${tdir}-1/f O_c &
1330 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1331 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1332 mcreate $DIR/${tdir}-2/f &
1336 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1337 kill -USR1 $close_pid
1338 cancel_lru_locks mdc # force the close
1339 wait $close_pid || error "close_pid failed"
1340 # open should still be here
1341 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1343 replay_barrier_nodf $SINGLEMDS
1345 wait $open_pid || error "open_pid failed"
1347 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1348 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1349 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1350 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1351 rm -rf $DIR/${tdir}-*
1353 run_test 53e "|X| open reply while two MDC requests in flight"
1356 cancel_lru_locks mdc # cleanup locks from former test cases
1358 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1359 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1360 multiop $DIR/${tdir}-1/f O_c &
1363 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1364 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1365 mcreate $DIR/${tdir}-2/f &
1369 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1370 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1371 kill -USR1 $close_pid
1372 cancel_lru_locks mdc # force the close
1374 #bz20647: make sure all pids are exists before failover
1375 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1376 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1377 replay_barrier_nodf $SINGLEMDS
1378 fail_nodf $SINGLEMDS
1379 wait $open_pid || error "open_pid failed"
1381 # close should be gone
1382 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1383 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1385 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1386 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1387 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1388 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1389 rm -rf $DIR/${tdir}-*
1391 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1394 cancel_lru_locks mdc # cleanup locks from former test cases
1396 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1397 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1398 multiop $DIR/${tdir}-1/f O_c &
1401 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1402 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1403 mcreate $DIR/${tdir}-2/f &
1407 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1408 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1409 kill -USR1 $close_pid
1410 cancel_lru_locks mdc # force the close
1411 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1413 #bz20647: make sure all pids are exists before failover
1414 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1415 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1416 replay_barrier_nodf $SINGLEMDS
1417 fail_nodf $SINGLEMDS
1418 wait $open_pid || error "open_pid failed"
1420 # close should be gone
1421 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1423 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1424 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1425 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1426 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1427 rm -rf $DIR/${tdir}-*
1429 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1432 cancel_lru_locks mdc # cleanup locks from former test cases
1434 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1435 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1436 multiop $DIR/${tdir}-1/f O_c &
1439 #define OBD_FAIL_MDS_REINT_NET 0x107
1440 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1441 mcreate $DIR/${tdir}-2/f &
1445 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1446 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1447 kill -USR1 $close_pid
1448 cancel_lru_locks mdc # force the close
1451 #bz20647: make sure all pids are exists before failover
1452 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1453 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1454 replay_barrier_nodf $SINGLEMDS
1455 fail_nodf $SINGLEMDS
1456 wait $open_pid || error "open_pid failed"
1458 # close should be gone
1459 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1460 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1462 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1463 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1464 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1465 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1466 rm -rf $DIR/${tdir}-*
1468 run_test 53h "open request and close reply while two MDC requests in flight"
1470 #b3761 ASSERTION(hash != 0) failed
1472 # OBD_FAIL_MDS_OPEN_CREATE | CFS_FAIL_ONCE
1473 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1475 # give touch a chance to run
1477 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1481 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1483 #b3440 ASSERTION(rec->ur_fid2->id) failed
1485 ln -s foo $DIR/$tfile
1486 replay_barrier $SINGLEMDS
1487 #drop_reply "cat $DIR/$tfile"
1491 run_test 56 "don't replay a symlink open request (3440)"
1493 #recovery one mds-ost setattr from llog
1495 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1496 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1497 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1498 replay_barrier $SINGLEMDS
1500 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1501 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1502 $CHECKSTAT -t file $DIR/$tfile ||
1503 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1504 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1507 run_test 57 "test recovery from llog for setattr op"
1510 zconf_umount $(hostname) $MOUNT2
1514 #recovery many mds-ost setattr from llog
1516 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1517 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1518 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1519 createmany -o $DIR/$tdir/$tfile-%d 2500
1520 replay_barrier $SINGLEMDS
1523 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1524 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1525 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1526 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1527 error "unlinkmany $DIR/$tfile failed"
1530 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1536 trap cleanup_58 EXIT
1538 large_xattr_enabled &&
1539 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1540 # Original extended attribute can be long. Print a small version of
1541 # attribute if an error occurs
1542 local sm_msg=$(printf "%.9s" $orig)
1544 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1545 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1546 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1547 replay_barrier $SINGLEMDS
1548 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1550 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1551 [[ "$new" = "$orig" ]] ||
1552 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1553 rm -f $DIR/$tdir/$tfile
1556 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1558 run_test 58b "test replay of setxattr op"
1560 test_58c() { # bug 16570
1565 trap cleanup_58 EXIT
1567 if large_xattr_enabled; then
1568 local xattr_size=$(max_xattr_size)
1569 orig="$(generate_string $((xattr_size / 2)))"
1570 orig1="$(generate_string $xattr_size)"
1576 # PING_INTERVAL max(obd_timeout / 4, 1U)
1577 sleep $((TIMEOUT / 4))
1579 # Original extended attribute can be long. Print a small version of
1580 # attribute if an error occurs
1581 local sm_msg=$(printf "%.9s" $orig)
1582 local sm_msg1=$(printf "%.9s" $orig1)
1584 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1585 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1586 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1587 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1588 error "drop_request for setfattr failed"
1589 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1590 [[ "$new" = "$orig" ]] ||
1591 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1592 drop_reint_reply "setfattr -n trusted.foo1 \
1593 -v $orig1 $DIR/$tdir/$tfile" ||
1594 error "drop_reint_reply for setfattr failed"
1595 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1596 [[ "$new" = "$orig1" ]] ||
1597 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1598 rm -f $DIR/$tdir/$tfile
1602 run_test 58c "resend/reconstruct setxattr op"
1604 # log_commit_thread vs filter_destroy race used to lead to import use after free
1607 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1609 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1610 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1611 error "createmany create files failed"
1613 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1614 error "unlinkmany $DIR/$tdir/$tfile failed"
1615 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1616 do_facet ost1 "lctl set_param fail_loc=0x507"
1619 do_facet ost1 "lctl set_param fail_loc=0x0"
1623 run_test 59 "test log_commit_thread vs filter_destroy race"
1625 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1626 # bug 12086: should no oops and No ctxt error for this test
1628 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1629 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1630 error "createmany create files failed"
1631 replay_barrier $SINGLEMDS
1632 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1634 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1635 local no_ctxt=$(dmesg | grep "No ctxt")
1636 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1638 run_test 60 "test llog post recovery init vs llog unlink"
1640 #test race llog recovery thread vs llog cleanup
1641 test_61a() { # was test_61
1642 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1643 local osts=$(osts_nodes)
1645 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1646 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1647 error "createmany create files failed"
1649 unlinkmany $DIR/$tdir/$tfile-%d 800
1650 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1651 set_nodes_failloc $osts 0x80000221
1656 set_nodes_failloc $osts 0x0
1658 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1659 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1662 run_test 61a "test race llog recovery vs llog cleanup"
1664 #test race mds llog sync vs llog cleanup
1666 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1667 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1668 facet_failover $SINGLEMDS
1671 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1674 run_test 61b "test race mds llog sync vs llog cleanup"
1676 #test race cancel cookie cb vs llog cleanup
1678 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1679 local osts=$(osts_nodes)
1681 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1682 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1683 set_nodes_failloc $osts 0x80000222
1687 set_nodes_failloc $osts 0x0
1689 run_test 61c "test race mds llog sync vs llog cleanup"
1691 test_61d() { # bug 16002 # bug 17466 # bug 22137
1692 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1694 do_facet mgs "lctl set_param fail_loc=0x80000605"
1695 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1696 error "mgs start should have failed"
1697 do_facet mgs "lctl set_param fail_loc=0"
1698 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1700 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1702 test_62() { # Bug 15756 - don't mis-drop resent replay
1703 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1704 replay_barrier $SINGLEMDS
1705 createmany -o $DIR/$tdir/$tfile- 25 ||
1706 error "createmany create files failed"
1707 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1708 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1710 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1711 unlinkmany $DIR/$tdir/$tfile- 25 ||
1712 error "unlinkmany $DIR/$tdir/$tfile failed"
1715 run_test 62 "don't mis-drop resent replay"
1717 #Adaptive Timeouts (bug 3055)
1725 echo "Cleaning up AT ..."
1726 if [ -n "$ATOLDBASE" ]; then
1727 local at_history=$($LCTL get_param -n at_history)
1728 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1729 do_facet ost1 "lctl set_param at_history=$at_history" || true
1732 if [ $AT_MAX_SET -ne 0 ]; then
1733 for facet in mds client ost; do
1734 var=AT_MAX_SAVE_${facet}
1735 echo restore AT on $facet to saved value ${!var}
1736 at_max_set ${!var} $facet
1737 at_new=$(at_max_get $facet)
1738 echo Restored AT value on $facet $at_new
1739 [ $at_new -eq ${!var} ] ||
1740 error "AT value not restored SAVED ${!var} NEW $at_new"
1747 local at_max_new=600
1749 # Save at_max original values
1751 if [ $AT_MAX_SET -eq 0 ]; then
1752 # Suppose that all osts have the same at_max
1753 for facet in mds client ost; do
1754 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1758 for facet in mds client ost; do
1759 at_max=$(at_max_get $facet)
1760 if [ $at_max -ne $at_max_new ]; then
1761 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1762 at_max_set $at_max_new $facet
1767 if [ -z "$ATOLDBASE" ]; then
1768 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1769 # speed up the timebase so we can check decreasing AT
1770 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1771 do_facet ost1 "lctl set_param at_history=8" || true
1773 # sleep for a while to cool down, should be > 8s and also allow
1774 # at least one ping to be sent. simply use TIMEOUT to be safe.
1779 test_65a() #bug 3055
1781 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1783 at_start || return 0
1784 $LCTL dk > /dev/null
1786 $LCTL set_param debug="other"
1787 # Slow down a request to the current service time, this is critical
1788 # because previous tests may have caused this value to increase.
1789 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1790 awk '/portal 12/ {print $5}'`
1791 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1793 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1794 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1795 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1796 createmany -o $DIR/$tfile 10 > /dev/null
1797 unlinkmany $DIR/$tfile 10 > /dev/null
1798 # check for log message
1799 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1801 # client should show REQ_DELAY estimates
1802 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1804 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1806 run_test 65a "AT: verify early replies"
1808 test_65b() #bug 3055
1810 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1812 at_start || return 0
1815 $LCTL set_param debug="other trace"
1816 $LCTL dk > /dev/null
1817 # Slow down a request to the current service time, this is critical
1818 # because previous tests may have caused this value to increase.
1819 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1820 error "$LFS setstripe failed for $DIR/$tfile"
1822 multiop $DIR/$tfile Ow1yc
1823 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1824 awk '/portal 6/ {print $5}'`
1825 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1827 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1828 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1829 do_facet ost1 $LCTL set_param fail_loc=0x224
1832 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1833 error "$LFS setstripe failed"
1834 # force some real bulk transfer
1835 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1837 do_facet ost1 $LCTL set_param fail_loc=0
1838 # check for log message
1839 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1841 # client should show REQ_DELAY estimates
1842 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1844 run_test 65b "AT: verify early replies on packed reply / bulk"
1846 test_66a() #bug 3055
1848 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1850 at_start || return 0
1851 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1852 # adjust 5s at a time so no early reply is sent (within deadline)
1853 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1854 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1855 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1856 createmany -o $DIR/$tfile 20 > /dev/null
1857 unlinkmany $DIR/$tfile 20 > /dev/null
1858 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1859 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1860 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1861 createmany -o $DIR/$tfile 20 > /dev/null
1862 unlinkmany $DIR/$tfile 20 > /dev/null
1863 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1864 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1866 createmany -o $DIR/$tfile 20 > /dev/null
1867 unlinkmany $DIR/$tfile 20 > /dev/null
1868 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1869 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1870 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1871 echo "Current MDT timeout $CUR, worst $WORST"
1872 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1874 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1876 test_66b() #bug 3055
1878 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1880 at_start || return 0
1881 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1882 awk '/network/ {print $4}')
1883 $LCTL set_param fail_val=$(($ORIG + 5))
1884 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1885 $LCTL set_param fail_loc=0x50c
1886 touch $DIR/$tfile > /dev/null 2>&1
1887 $LCTL set_param fail_loc=0
1888 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1889 awk '/network/ {print $4}')
1890 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1891 awk '/network/ {print $6}')
1892 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1893 [ $WORST -gt $ORIG ] ||
1894 error "Worst $WORST should be worse than orig $ORIG"
1896 run_test 66b "AT: verify net latency adjusts"
1898 test_67a() #bug 3055
1900 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1902 at_start || return 0
1903 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1904 # sleeping threads may drive values above this
1905 do_facet ost1 "$LCTL set_param fail_val=400"
1906 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1907 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1908 createmany -o $DIR/$tfile 20 > /dev/null
1909 unlinkmany $DIR/$tfile 20 > /dev/null
1910 do_facet ost1 "$LCTL set_param fail_loc=0"
1911 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1912 ATTEMPTS=$(($CONN2 - $CONN1))
1913 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1914 [ $ATTEMPTS -gt 0 ] &&
1915 error_ignore bz13721 "AT should have prevented reconnect"
1918 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1920 test_67b() #bug 3055
1922 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1924 at_start || return 0
1925 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1927 # exhaust precreations on ost1
1928 local OST=$(ostname_from_index 0)
1929 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1930 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1931 osp.$mdtosc.prealloc_last_id)
1932 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1933 osp.$mdtosc.prealloc_next_id)
1935 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1936 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${OST} ||
1937 error "$LFS setstripe failed"
1938 echo "Creating to objid $last_id on ost $OST..."
1939 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1940 do_facet ost1 "$LCTL set_param fail_val=20000"
1941 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1942 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1945 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1947 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1948 ATTEMPTS=$(($CONN2 - $CONN1))
1949 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1950 # do it again; should not timeout
1951 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1952 cp /etc/profile $DIR/$tfile || error "cp failed"
1953 do_facet ost1 "$LCTL set_param fail_loc=0"
1955 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1956 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1957 ATTEMPTS=$(($CONN3 - $CONN2))
1958 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1959 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1962 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1964 test_68 () #bug 13813
1966 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1968 at_start || return 0
1969 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1970 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1971 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1972 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
1973 local ENQ_MIN=$(cat $ldlm_enqueue_min)
1974 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
1975 echo $TIMEOUT >> $ldlm_enqueue_min
1976 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
1978 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1979 $LFS setstripe --stripe-index=0 -c 1 $DIR/$tdir ||
1980 error "$LFS setstripe failed for $DIR/$tdir"
1981 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
1982 $LCTL set_param fail_val=$(($TIMEOUT - 1))
1983 $LCTL set_param fail_loc=0x80000312
1984 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
1985 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
1986 $LCTL set_param fail_loc=0x80000312
1987 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
1988 $LCTL set_param fail_loc=0
1990 echo $ENQ_MIN >> $ldlm_enqueue_min
1991 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
1995 run_test 68 "AT: verify slowing locks"
1998 # end of AT tests includes above lines
2000 # start multi-client tests
2002 [ $CLIENTCOUNT -lt 2 ] &&
2003 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2005 echo "mount clients $CLIENTS ..."
2006 zconf_mount_clients $CLIENTS $MOUNT
2008 local clients=${CLIENTS//,/ }
2009 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2010 for CLIENT in $clients; do
2011 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2012 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2013 error "dd failed on $CLIENT"
2016 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2017 for C in ${CLIENTS//,/ }; do
2018 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2019 of=/dev/null 2>/dev/null ||
2020 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2026 run_test 70a "check multi client t-f"
2028 check_for_process () {
2033 killall_process $clients "$prog" -0
2037 local clients=${CLIENTS:-$HOSTNAME}
2039 zconf_mount_clients $clients $MOUNT
2042 [ "$SLOW" = "no" ] && duration=120
2043 # set duration to 900 because it takes some time to boot node
2044 [ "$FAILURE_MODE" = HARD ] && duration=900
2047 local start_ts=$(date +%s)
2048 local cmd="rundbench 1 -t $duration"
2050 if [ $MDSCOUNT -ge 2 ]; then
2051 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2052 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2054 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2055 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2056 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2057 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2060 #LU-1897 wait for all dbench copies to start
2061 while ! check_for_process $clients dbench; do
2062 elapsed=$(($(date +%s) - start_ts))
2063 if [ $elapsed -gt $duration ]; then
2064 killall_process $clients dbench
2065 error "dbench failed to start on $clients!"
2070 log "Started rundbench load pid=$pid ..."
2072 elapsed=$(($(date +%s) - start_ts))
2073 local num_failovers=0
2075 while [ $elapsed -lt $duration ]; do
2076 if ! check_for_process $clients dbench; then
2077 error_noexit "dbench stopped on some of $clients!"
2078 killall_process $clients dbench
2082 replay_barrier mds$fail_index
2083 sleep 1 # give clients a time to do operations
2084 # Increment the number of failovers
2085 num_failovers=$((num_failovers+1))
2086 log "$TESTNAME fail mds$fail_index $num_failovers times"
2088 elapsed=$(($(date +%s) - start_ts))
2089 if [ $fail_index -ge $MDSCOUNT ]; then
2092 fail_index=$((fail_index+1))
2096 wait $pid || error "rundbench load on $clients failed!"
2098 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2099 # end multi-client tests
2104 local monitor_pid=$3
2106 local start_ts=$(date +%s)
2107 local num_failovers=0
2110 elapsed=$(($(date +%s) - start_ts))
2111 while [ $elapsed -lt $duration ]; do
2112 fail_index=$((RANDOM%max_index+1))
2113 kill -0 $monitor_pid ||
2114 error "$monitor_pid stopped"
2116 replay_barrier mds$fail_index
2118 # Increment the number of failovers
2119 num_failovers=$((num_failovers+1))
2120 log "$TESTNAME fail mds$fail_index $num_failovers times"
2122 elapsed=$(($(date +%s) - start_ts))
2128 rm -f $DIR/replay-single.70c.lck
2133 local clients=${CLIENTS:-$HOSTNAME}
2136 zconf_mount_clients $clients $MOUNT
2139 [ "$SLOW" = "no" ] && duration=180
2140 # set duration to 900 because it takes some time to boot node
2141 [ "$FAILURE_MODE" = HARD ] && duration=600
2144 local start_ts=$(date +%s)
2146 stack_trap cleanup_70c EXIT
2148 while [ ! -e $DIR/replay-single.70c.lck ]; do
2149 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2150 if [ $MDSCOUNT -ge 2 ]; then
2151 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2152 error "set default dirstripe failed"
2154 cd $DIR/$tdir || break
2155 tar cf - /etc | tar xf - || error "tar failed in loop"
2159 echo "Started tar $tar_70c_pid"
2161 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2162 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2164 touch $DIR/replay-single.70c.lck
2165 wait $tar_70c_pid || error "$?: tar failed"
2170 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2174 kill -9 $mkdir_70d_pid
2178 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2179 local clients=${CLIENTS:-$HOSTNAME}
2182 zconf_mount_clients $clients $MOUNT
2185 [ "$SLOW" = "no" ] && duration=180
2186 # set duration to 900 because it takes some time to boot node
2187 [ "$FAILURE_MODE" = HARD ] && duration=900
2192 local start_ts=$(date +%s)
2194 trap cleanup_70d EXIT
2197 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2201 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2206 touch $DIR/$tdir/test/a || {
2210 mkdir $DIR/$tdir/test/b || {
2214 rm -rf $DIR/$tdir/test || {
2220 touch $DIR/$tdir/test1/a || {
2224 mkdir $DIR/$tdir/test1/b || {
2229 rm -rf $DIR/$tdir/test1 || {
2231 ls -lR $DIR/$tdir/test1
2237 echo "Started $mkdir_70d_pid"
2239 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2240 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2245 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2248 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2249 local clients=${CLIENTS:-$HOSTNAME}
2252 lctl set_param debug=+ha
2253 zconf_mount_clients $clients $MOUNT
2256 [ "$SLOW" = "no" ] && duration=180
2257 # set duration to 900 because it takes some time to boot node
2258 [ "$FAILURE_MODE" = HARD ] && duration=900
2261 $LFS mkdir -i0 $DIR/$tdir/test_0
2262 $LFS mkdir -i0 $DIR/$tdir/test_1
2263 touch $DIR/$tdir/test_0/a
2264 touch $DIR/$tdir/test_1/b
2267 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2272 checkstat $DIR/$tdir/test_0/a && {
2273 echo "a still exists"
2277 checkstat $DIR/$tdir/test_1/b || {
2278 echo "b still exists"
2282 touch $DIR/$tdir/test_0/a || {
2283 echo "touch a fails"
2287 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2294 stack_trap "kill -9 $rename_70e_pid" EXIT
2295 echo "Started PID=$rename_70e_pid"
2297 random_fail_mdt 2 $duration $rename_70e_pid
2298 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2300 run_test 70e "rename cross-MDT with random fails"
2302 test_70f_write_and_read(){
2307 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2308 for client in ${CLIENTS//,/ }; do
2309 [ -f $stopflag ] || return
2311 local tgtfile=$DIR/$tdir/$tfile.$client
2312 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2313 of=$tgtfile 2>/dev/null ||
2314 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2315 "of=$tgtfile failed on $client, rc=$?"
2318 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2321 for client in ${CLIENTS//,/ }; do
2322 [ -f $stopflag ] || return
2324 # flush client cache in case test is running on only one client
2325 # do_node $client cancel_lru_locks osc
2326 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2328 tgtfile=$DIR/$tdir/$tfile.$client
2329 local md5=$(do_node $prev_client "md5sum $tgtfile")
2330 [ ${checksum[$index]// */} = ${md5// */} ] ||
2331 error "$tgtfile: checksum doesn't match on $prev_client"
2332 index=$((index + 1))
2342 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2343 $LFS setstripe -c -1 $DIR/$tdir ||
2344 error "cannot $LFS setstripe $DIR/$tdir"
2347 while [ -f $stopflag ]; do
2348 test_70f_write_and_read $srcfile $stopflag
2349 # use direct IO and buffer cache in turns if loop
2350 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2354 test_70f_cleanup() {
2356 rm -f $TMP/$tfile.stop
2357 do_nodes $CLIENTS rm -f $TMP/$tfile
2358 rm -f $DIR/$tdir/$tfile.*
2362 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2363 # { skip "Failover host not defined" && return; }
2364 # [ $CLIENTCOUNT -lt 2 ] &&
2365 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2367 [[ "$OST1_VERSION" -lt $(version_code 2.9.53) ]] &&
2368 skip "Need server version at least 2.9.53"
2370 echo "mount clients $CLIENTS ..."
2371 zconf_mount_clients $CLIENTS $MOUNT
2373 local srcfile=$TMP/$tfile
2377 trap test_70f_cleanup EXIT
2378 # create a different source file local to each client node so we can
2379 # detect if the file wasn't written out properly after failover
2380 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2381 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2382 for client in ${CLIENTS//,/ }; do
2383 checksum[$index]=$(do_node $client "md5sum $srcfile")
2384 index=$((index + 1))
2388 [ "$SLOW" = "no" ] && duration=60
2389 # set duration to 900 because it takes some time to boot node
2390 [ "$FAILURE_MODE" = HARD ] && duration=900
2392 local stopflag=$TMP/$tfile.stop
2393 test_70f_loop $srcfile $stopflag &
2397 local num_failovers=0
2398 local start_ts=$SECONDS
2399 while [ $elapsed -lt $duration ]; do
2403 num_failovers=$((num_failovers + 1))
2404 log "$TESTNAME failing OST $num_failovers times"
2407 elapsed=$((SECONDS - start_ts))
2414 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2418 kill -9 $mkdir_71a_pid
2421 random_double_fail_mdt() {
2424 local monitor_pid=$3
2426 local start_ts=$(date +%s)
2427 local num_failovers=0
2431 elapsed=$(($(date +%s) - start_ts))
2432 while [ $elapsed -lt $duration ]; do
2433 fail_index=$((RANDOM%max_index + 1))
2434 if [ $fail_index -eq $max_index ]; then
2437 second_index=$((fail_index + 1))
2439 kill -0 $monitor_pid ||
2440 error "$monitor_pid stopped"
2442 replay_barrier mds$fail_index
2443 replay_barrier mds$second_index
2445 # Increment the number of failovers
2446 num_failovers=$((num_failovers+1))
2447 log "fail mds$fail_index mds$second_index $num_failovers times"
2448 fail mds${fail_index},mds${second_index}
2449 elapsed=$(($(date +%s) - start_ts))
2454 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2455 local clients=${CLIENTS:-$HOSTNAME}
2458 zconf_mount_clients $clients $MOUNT
2461 [ "$SLOW" = "no" ] && duration=180
2462 # set duration to 900 because it takes some time to boot node
2463 [ "$FAILURE_MODE" = HARD ] && duration=900
2465 mkdir_on_mdt0 $DIR/$tdir
2468 local start_ts=$(date +%s)
2470 trap cleanup_71a EXIT
2473 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2474 rmdir $DIR/$tdir/test
2478 echo "Started $mkdir_71a_pid"
2480 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2481 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2486 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2489 multiop_bg_pause $DIR/$tfile O_tSc ||
2490 error "multiop_bg_pause $DIR/$tfile failed"
2494 replay_barrier $SINGLEMDS
2495 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2496 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2499 wait $pid || error "multiop pid failed"
2500 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2503 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2506 multiop_bg_pause $DIR/$tfile O_tSc ||
2507 error "multiop_bg_pause $DIR/$tfile failed"
2511 replay_barrier $SINGLEMDS
2512 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
2513 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
2516 wait $pid || error "multiop pid failed"
2517 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2520 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2524 local clients=${CLIENTS:-$HOSTNAME}
2526 zconf_umount_clients $clients $MOUNT
2528 facet_failover $SINGLEMDS
2529 zconf_mount_clients $clients $MOUNT
2531 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2532 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2533 clients_up || error "client evicted: $?"
2536 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2538 remote_dir_check_80() {
2543 diridx=$($LFS getstripe -m $remote_dir) ||
2544 error "$LFS getstripe -m $remote_dir failed"
2545 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2547 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2548 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2549 error "$LFS getstripe -m $remote_dir/f-1 failed"
2550 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2556 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2557 ([ $FAILURE_MODE == "HARD" ] &&
2558 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2559 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2563 local remote_dir=$DIR/$tdir/remote_dir
2565 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2566 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2567 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2568 $LFS mkdir -i $MDTIDX $remote_dir &
2574 wait $CLIENT_PID || error "remote creation failed"
2576 remote_dir_check_80 || error "remote dir check failed"
2577 rm -rf $DIR/$tdir || error "rmdir failed"
2581 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2584 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2585 ([ $FAILURE_MODE == "HARD" ] &&
2586 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2587 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2591 local remote_dir=$DIR/$tdir/remote_dir
2593 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2594 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2595 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2596 $LFS mkdir -i $MDTIDX $remote_dir &
2601 fail mds$((MDTIDX + 1))
2603 wait $CLIENT_PID || error "remote creation failed"
2605 remote_dir_check_80 || error "remote dir check failed"
2606 rm -rf $DIR/$tdir || error "rmdir failed"
2610 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2613 [[ "$mds1_FSTYPE" = zfs ]] &&
2614 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2615 skip "requires LU-10143 fix on MDS"
2616 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2617 ([ $FAILURE_MODE == "HARD" ] &&
2618 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2619 skip "MDTs needs to be on diff hosts for HARD fail mode"
2622 local remote_dir=$DIR/$tdir/remote_dir
2624 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2625 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2626 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2627 $LFS mkdir -i $MDTIDX $remote_dir &
2633 fail mds$((MDTIDX + 1))
2635 wait $CLIENT_PID || error "remote creation failed"
2637 remote_dir_check_80 || error "remote dir check failed"
2638 rm -rf $DIR/$tdir || error "rmdir failed"
2642 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2645 [[ "$mds1_FSTYPE" = zfs ]] &&
2646 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2647 skip "requires LU-10143 fix on MDS"
2648 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2650 local remote_dir=$DIR/$tdir/remote_dir
2652 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2653 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2654 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2655 $LFS mkdir -i $MDTIDX $remote_dir &
2658 # sleep 3 seconds to make sure MDTs are failed after
2659 # lfs mkdir -i has finished on all of MDTs.
2664 fail mds${MDTIDX},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 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2676 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2677 ([ $FAILURE_MODE == "HARD" ] &&
2678 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2679 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2683 local remote_dir=$DIR/$tdir/remote_dir
2685 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2686 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2687 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2688 $LFS mkdir -i $MDTIDX $remote_dir &
2691 # sleep 3 seconds to make sure MDTs are failed after
2692 # lfs mkdir -i has finished on all of MDTs.
2698 wait $CLIENT_PID || error "remote creation failed"
2700 remote_dir_check_80 || error "remote dir check failed"
2701 rm -rf $DIR/$tdir || error "rmdir failed"
2705 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2708 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2709 ([ $FAILURE_MODE == "HARD" ] &&
2710 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2711 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2714 local remote_dir=$DIR/$tdir/remote_dir
2716 mkdir_on_mdt0 $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 &
2723 fail mds$((MDTIDX + 1))
2725 wait $CLIENT_PID || error "remote creation failed"
2727 remote_dir_check_80 || error "remote dir check failed"
2728 rm -rf $DIR/$tdir || error "rmdir failed"
2732 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2735 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2736 ([ $FAILURE_MODE == "HARD" ] &&
2737 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2738 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2742 local remote_dir=$DIR/$tdir/remote_dir
2744 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2745 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2746 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2747 $LFS mkdir -i $MDTIDX $remote_dir &
2750 # sleep 3 seconds to make sure MDTs are failed after
2751 # lfs mkdir -i has finished on all of MDTs.
2757 fail mds$((MDTIDX + 1))
2759 wait $CLIENT_PID || error "remote creation failed"
2761 remote_dir_check_80 || error "remote dir check failed"
2762 rm -rf $DIR/$tdir || error "rmdir failed"
2766 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2769 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2771 local remote_dir=$DIR/$tdir/remote_dir
2773 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2774 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2775 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2776 $LFS mkdir -i $MDTIDX $remote_dir &
2779 # sleep 3 seconds to make sure MDTs are failed after
2780 # lfs mkdir -i has finished on all of MDTs.
2785 fail mds${MDTIDX},mds$((MDTIDX + 1))
2787 wait $CLIENT_PID || error "remote dir creation failed"
2789 remote_dir_check_80 || error "remote dir check failed"
2790 rm -rf $DIR/$tdir || error "rmdir failed"
2794 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2797 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2798 ([ $FAILURE_MODE == "HARD" ] &&
2799 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2800 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2804 local remote_dir=$DIR/$tdir/remote_dir
2806 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2807 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2809 touch $remote_dir || error "touch $remote_dir failed"
2810 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2811 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2816 fail mds$((MDTIDX + 1))
2818 wait $CLIENT_PID || error "rm remote dir failed"
2820 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2822 rm -rf $DIR/$tdir || error "rmdir failed"
2826 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2829 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2830 ([ $FAILURE_MODE == "HARD" ] &&
2831 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2832 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2835 local remote_dir=$DIR/$tdir/remote_dir
2837 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2838 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2840 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2841 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2848 wait $CLIENT_PID || error "rm remote dir failed"
2850 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2852 rm -rf $DIR/$tdir || error "rmdir failed"
2856 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2859 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2860 ([ $FAILURE_MODE == "HARD" ] &&
2861 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2862 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2866 local remote_dir=$DIR/$tdir/remote_dir
2868 mkdir_on_mdt0 $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 fail mds$((MDTIDX + 1))
2881 wait $CLIENT_PID || error "rm remote dir failed"
2883 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2885 rm -rf $DIR/$tdir || error "rmdir failed"
2889 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2892 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2894 local remote_dir=$DIR/$tdir/remote_dir
2896 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2897 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2899 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2900 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2906 fail mds${MDTIDX},mds$((MDTIDX + 1))
2908 wait $CLIENT_PID || error "rm remote dir failed"
2910 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2912 rm -rf $DIR/$tdir || error "rmdir failed"
2916 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2919 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2920 ([ $FAILURE_MODE == "HARD" ] &&
2921 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2922 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2926 local remote_dir=$DIR/$tdir/remote_dir
2928 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2929 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2931 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2932 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2935 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2940 wait $CLIENT_PID || error "rm remote dir failed"
2942 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2944 rm -rf $DIR/$tdir || error "rmdir failed"
2948 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2951 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2952 ([ $FAILURE_MODE == "HARD" ] &&
2953 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2954 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2958 local remote_dir=$DIR/$tdir/remote_dir
2960 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2961 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2963 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2964 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2969 fail mds$((MDTIDX + 1))
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 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
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_on_mdt0 $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
3002 fail mds$((MDTIDX + 1))
3004 wait $CLIENT_PID || error "rm remote dir failed"
3006 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3008 rm -rf $DIR/$tdir || error "rmdir failed"
3012 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3015 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3017 local remote_dir=$DIR/$tdir/remote_dir
3019 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3020 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3022 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3023 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3029 fail mds${MDTIDX},mds$((MDTIDX + 1))
3031 wait $CLIENT_PID || error "rm remote dir failed"
3033 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3035 rm -rf $DIR/$tdir || error "rmdir failed"
3039 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3042 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3043 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3044 createmany -o $DIR/$tfile- 1 &
3048 client_up || client_up || true # reconnect
3050 run_test 84a "stale open during export disconnect"
3052 test_85a() { #bug 16774
3053 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3055 for i in $(seq 100); do
3056 echo "tag-$i" > $DIR/$tfile-$i
3057 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3060 lov_id=$(lctl dl | grep "clilov")
3061 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3062 count=$(lctl get_param -n \
3063 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3064 echo "before recovery: unused locks count = $count"
3068 count2=$(lctl get_param -n \
3069 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3070 echo "after recovery: unused locks count = $count2"
3072 if [ $count2 -ge $count ]; then
3073 error "unused locks are not canceled"
3076 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3078 test_85b() { #bug 16774
3082 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3084 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3086 for i in $(seq 100); do
3087 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3088 count=32 >/dev/null 2>&1
3091 cancel_lru_locks osc
3093 for i in $(seq 100); do
3094 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3095 count=32 >/dev/null 2>&1
3098 lov_id=$(lctl dl | grep "clilov")
3099 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3100 count=$(lctl get_param -n \
3101 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3102 echo "before recovery: unused locks count = $count"
3103 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3107 count2=$(lctl get_param \
3108 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3109 echo "after recovery: unused locks count = $count2"
3111 if [ $count2 -ge $count ]; then
3112 error "unused locks are not canceled"
3117 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3120 local clients=${CLIENTS:-$HOSTNAME}
3122 zconf_umount_clients $clients $MOUNT
3123 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3124 remount_facet $SINGLEMDS
3125 zconf_mount_clients $clients $MOUNT
3127 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3130 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3133 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3134 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3135 error "dd to $DIR/$tfile failed"
3136 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3137 cancel_lru_locks osc
3139 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3140 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3141 if [ $cksum != $cksum2 ] ; then
3142 error "New checksum $cksum2 does not match original $cksum"
3145 run_test 87a "write replay"
3148 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3151 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3152 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3153 error "dd to $DIR/$tfile failed"
3154 sleep 1 # Give it a chance to flush dirty data
3155 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3156 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3157 cancel_lru_locks osc
3159 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3160 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3161 if [ $cksum != $cksum2 ] ; then
3162 error "New checksum $cksum2 does not match original $cksum"
3165 run_test 87b "write replay with changed data (checksum resend)"
3167 test_88() { #bug 17485
3168 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3169 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3171 $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "$LFS setstripe failed"
3174 replay_barrier $SINGLEMDS
3176 # exhaust precreations on ost1
3177 local OST=$(ostname_from_index 0)
3178 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3179 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3180 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3181 echo "before test: last_id = $last_id, next_id = $next_id"
3183 echo "Creating to objid $last_id on ost $OST..."
3184 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3185 error "createmany create files to last_id failed"
3187 #create some files to use some uncommitted objids
3188 last_id=$(($last_id + 1))
3189 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3190 error "createmany create files with uncommitted objids failed"
3192 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3193 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3194 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3196 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3197 # it has to take care about the affected facets, bug20407
3198 local affected_mds1=$(affected_facets mds1)
3199 local affected_ost1=$(affected_facets ost1)
3201 shutdown_facet $SINGLEMDS
3204 reboot_facet $SINGLEMDS
3205 change_active $affected_mds1
3206 wait_for_facet $affected_mds1
3207 mount_facets $affected_mds1 || error "Restart of mds failed"
3210 change_active $affected_ost1
3211 wait_for_facet $affected_ost1
3212 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3216 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3217 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3218 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3220 # create new files, which should use new objids, and ensure the orphan
3221 # cleanup phase for ost1 is completed at the same time
3222 for i in $(seq 8); do
3223 file_id=$(($last_id + 10 + $i))
3224 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3227 # if the objids were not recreated, then "ls" will fail with -ENOENT
3228 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3231 # write into previously created files
3232 for i in $(seq 8); do
3233 file_id=$(($last_id + $i))
3234 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3235 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3238 # compare the content
3239 for i in $(seq 8); do
3240 file_id=$(($last_id + $i))
3241 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3242 error "the content of file is modified!"
3247 run_test 88 "MDS should not assign same objid to different files "
3250 cancel_lru_locks osc
3251 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3252 rm -f $DIR/$tdir/$tfile
3253 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3254 wait_delete_completed || error "initial wait delete timed out"
3255 local before=$(calc_osc_kbytes kbytesfree)
3256 local write_size=$(fs_log_size)
3258 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile
3259 (( $write_size >= 1024 )) || write_size=1024
3260 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3263 facet_failover $SINGLEMDS
3264 rm $DIR/$tdir/$tfile
3267 zconf_mount $(hostname) $MOUNT || error "mount fails"
3268 client_up || error "client_up failed"
3270 # wait for the remounted client to connect to ost1
3271 local target=$(get_osc_import_name client ost1)
3272 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3273 $(max_recovery_time)
3275 wait_mds_ost_sync || error "MDS-OST sync timed out"
3276 wait_delete_completed || error "wait delete timed out"
3277 local after=$(calc_osc_kbytes kbytesfree)
3279 log "free_before: $before free_after: $after"
3280 (( $before <= $after + $(fs_log_size) )) ||
3281 error "kbytesfree $before > $after + margin $(fs_log_size)"
3283 run_test 89 "no disk space leak on late ost connection"
3290 change_active $facet
3291 wait_for_facet $facet
3292 mount_facet $facet || error "Restart of $facet failed"
3296 test_90() { # bug 19494
3297 local dir=$DIR/$tdir
3298 local ostfail=$(get_random_entry $(get_facets OST))
3300 if [[ $FAILURE_MODE = HARD ]]; then
3301 local affected=$(affected_facets $ostfail);
3303 [[ "$affected" == $ostfail ]] ||
3304 skip "cannot use FAILURE_MODE=$FAILURE_MODE, affected: $affected"
3306 # ensure all OSTs are active to allow allocations
3309 mkdir $dir || error "mkdir $dir failed"
3311 echo "Create the files"
3313 # file "f${index}" striped over 1 OST
3314 # file "all" striped over all OSTs
3316 $LFS setstripe -c $OSTCOUNT $dir/all ||
3317 error "setstripe failed to create $dir/all"
3319 for ((i = 0; i < $OSTCOUNT; i++)); do
3322 $LFS setstripe -i $i -c 1 $f ||
3323 error "$LFS setstripe failed to create $f"
3325 # confirm setstripe actually created stripe on requested OST
3326 local uuid=$(ostuuid_from_index $i)
3328 for file in f$i all; do
3329 local found=$($LFS find --obd $uuid --name $file $dir)
3331 if [[ $dir/$file != $found ]]; then
3332 $LFS getstripe $dir/$file
3333 error "wrong stripe: $file, uuid: $uuid"
3338 # Before failing an OST, get its obd name and index
3339 local varsvc=${ostfail}_svc
3340 local obd=$(do_facet $ostfail lctl get_param \
3341 -n obdfilter.${!varsvc}.uuid)
3342 local index=$(($(facet_number $ostfail) - 1))
3344 echo "Fail $ostfail $obd, display the list of affected files"
3345 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3347 trap "cleanup_90 $ostfail" EXIT INT
3348 echo "General Query: lfs find $dir"
3349 local list=$($LFS find $dir)
3351 for (( i=0; i<$OSTCOUNT; i++ )); do
3352 list_member "$list" $dir/f$i ||
3353 error_noexit "lfs find $dir: no file f$i"
3355 list_member "$list" $dir/all ||
3356 error_noexit "lfs find $dir: no file all"
3358 # focus on the missing OST,
3359 # we expect to see only two files affected: "f$(index)" and "all"
3361 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3362 list=$($LFS find --obd $obd $dir)
3364 for file in all f$index; do
3365 list_member "$list" $dir/$file ||
3366 error_noexit "lfs find does not report the affected $obd for $file"
3369 [[ $(echo $list | wc -w) -eq 2 ]] ||
3370 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3372 echo "Check getstripe: $LFS getstripe -r --obd $obd"
3373 list=$($LFS getstripe -r --obd $obd $dir)
3375 for file in all f$index; do
3376 echo "$list" | grep $dir/$file ||
3377 error_noexit "lfs getsripe does not report the affected $obd for $file"
3382 run_test 90 "lfs find identifies the missing striped file segments"
3385 [[ "$MDS1_VERSION" -ge $(version_code 2.6.90) ]] ||
3386 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
3387 "$MDS1_VERSION" -lt $(version_code 2.5.50) ]] ||
3388 skip "Need MDS version 2.5.4+ or 2.6.90+"
3390 cancel_lru_locks osc
3392 $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
3393 error "$LFS setstripe $DIR/$tfile failed"
3394 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3395 error "dd to $DIR/$tfile failed"
3396 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3397 # We need to emulate a state that OST is waiting for other clients
3398 # not completing the recovery. Final ping is queued, but reply will be
3399 # sent on the recovery completion. It is done by sleep before
3400 # processing final pings
3401 do_facet ost1 "$LCTL set_param fail_val=40"
3402 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3405 run_test 93a "replay + reconnect"
3408 [[ "$MDS1_VERSION" -ge $(version_code 2.7.90) ]] ||
3409 skip "Need MDS version 2.7.90+"
3411 cancel_lru_locks mdc
3413 createmany -o $DIR/$tfile 20 ||
3414 error "createmany -o $DIR/$tfile failed"
3416 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3417 # We need to emulate a state that MDT is waiting for other clients
3418 # not completing the recovery. Final ping is queued, but reply will be
3419 # sent on the recovery completion. It is done by sleep before
3420 # processing final pings
3421 do_facet mds1 "$LCTL set_param fail_val=80"
3422 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3425 run_test 93b "replay + reconnect on mds"
3427 striped_dir_check_100() {
3428 local striped_dir=$DIR/$tdir/striped_dir
3429 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3431 $LFS getdirstripe $striped_dir
3432 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3434 createmany -o $striped_dir/f-%d 20 ||
3435 error "creation failed under striped dir"
3439 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3440 ([ $FAILURE_MODE == "HARD" ] &&
3441 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3442 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3445 local striped_dir=$DIR/$tdir/striped_dir
3448 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3450 #To make sure MDT1 and MDT0 are connected
3451 #otherwise it may create single stripe dir here
3452 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3454 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3455 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3456 $LFS setdirstripe -i0 -c2 $striped_dir &
3459 fail mds$((MDTIDX + 1))
3461 wait $CLIENT_PID || error "striped dir creation failed"
3463 striped_dir_check_100 || error "striped dir check failed"
3464 rm -rf $DIR/$tdir || error "rmdir failed"
3466 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3469 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3470 ([ $FAILURE_MODE == "HARD" ] &&
3471 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3472 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3475 local striped_dir=$DIR/$tdir/striped_dir
3478 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3480 #To make sure MDT1 and MDT0 are connected
3481 #otherwise it may create single stripe dir here
3482 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3484 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3485 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3486 $LFS mkdir -i0 -c2 $striped_dir &
3491 wait $CLIENT_PID || error "striped dir creation failed"
3493 striped_dir_check_100 || error "striped dir check failed"
3494 rm -rf $DIR/$tdir || error "rmdir failed"
3496 run_test 100b "DNE: create striped dir, fail MDT0"
3499 (( $MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
3500 [[ "$FAILURE_MODE" != "HARD" ||
3501 "$(facet_host mds1)" != "$(facet_host mds2)" ]] ||
3502 skip "MDTs needs to be on diff hosts for HARD fail mode"
3504 local striped_dir=$DIR/$tdir/striped_dir
3506 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3508 #To make sure MDT1 and MDT0 are connected
3509 #otherwise it may create single stripe dir here
3510 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3513 $LFS mkdir -i1 -c2 $striped_dir
3515 fail_abort mds2 abort_recov_mdt
3517 if (( $MDS1_VERSION >= $(version_code 2.15.54.138) )); then
3518 # after 2.15.54.138 striped mkdir can replay by client request
3519 createmany -o $striped_dir/f-%d 20 ||
3520 error "createmany -o $DIR/$tfile failed"
3525 # LU-16159 abort_recovery will cancel update logs, the second recovery
3526 # won't replay $striped_dir creation
3527 (( $MDS1_VERSION >= $(version_code 2.15.52) &&
3528 $MDS1_VERSION < $(version_code 2.15.54.138) )) &&
3529 fail_abort_cleanup && return 0
3531 striped_dir_check_100 || error "striped dir check failed"
3533 run_test 100c "DNE: create striped dir, abort_recov_mdt mds2"
3536 (( $MDSCOUNT > 1 )) || skip "needs > 1 MDTs"
3537 (( $MDS1_VERSION >= $(version_code 2.15.52.144) )) ||
3538 skip "Need MDS version 2.15.52.144+"
3540 test_mkdir -c $MDSCOUNT $DIR/$tdir || error "mkdir $tdir failed"
3541 $LFS setdirstripe -D -i -1 -c $MDSCOUNT $DIR/$tdir ||
3542 error "set $tdir default LMV failed"
3543 createmany -d $DIR/$tdir/s 100 || error "create subdir failed"
3545 local index=$((RANDOM % MDSCOUNT))
3546 local devname=$(mdtname_from_index $index)
3547 local mdt=mds$((index + 1))
3552 # cancel update llog upon recovery abort
3553 do_facet $mdt $LCTL --device $devname llog_print update_log
3554 log=$(do_facet $mdt "$LCTL --device $devname llog_print update_log |
3555 awk '/index/ { print \\\$4; exit }'")
3557 count=$(do_facet $mdt "$LCTL --device $devname llog_print update_log |
3559 (( count > 0 )) || error "no update logs found"
3560 stack_trap fail_abort_cleanup RETURN
3561 fail_abort $mdt || error "fail_abort $mdt failed"
3562 wait_update_facet $mdt "$LCTL --device $devname llog_print update_log |
3563 grep -c index" 0 60 || error "update logs not canceled"
3565 run_test 100d "DNE: cancel update logs upon recovery abort"
3568 (( MDSCOUNT > 1 )) || skip "needs >= 2 MDTs"
3569 (( MDS1_VERSION >= $(version_code 2.15.54.79) )) ||
3570 skip "Need MDS version 2.15.54.79+"
3571 [[ $FAILURE_MODE != "HARD" ||
3572 "$(facet_host mds1)" != "$(facet_host mds2)" ]] ||
3573 skip "MDTs needs to be on diff hosts for HARD fail mode"
3577 local striped_dir=$DIR/$tdir/striped_dir
3579 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3584 $LFS mkdir -i 0,1 $striped_dir
3585 old=$($LFS getdirstripe $striped_dir)
3590 new=$($LFS getdirstripe $striped_dir)
3592 [ "$old" == "$new" ] ||
3593 error "$striped_dir layout mismatch"
3594 rm -rf $DIR/$tdir || error "rmdir failed"
3596 run_test 100e "DNE: create striped dir on MDT0 and MDT1, fail MDT0, MDT1"
3598 test_101() { #LU-5648
3599 mkdir -p $DIR/$tdir/d1
3600 mkdir -p $DIR/$tdir/d2
3601 touch $DIR/$tdir/file0
3604 replay_barrier $SINGLEMDS
3605 for i in $(seq $num) ; do
3606 echo test$i > $DIR/$tdir/d1/file$i
3609 fail_abort $SINGLEMDS
3610 for i in $(seq $num) ; do
3611 touch $DIR/$tdir/d2/file$i
3612 test -s $DIR/$tdir/d2/file$i &&
3613 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3618 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3627 [[ $(lctl get_param mdc.*.import |
3628 grep "connect_flags:.*multi_mod_rpc") ]] ||
3629 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3631 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3632 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3633 facet="mds$((0x$idx + 1))"
3635 # get current value of max_mod_rcps_in_flight
3636 num=$($LCTL get_param -n \
3637 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3638 # set default value if client does not support multi mod RPCs
3639 [ -z "$num" ] && num=1
3641 echo "creating $num files ..."
3643 for i in $(seq $num); do
3644 touch $DIR/$tdir/file-$i
3647 # drop request on MDT to force resend
3648 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3649 do_facet $facet "$LCTL set_param fail_loc=0x159"
3650 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3651 for i in $(seq $num); do
3652 chmod 0600 $DIR/$tdir/file-$i &
3656 do_facet $facet "$LCTL set_param fail_loc=0"
3657 for pid in $pids; do
3658 wait $pid || error "chmod failed"
3660 echo "done ($(date +%H:%M:%S))"
3662 # check chmod succeed
3663 for i in $(seq $num); do
3664 checkstat -vp 0600 $DIR/$tdir/file-$i
3669 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3678 [[ $(lctl get_param mdc.*.import |
3679 grep "connect_flags:.*multi_mod_rpc") ]] ||
3680 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3682 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3683 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3684 facet="mds$((0x$idx + 1))"
3686 # get current value of max_mod_rcps_in_flight
3687 num=$($LCTL get_param -n \
3688 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3689 # set default value if client does not support multi mod RPCs
3690 [ -z "$num" ] && num=1
3692 echo "creating $num files ..."
3694 for i in $(seq $num); do
3695 touch $DIR/$tdir/file-$i
3698 # drop reply on MDT to force reconstruction
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"
3708 for pid in $pids; do
3709 wait $pid || error "chmod failed"
3711 echo "done ($(date +%H:%M:%S))"
3713 # check chmod succeed
3714 for i in $(seq $num); do
3715 checkstat -vp 0600 $DIR/$tdir/file-$i
3720 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3729 [[ $(lctl get_param mdc.*.import |
3730 grep "connect_flags:.*multi_mod_rpc") ]] ||
3731 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3733 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3734 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3735 facet="mds$((0x$idx + 1))"
3737 # get current value of max_mod_rcps_in_flight
3738 num=$($LCTL get_param -n \
3739 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3740 # set default value if client does not support multi mod RPCs
3741 [ -z "$num" ] && num=1
3743 echo "creating $num files ..."
3745 for i in $(seq $num); do
3746 touch $DIR/$tdir/file-$i
3749 replay_barrier $facet
3752 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3753 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3754 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3755 for i in $(seq $num); do
3756 chmod 0600 $DIR/$tdir/file-$i &
3760 do_facet $facet "$LCTL set_param fail_loc=0"
3765 for pid in $pids; do
3766 wait $pid || error "chmod failed"
3768 echo "done ($(date +%H:%M:%S))"
3770 # check chmod succeed
3771 for i in $(seq $num); do
3772 checkstat -vp 0600 $DIR/$tdir/file-$i
3777 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3786 [[ $(lctl get_param mdc.*.import |
3787 grep "connect_flags:.*multi_mod_rpc") ]] ||
3788 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3790 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3791 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3792 facet="mds$((0x$idx + 1))"
3794 # get current value of max_mod_rcps_in_flight
3795 num=$($LCTL get_param -n \
3796 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3797 # set default value if client does not support multi mod RPCs
3798 [ -z "$num" ] && num=1
3800 echo "creating $num files ..."
3802 for i in $(seq $num); do
3803 touch $DIR/$tdir/file-$i
3807 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3808 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3809 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3810 for i in $(seq $num); do
3811 chmod 0600 $DIR/$tdir/file-$i &
3816 # write MDT transactions to disk
3817 do_facet $facet "sync; sync; sync"
3819 do_facet $facet "$LCTL set_param fail_loc=0"
3824 for pid in $pids; do
3825 wait $pid || error "chmod failed"
3827 echo "done ($(date +%H:%M:%S))"
3829 # check chmod succeed
3830 for i in $(seq $num); do
3831 checkstat -vp 0600 $DIR/$tdir/file-$i
3836 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3839 remote_mds_nodsh && skip "remote MDS with nodsh"
3840 [[ "$MDS1_VERSION" -gt $(version_code 2.8.54) ]] ||
3841 skip "Need MDS version 2.8.54+"
3843 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3844 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3847 createmany -o $DIR/$tdir/t- 30 ||
3848 error "create files on remote directory failed"
3850 rm -rf $DIR/$tdir/t-*
3852 #MDS should crash with tr->otr_next_id overflow
3855 run_test 103 "Check otr_next_id overflow"
3858 check_striped_dir_110()
3860 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3861 error "create striped dir failed"
3862 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3863 [ $stripe_count -eq $MDSCOUNT ] ||
3864 error "$stripe_count != 2 after recovery"
3868 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3869 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3870 skip "Need MDS version at least 2.7.56"
3872 ([ $FAILURE_MODE == "HARD" ] &&
3873 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3874 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3879 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3882 check_striped_dir_110 || error "check striped_dir failed"
3883 rm -rf $DIR/$tdir || error "rmdir failed"
3887 run_test 110a "DNE: create striped dir, fail MDT1"
3890 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3891 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3892 skip "Need MDS version at least 2.7.56"
3894 ([ $FAILURE_MODE == "HARD" ] &&
3895 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3896 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3901 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3904 zconf_mount $(hostname) $MOUNT
3905 client_up || return 1
3907 check_striped_dir_110 || error "check striped_dir failed"
3909 rm -rf $DIR/$tdir || error "rmdir failed"
3913 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3916 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3917 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3918 skip "Need MDS version at least 2.7.56"
3920 ([ $FAILURE_MODE == "HARD" ] &&
3921 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3922 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3927 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3930 check_striped_dir_110 || error "check striped_dir failed"
3932 rm -rf $DIR/$tdir || error "rmdir failed"
3936 run_test 110c "DNE: create striped dir, fail MDT2"
3939 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3940 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3941 skip "Need MDS version at least 2.7.56"
3943 ([ $FAILURE_MODE == "HARD" ] &&
3944 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3945 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3950 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3953 zconf_mount $(hostname) $MOUNT
3954 client_up || return 1
3956 check_striped_dir_110 || error "check striped_dir failed"
3958 rm -rf $DIR/$tdir || error "rmdir failed"
3962 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3965 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3966 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3967 skip "Need MDS version at least 2.7.56"
3969 ([ $FAILURE_MODE == "HARD" ] &&
3970 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3971 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3976 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3980 zconf_mount $(hostname) $MOUNT
3981 client_up || return 1
3983 check_striped_dir_110 || error "check striped_dir failed"
3985 rm -rf $DIR/$tdir || error "rmdir failed"
3989 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3992 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3993 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3994 skip "Need MDS version at least 2.7.56"
3996 ([ $FAILURE_MODE == "HARD" ] &&
3997 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3998 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4004 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
4007 check_striped_dir_110 || error "check striped_dir failed"
4009 rm -rf $DIR/$tdir || error "rmdir failed"
4013 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
4016 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4017 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4018 skip "Need MDS version at least 2.7.56"
4020 ([ $FAILURE_MODE == "HARD" ] &&
4021 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4022 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4027 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
4031 zconf_mount $(hostname) $MOUNT
4032 client_up || return 1
4034 check_striped_dir_110 || error "check striped_dir failed"
4036 rm -rf $DIR/$tdir || error "rmdir failed"
4040 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4043 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4044 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4045 skip "Need MDS version at least 2.7.56"
4047 ([ $FAILURE_MODE == "HARD" ] &&
4048 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4049 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4053 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4055 rm -rf $DIR/$tdir/striped_dir
4058 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4059 error "striped dir still exists"
4062 run_test 111a "DNE: unlink striped dir, fail MDT1"
4065 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4066 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4067 skip "Need MDS version at least 2.7.56"
4069 ([ $FAILURE_MODE == "HARD" ] &&
4070 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4071 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4075 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4077 rm -rf $DIR/$tdir/striped_dir
4080 zconf_mount $(hostname) $MOUNT
4081 client_up || return 1
4083 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4084 error "striped dir still exists"
4087 run_test 111b "DNE: unlink striped dir, fail MDT2"
4090 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4091 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4092 skip "Need MDS version at least 2.7.56"
4094 ([ $FAILURE_MODE == "HARD" ] &&
4095 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4096 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4100 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4102 rm -rf $DIR/$tdir/striped_dir
4106 zconf_mount $(hostname) $MOUNT
4107 client_up || return 1
4108 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4109 error "striped dir still exists"
4112 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4115 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4116 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4117 skip "Need MDS version at least 2.7.56"
4119 ([ $FAILURE_MODE == "HARD" ] &&
4120 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4121 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4125 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4127 rm -rf $DIR/$tdir/striped_dir
4131 zconf_mount $(hostname) $MOUNT
4132 client_up || return 1
4133 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4134 error "striped dir still exists"
4138 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4141 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4142 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4143 skip "Need MDS version at least 2.7.56"
4145 ([ $FAILURE_MODE == "HARD" ] &&
4146 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4147 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4151 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4153 rm -rf $DIR/$tdir/striped_dir
4156 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4157 error "striped dir still exists"
4160 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4163 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4164 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4165 skip "Need MDS version at least 2.7.56"
4167 ([ $FAILURE_MODE == "HARD" ] &&
4168 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4169 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4173 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4175 rm -rf $DIR/$tdir/striped_dir
4178 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4179 error "striped dir still exists"
4182 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4185 (( $MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
4186 (( $MDS1_VERSION >= $(version_code 2.7.56) )) ||
4187 skip "Need MDS version at least 2.7.56"
4189 ([ $FAILURE_MODE != "HARD" ] ||
4190 [ "$(facet_host mds1)" != "$(facet_host mds2)" ]) ||
4191 skip "MDTs needs to be on diff hosts for HARD fail mode"
4194 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4198 rm -rf $DIR/$tdir/striped_dir
4200 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4201 error "striped dir still exists"
4204 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4206 test_112_rename_prepare() {
4207 mkdir_on_mdt0 $DIR/$tdir
4208 mkdir -p $DIR/$tdir/src_dir
4209 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4210 error "create remote source failed"
4212 touch $DIR/$tdir/src_dir/src_child/a
4214 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4215 error "create remote target dir failed"
4217 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4218 error "create remote target child failed"
4223 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4224 error "src_child still exists after rename"
4226 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4227 error "missing file(a) after rename"
4231 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4232 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4233 skip "Need MDS version at least 2.7.56"
4235 ([ $FAILURE_MODE == "HARD" ] &&
4236 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4237 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4240 test_112_rename_prepare
4243 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4244 error "rename dir cross MDT failed!"
4248 rm -rf $DIR/$tdir || error "rmdir failed"
4250 run_test 112a "DNE: cross MDT rename, fail MDT1"
4253 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4254 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4255 skip "Need MDS version at least 2.7.56"
4257 ([ $FAILURE_MODE == "HARD" ] &&
4258 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4259 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4262 test_112_rename_prepare
4265 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4266 error "rename dir cross MDT failed!"
4271 rm -rf $DIR/$tdir || error "rmdir failed"
4273 run_test 112b "DNE: cross MDT rename, fail MDT2"
4276 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4277 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4278 skip "Need MDS version at least 2.7.56"
4280 ([ $FAILURE_MODE == "HARD" ] &&
4281 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4282 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4285 test_112_rename_prepare
4288 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4289 error "rename dir cross MDT failed!"
4294 rm -rf $DIR/$tdir || error "rmdir failed"
4296 run_test 112c "DNE: cross MDT rename, fail MDT3"
4299 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4300 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4301 skip "Need MDS version at least 2.7.56"
4303 ([ $FAILURE_MODE == "HARD" ] &&
4304 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4305 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4308 test_112_rename_prepare
4311 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4312 error "rename dir cross MDT failed!"
4317 rm -rf $DIR/$tdir || error "rmdir failed"
4319 run_test 112d "DNE: cross MDT rename, fail MDT4"
4322 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4323 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4324 skip "Need MDS version at least 2.7.56"
4326 ([ $FAILURE_MODE == "HARD" ] &&
4327 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4328 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4331 test_112_rename_prepare
4335 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4336 error "rename dir cross MDT failed!"
4341 rm -rf $DIR/$tdir || error "rmdir failed"
4343 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4346 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4347 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4348 skip "Need MDS version at least 2.7.56"
4350 ([ $FAILURE_MODE == "HARD" ] &&
4351 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4352 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4355 test_112_rename_prepare
4359 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4360 error "rename dir cross MDT failed!"
4365 rm -rf $DIR/$tdir || error "rmdir failed"
4367 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4370 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4371 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4372 skip "Need MDS version at least 2.7.56"
4374 ([ $FAILURE_MODE == "HARD" ] &&
4375 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4376 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4379 test_112_rename_prepare
4383 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4384 error "rename dir cross MDT failed!"
4389 rm -rf $DIR/$tdir || error "rmdir failed"
4391 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4394 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4395 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4396 skip "Need MDS version at least 2.7.56"
4398 ([ $FAILURE_MODE == "HARD" ] &&
4399 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4400 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4403 test_112_rename_prepare
4407 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4408 error "rename dir cross MDT failed!"
4413 rm -rf $DIR/$tdir || error "rmdir failed"
4415 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4418 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4419 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4420 skip "Need MDS version at least 2.7.56"
4422 ([ $FAILURE_MODE == "HARD" ] &&
4423 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4424 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4427 test_112_rename_prepare
4431 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4432 error "rename dir cross MDT failed!"
4437 rm -rf $DIR/$tdir || error "rmdir failed"
4439 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4442 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4443 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4444 skip "Need MDS version at least 2.7.56"
4446 ([ $FAILURE_MODE == "HARD" ] &&
4447 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4448 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4451 test_112_rename_prepare
4455 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4456 error "rename dir cross MDT failed!"
4461 rm -rf $DIR/$tdir || error "rmdir failed"
4463 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4466 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4467 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4468 skip "Need MDS version at least 2.7.56"
4470 ([ $FAILURE_MODE == "HARD" ] &&
4471 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4472 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4475 test_112_rename_prepare
4480 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4481 error "rename dir cross MDT failed!"
4486 rm -rf $DIR/$tdir || error "rmdir failed"
4488 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4491 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4492 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4493 skip "Need MDS version at least 2.7.56"
4495 ([ $FAILURE_MODE == "HARD" ] &&
4496 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4497 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4500 test_112_rename_prepare
4505 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4506 error "rename dir cross MDT failed!"
4511 rm -rf $DIR/$tdir || error "rmdir failed"
4513 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4516 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4517 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4518 skip "Need MDS version at least 2.7.56"
4520 ([ $FAILURE_MODE == "HARD" ] &&
4521 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4522 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4525 test_112_rename_prepare
4530 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4531 error "rename dir cross MDT failed!"
4536 rm -rf $DIR/$tdir || error "rmdir failed"
4538 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4541 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4542 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4543 skip "Need MDS version at least 2.7.56"
4545 ([ $FAILURE_MODE == "HARD" ] &&
4546 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4547 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4550 test_112_rename_prepare
4555 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4556 error "rename dir cross MDT failed!"
4561 rm -rf $DIR/$tdir || error "rmdir failed"
4563 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4566 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4567 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4568 skip "Need MDS version at least 2.7.56"
4570 ([ $FAILURE_MODE == "HARD" ] &&
4571 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4572 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4580 for ((j=0;j<$((MDSCOUNT));j++)); do
4581 fail_index=$((fail_index+1))
4582 index=$((fail_index % MDSCOUNT))
4583 replay_barrier mds$((index + 1))
4584 for ((i=0;i<5;i++)); do
4585 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4586 error "create striped dir $DIR/$tdir/test_$i"
4589 fail mds$((index + 1))
4590 for ((i=0;i<5;i++)); do
4591 checkstat -t dir $DIR/$tdir/test_$i ||
4592 error "$DIR/$tdir/test_$i does not exist!"
4594 rm -rf $DIR/$tdir/test_* ||
4598 run_test 115 "failover for create/unlink striped directory"
4601 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4602 [ "$MDS1_VERSION" -lt $(version_code 2.7.55) ] &&
4603 skip "Do not support large update log before 2.7.55" &&
4605 ([ $FAILURE_MODE == "HARD" ] &&
4606 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4607 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4611 mkdir_on_mdt0 $DIR/$tdir
4614 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4615 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4616 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4619 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4620 error "stried_dir does not exists"
4622 run_test 116a "large update log master MDT recovery"
4625 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4626 [ "$MDS1_VERSION" -lt $(version_code 2.7.55) ] &&
4627 skip "Do not support large update log before 2.7.55" &&
4630 ([ $FAILURE_MODE == "HARD" ] &&
4631 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4632 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4636 mkdir_on_mdt0 $DIR/$tdir
4639 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4640 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4641 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4644 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4645 error "stried_dir does not exists"
4647 run_test 116b "large update log slave MDT recovery"
4650 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4651 ([ $FAILURE_MODE == "HARD" ] &&
4652 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4653 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4659 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4660 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4663 # Let's set rdonly on all MDTs, so client will send
4664 # replay requests on all MDTs and replay these requests
4665 # at the same time. This test will verify the recovery
4666 # will not be deadlock in this case, LU-7531.
4667 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4668 replay_barrier mds$((index + 1))
4669 if [ -z $mds_indexs ]; then
4670 mds_indexs="${mds_indexs}mds$((index+1))"
4672 mds_indexs="${mds_indexs},mds$((index+1))"
4676 rm -rf $DIR/$tdir/remote_dir
4677 rm -rf $DIR/$tdir/remote_dir_1
4681 rm -rf $DIR/$tdir || error "rmdir failed"
4683 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4686 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4687 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4688 skip "Do not support large update log before 2.7.64" &&
4693 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4694 error "setdirstripe fails"
4695 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4696 error "setdirstripe fails 1"
4697 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4699 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4700 do_facet mds1 "lctl set_param fail_loc=0x1705"
4701 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4702 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4703 do_facet mds1 "lctl set_param fail_loc=0x0"
4706 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4707 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4712 run_test 118 "invalidate osp update will not cause update log corruption"
4715 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4716 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4717 skip "Do not support large update log before 2.7.64" &&
4720 local hard_timeout=$(do_facet mds1 \
4721 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4723 local clients=${CLIENTS:-$HOSTNAME}
4724 local time_min=$(recovery_time_min)
4726 mkdir_on_mdt0 $DIR/$tdir
4727 mkdir $DIR/$tdir/tmp
4728 rmdir $DIR/$tdir/tmp
4731 mkdir $DIR/$tdir/dir_1
4732 for ((i = 0; i < 20; i++)); do
4733 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4740 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4741 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4742 #sleep (timeout + 5), so mds will evict the client exports,
4743 #but DNE update recovery will keep going.
4744 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4746 mount_facet mds1 "-o recovery_time_hard=$time_min"
4748 wait_clients_import_state "$clients" mds1 FULL
4750 clients_up || clients_up || error "failover df: $?"
4752 #revert back the hard timeout
4753 do_facet mds1 $LCTL set_param \
4754 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4756 for ((i = 0; i < 20; i++)); do
4757 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4758 [ $stripe_count == 2 ] || {
4759 error "stripe_dir-$i creation replay fails"
4764 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4767 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4768 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4769 skip "Do not support large update log before 2.7.64" &&
4772 mkdir_on_mdt0 $DIR/$tdir
4773 replay_barrier_nosync mds1
4774 for ((i = 0; i < 20; i++)); do
4775 mkdir $DIR/$tdir/dir-$i || {
4776 error "create dir-$i fails"
4779 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4780 error "create stripe_dir-$i fails"
4785 stack_trap fail_abort_cleanup RETURN
4788 for ((i = 0; i < 20; i++)); do
4789 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4790 error "dir-$i still exists"
4793 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4794 error "stripe_dir-$i still exists"
4799 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4802 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4803 skip "Don't support it before 2.11" &&
4806 local at_max_saved=$(at_max_get mds)
4808 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4809 cancel_lru_locks mdc
4811 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4814 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4820 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4821 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4825 wait_clients_import_state "$clients" mds1 FULL
4826 clients_up || clients_up || error "failover df: $?"
4829 wait $mpid || error "multiop_bg_pause pid failed"
4831 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4832 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4833 at_max_set $at_max_saved mds
4836 run_test 121 "lock replay timed out and race"
4839 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4840 skip "Do not support Data-on-MDT before 2.11"
4842 replay_barrier $SINGLEMDS
4843 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4846 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4847 error "Fail to replay DoM file creation"
4849 run_test 130a "DoM file create (setstripe) replay"
4852 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4853 skip "Do not support Data-on-MDT before 2.11"
4855 mkdir_on_mdt0 $DIR/$tdir
4856 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4857 replay_barrier $SINGLEMDS
4858 touch $DIR/$tdir/$tfile
4861 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4862 error "Fail to replay DoM file creation"
4864 run_test 130b "DoM file create (inherited) replay"
4867 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4868 skip "Do not support Data-on-MDT before 2.11"
4870 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4871 replay_barrier $SINGLEMDS
4872 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4873 # lock is not canceled and will be replayed
4876 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4877 error "Wrong file content after failover"
4879 run_test 131a "DoM file write lock replay"
4882 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4883 skip "Do not support Data-on-MDT before 2.11"
4885 # refresh grants so write after replay_barrier doesn't
4887 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile-2
4888 stack_trap "rm -f $DIR/$tfile-2"
4889 dd if=/dev/zero of=$DIR/$tfile-2 bs=64k count=2 ||
4891 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4892 replay_barrier $SINGLEMDS
4893 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4894 cancel_lru_locks mdc
4898 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4899 error "Wrong file content after failover"
4901 run_test 131b "DoM file write replay"
4904 [ "$MDS1_VERSION" -lt $(version_code 2.12.0) ] &&
4905 skip "Need MDS version 2.12.0 or later"
4907 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4908 replay_barrier $SINGLEMDS
4909 # write over the first component size cause next component instantiation
4910 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4911 error "dd to $DIR/$tfile failed"
4912 lfs getstripe $DIR/$tfile
4914 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4915 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4916 error "Component #1 was not instantiated"
4920 lfs getstripe $DIR/$tfile
4921 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4922 error "Component #1 instantiation was not replayed"
4923 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4924 if [ $cksum != $cksum2 ] ; then
4925 error_noexit "New cksum $cksum2 does not match original $cksum"
4928 run_test 132a "PFL new component instantiate replay"
4931 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4932 ([ $FAILURE_MODE == "HARD" ] &&
4933 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4934 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4937 local remote_dir=$DIR/$tdir/remote_dir
4939 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4940 $LFS mkdir -i 1 $remote_dir
4943 do_facet mds2 $LCTL set_param seq.srv*MDT0001.space=clear
4945 zconf_mount $(hostname) $MOUNT
4946 client_up || return 1
4948 #define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123
4950 do_facet mds1 $LCTL set_param fail_val=700 fail_loc=0x80000123
4951 cp /etc/hosts $remote_dir/file &
4957 wait $pid || error "cp failed"
4958 rm -rf $DIR/$tdir || error "rmdir failed"
4962 run_test 133 "check resend of ongoing requests for lwp during failover"
4965 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return 0
4966 (( $MDS1_VERSION >= $(version_code 2.13.56) )) ||
4967 skip "need MDS version >= 2.13.56"
4970 pool_add_targets pool_134 1 1
4972 mkdir -p $DIR/$tdir/{A,B}
4973 $LFS setstripe -p pool_134 $DIR/$tdir/A
4974 $LFS setstripe -E EOF -p pool_134 $DIR/$tdir/B
4978 touch $DIR/$tdir/A/$tfile || error "touch non-pfl file failed"
4979 touch $DIR/$tdir/B/$tfile || error "touch pfl failed"
4983 [ -f $DIR/$tdir/A/$tfile ] || error "non-pfl file does not exist"
4984 [ -f $DIR/$tdir/B/$tfile ] || error "pfl file does not exist"
4986 run_test 134 "replay creation of a file created in a pool"
4993 # make sure we are using the primary server
4994 [[ $(facet_active ost1) == "ost1" ]] || fail ost1
4996 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4999 $LFS setstripe -S $((128 * 1024)) -i 0 $DIR/$tdir
5001 # Create 20 files so we have 20 ost locks
5002 touch $DIR/$tdir/file.{1..20}
5004 # Init all the clients connections (write lastrcv on the OST)
5008 old_replay=$($LCTL get_param ldlm.cancel_unused_locks_before_replay)
5009 $LCTL set_param ldlm.cancel_unused_locks_before_replay=0
5010 stack_trap "$LCTL set_param $old_replay" EXIT
5012 local old_debug=$($LCTL get_param -n debug)
5013 local old_debug_mb=$($LCTL get_param -n debug_mb)
5014 $LCTL set_param debug_mb=100 debug='+info +ha +dlmtrace'
5015 stack_trap "$LCTL set_param debug_mb=$old_debug_mb debug='$old_debug'"
5017 printf "%s\n" $DIR/$tdir/file.{1..20} |
5018 xargs -I{} -P20 dd if=/dev/urandom of={} bs=1K count=1 &> /dev/null
5024 #define OBD_FAIL_LDLM_LOCK_REPLAY 0x32d
5025 # Make sure lock replay server side never completes and errors out.
5026 do_rpc_nodes $(facet_active_host ost1) \
5027 load_module ../libcfs/libcfs/libcfs
5028 do_facet ost1 "$LCTL set_param fail_loc=0x32d fail_val=20"
5029 do_facet ost1 "$LCTL set_param debug_mb=100 debug='+info +ha +dlmtrace'"
5032 # Now make sure we notice
5033 (sync;sync;sync;echo "End of sync") & PID=$!
5034 wait_clients_import_state ${HOSTNAME} ost1 REPLAY_LOCKS
5035 kill -0 $PID || error "Unexpected sync success"
5042 do_rpc_nodes $(facet_active_host ost1) \
5043 load_module ../libcfs/libcfs/libcfs
5044 do_facet ost1 "$LCTL set_param fail_loc=0"
5048 clients_up || clients_up || error "$LFS df $MOUNT failed"
5050 wait $PID || error "Fail to sync"
5051 echo blah > $DIR/$tdir/file.test2
5055 run_test 135 "Server failure in lock replay phase"
5058 (( $MDSCOUNT >= 3 )) || skip "needs > 2 MDTs"
5059 (( MDS1_VERSION >= $(version_code 2.15.53) )) ||
5060 skip "need MDS version >= 2.15.53 for LU-16536 fix"
5062 $LFS mkdir -i0 -c3 $DIR/$tdir || error "can't mkdir"
5063 $LFS getdirstripe $DIR/$tdir
5066 #define OBD_FAIL_OUT_DROP_DESTROY 0x170b
5067 local mdts=$(mdts_nodes)
5068 do_nodes $mdts $LCTL set_param fail_loc=0x170b
5074 start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS || error "MDT1 start failed"
5075 start mds2 $(mdsdevname 2) $MDS_MOUNT_OPTS || error "MDT2 start failed"
5076 start mds3 $(mdsdevname 3) $MDS_MOUNT_OPTS || error "MDT3 star"
5078 run_test 136 "MDS to disconnect all OSPs first, then cleanup ldlm"
5080 check_striped_create_137() {
5083 cancel_lru_locks mdc
5084 $CHECKSTAT -t dir $DIR/$tdir/striped_dir/dir0 ||
5085 error "Create under striped dir failed"
5086 $LFS getdirstripe $DIR/$tdir/striped_dir/dir0
5087 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir/dir0)
5088 [ $stripe_count -eq 0 ] || error "$stripe_count != 0 after recovery"
5090 $CHECKSTAT -t dir $DIR/$tdir/striped_dir/dir1 ||
5091 error "Create under striped dir failed"
5092 $LFS getdirstripe $DIR/$tdir/striped_dir/dir1
5093 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir/dir1)
5094 [ $stripe_count -eq 0 ] || error "$stripe_count != 0 after recovery"
5098 (( $MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
5099 (( $MDS1_VERSION >= $(version_code v2_15_62-70-g668dfb53de) )) ||
5100 skip "Need MDS >= 2.15.62.70 for intent mkdir"
5102 [[ $FAILURE_MODE != "HARD" ]] ||
5103 [[ "$(facet_host mds1)" != "$(facet_host mds2)" ]] ||
5104 skip "MDTs needs to be on diff hosts for HARD fail mode"
5106 local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
5108 save_lustre_params client "llite.*.intent_mkdir" > $save
5109 stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
5110 $LCTL set_param llite.*.intent_mkdir=1
5113 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
5115 mkdir $DIR/$tdir/striped_dir/dir0
5116 mkdir $DIR/$tdir/striped_dir/dir1
5119 check_striped_create_137 || error "check striped dir0 failed"
5120 rm -rf $DIR/$tdir || error "rm -rf $DIR/$tdir failed"
5122 run_test 137a "DNE: create under striped dir, fail MDT1"
5125 (( $MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
5126 (( $MDS1_VERSION >= $(version_code v2_15_62-70-g668dfb53de) )) ||
5127 skip "Need MDS version at least 2.15.62.70 for intent mkdir"
5129 [[ $FAILURE_MODE != "HARD" ]] ||
5130 [[ "$(facet_host mds1)" != "$(facet_host mds2)" ]] ||
5131 skip "MDTs needs to be on diff hosts for HARD fail mode"
5133 local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
5135 save_lustre_params client "llite.*.intent_mkdir" > $save
5136 stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
5137 $LCTL set_param llite.*.intent_mkdir=1
5140 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
5142 mkdir $DIR/$tdir/striped_dir/dir0
5143 mkdir $DIR/$tdir/striped_dir/dir1
5146 check_striped_create_137 ||
5147 error "check create under striped_dir failed"
5151 run_test 137b "DNE: create under striped dir, fail MDT2"
5154 (( $MDSCOUNT >= 2 )) || skip "needs >= 2 MDTs"
5155 (( $MDS1_VERSION >= $(version_code v2_15_62-70-g668dfb53de) )) ||
5156 skip "Need MDS version at least 2.15.62.70 for intent mkdir"
5158 [[ $FAILURE_MODE != "HARD" ]] ||
5159 [[ "$(facet_host mds1)" != "$(facet_host mds2)" ]] ||
5160 skip "MDTs needs to be on diff hosts for HARD fail mode"
5162 local save="$TMP/$TESTSUITE-$TESTNAME.parameters"
5164 save_lustre_params client "llite.*.intent_mkdir" > $save
5165 stack_trap "restore_lustre_params < $save; rm -f $save" EXIT
5166 $LCTL set_param llite.*.intent_mkdir=1
5169 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
5172 mkdir $DIR/$tdir/striped_dir/dir0
5173 mkdir $DIR/$tdir/striped_dir/dir1
5176 check_striped_create_137 ||
5177 error "check create under striped_dir failed"
5181 run_test 137c "DNE: create under striped dir, fail MDT1/MDT2"
5184 [[ -z $RCLIENTS ]] && skip "Need remote client"
5188 rcli=$(echo $RCLIENTS | cut -d ' ' -f 1)
5190 echo "Selected \"$rcli\" from \"$RCLIENTS\""
5192 # We want idle disconnect enabled on all targets except OST0000. Test
5193 # assumes all nodes are configured the same.
5194 old=$(do_node $rcli "$LCTL get_param -n *.*.idle_timeout 2>/dev/null |
5196 [[ -n $old ]] || error "Cannot determine current idle_timeout"
5198 if ((old == 0)); then
5199 do_node "$rcli" "$LCTL set_param *.*.idle_timeout=10"
5200 do_node "$rcli" "$LCTL set_param osc.*OST0000*.idle_timeout=0"
5201 stack_trap "do_node $rcli $LCTL set_param *.*.idle_timeout=$old"
5203 do_node "$rcli" "$LCTL set_param osc.*OST0000*.idle_timeout=0"
5204 stack_trap "do_node $rcli $LCTL set_param osc.*OST0000*.idle_timeout=$old"
5207 # Ensure OST0 import is idle
5208 wait_update "$rcli" \
5209 "$LCTL get_param osc.*OST0000*.import | \
5210 awk 'BEGIN{ count=0 } /idle: 0/ { count+=1 } \
5211 END { print count }'" \
5214 (( $? != 0 )) && error "OST0000 not idle after 30s"
5216 # Send ping to ensure import is FULL
5217 do_node "$rcli" "lctl set_param osc.*OST0000*.ping=1" ||
5218 error "OBD ping failed"
5222 conns=( $(do_node "$rcli" "$LCTL get_param *.*.import" |
5223 awk '/connection_attempts:/{print $NF}' | xargs echo) )
5227 saved_debug=$(do_node "$rcli" \
5228 "cat /sys/module/libcfs/parameters/libcfs_debug" \
5230 [[ -z $saved_debug ]] && error "Failed to get existing debug"
5231 stack_trap "do_node $rcli $LCTL set_param debug=$saved_debug"
5232 do_node "$rcli" "$LCTL set_param debug=+info+rpctrace"
5234 # From lustre/obdclass/class_obd.c
5235 # unsigned int ping_interval = (OBD_TIMEOUT_DEFAULT > 4) ?
5236 # (OBD_TIMEOUT_DEFAULT / 4) : 1;
5237 # Delay a ping for 3 intervals
5240 timeout=$(do_node "$rcli" "$LCTL get_param -n timeout")
5241 (( timeout > 4 )) && delay=$((3 * timeout / 4)) || delay=3
5243 do_node "$rcli" "$LCTL clear"
5244 log "delay ping ${delay}s"
5246 #define OBD_FAIL_PTLRPC_DELAY_SEND_FAIL 0x535
5247 do_node "$rcli" "$LCTL set_param fail_loc=0x80000535 fail_val=${delay}"
5248 # Send ping that will be delayed for ${delay} seconds
5249 # This races with the pinger, but it is okay if a ping sent by pinger
5250 # thread is delayed instead
5251 do_node "$rcli" "lctl set_param osc.*OST0000*.ping=1"
5253 local logfile="$TMP/lustre-log-${TESTNAME}.log"
5257 local begin=$SECONDS
5258 local max_wait=$((delay + 1))
5261 while (( $waited <= $max_wait )); do
5262 [[ -z $sleep ]] || sleep $sleep
5264 waited=$((SECONDS - begin))
5265 do_node "$rcli" "$LCTL dk" >> ${logfile}
5267 if ! grep -q 'fail_timeout id 535 sleeping for' $logfile; then
5268 reason="Did not hit fail_loc"
5272 if ! grep -q 'cfs_fail_timeout id 535 awake' $logfile; then
5273 reason="Delayed send did not wake"
5277 nsent=$(grep -c "ptl_send_rpc.*o400->.*OST0000" $logfile)
5278 if (( nsent <= 1 )); then
5279 reason="Did not send more than 1 obd ping"
5283 expired=$(grep "Request sent has timed out .* o400->" $logfile)
5284 if [[ -z $expired ]]; then
5285 reason="RPC did not time out"
5292 if [[ -n $reason ]]; then
5303 conns2=( $(do_node "$rcli" "$LCTL get_param *.*.import" |
5304 awk '/connection_attempts:/{print $NF}' | xargs echo) )
5306 echo "conns: ${conns[*]}"
5308 echo "conns2: ${conns2[*]}"
5310 (( ${#conns[@]} != ${#conns2[@]} )) &&
5311 error "Expected ${#conns[@]} imports found ${#conns2[@]}"
5315 for ((i = 0; i < ${#conns[@]}; i++)); do
5316 if (( conns[i] != conns2[i] )); then
5317 error "New connection attempt ${conns[i]} -> ${conns2[i]}"
5323 run_test 200 "Dropping one OBD_PING should not cause disconnect"
5326 (( MDS1_VERSION >= $(version_code 2.15.63) )) ||
5327 skip "MDS < 2.15.63 doesn't support parallel disconnect"
5328 (( MDSCOUNT >= 2 )) || skip_env "needs >= 2 MDTs"
5329 (( OSTCOUNT >= 2 )) || skip_env "needs >= 2 OSTs"
5331 # delay DISCONNECT for 8 seconds, on all OSTs and MDTs
5332 #define OBD_FAIL_OST_DISCONNECT_DELAY 0x245
5333 do_nodes $(comma_list $(mdts_nodes)) "$LCTL set_param \
5334 fail_loc=0x245 fail_val=8"
5335 do_nodes $(comma_list $(osts_nodes)) "$LCTL set_param \
5336 fail_loc=0x245 fail_val=8"
5338 local start_time=$SECONDS
5342 local duration=$((SECONDS - start_time))
5344 start mds2 $(mdsdevname 2) $MDS_MOUNT_OPTS ||
5345 error "mount mds2 failed"
5346 echo "Umount took $duration seconds"
5348 # Valid timeout is 8s for MDT0000-lwp-MDT0001
5349 # + 8s for osp devices MDTs/OSTs + (4s + OSTCOUNTs) for other umount
5350 (( duration <= (20 + OSTCOUNT) )) || error "Cascading timeouts on disconnect"
5352 run_test 201 "MDT umount cascading disconnects timeouts"
5358 if ! do_facet $SINGLEMDS $LCTL get_param version | grep "ddn"; then
5360 (( $MDS1_VERSION >= $(version_code v2_16_50-35-gc66a7dea85) )) ||
5361 (( $MDS1_VERSION < $(version_code v2_15_55-64-g13557aa869) &&
5362 $MDS1_VERSION >= $(version_code v2_15_6-RC1) )) ||
5363 skip "need MDS with LU-18435 fix for layout version"
5365 # b_es6_0 and b_es5_2
5366 (( $MDS1_VERSION >= $(version_code 2.14.0-ddn180) )) ||
5367 (( $MDS1_VERSION < $(version_code 2.14.0-ddn86-14-gf1bd967799) &&
5368 $MDS1_VERSION >= $(version_code 2.14.0-ddn1) )) ||
5369 (( $MDS1_VERSION < $(version_code 2.12.9-ddn19-4-g3455e9100f) )) ||
5370 skip "need MDS with LU-18435 fix for layout version"
5373 mkdir_on_mdt0 $td || error "can't mkdir"
5374 $LFS setstripe -E128M -c1 -Eeof -c2 $td || error "can't setstripe"
5377 local before=$($LFS getstripe -v $tf|awk '/lcm_layout_gen:/{print $2}')
5379 cancel_lru_locks mdc
5380 local after=$($LFS getstripe -v $tf|awk '/lcm_layout_gen:/{print $2}')
5381 (( $before == $after )) || error "layout gen changed: $before -> $after"
5383 run_test 202 "pfl replay should recovery layout generation"
5386 mount_client $MOUNT2
5387 stack_trap "umount_client $MOUNT2"
5389 local start=$SECONDS
5390 #define OBD_FAIL_MDS_PAUSE_GETATTR 0x2403
5391 do_facet mds1 "$LCTL set_param fail_loc=0x80002403 fail_val=2"
5393 stat $MOUNT/$tfile &
5399 $LFS setstripe -E 1MB -c -1 -E 2MB -c -1 -E 3MB -c -1 -E 4MB -c -1 \
5400 -E 5MB -c -1 -E 6MB -c -1 -E 7MB -c -1 -E 8MB -c -1 \
5401 -E 9MB -c -1 -E 10MB -c -1 -E 11MB -c -1 -E eof -c -1 \
5405 do_facet mds1 "$LCTL set_param fail_loc=0 fail_val=0"
5406 (( SECONDS-start < TIMEOUT/2 )) ||
5407 error "took too long: $((SECONDS-start)) >= $((TIMEOUT/2))"
5409 run_test 203 "resend can hit original request"
5411 complete_test $SECONDS
5412 check_and_cleanup_lustre