5 LUSTRE=${LUSTRE:-$(dirname $0)/..}
6 . $LUSTRE/tests/test-framework.sh
10 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
11 # bug number for skipped test: LU-13614
14 if [ "$mds1_FSTYPE" = zfs ]; then
15 # bug number for skipped test: LU-11388
16 ALWAYS_EXCEPT+=" 131b"
20 # bug number for skipped tests: LU-9795
21 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 121"
23 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
27 CHECK_GRANT=${CHECK_GRANT:-"yes"}
28 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
30 require_dsh_mds || exit 0
31 check_and_setup_lustre
36 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
38 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
39 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
41 do_facet $SINGLEMDS sync
44 test_0a() { # was test_0
45 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
46 replay_barrier $SINGLEMDS
50 run_test 0a "empty replay"
53 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
55 # this test attempts to trigger a race in the precreation code,
56 # and must run before any other objects are created on the filesystem
58 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
59 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
61 run_test 0b "ensure object created after recover exists. (3284)"
64 replay_barrier $SINGLEMDS
67 facet_failover $SINGLEMDS
68 zconf_mount $(hostname) $MOUNT || error "mount fails"
69 client_up || error "post-failover df failed"
70 # file shouldn't exist if replay-barrier works as expected
71 rm $DIR/$tfile && error "File exists and it shouldn't"
74 run_test 0c "check replay-barrier"
77 replay_barrier $SINGLEMDS
79 facet_failover $SINGLEMDS
80 zconf_mount $(hostname) $MOUNT || error "mount fails"
81 client_up || error "post-failover df failed"
83 run_test 0d "expired recovery with no clients"
86 replay_barrier $SINGLEMDS
89 $CHECKSTAT -t file $DIR/$tfile ||
90 error "$CHECKSTAT $DIR/$tfile attribute check failed"
93 run_test 1 "simple create"
96 replay_barrier $SINGLEMDS
99 $CHECKSTAT -t file $DIR/$tfile ||
100 error "$CHECKSTAT $DIR/$tfile attribute check failed"
106 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
107 replay_barrier $SINGLEMDS
110 $CHECKSTAT -t file $DIR/$tfile ||
111 error "$CHECKSTAT $DIR/$tfile attribute check failed"
117 replay_barrier $SINGLEMDS
118 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
120 $CHECKSTAT -t file $DIR/$tfile ||
121 error "$CHECKSTAT $DIR/$tfile check failed"
123 run_test 2c "setstripe replay"
126 [[ "$mds1_FSTYPE" = zfs ]] &&
127 [[ "$MDS1_VERSION" -lt $(version_code 2.12.51) ]] &&
128 skip "requires LU-10143 fix on MDS"
129 replay_barrier $SINGLEMDS
130 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
132 $CHECKSTAT -t dir $DIR/$tdir ||
133 error "$CHECKSTAT $DIR/$tdir check failed"
135 run_test 2d "setdirstripe replay"
138 local file=$DIR/$tfile
139 replay_barrier $SINGLEMDS
141 openfile -f O_DIRECTORY $file
143 $CHECKSTAT -t file $file ||
144 error "$CHECKSTAT $file attribute check failed"
147 run_test 3a "replay failed open(O_DIRECTORY)"
150 replay_barrier $SINGLEMDS
151 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
152 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
154 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
156 $CHECKSTAT -t file $DIR/$tfile &&
157 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
160 run_test 3b "replay failed open -ENOMEM"
163 replay_barrier $SINGLEMDS
164 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
165 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
167 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
170 $CHECKSTAT -t file $DIR/$tfile &&
171 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
174 run_test 3c "replay failed open -ENOMEM"
176 test_4a() { # was test_4
177 replay_barrier $SINGLEMDS
178 for i in $(seq 10); do
179 echo "tag-$i" > $DIR/$tfile-$i
182 for i in $(seq 10); do
183 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
186 run_test 4a "|x| 10 open(O_CREAT)s"
189 for i in $(seq 10); do
190 echo "tag-$i" > $DIR/$tfile-$i
192 replay_barrier $SINGLEMDS
195 $CHECKSTAT -t file $DIR/$tfile-* &&
196 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
199 run_test 4b "|x| rm 10 files"
201 # The idea is to get past the first block of precreated files on both
202 # osts, and then replay.
204 replay_barrier $SINGLEMDS
205 for i in $(seq 220); do
206 echo "tag-$i" > $DIR/$tfile-$i
209 for i in $(seq 220); do
210 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
214 # waiting for commitment of removal
216 run_test 5 "|x| 220 open(O_CREAT)"
218 test_6a() { # was test_6
219 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
220 replay_barrier $SINGLEMDS
221 mcreate $DIR/$tdir/$tfile
223 $CHECKSTAT -t dir $DIR/$tdir ||
224 error "$CHECKSTAT $DIR/$tdir attribute check failed"
225 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
226 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
228 # waiting for log process thread
230 run_test 6a "mkdir + contained create"
233 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
234 replay_barrier $SINGLEMDS
237 $CHECKSTAT -t dir $DIR/$tdir &&
238 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
241 run_test 6b "|X| rmdir"
244 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
245 replay_barrier $SINGLEMDS
246 mcreate $DIR/$tdir/$tfile
248 $CHECKSTAT -t dir $DIR/$tdir ||
249 error "$CHECKSTAT $DIR/$tdir attribute check failed"
250 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
251 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
254 run_test 7 "mkdir |X| contained create"
257 replay_barrier $SINGLEMDS
258 multiop_bg_pause $DIR/$tfile mo_c ||
259 error "multiop mknod $DIR/$tfile failed"
263 $CHECKSTAT -t file $DIR/$tfile ||
264 error "$CHECKSTAT $DIR/$tfile attribute check failed"
265 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
266 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
269 run_test 8 "creat open |X| close"
272 replay_barrier $SINGLEMDS
274 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
276 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
278 echo " old_inum == $old_inum, new_inum == $new_inum"
279 if [ $old_inum -eq $new_inum ] ;
281 echo "old_inum and new_inum match"
283 echo " old_inum and new_inum do not match"
284 error "old index($old_inum) does not match new index($new_inum)"
288 run_test 9 "|X| create (same inum/gen)"
291 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
292 replay_barrier $SINGLEMDS
293 mv $DIR/$tfile $DIR/$tfile-2
296 $CHECKSTAT $DIR/$tfile &&
297 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
298 $CHECKSTAT $DIR/$tfile-2 ||
299 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
303 run_test 10 "create |X| rename unlink"
306 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
307 echo "old" > $DIR/$tfile
308 mv $DIR/$tfile $DIR/$tfile-2
309 replay_barrier $SINGLEMDS
310 echo "new" > $DIR/$tfile
312 grep old $DIR/$tfile-2
314 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
315 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
317 run_test 11 "create open write rename |X| create-old-name read"
320 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
321 multiop_bg_pause $DIR/$tfile o_tSc ||
322 error "multiop_bg_pause $DIR/$tfile failed"
325 replay_barrier $SINGLEMDS
326 kill -USR1 $pid || error "multiop $pid not running"
327 wait $pid || error "multiop $pid failed"
330 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
333 run_test 12 "open, unlink |X| close"
335 # 1777 - replay open after committed chmod that would make
336 # a regular open a failure
338 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
339 multiop_bg_pause $DIR/$tfile O_wc ||
340 error "multiop_bg_pause $DIR/$tfile failed"
343 $CHECKSTAT -p 0 $DIR/$tfile ||
344 error "$CHECKSTAT $DIR/$tfile attribute check failed"
345 replay_barrier $SINGLEMDS
347 kill -USR1 $pid || error "multiop $pid not running"
348 wait $pid || error "multiop $pid failed"
350 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
351 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
352 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
355 run_test 13 "open chmod 0 |x| write close"
358 multiop_bg_pause $DIR/$tfile O_tSc ||
359 error "multiop_bg_pause $DIR/$tfile failed"
362 replay_barrier $SINGLEMDS
363 kill -USR1 $pid || error "multiop $pid not running"
364 wait $pid || error "multiop $pid failed"
367 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
370 run_test 14 "open(O_CREAT), unlink |X| close"
373 multiop_bg_pause $DIR/$tfile O_tSc ||
374 error "multiop_bg_pause $DIR/$tfile failed"
377 replay_barrier $SINGLEMDS
378 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
379 kill -USR1 $pid || error "multiop $pid not running"
380 wait $pid || error "multiop $pid failed"
383 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
384 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
387 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
390 replay_barrier $SINGLEMDS
393 mcreate $DIR/$tfile-2
395 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
396 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
397 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
399 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
402 replay_barrier $SINGLEMDS
403 multiop_bg_pause $DIR/$tfile O_c ||
404 error "multiop_bg_pause $DIR/$tfile failed"
407 kill -USR1 $pid || error "multiop $pid not running"
408 wait $pid || error "multiop $pid failed"
409 $CHECKSTAT -t file $DIR/$tfile ||
410 error "$CHECKSTAT $DIR/$tfile attribute check failed"
413 run_test 17 "|X| open(O_CREAT), |replay| close"
416 replay_barrier $SINGLEMDS
417 multiop_bg_pause $DIR/$tfile O_tSc ||
418 error "multiop_bg_pause $DIR/$tfile failed"
421 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
422 echo "pid: $pid will close"
423 kill -USR1 $pid || error "multiop $pid not running"
424 wait $pid || error "multiop $pid failed"
427 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
428 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
429 # this touch frequently fails
430 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
431 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
432 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
435 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
437 # bug 1855 (a simpler form of test_11 above)
439 replay_barrier $SINGLEMDS
441 echo "old" > $DIR/$tfile
442 mv $DIR/$tfile $DIR/$tfile-2
443 grep old $DIR/$tfile-2
445 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
447 run_test 19 "mcreate, open, write, rename "
449 test_20a() { # was test_20
450 replay_barrier $SINGLEMDS
451 multiop_bg_pause $DIR/$tfile O_tSc ||
452 error "multiop_bg_pause $DIR/$tfile failed"
457 kill -USR1 $pid || error "multiop $pid not running"
458 wait $pid || error "multiop $pid failed"
459 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
462 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
464 test_20b() { # bug 10480
465 local wait_timeout=$((TIMEOUT * 4))
466 local extra=$(fs_log_size)
470 save_layout_restore_at_exit $MOUNT
471 $LFS setstripe -i 0 -c 1 $DIR
473 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
475 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
476 while [ ! -e $DIR/$tfile ] ; do
477 sleep 0.01 # give dd a chance to start
480 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
482 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
484 client_up || client_up || true # reconnect
486 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
488 fail $SINGLEMDS # start orphan recovery
489 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
490 wait_delete_completed $wait_timeout || error "delete did not finish"
494 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
495 log "before $beforeused, after $afterused"
497 (( $beforeused + $extra >= $afterused )) && break
498 n_attempts=$((n_attempts + 1))
499 [ $n_attempts -gt 3 ] &&
500 error "after $afterused > before $beforeused + $extra"
502 wait_zfs_commit $SINGLEMDS 5
507 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
509 test_20c() { # bug 10480
510 multiop_bg_pause $DIR/$tfile Ow_c ||
511 error "multiop_bg_pause $DIR/$tfile failed"
517 client_up || client_up || true # reconnect
519 kill -USR1 $pid || error "multiop $pid not running"
520 wait $pid || error "multiop $pid failed"
521 [ -s $DIR/$tfile ] || error "File was truncated"
525 run_test 20c "check that client eviction does not affect file content"
528 replay_barrier $SINGLEMDS
529 multiop_bg_pause $DIR/$tfile O_tSc ||
530 error "multiop_bg_pause $DIR/$tfile failed"
533 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
536 kill -USR1 $pid || error "multiop $pid not running"
537 wait $pid || error "multiop $pid failed"
538 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
539 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
542 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
545 multiop_bg_pause $DIR/$tfile O_tSc ||
546 error "multiop_bg_pause $DIR/$tfile failed"
549 replay_barrier $SINGLEMDS
553 kill -USR1 $pid || error "multiop $pid not running"
554 wait $pid || error "multiop $pid failed"
555 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
558 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
561 multiop_bg_pause $DIR/$tfile O_tSc ||
562 error "multiop_bg_pause $DIR/$tfile failed"
565 replay_barrier $SINGLEMDS
567 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
570 kill -USR1 $pid || error "multiop $pid not running"
571 wait $pid || error "multiop $pid failed"
572 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
573 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
576 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
579 multiop_bg_pause $DIR/$tfile O_tSc ||
580 error "multiop_bg_pause $DIR/$tfile failed"
583 replay_barrier $SINGLEMDS
586 kill -USR1 $pid || error "multiop $pid not running"
587 wait $pid || error "multiop $pid failed"
588 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
591 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
594 multiop_bg_pause $DIR/$tfile O_tSc ||
595 error "multiop_bg_pause $DIR/$tfile failed"
599 replay_barrier $SINGLEMDS
601 kill -USR1 $pid || error "multiop $pid not running"
602 wait $pid || error "multiop $pid failed"
603 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
606 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
609 replay_barrier $SINGLEMDS
610 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
611 error "multiop_bg_pause $DIR/$tfile-1 failed"
613 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
614 error "multiop_bg_pause $DIR/$tfile-2 failed"
618 kill -USR1 $pid2 || error "second multiop $pid2 not running"
619 wait $pid2 || error "second multiop $pid2 failed"
622 kill -USR1 $pid1 || error "multiop $pid1 not running"
623 wait $pid1 || error "multiop $pid1 failed"
624 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
625 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
628 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
631 replay_barrier $SINGLEMDS
632 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
633 error "multiop_bg_pause $DIR/$tfile-1 failed"
635 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
636 error "multiop_bg_pause $DIR/$tfile-2 failed"
642 kill -USR1 $pid1 || error "multiop $pid1 not running"
643 wait $pid1 || error "multiop $pid1 failed"
644 kill -USR1 $pid2 || error "second multiop $pid2 not running"
645 wait $pid2 || error "second multiop $pid2 failed"
646 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
647 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
650 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
653 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
654 error "multiop_bg_pause $DIR/$tfile-1 failed"
656 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
657 error "multiop_bg_pause $DIR/$tfile-2 failed"
659 replay_barrier $SINGLEMDS
662 kill -USR1 $pid2 || error "second multiop $pid2 not running"
663 wait $pid2 || error "second multiop $pid2 failed"
666 kill -USR1 $pid1 || error "multiop $pid1 not running"
667 wait $pid1 || error "multiop $pid1 failed"
668 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
669 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
672 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
675 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
676 error "multiop_bg_pause $DIR/$tfile-1 failed"
678 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
679 error "multiop_bg_pause $DIR/$tfile-2 failed"
681 replay_barrier $SINGLEMDS
686 kill -USR1 $pid1 || error "multiop $pid1 not running"
687 wait $pid1 || error "multiop $pid1 failed"
688 kill -USR1 $pid2 || error "second multiop $pid2 not running"
689 wait $pid2 || error "second multiop $pid2 failed"
690 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
691 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
694 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
697 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
698 error "multiop_bg_pause $DIR/$tfile-1 failed"
700 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
701 error "multiop_bg_pause $DIR/$tfile-2 failed"
706 replay_barrier $SINGLEMDS
708 kill -USR1 $pid1 || error "multiop $pid1 not running"
709 wait $pid1 || error "multiop $pid1 failed"
710 kill -USR1 $pid2 || error "second multiop $pid2 not running"
711 wait $pid2 || error "second multiop $pid2 failed"
712 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
713 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
716 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
719 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
720 error "multiop_bg_pause $DIR/$tfile-1 failed"
722 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
723 error "multiop_bg_pause $DIR/$tfile-2 failed"
727 replay_barrier $SINGLEMDS
730 kill -USR1 $pid1 || error "multiop $pid1 not running"
731 wait $pid1 || error "multiop $pid1 failed"
732 kill -USR1 $pid2 || error "second multiop $pid2 not running"
733 wait $pid2 || error "second multiop $pid2 failed"
734 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
735 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
738 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
740 # tests for bug 2104; completion without crashing is success. The close is
741 # stale, but we always return 0 for close, so the app never sees it.
743 multiop_bg_pause $DIR/$tfile O_c ||
744 error "multiop_bg_pause $DIR/$tfile failed"
746 multiop_bg_pause $DIR/$tfile O_c ||
747 error "second multiop_bg_pause $DIR/$tfile failed"
750 client_up || client_up || error "client_up failed"
751 kill -USR1 $pid1 || error "multiop $pid1 not running"
752 kill -USR1 $pid2 || error "second multiop $pid2 not running"
753 wait $pid1 || error "multiop $pid1 failed"
754 wait $pid2 || error "second multiop $pid2 failed"
757 run_test 32 "close() notices client eviction; close() after client eviction"
760 createmany -o $DIR/$tfile-%d 10 ||
761 error "createmany create $DIR/$tfile failed"
762 replay_barrier_nosync $SINGLEMDS
763 fail_abort $SINGLEMDS
764 # recreate shouldn't fail
765 createmany -o $DIR/$tfile--%d 10 ||
766 error "createmany recreate $DIR/$tfile failed"
770 run_test 33a "fid seq shouldn't be reused after abort recovery"
773 #define OBD_FAIL_SEQ_ALLOC 0x1311
774 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
776 createmany -o $DIR/$tfile-%d 10
777 replay_barrier_nosync $SINGLEMDS
778 fail_abort $SINGLEMDS
779 # recreate shouldn't fail
780 createmany -o $DIR/$tfile--%d 10 ||
781 error "createmany recreate $DIR/$tfile failed"
785 run_test 33b "test fid seq allocation"
788 multiop_bg_pause $DIR/$tfile O_c ||
789 error "multiop_bg_pause $DIR/$tfile failed"
793 replay_barrier $SINGLEMDS
794 fail_abort $SINGLEMDS
795 kill -USR1 $pid || error "multiop $pid not running"
796 wait $pid || error "multiop $pid failed"
797 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
801 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
803 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
805 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
807 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
808 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
813 # give a chance to remove from MDS
814 fail_abort $SINGLEMDS
815 $CHECKSTAT -t file $DIR/$tfile &&
816 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
819 run_test 35 "test recovery from llog for unlink op"
821 # b=2432 resent cancel after replay uses wrong cookie,
822 # so don't resend cancels
824 replay_barrier $SINGLEMDS
826 checkstat $DIR/$tfile
827 facet_failover $SINGLEMDS
829 if $LCTL dk | grep "stale lock .*cookie"; then
830 error "cancel after replay failed"
833 run_test 36 "don't resend cancel"
836 # directory orphans can't be unlinked from PENDING directory
838 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
839 rmdir $DIR/$tdir/$tfile 2>/dev/null
840 multiop_bg_pause $DIR/$tdir/$tfile dD_c ||
841 error "multiop_bg_pause $tfile failed"
843 rmdir $DIR/$tdir/$tfile
845 replay_barrier $SINGLEMDS
846 # clear the dmesg buffer so we only see errors from this recovery
847 do_facet $SINGLEMDS dmesg -c >/dev/null
848 fail_abort $SINGLEMDS
849 kill -USR1 $pid || error "multiop $pid not running"
850 do_facet $SINGLEMDS dmesg | grep "error unlinking orphan" &&
851 error "error unlinking files"
852 wait $pid || error "multiop $pid failed"
856 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
859 createmany -o $DIR/$tfile-%d 800 ||
860 error "createmany -o $DIR/$tfile failed"
861 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
862 replay_barrier $SINGLEMDS
864 unlinkmany $DIR/$tfile-%d 400 400 ||
865 error "unlinkmany $DIR/$tfile 400 failed"
867 $CHECKSTAT -t file $DIR/$tfile-* &&
868 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
871 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
873 test_39() { # bug 4176
874 createmany -o $DIR/$tfile-%d 800 ||
875 error "createmany -o $DIR/$tfile failed"
876 replay_barrier $SINGLEMDS
877 unlinkmany $DIR/$tfile-%d 0 400
879 unlinkmany $DIR/$tfile-%d 400 400 ||
880 error "unlinkmany $DIR/$tfile 400 failed"
882 $CHECKSTAT -t file $DIR/$tfile-* &&
883 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
886 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
889 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
894 # always need connection to MDS to verify layout during IO. LU-2628.
895 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
896 skip "layout_lock needs MDS connection for IO" && return 0
898 $LCTL mark multiop $MOUNT/$tfile OS_c
899 multiop $MOUNT/$tfile OS_c &
901 writeme -s $MOUNT/${tfile}-2 &
904 facet_failover $SINGLEMDS
905 #define OBD_FAIL_MDS_CONNECT_NET 0x117
906 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
908 stat1=$(count_ost_writes)
910 stat2=$(count_ost_writes)
911 echo "$stat1, $stat2"
912 if [ $stat1 -lt $stat2 ]; then
913 echo "writes continuing during recovery"
916 echo "writes not continuing during recovery, bug 2477"
919 echo "waiting for writeme $WRITE_PID"
923 echo "waiting for multiop $PID"
924 wait $PID || error "multiop $PID failed"
925 do_facet client munlink $MOUNT/$tfile ||
926 error "munlink $MOUNT/$tfile failed"
927 do_facet client munlink $MOUNT/${tfile}-2 ||
928 error "munlink $MOUNT/$tfile-2 failed"
931 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
934 # make sure that a read to one osc doesn't try to double-unlock its page just
935 # because another osc is invalid. trigger_group_io used to mistakenly return
936 # an error if any oscs were invalid even after having successfully put rpcs
937 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
938 # the page, guarnateeing that the unlock from the RPC completion would
939 # assert on trying to unlock the unlocked page.
941 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
943 local f=$MOUNT/$tfile
944 # make sure the start of the file is ost1
945 $LFS setstripe -S $((128 * 1024)) -i 0 $f
946 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
947 error "dd on client failed"
949 # fail ost2 and read from ost1
950 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
951 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
952 grep $mdtosc | awk '{print $1}')
953 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
954 lctl get_param -n devices &&
955 error "OST 2 $osc2dev does not exist"
956 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
957 error "deactive device on $SINGLEMDS failed"
958 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
959 error "second dd on client failed"
960 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
961 error "active device on $SINGLEMDS failed"
964 run_test 41 "read from a valid osc while other oscs are invalid"
966 # test MDS recovery after ost failure
968 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
969 createmany -o $DIR/$tfile-%d 800 ||
970 error "createmany -o $DIR/$tfile failed"
972 unlinkmany $DIR/$tfile-%d 0 400
974 lctl set_param debug=-1
977 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
978 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
979 #[ $blocks_after -lt $blocks ] || return 1
980 echo "wait for MDS to timeout and recover"
981 sleep $((TIMEOUT * 2))
983 unlinkmany $DIR/$tfile-%d 400 400 ||
984 error "unlinkmany $DIR/$tfile 400 failed"
985 $CHECKSTAT -t file $DIR/$tfile-* &&
986 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
989 run_test 42 "recovery after ost failure"
991 # timeout in MDS/OST recovery RPC will LBUG MDS
992 test_43() { # bug 2530
993 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
995 replay_barrier $SINGLEMDS
997 # OBD_FAIL_OST_CREATE_NET 0x204
998 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1004 run_test 43 "mds osc import failure during recovery; don't LBUG"
1006 test_44a() { # was test_44
1007 local at_max_saved=0
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 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1015 # adaptive timeouts slow this way down
1016 if at_is_enabled; then
1017 at_max_saved=$(at_max_get mds)
1021 for i in $(seq 1 10); do
1022 echo "$i of 10 ($(date +%s))"
1023 do_facet $SINGLEMDS \
1024 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1025 #define OBD_FAIL_TGT_CONN_RACE 0x701
1026 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1027 # lctl below may fail, it is valid case
1028 $LCTL --device $mdcdev recover
1031 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1032 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1035 run_test 44a "race in target handle connect"
1038 local mdcdev=$($LCTL dl |
1039 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1040 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1041 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1042 { echo mdcdev=$mdcdev; $LCTL dl;
1043 error "more than one ${FSNAME}-MDT0000-mdc"; }
1045 for i in $(seq 1 10); do
1046 echo "$i of 10 ($(date +%s))"
1047 do_facet $SINGLEMDS \
1048 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1049 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1050 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1051 # lctl below may fail, it is valid case
1052 $LCTL --device $mdcdev recover
1057 run_test 44b "race in target handle connect"
1060 replay_barrier $SINGLEMDS
1061 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1062 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1063 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1064 fail_abort $SINGLEMDS
1065 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1067 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1070 run_test 44c "race in target handle connect"
1072 # Handle failed close
1074 local mdcdev=$($LCTL get_param -n devices |
1075 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1076 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1077 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1078 { echo mdcdev=$mdcdev; $LCTL dl;
1079 error "more than one ${FSNAME}-MDT0000-mdc"; }
1081 $LCTL --device $mdcdev recover ||
1082 error "$LCTL --device $mdcdev recover failed"
1084 multiop_bg_pause $DIR/$tfile O_c ||
1085 error "multiop_bg_pause $DIR/$tfile failed"
1088 # This will cause the CLOSE to fail before even
1089 # allocating a reply buffer
1090 $LCTL --device $mdcdev deactivate ||
1091 error "$LCTL --device $mdcdev deactivate failed"
1094 kill -USR1 $pid || error "multiop $pid not running"
1095 wait $pid || error "multiop $pid failed"
1097 $LCTL --device $mdcdev activate ||
1098 error "$LCTL --device $mdcdev activate failed"
1101 $CHECKSTAT -t file $DIR/$tfile ||
1102 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1105 run_test 45 "Handle failed close"
1108 drop_reply "touch $DIR/$tfile"
1110 # ironically, the previous test, 45, will cause a real forced close,
1111 # so just look for one for this test
1112 local FID=$($LFS path2fid $tfile)
1113 $LCTL dk | grep -i "force closing file handle $FID" &&
1114 error "found force closing in dmesg"
1117 run_test 46 "Don't leak file handle after open resend (3325)"
1119 test_47() { # bug 2824
1120 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1122 # create some files to make sure precreate has been done on all
1123 # OSTs. (just in case this test is run independently)
1124 createmany -o $DIR/$tfile 20 ||
1125 error "createmany create $DIR/$tfile failed"
1127 # OBD_FAIL_OST_CREATE_NET 0x204
1129 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1130 client_up || error "client_up failed"
1132 # let the MDS discover the OST failure, attempt to recover, fail
1133 # and recover again.
1134 sleep $((3 * TIMEOUT))
1136 # Without 2824, this createmany would hang
1137 createmany -o $DIR/$tfile 20 ||
1138 error "createmany recraete $DIR/$tfile failed"
1139 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1143 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1146 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1147 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1149 replay_barrier $SINGLEMDS
1150 createmany -o $DIR/$tfile 20 ||
1151 error "createmany -o $DIR/$tfile failed"
1152 # OBD_FAIL_OST_EROFS 0x216
1153 facet_failover $SINGLEMDS
1154 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1155 client_up || error "client_up failed"
1157 # let the MDS discover the OST failure, attempt to recover, fail
1158 # and recover again.
1159 sleep $((3 * TIMEOUT))
1161 createmany -o $DIR/$tfile 20 20 ||
1162 error "createmany recraete $DIR/$tfile failed"
1163 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1166 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1169 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1170 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1171 grep $mdtosc | awk '{print $1}')
1172 [ "$oscdev" ] || error "could not find OSC device on MDS"
1173 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1174 error "OSC device $oscdev recovery failed"
1175 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1176 error "second OSC device $oscdev recovery failed"
1177 # give the mds_lov_sync threads a chance to run
1180 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1182 # b3764 timed out lock replay
1184 [ "$MDS1_VERSION" -lt $(version_code 2.6.90) ] &&
1185 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly"
1187 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1188 cancel_lru_locks mdc
1190 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1193 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1194 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1195 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1197 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1199 wait $mpid || error "multiop_bg_pause pid failed"
1201 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1202 lctl set_param fail_loc=0x0
1203 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1206 run_test 52 "time out lock replay (3764)"
1208 # bug 3462 - simultaneous MDC requests
1210 [[ $(lctl get_param mdc.*.import |
1211 grep "connect_flags:.*multi_mod_rpc") ]] ||
1212 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1214 cancel_lru_locks mdc # cleanup locks from former test cases
1215 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1216 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1217 multiop $DIR/${tdir}-1/f O_c &
1219 # give multiop a change to open
1222 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1223 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1224 kill -USR1 $close_pid
1225 cancel_lru_locks mdc # force the close
1226 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1228 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1230 # close should still be here
1231 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1233 replay_barrier_nodf $SINGLEMDS
1235 wait $close_pid || error "close_pid $close_pid failed"
1237 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1238 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1239 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1240 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1241 rm -rf $DIR/${tdir}-*
1243 run_test 53a "|X| close request while two MDC requests in flight"
1246 cancel_lru_locks mdc # cleanup locks from former test cases
1248 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1249 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1250 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1251 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1254 #define OBD_FAIL_MDS_REINT_NET 0x107
1255 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1256 mcreate $DIR/${tdir}-2/f &
1260 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1261 kill -USR1 $close_pid
1262 cancel_lru_locks mdc # force the close
1263 wait $close_pid || error "close_pid $close_pid failed"
1264 # open should still be here
1265 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1267 replay_barrier_nodf $SINGLEMDS
1269 wait $open_pid || error "open_pid failed"
1271 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1272 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1273 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1274 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1275 rm -rf $DIR/${tdir}-*
1277 run_test 53b "|X| open request while two MDC requests in flight"
1280 cancel_lru_locks mdc # cleanup locks from former test cases
1282 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1283 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1284 multiop $DIR/${tdir}-1/f O_c &
1287 #define OBD_FAIL_MDS_REINT_NET 0x107
1288 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1289 mcreate $DIR/${tdir}-2/f &
1293 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1294 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1295 kill -USR1 $close_pid
1296 cancel_lru_locks mdc # force the close
1298 #bz20647: make sure all pids exist before failover
1299 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1300 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1301 replay_barrier_nodf $SINGLEMDS
1302 fail_nodf $SINGLEMDS
1303 wait $open_pid || error "open_pid failed"
1305 # close should be gone
1306 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1307 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1309 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1310 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1311 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1312 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1313 rm -rf $DIR/${tdir}-*
1315 run_test 53c "|X| open request and close request while two MDC requests in flight"
1318 [[ $(lctl get_param mdc.*.import |
1319 grep "connect_flags:.*multi_mod_rpc") ]] ||
1320 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1322 cancel_lru_locks mdc # cleanup locks from former test cases
1324 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1325 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1326 multiop $DIR/${tdir}-1/f O_c &
1328 # give multiop a chance to open
1331 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1332 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1333 kill -USR1 $close_pid
1334 cancel_lru_locks mdc # force the close
1335 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1336 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1338 # close should still be here
1339 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1341 wait $close_pid || error "close_pid failed"
1343 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1344 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1345 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1346 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1347 rm -rf $DIR/${tdir}-*
1349 run_test 53d "close reply while two MDC requests in flight"
1352 cancel_lru_locks mdc # cleanup locks from former test cases
1354 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1355 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1356 multiop $DIR/${tdir}-1/f O_c &
1359 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1360 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1361 mcreate $DIR/${tdir}-2/f &
1365 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1366 kill -USR1 $close_pid
1367 cancel_lru_locks mdc # force the close
1368 wait $close_pid || error "close_pid failed"
1369 # open should still be here
1370 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1372 replay_barrier_nodf $SINGLEMDS
1374 wait $open_pid || error "open_pid failed"
1376 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1377 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1378 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1379 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1380 rm -rf $DIR/${tdir}-*
1382 run_test 53e "|X| open reply while two MDC requests in flight"
1385 cancel_lru_locks mdc # cleanup locks from former test cases
1387 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1388 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1389 multiop $DIR/${tdir}-1/f O_c &
1392 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1393 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1394 mcreate $DIR/${tdir}-2/f &
1398 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1399 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1400 kill -USR1 $close_pid
1401 cancel_lru_locks mdc # force the close
1403 #bz20647: make sure all pids are exists before failover
1404 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1405 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1406 replay_barrier_nodf $SINGLEMDS
1407 fail_nodf $SINGLEMDS
1408 wait $open_pid || error "open_pid failed"
1410 # close should be gone
1411 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1412 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1414 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1415 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1416 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1417 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1418 rm -rf $DIR/${tdir}-*
1420 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1423 cancel_lru_locks mdc # cleanup locks from former test cases
1425 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1426 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1427 multiop $DIR/${tdir}-1/f O_c &
1430 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1431 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1432 mcreate $DIR/${tdir}-2/f &
1436 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1437 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1438 kill -USR1 $close_pid
1439 cancel_lru_locks mdc # force the close
1440 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1442 #bz20647: make sure all pids are exists before failover
1443 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1444 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1445 replay_barrier_nodf $SINGLEMDS
1446 fail_nodf $SINGLEMDS
1447 wait $open_pid || error "open_pid failed"
1449 # close should be gone
1450 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1452 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1453 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1454 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1455 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1456 rm -rf $DIR/${tdir}-*
1458 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1461 cancel_lru_locks mdc # cleanup locks from former test cases
1463 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1464 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1465 multiop $DIR/${tdir}-1/f O_c &
1468 #define OBD_FAIL_MDS_REINT_NET 0x107
1469 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1470 mcreate $DIR/${tdir}-2/f &
1474 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1475 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1476 kill -USR1 $close_pid
1477 cancel_lru_locks mdc # force the close
1480 #bz20647: make sure all pids are exists before failover
1481 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1482 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1483 replay_barrier_nodf $SINGLEMDS
1484 fail_nodf $SINGLEMDS
1485 wait $open_pid || error "open_pid failed"
1487 # close should be gone
1488 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1489 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1491 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1492 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1493 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1494 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1495 rm -rf $DIR/${tdir}-*
1497 run_test 53h "open request and close reply while two MDC requests in flight"
1499 #b3761 ASSERTION(hash != 0) failed
1501 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1502 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1504 # give touch a chance to run
1506 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1510 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1512 #b3440 ASSERTION(rec->ur_fid2->id) failed
1514 ln -s foo $DIR/$tfile
1515 replay_barrier $SINGLEMDS
1516 #drop_reply "cat $DIR/$tfile"
1520 run_test 56 "don't replay a symlink open request (3440)"
1522 #recovery one mds-ost setattr from llog
1524 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1525 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1526 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1527 replay_barrier $SINGLEMDS
1529 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1530 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1531 $CHECKSTAT -t file $DIR/$tfile ||
1532 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1533 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1536 run_test 57 "test recovery from llog for setattr op"
1539 zconf_umount $(hostname) $MOUNT2
1543 #recovery many mds-ost setattr from llog
1545 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1546 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1547 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1548 createmany -o $DIR/$tdir/$tfile-%d 2500
1549 replay_barrier $SINGLEMDS
1552 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1553 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1554 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1555 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1556 error "unlinkmany $DIR/$tfile failed"
1559 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1565 trap cleanup_58 EXIT
1567 large_xattr_enabled &&
1568 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1569 # Original extended attribute can be long. Print a small version of
1570 # attribute if an error occurs
1571 local sm_msg=$(printf "%.9s" $orig)
1573 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1574 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1575 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1576 replay_barrier $SINGLEMDS
1577 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1579 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1580 [[ "$new" = "$orig" ]] ||
1581 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1582 rm -f $DIR/$tdir/$tfile
1585 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1587 run_test 58b "test replay of setxattr op"
1589 test_58c() { # bug 16570
1594 trap cleanup_58 EXIT
1596 if large_xattr_enabled; then
1597 local xattr_size=$(max_xattr_size)
1598 orig="$(generate_string $((xattr_size / 2)))"
1599 orig1="$(generate_string $xattr_size)"
1605 # PING_INTERVAL max(obd_timeout / 4, 1U)
1606 sleep $((TIMEOUT / 4))
1608 # Original extended attribute can be long. Print a small version of
1609 # attribute if an error occurs
1610 local sm_msg=$(printf "%.9s" $orig)
1611 local sm_msg1=$(printf "%.9s" $orig1)
1613 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1614 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1615 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1616 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1617 error "drop_request for setfattr failed"
1618 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1619 [[ "$new" = "$orig" ]] ||
1620 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1621 drop_reint_reply "setfattr -n trusted.foo1 \
1622 -v $orig1 $DIR/$tdir/$tfile" ||
1623 error "drop_reint_reply for setfattr failed"
1624 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1625 [[ "$new" = "$orig1" ]] ||
1626 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1627 rm -f $DIR/$tdir/$tfile
1631 run_test 58c "resend/reconstruct setxattr op"
1633 # log_commit_thread vs filter_destroy race used to lead to import use after free
1636 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1638 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1639 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1640 error "createmany create files failed"
1642 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1643 error "unlinkmany $DIR/$tdir/$tfile failed"
1644 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1645 do_facet ost1 "lctl set_param fail_loc=0x507"
1648 do_facet ost1 "lctl set_param fail_loc=0x0"
1652 run_test 59 "test log_commit_thread vs filter_destroy race"
1654 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1655 # bug 12086: should no oops and No ctxt error for this test
1657 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1658 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1659 error "createmany create files failed"
1660 replay_barrier $SINGLEMDS
1661 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1663 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1664 local no_ctxt=$(dmesg | grep "No ctxt")
1665 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1667 run_test 60 "test llog post recovery init vs llog unlink"
1669 #test race llog recovery thread vs llog cleanup
1670 test_61a() { # was test_61
1671 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1673 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1674 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1675 error "createmany create files failed"
1677 unlinkmany $DIR/$tdir/$tfile-%d 800
1678 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1679 set_nodes_failloc "$(osts_nodes)" 0x80000221
1684 set_nodes_failloc "$(osts_nodes)" 0x0
1686 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1687 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1690 run_test 61a "test race llog recovery vs llog cleanup"
1692 #test race mds llog sync vs llog cleanup
1694 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1695 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1696 facet_failover $SINGLEMDS
1699 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1702 run_test 61b "test race mds llog sync vs llog cleanup"
1704 #test race cancel cookie cb vs llog cleanup
1706 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1708 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1709 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1710 set_nodes_failloc "$(osts_nodes)" 0x80000222
1714 set_nodes_failloc "$(osts_nodes)" 0x0
1716 run_test 61c "test race mds llog sync vs llog cleanup"
1718 test_61d() { # bug 16002 # bug 17466 # bug 22137
1719 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1721 do_facet mgs "lctl set_param fail_loc=0x80000605"
1722 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1723 error "mgs start should have failed"
1724 do_facet mgs "lctl set_param fail_loc=0"
1725 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1727 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1729 test_62() { # Bug 15756 - don't mis-drop resent replay
1730 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1731 replay_barrier $SINGLEMDS
1732 createmany -o $DIR/$tdir/$tfile- 25 ||
1733 error "createmany create files failed"
1734 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1735 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1737 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1738 unlinkmany $DIR/$tdir/$tfile- 25 ||
1739 error "unlinkmany $DIR/$tdir/$tfile failed"
1742 run_test 62 "don't mis-drop resent replay"
1744 #Adaptive Timeouts (bug 3055)
1752 echo "Cleaning up AT ..."
1753 if [ -n "$ATOLDBASE" ]; then
1754 local at_history=$($LCTL get_param -n at_history)
1755 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1756 do_facet ost1 "lctl set_param at_history=$at_history" || true
1759 if [ $AT_MAX_SET -ne 0 ]; then
1760 for facet in mds client ost; do
1761 var=AT_MAX_SAVE_${facet}
1762 echo restore AT on $facet to saved value ${!var}
1763 at_max_set ${!var} $facet
1764 at_new=$(at_max_get $facet)
1765 echo Restored AT value on $facet $at_new
1766 [ $at_new -eq ${!var} ] ||
1767 error "AT value not restored SAVED ${!var} NEW $at_new"
1774 local at_max_new=600
1776 # Save at_max original values
1778 if [ $AT_MAX_SET -eq 0 ]; then
1779 # Suppose that all osts have the same at_max
1780 for facet in mds client ost; do
1781 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1785 for facet in mds client ost; do
1786 at_max=$(at_max_get $facet)
1787 if [ $at_max -ne $at_max_new ]; then
1788 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1789 at_max_set $at_max_new $facet
1794 if [ -z "$ATOLDBASE" ]; then
1795 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1796 # speed up the timebase so we can check decreasing AT
1797 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1798 do_facet ost1 "lctl set_param at_history=8" || true
1800 # sleep for a while to cool down, should be > 8s and also allow
1801 # at least one ping to be sent. simply use TIMEOUT to be safe.
1806 test_65a() #bug 3055
1808 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1810 at_start || return 0
1811 $LCTL dk > /dev/null
1813 $LCTL set_param debug="other"
1814 # Slow down a request to the current service time, this is critical
1815 # because previous tests may have caused this value to increase.
1816 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1817 awk '/portal 12/ {print $5}'`
1818 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1820 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1821 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1822 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1823 createmany -o $DIR/$tfile 10 > /dev/null
1824 unlinkmany $DIR/$tfile 10 > /dev/null
1825 # check for log message
1826 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1828 # client should show REQ_DELAY estimates
1829 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1831 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1833 run_test 65a "AT: verify early replies"
1835 test_65b() #bug 3055
1837 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1839 at_start || return 0
1842 $LCTL set_param debug="other trace"
1843 $LCTL dk > /dev/null
1844 # Slow down a request to the current service time, this is critical
1845 # because previous tests may have caused this value to increase.
1846 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1847 error "$LFS setstripe failed for $DIR/$tfile"
1849 multiop $DIR/$tfile Ow1yc
1850 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1851 awk '/portal 6/ {print $5}'`
1852 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1854 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1855 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1856 do_facet ost1 $LCTL set_param fail_loc=0x224
1859 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1860 error "$LFS setstripe failed"
1861 # force some real bulk transfer
1862 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1864 do_facet ost1 $LCTL set_param fail_loc=0
1865 # check for log message
1866 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1868 # client should show REQ_DELAY estimates
1869 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1871 run_test 65b "AT: verify early replies on packed reply / bulk"
1873 test_66a() #bug 3055
1875 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1877 at_start || return 0
1878 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1879 # adjust 5s at a time so no early reply is sent (within deadline)
1880 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1881 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1882 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1883 createmany -o $DIR/$tfile 20 > /dev/null
1884 unlinkmany $DIR/$tfile 20 > /dev/null
1885 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1886 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1887 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1888 createmany -o $DIR/$tfile 20 > /dev/null
1889 unlinkmany $DIR/$tfile 20 > /dev/null
1890 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1891 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1893 createmany -o $DIR/$tfile 20 > /dev/null
1894 unlinkmany $DIR/$tfile 20 > /dev/null
1895 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1896 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1897 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1898 echo "Current MDT timeout $CUR, worst $WORST"
1899 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1901 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1903 test_66b() #bug 3055
1905 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1907 at_start || return 0
1908 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1909 awk '/network/ {print $4}')
1910 $LCTL set_param fail_val=$(($ORIG + 5))
1911 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1912 $LCTL set_param fail_loc=0x50c
1913 touch $DIR/$tfile > /dev/null 2>&1
1914 $LCTL set_param fail_loc=0
1915 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1916 awk '/network/ {print $4}')
1917 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1918 awk '/network/ {print $6}')
1919 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1920 [ $WORST -gt $ORIG ] ||
1921 error "Worst $WORST should be worse than orig $ORIG"
1923 run_test 66b "AT: verify net latency adjusts"
1925 test_67a() #bug 3055
1927 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1929 at_start || return 0
1930 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1931 # sleeping threads may drive values above this
1932 do_facet ost1 "$LCTL set_param fail_val=400"
1933 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1934 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1935 createmany -o $DIR/$tfile 20 > /dev/null
1936 unlinkmany $DIR/$tfile 20 > /dev/null
1937 do_facet ost1 "$LCTL set_param fail_loc=0"
1938 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1939 ATTEMPTS=$(($CONN2 - $CONN1))
1940 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1941 [ $ATTEMPTS -gt 0 ] &&
1942 error_ignore bz13721 "AT should have prevented reconnect"
1945 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1947 test_67b() #bug 3055
1949 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1951 at_start || return 0
1952 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1954 # exhaust precreations on ost1
1955 local OST=$(ostname_from_index 0)
1956 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1957 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1958 osp.$mdtosc.prealloc_last_id)
1959 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1960 osp.$mdtosc.prealloc_next_id)
1962 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1963 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${OST} ||
1964 error "$LFS setstripe failed"
1965 echo "Creating to objid $last_id on ost $OST..."
1966 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1967 do_facet ost1 "$LCTL set_param fail_val=20000"
1968 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1969 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1972 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1974 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1975 ATTEMPTS=$(($CONN2 - $CONN1))
1976 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1977 # do it again; should not timeout
1978 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1979 cp /etc/profile $DIR/$tfile || error "cp failed"
1980 do_facet ost1 "$LCTL set_param fail_loc=0"
1982 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1983 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1984 ATTEMPTS=$(($CONN3 - $CONN2))
1985 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1986 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1989 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1991 test_68 () #bug 13813
1993 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1995 at_start || return 0
1996 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1997 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1998 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1999 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
2000 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2001 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2002 echo $TIMEOUT >> $ldlm_enqueue_min
2003 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2005 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2006 $LFS setstripe --stripe-index=0 -c 1 $DIR/$tdir ||
2007 error "$LFS setstripe failed for $DIR/$tdir"
2008 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2009 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2010 $LCTL set_param fail_loc=0x80000312
2011 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2012 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2013 $LCTL set_param fail_loc=0x80000312
2014 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2015 $LCTL set_param fail_loc=0
2017 echo $ENQ_MIN >> $ldlm_enqueue_min
2018 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2022 run_test 68 "AT: verify slowing locks"
2025 # end of AT tests includes above lines
2027 # start multi-client tests
2029 [ -z "$CLIENTS" ] &&
2030 { skip "Need two or more clients." && return; }
2031 [ $CLIENTCOUNT -lt 2 ] &&
2032 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2034 echo "mount clients $CLIENTS ..."
2035 zconf_mount_clients $CLIENTS $MOUNT
2037 local clients=${CLIENTS//,/ }
2038 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2039 for CLIENT in $clients; do
2040 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2041 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2042 error "dd failed on $CLIENT"
2045 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2046 for C in ${CLIENTS//,/ }; do
2047 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2048 of=/dev/null 2>/dev/null ||
2049 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2055 run_test 70a "check multi client t-f"
2057 check_for_process () {
2062 killall_process $clients "$prog" -0
2066 local clients=${CLIENTS:-$HOSTNAME}
2068 zconf_mount_clients $clients $MOUNT
2071 [ "$SLOW" = "no" ] && duration=120
2072 # set duration to 900 because it takes some time to boot node
2073 [ "$FAILURE_MODE" = HARD ] && duration=900
2076 local start_ts=$(date +%s)
2077 local cmd="rundbench 1 -t $duration"
2079 if [ $MDSCOUNT -ge 2 ]; then
2080 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2081 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2083 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2084 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2085 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2086 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2089 #LU-1897 wait for all dbench copies to start
2090 while ! check_for_process $clients dbench; do
2091 elapsed=$(($(date +%s) - start_ts))
2092 if [ $elapsed -gt $duration ]; then
2093 killall_process $clients dbench
2094 error "dbench failed to start on $clients!"
2099 log "Started rundbench load pid=$pid ..."
2101 elapsed=$(($(date +%s) - start_ts))
2102 local num_failovers=0
2104 while [ $elapsed -lt $duration ]; do
2105 if ! check_for_process $clients dbench; then
2106 error_noexit "dbench stopped on some of $clients!"
2107 killall_process $clients dbench
2111 replay_barrier mds$fail_index
2112 sleep 1 # give clients a time to do operations
2113 # Increment the number of failovers
2114 num_failovers=$((num_failovers+1))
2115 log "$TESTNAME fail mds$fail_index $num_failovers times"
2117 elapsed=$(($(date +%s) - start_ts))
2118 if [ $fail_index -ge $MDSCOUNT ]; then
2121 fail_index=$((fail_index+1))
2125 wait $pid || error "rundbench load on $clients failed!"
2127 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2128 # end multi-client tests
2133 local monitor_pid=$3
2135 local start_ts=$(date +%s)
2136 local num_failovers=0
2139 elapsed=$(($(date +%s) - start_ts))
2140 while [ $elapsed -lt $duration ]; do
2141 fail_index=$((RANDOM%max_index+1))
2142 kill -0 $monitor_pid ||
2143 error "$monitor_pid stopped"
2145 replay_barrier mds$fail_index
2147 # Increment the number of failovers
2148 num_failovers=$((num_failovers+1))
2149 log "$TESTNAME fail mds$fail_index $num_failovers times"
2151 elapsed=$(($(date +%s) - start_ts))
2157 rm -f $DIR/replay-single.70c.lck
2162 local clients=${CLIENTS:-$HOSTNAME}
2165 zconf_mount_clients $clients $MOUNT
2168 [ "$SLOW" = "no" ] && duration=180
2169 # set duration to 900 because it takes some time to boot node
2170 [ "$FAILURE_MODE" = HARD ] && duration=600
2173 local start_ts=$(date +%s)
2175 trap cleanup_70c EXIT
2177 while [ ! -e $DIR/replay-single.70c.lck ]; do
2178 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2179 if [ $MDSCOUNT -ge 2 ]; then
2180 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2181 error "set default dirstripe failed"
2183 cd $DIR/$tdir || break
2184 tar cf - /etc | tar xf - || error "tar failed in loop"
2188 echo "Started tar $tar_70c_pid"
2190 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2191 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2193 touch $DIR/replay-single.70c.lck
2194 wait $tar_70c_pid || error "$?: tar failed"
2199 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2203 kill -9 $mkdir_70d_pid
2207 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2208 local clients=${CLIENTS:-$HOSTNAME}
2211 zconf_mount_clients $clients $MOUNT
2214 [ "$SLOW" = "no" ] && duration=180
2215 # set duration to 900 because it takes some time to boot node
2216 [ "$FAILURE_MODE" = HARD ] && duration=900
2221 local start_ts=$(date +%s)
2223 trap cleanup_70d EXIT
2226 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2230 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2235 touch $DIR/$tdir/test/a || {
2239 mkdir $DIR/$tdir/test/b || {
2243 rm -rf $DIR/$tdir/test || {
2249 touch $DIR/$tdir/test1/a || {
2253 mkdir $DIR/$tdir/test1/b || {
2258 rm -rf $DIR/$tdir/test1 || {
2260 ls -lR $DIR/$tdir/test1
2266 echo "Started $mkdir_70d_pid"
2268 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2269 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2274 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2277 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2278 local clients=${CLIENTS:-$HOSTNAME}
2281 lctl set_param debug=+ha
2282 zconf_mount_clients $clients $MOUNT
2285 [ "$SLOW" = "no" ] && duration=180
2286 # set duration to 900 because it takes some time to boot node
2287 [ "$FAILURE_MODE" = HARD ] && duration=900
2290 $LFS mkdir -i0 $DIR/$tdir/test_0
2291 $LFS mkdir -i0 $DIR/$tdir/test_1
2292 touch $DIR/$tdir/test_0/a
2293 touch $DIR/$tdir/test_1/b
2296 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2301 checkstat $DIR/$tdir/test_0/a && {
2302 echo "a still exists"
2306 checkstat $DIR/$tdir/test_1/b || {
2307 echo "b still exists"
2311 touch $DIR/$tdir/test_0/a || {
2312 echo "touch a fails"
2316 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2323 stack_trap "kill -9 $rename_70e_pid" EXIT
2324 echo "Started PID=$rename_70e_pid"
2326 random_fail_mdt 2 $duration $rename_70e_pid
2327 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2329 run_test 70e "rename cross-MDT with random fails"
2331 test_70f_write_and_read(){
2336 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2337 for client in ${CLIENTS//,/ }; do
2338 [ -f $stopflag ] || return
2340 local tgtfile=$DIR/$tdir/$tfile.$client
2341 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2342 of=$tgtfile 2>/dev/null ||
2343 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2344 "of=$tgtfile failed on $client, rc=$?"
2347 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2350 for client in ${CLIENTS//,/ }; do
2351 [ -f $stopflag ] || return
2353 # flush client cache in case test is running on only one client
2354 # do_node $client cancel_lru_locks osc
2355 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2357 tgtfile=$DIR/$tdir/$tfile.$client
2358 local md5=$(do_node $prev_client "md5sum $tgtfile")
2359 [ ${checksum[$index]// */} = ${md5// */} ] ||
2360 error "$tgtfile: checksum doesn't match on $prev_client"
2361 index=$((index + 1))
2371 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2372 $LFS setstripe -c -1 $DIR/$tdir ||
2373 error "cannot $LFS setstripe $DIR/$tdir"
2376 while [ -f $stopflag ]; do
2377 test_70f_write_and_read $srcfile $stopflag
2378 # use direct IO and buffer cache in turns if loop
2379 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2383 test_70f_cleanup() {
2385 rm -f $TMP/$tfile.stop
2386 do_nodes $CLIENTS rm -f $TMP/$tfile
2387 rm -f $DIR/$tdir/$tfile.*
2391 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2392 # { skip "Failover host not defined" && return; }
2393 # [ -z "$CLIENTS" ] &&
2394 # { skip "CLIENTS are not specified." && return; }
2395 # [ $CLIENTCOUNT -lt 2 ] &&
2396 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2398 [[ "$OST1_VERSION" -lt $(version_code 2.9.53) ]] &&
2399 skip "Need server version at least 2.9.53"
2401 echo "mount clients $CLIENTS ..."
2402 zconf_mount_clients $CLIENTS $MOUNT
2404 local srcfile=$TMP/$tfile
2408 trap test_70f_cleanup EXIT
2409 # create a different source file local to each client node so we can
2410 # detect if the file wasn't written out properly after failover
2411 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2412 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2413 for client in ${CLIENTS//,/ }; do
2414 checksum[$index]=$(do_node $client "md5sum $srcfile")
2415 index=$((index + 1))
2419 [ "$SLOW" = "no" ] && duration=60
2420 # set duration to 900 because it takes some time to boot node
2421 [ "$FAILURE_MODE" = HARD ] && duration=900
2423 local stopflag=$TMP/$tfile.stop
2424 test_70f_loop $srcfile $stopflag &
2428 local num_failovers=0
2429 local start_ts=$SECONDS
2430 while [ $elapsed -lt $duration ]; do
2434 num_failovers=$((num_failovers + 1))
2435 log "$TESTNAME failing OST $num_failovers times"
2438 elapsed=$((SECONDS - start_ts))
2445 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2449 kill -9 $mkdir_71a_pid
2452 random_double_fail_mdt() {
2455 local monitor_pid=$3
2457 local start_ts=$(date +%s)
2458 local num_failovers=0
2462 elapsed=$(($(date +%s) - start_ts))
2463 while [ $elapsed -lt $duration ]; do
2464 fail_index=$((RANDOM%max_index + 1))
2465 if [ $fail_index -eq $max_index ]; then
2468 second_index=$((fail_index + 1))
2470 kill -0 $monitor_pid ||
2471 error "$monitor_pid stopped"
2473 replay_barrier mds$fail_index
2474 replay_barrier mds$second_index
2476 # Increment the number of failovers
2477 num_failovers=$((num_failovers+1))
2478 log "fail mds$fail_index mds$second_index $num_failovers times"
2479 fail mds${fail_index},mds${second_index}
2480 elapsed=$(($(date +%s) - start_ts))
2485 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2486 local clients=${CLIENTS:-$HOSTNAME}
2489 zconf_mount_clients $clients $MOUNT
2492 [ "$SLOW" = "no" ] && duration=180
2493 # set duration to 900 because it takes some time to boot node
2494 [ "$FAILURE_MODE" = HARD ] && duration=900
2496 mkdir_on_mdt0 $DIR/$tdir
2499 local start_ts=$(date +%s)
2501 trap cleanup_71a EXIT
2504 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2505 rmdir $DIR/$tdir/test
2509 echo "Started $mkdir_71a_pid"
2511 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2512 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2517 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2520 multiop_bg_pause $DIR/$tfile O_tSc ||
2521 error "multiop_bg_pause $DIR/$tfile failed"
2525 replay_barrier $SINGLEMDS
2526 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2527 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2530 wait $pid || error "multiop pid failed"
2531 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2534 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2537 multiop_bg_pause $DIR/$tfile O_tSc ||
2538 error "multiop_bg_pause $DIR/$tfile failed"
2542 replay_barrier $SINGLEMDS
2543 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
2544 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
2547 wait $pid || error "multiop pid failed"
2548 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2551 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2555 local clients=${CLIENTS:-$HOSTNAME}
2557 zconf_umount_clients $clients $MOUNT
2559 facet_failover $SINGLEMDS
2560 zconf_mount_clients $clients $MOUNT
2562 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2563 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2564 clients_up || error "client evicted: $?"
2567 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2569 remote_dir_check_80() {
2574 diridx=$($LFS getstripe -m $remote_dir) ||
2575 error "$LFS getstripe -m $remote_dir failed"
2576 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2578 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2579 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2580 error "$LFS getstripe -m $remote_dir/f-1 failed"
2581 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2587 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2588 ([ $FAILURE_MODE == "HARD" ] &&
2589 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2590 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2594 local remote_dir=$DIR/$tdir/remote_dir
2596 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2597 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2598 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2599 $LFS mkdir -i $MDTIDX $remote_dir &
2605 wait $CLIENT_PID || error "remote creation failed"
2607 remote_dir_check_80 || error "remote dir check failed"
2608 rm -rf $DIR/$tdir || error "rmdir failed"
2612 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2615 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2616 ([ $FAILURE_MODE == "HARD" ] &&
2617 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2618 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 &
2632 fail mds$((MDTIDX + 1))
2634 wait $CLIENT_PID || error "remote creation failed"
2636 remote_dir_check_80 || error "remote dir check failed"
2637 rm -rf $DIR/$tdir || error "rmdir failed"
2641 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2644 [[ "$mds1_FSTYPE" = zfs ]] &&
2645 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2646 skip "requires LU-10143 fix on MDS"
2647 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2648 ([ $FAILURE_MODE == "HARD" ] &&
2649 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2650 skip "MDTs needs to be on diff hosts for HARD fail mode"
2653 local remote_dir=$DIR/$tdir/remote_dir
2655 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2656 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2657 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2658 $LFS mkdir -i $MDTIDX $remote_dir &
2664 fail mds$((MDTIDX + 1))
2666 wait $CLIENT_PID || error "remote creation failed"
2668 remote_dir_check_80 || error "remote dir check failed"
2669 rm -rf $DIR/$tdir || error "rmdir failed"
2673 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2676 [[ "$mds1_FSTYPE" = zfs ]] &&
2677 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2678 skip "requires LU-10143 fix on MDS"
2679 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2681 local remote_dir=$DIR/$tdir/remote_dir
2683 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2684 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2685 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2686 $LFS mkdir -i $MDTIDX $remote_dir &
2689 # sleep 3 seconds to make sure MDTs are failed after
2690 # lfs mkdir -i has finished on all of MDTs.
2695 fail mds${MDTIDX},mds$((MDTIDX + 1))
2697 wait $CLIENT_PID || error "remote creation failed"
2699 remote_dir_check_80 || error "remote dir check failed"
2700 rm -rf $DIR/$tdir || error "rmdir failed"
2704 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2707 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2708 ([ $FAILURE_MODE == "HARD" ] &&
2709 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2710 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2714 local remote_dir=$DIR/$tdir/remote_dir
2716 mkdir_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 &
2722 # sleep 3 seconds to make sure MDTs are failed after
2723 # lfs mkdir -i has finished on all of MDTs.
2729 wait $CLIENT_PID || error "remote creation failed"
2731 remote_dir_check_80 || error "remote dir check failed"
2732 rm -rf $DIR/$tdir || error "rmdir failed"
2736 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2739 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2740 ([ $FAILURE_MODE == "HARD" ] &&
2741 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2742 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2745 local remote_dir=$DIR/$tdir/remote_dir
2747 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2748 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2749 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2750 $LFS mkdir -i $MDTIDX $remote_dir &
2754 fail mds$((MDTIDX + 1))
2756 wait $CLIENT_PID || error "remote creation failed"
2758 remote_dir_check_80 || error "remote dir check failed"
2759 rm -rf $DIR/$tdir || error "rmdir failed"
2763 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2766 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2767 ([ $FAILURE_MODE == "HARD" ] &&
2768 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2769 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2773 local remote_dir=$DIR/$tdir/remote_dir
2775 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2776 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2777 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2778 $LFS mkdir -i $MDTIDX $remote_dir &
2781 # sleep 3 seconds to make sure MDTs are failed after
2782 # lfs mkdir -i has finished on all of MDTs.
2788 fail mds$((MDTIDX + 1))
2790 wait $CLIENT_PID || error "remote creation failed"
2792 remote_dir_check_80 || error "remote dir check failed"
2793 rm -rf $DIR/$tdir || error "rmdir failed"
2797 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2800 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2802 local remote_dir=$DIR/$tdir/remote_dir
2804 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2805 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2806 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2807 $LFS mkdir -i $MDTIDX $remote_dir &
2810 # sleep 3 seconds to make sure MDTs are failed after
2811 # lfs mkdir -i has finished on all of MDTs.
2816 fail mds${MDTIDX},mds$((MDTIDX + 1))
2818 wait $CLIENT_PID || error "remote dir creation failed"
2820 remote_dir_check_80 || error "remote dir check failed"
2821 rm -rf $DIR/$tdir || error "rmdir failed"
2825 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2828 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2829 ([ $FAILURE_MODE == "HARD" ] &&
2830 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2831 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2835 local remote_dir=$DIR/$tdir/remote_dir
2837 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2838 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2840 touch $remote_dir || error "touch $remote_dir failed"
2841 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2842 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2847 fail mds$((MDTIDX + 1))
2849 wait $CLIENT_PID || error "rm remote dir failed"
2851 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2853 rm -rf $DIR/$tdir || error "rmdir failed"
2857 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2860 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2861 ([ $FAILURE_MODE == "HARD" ] &&
2862 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2863 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2866 local remote_dir=$DIR/$tdir/remote_dir
2868 mkdir_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 wait $CLIENT_PID || error "rm remote dir failed"
2881 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2883 rm -rf $DIR/$tdir || error "rmdir failed"
2887 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2890 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2891 ([ $FAILURE_MODE == "HARD" ] &&
2892 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2893 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2897 local remote_dir=$DIR/$tdir/remote_dir
2899 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2900 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2902 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2903 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2910 fail mds$((MDTIDX + 1))
2912 wait $CLIENT_PID || error "rm remote dir failed"
2914 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2916 rm -rf $DIR/$tdir || error "rmdir failed"
2920 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2923 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2925 local remote_dir=$DIR/$tdir/remote_dir
2927 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2928 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2930 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2931 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2937 fail mds${MDTIDX},mds$((MDTIDX + 1))
2939 wait $CLIENT_PID || error "rm remote dir failed"
2941 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2943 rm -rf $DIR/$tdir || error "rmdir failed"
2947 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2950 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2951 ([ $FAILURE_MODE == "HARD" ] &&
2952 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2953 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2957 local remote_dir=$DIR/$tdir/remote_dir
2959 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2960 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2962 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2963 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2966 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2971 wait $CLIENT_PID || error "rm remote dir failed"
2973 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2975 rm -rf $DIR/$tdir || error "rmdir failed"
2979 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2982 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2983 ([ $FAILURE_MODE == "HARD" ] &&
2984 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2985 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2989 local remote_dir=$DIR/$tdir/remote_dir
2991 mkdir_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
3000 fail mds$((MDTIDX + 1))
3002 wait $CLIENT_PID || error "rm remote dir failed"
3004 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3006 rm -rf $DIR/$tdir || error "rmdir failed"
3010 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3013 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3014 ([ $FAILURE_MODE == "HARD" ] &&
3015 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3016 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3020 local remote_dir=$DIR/$tdir/remote_dir
3022 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3023 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3025 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3026 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3033 fail mds$((MDTIDX + 1))
3035 wait $CLIENT_PID || error "rm remote dir failed"
3037 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3039 rm -rf $DIR/$tdir || error "rmdir failed"
3043 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3046 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3048 local remote_dir=$DIR/$tdir/remote_dir
3050 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3051 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3053 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3054 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3060 fail mds${MDTIDX},mds$((MDTIDX + 1))
3062 wait $CLIENT_PID || error "rm remote dir failed"
3064 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3066 rm -rf $DIR/$tdir || error "rmdir failed"
3070 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3073 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3074 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3075 createmany -o $DIR/$tfile- 1 &
3079 client_up || client_up || true # reconnect
3081 run_test 84a "stale open during export disconnect"
3083 test_85a() { #bug 16774
3084 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3086 for i in $(seq 100); do
3087 echo "tag-$i" > $DIR/$tfile-$i
3088 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3091 lov_id=$(lctl dl | grep "clilov")
3092 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3093 count=$(lctl get_param -n \
3094 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3095 echo "before recovery: unused locks count = $count"
3099 count2=$(lctl get_param -n \
3100 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3101 echo "after recovery: unused locks count = $count2"
3103 if [ $count2 -ge $count ]; then
3104 error "unused locks are not canceled"
3107 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3109 test_85b() { #bug 16774
3113 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3115 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3117 for i in $(seq 100); do
3118 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3119 count=32 >/dev/null 2>&1
3122 cancel_lru_locks osc
3124 for i in $(seq 100); do
3125 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3126 count=32 >/dev/null 2>&1
3129 lov_id=$(lctl dl | grep "clilov")
3130 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3131 count=$(lctl get_param -n \
3132 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3133 echo "before recovery: unused locks count = $count"
3134 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3138 count2=$(lctl get_param \
3139 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3140 echo "after recovery: unused locks count = $count2"
3142 if [ $count2 -ge $count ]; then
3143 error "unused locks are not canceled"
3148 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3151 local clients=${CLIENTS:-$HOSTNAME}
3153 zconf_umount_clients $clients $MOUNT
3154 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3155 remount_facet $SINGLEMDS
3156 zconf_mount_clients $clients $MOUNT
3158 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3161 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3164 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3165 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3166 error "dd to $DIR/$tfile failed"
3167 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3168 cancel_lru_locks osc
3170 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3171 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3172 if [ $cksum != $cksum2 ] ; then
3173 error "New checksum $cksum2 does not match original $cksum"
3176 run_test 87a "write replay"
3179 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3182 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3183 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3184 error "dd to $DIR/$tfile failed"
3185 sleep 1 # Give it a chance to flush dirty data
3186 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3187 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3188 cancel_lru_locks osc
3190 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3191 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3192 if [ $cksum != $cksum2 ] ; then
3193 error "New checksum $cksum2 does not match original $cksum"
3196 run_test 87b "write replay with changed data (checksum resend)"
3198 test_88() { #bug 17485
3199 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3200 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3202 $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "$LFS setstripe failed"
3205 replay_barrier $SINGLEMDS
3207 # exhaust precreations on ost1
3208 local OST=$(ostname_from_index 0)
3209 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3210 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3211 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3212 echo "before test: last_id = $last_id, next_id = $next_id"
3214 echo "Creating to objid $last_id on ost $OST..."
3215 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3216 error "createmany create files to last_id failed"
3218 #create some files to use some uncommitted objids
3219 last_id=$(($last_id + 1))
3220 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3221 error "createmany create files with uncommitted objids failed"
3223 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3224 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3225 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3227 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3228 # it has to take care about the affected facets, bug20407
3229 local affected_mds1=$(affected_facets mds1)
3230 local affected_ost1=$(affected_facets ost1)
3232 shutdown_facet $SINGLEMDS
3235 reboot_facet $SINGLEMDS
3236 change_active $affected_mds1
3237 wait_for_facet $affected_mds1
3238 mount_facets $affected_mds1 || error "Restart of mds failed"
3241 change_active $affected_ost1
3242 wait_for_facet $affected_ost1
3243 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3247 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3248 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3249 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3251 # create new files, which should use new objids, and ensure the orphan
3252 # cleanup phase for ost1 is completed at the same time
3253 for i in $(seq 8); do
3254 file_id=$(($last_id + 10 + $i))
3255 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3258 # if the objids were not recreated, then "ls" will fail with -ENOENT
3259 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3262 # write into previously created files
3263 for i in $(seq 8); do
3264 file_id=$(($last_id + $i))
3265 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3266 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3269 # compare the content
3270 for i in $(seq 8); do
3271 file_id=$(($last_id + $i))
3272 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3273 error "the content of file is modified!"
3278 run_test 88 "MDS should not assign same objid to different files "
3280 function calc_osc_kbytes_used() {
3281 local kbtotal=$(calc_osc_kbytes kbytestotal)
3282 local kbfree=$(calc_osc_kbytes kbytesfree)
3283 echo $((kbtotal-kbfree))
3287 cancel_lru_locks osc
3288 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3289 rm -f $DIR/$tdir/$tfile
3290 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3291 wait_delete_completed || error "initial wait delete timed out"
3292 local blocks1=$(calc_osc_kbytes_used)
3293 local write_size=$(fs_log_size)
3295 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile
3296 [ $write_size -lt 1024 ] && write_size=1024
3297 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3300 facet_failover $SINGLEMDS
3301 rm $DIR/$tdir/$tfile
3304 zconf_mount $(hostname) $MOUNT || error "mount fails"
3305 client_up || error "client_up failed"
3307 # wait for the remounted client to connect to ost1
3308 local target=$(get_osc_import_name client ost1)
3309 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3310 $(max_recovery_time)
3312 wait_mds_ost_sync || error "MDS-OST sync timed out"
3313 wait_delete_completed || error "wait delete timed out"
3314 local blocks2=$(calc_osc_kbytes_used)
3316 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3317 error $((blocks2 - blocks1)) blocks leaked
3319 run_test 89 "no disk space leak on late ost connection"
3326 change_active $facet
3327 wait_for_facet $facet
3328 mount_facet $facet || error "Restart of $facet failed"
3332 test_90() { # bug 19494
3333 local dir=$DIR/$tdir
3334 local ostfail=$(get_random_entry $(get_facets OST))
3336 if [[ $FAILURE_MODE = HARD ]]; then
3337 local affected=$(affected_facets $ostfail);
3339 [[ "$affected" == $ostfail ]] ||
3340 skip "cannot use FAILURE_MODE=$FAILURE_MODE, affected: $affected"
3342 # ensure all OSTs are active to allow allocations
3345 mkdir $dir || error "mkdir $dir failed"
3347 echo "Create the files"
3349 # file "f${index}" striped over 1 OST
3350 # file "all" striped over all OSTs
3352 $LFS setstripe -c $OSTCOUNT $dir/all ||
3353 error "setstripe failed to create $dir/all"
3355 for ((i = 0; i < $OSTCOUNT; i++)); do
3358 $LFS setstripe -i $i -c 1 $f ||
3359 error "$LFS setstripe failed to create $f"
3361 # confirm setstripe actually created stripe on requested OST
3362 local uuid=$(ostuuid_from_index $i)
3364 for file in f$i all; do
3365 local found=$($LFS find --obd $uuid --name $file $dir)
3367 if [[ $dir/$file != $found ]]; then
3368 $LFS getstripe $dir/$file
3369 error "wrong stripe: $file, uuid: $uuid"
3374 # Before failing an OST, get its obd name and index
3375 local varsvc=${ostfail}_svc
3376 local obd=$(do_facet $ostfail lctl get_param \
3377 -n obdfilter.${!varsvc}.uuid)
3378 local index=$(($(facet_number $ostfail) - 1))
3380 echo "Fail $ostfail $obd, display the list of affected files"
3381 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3383 trap "cleanup_90 $ostfail" EXIT INT
3384 echo "General Query: lfs find $dir"
3385 local list=$($LFS find $dir)
3387 for (( i=0; i<$OSTCOUNT; i++ )); do
3388 list_member "$list" $dir/f$i ||
3389 error_noexit "lfs find $dir: no file f$i"
3391 list_member "$list" $dir/all ||
3392 error_noexit "lfs find $dir: no file all"
3394 # focus on the missing OST,
3395 # we expect to see only two files affected: "f$(index)" and "all"
3397 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3398 list=$($LFS find --obd $obd $dir)
3400 for file in all f$index; do
3401 list_member "$list" $dir/$file ||
3402 error_noexit "lfs find does not report the affected $obd for $file"
3405 [[ $(echo $list | wc -w) -eq 2 ]] ||
3406 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3408 echo "Check getstripe: $LFS getstripe -r --obd $obd"
3409 list=$($LFS getstripe -r --obd $obd $dir)
3411 for file in all f$index; do
3412 echo "$list" | grep $dir/$file ||
3413 error_noexit "lfs getsripe does not report the affected $obd for $file"
3418 run_test 90 "lfs find identifies the missing striped file segments"
3421 [[ "$MDS1_VERSION" -ge $(version_code 2.6.90) ]] ||
3422 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
3423 "$MDS1_VERSION" -lt $(version_code 2.5.50) ]] ||
3424 skip "Need MDS version 2.5.4+ or 2.6.90+"
3426 cancel_lru_locks osc
3428 $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
3429 error "$LFS setstripe $DIR/$tfile failed"
3430 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3431 error "dd to $DIR/$tfile failed"
3432 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3433 # We need to emulate a state that OST is waiting for other clients
3434 # not completing the recovery. Final ping is queued, but reply will be
3435 # sent on the recovery completion. It is done by sleep before
3436 # processing final pings
3437 do_facet ost1 "$LCTL set_param fail_val=40"
3438 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3441 run_test 93a "replay + reconnect"
3444 [[ "$MDS1_VERSION" -ge $(version_code 2.7.90) ]] ||
3445 skip "Need MDS version 2.7.90+"
3447 cancel_lru_locks mdc
3449 createmany -o $DIR/$tfile 20 ||
3450 error "createmany -o $DIR/$tfile failed"
3452 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3453 # We need to emulate a state that MDT is waiting for other clients
3454 # not completing the recovery. Final ping is queued, but reply will be
3455 # sent on the recovery completion. It is done by sleep before
3456 # processing final pings
3457 do_facet mds1 "$LCTL set_param fail_val=80"
3458 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3461 run_test 93b "replay + reconnect on mds"
3463 striped_dir_check_100() {
3464 local striped_dir=$DIR/$tdir/striped_dir
3465 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3467 $LFS getdirstripe $striped_dir
3468 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3470 createmany -o $striped_dir/f-%d 20 ||
3471 error "creation failed under striped dir"
3475 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3476 ([ $FAILURE_MODE == "HARD" ] &&
3477 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3478 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3481 local striped_dir=$DIR/$tdir/striped_dir
3484 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3486 #To make sure MDT1 and MDT0 are connected
3487 #otherwise it may create single stripe dir here
3488 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3490 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3491 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3492 $LFS setdirstripe -i0 -c2 $striped_dir &
3495 fail mds$((MDTIDX + 1))
3497 wait $CLIENT_PID || error "striped dir creation failed"
3499 striped_dir_check_100 || error "striped dir check failed"
3500 rm -rf $DIR/$tdir || error "rmdir failed"
3502 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3505 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3506 ([ $FAILURE_MODE == "HARD" ] &&
3507 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3508 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3511 local striped_dir=$DIR/$tdir/striped_dir
3514 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3516 #To make sure MDT1 and MDT0 are connected
3517 #otherwise it may create single stripe dir here
3518 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3520 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3521 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3522 $LFS mkdir -i0 -c2 $striped_dir &
3527 wait $CLIENT_PID || error "striped dir creation failed"
3529 striped_dir_check_100 || error "striped dir check failed"
3530 rm -rf $DIR/$tdir || error "rmdir failed"
3532 run_test 100b "DNE: create striped dir, fail MDT0"
3535 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3536 ([ $FAILURE_MODE == "HARD" ] &&
3537 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3538 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3541 local striped_dir=$DIR/$tdir/striped_dir
3543 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3545 #To make sure MDT1 and MDT0 are connected
3546 #otherwise it may create single stripe dir here
3547 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3550 $LFS mkdir -i1 -c2 $striped_dir
3552 fail_abort mds2 abort_recov_mdt
3554 createmany -o $striped_dir/f-%d 20 &&
3555 error "createmany -o $DIR/$tfile should fail"
3558 striped_dir_check_100 || error "striped dir check failed"
3559 rm -rf $DIR/$tdir || error "rmdir failed"
3561 run_test 100c "DNE: create striped dir, fail MDT0"
3563 test_101() { #LU-5648
3564 mkdir -p $DIR/$tdir/d1
3565 mkdir -p $DIR/$tdir/d2
3566 touch $DIR/$tdir/file0
3569 replay_barrier $SINGLEMDS
3570 for i in $(seq $num) ; do
3571 echo test$i > $DIR/$tdir/d1/file$i
3574 fail_abort $SINGLEMDS
3575 for i in $(seq $num) ; do
3576 touch $DIR/$tdir/d2/file$i
3577 test -s $DIR/$tdir/d2/file$i &&
3578 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3583 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3592 [[ $(lctl get_param mdc.*.import |
3593 grep "connect_flags:.*multi_mod_rpc") ]] ||
3594 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3596 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3597 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3598 facet="mds$((0x$idx + 1))"
3600 # get current value of max_mod_rcps_in_flight
3601 num=$($LCTL get_param -n \
3602 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3603 # set default value if client does not support multi mod RPCs
3604 [ -z "$num" ] && num=1
3606 echo "creating $num files ..."
3608 for i in $(seq $num); do
3609 touch $DIR/$tdir/file-$i
3612 # drop request on MDT to force resend
3613 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3614 do_facet $facet "$LCTL set_param fail_loc=0x159"
3615 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3616 for i in $(seq $num); do
3617 chmod 0600 $DIR/$tdir/file-$i &
3621 do_facet $facet "$LCTL set_param fail_loc=0"
3622 for pid in $pids; do
3623 wait $pid || error "chmod failed"
3625 echo "done ($(date +%H:%M:%S))"
3627 # check chmod succeed
3628 for i in $(seq $num); do
3629 checkstat -vp 0600 $DIR/$tdir/file-$i
3634 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3643 [[ $(lctl get_param mdc.*.import |
3644 grep "connect_flags:.*multi_mod_rpc") ]] ||
3645 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3647 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3648 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3649 facet="mds$((0x$idx + 1))"
3651 # get current value of max_mod_rcps_in_flight
3652 num=$($LCTL get_param -n \
3653 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3654 # set default value if client does not support multi mod RPCs
3655 [ -z "$num" ] && num=1
3657 echo "creating $num files ..."
3659 for i in $(seq $num); do
3660 touch $DIR/$tdir/file-$i
3663 # drop reply on MDT to force reconstruction
3664 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3665 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3666 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3667 for i in $(seq $num); do
3668 chmod 0600 $DIR/$tdir/file-$i &
3672 do_facet $facet "$LCTL set_param fail_loc=0"
3673 for pid in $pids; do
3674 wait $pid || error "chmod failed"
3676 echo "done ($(date +%H:%M:%S))"
3678 # check chmod succeed
3679 for i in $(seq $num); do
3680 checkstat -vp 0600 $DIR/$tdir/file-$i
3685 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3694 [[ $(lctl get_param mdc.*.import |
3695 grep "connect_flags:.*multi_mod_rpc") ]] ||
3696 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3698 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3699 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3700 facet="mds$((0x$idx + 1))"
3702 # get current value of max_mod_rcps_in_flight
3703 num=$($LCTL get_param -n \
3704 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3705 # set default value if client does not support multi mod RPCs
3706 [ -z "$num" ] && num=1
3708 echo "creating $num files ..."
3710 for i in $(seq $num); do
3711 touch $DIR/$tdir/file-$i
3714 replay_barrier $facet
3717 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3718 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3719 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3720 for i in $(seq $num); do
3721 chmod 0600 $DIR/$tdir/file-$i &
3725 do_facet $facet "$LCTL set_param fail_loc=0"
3730 for pid in $pids; do
3731 wait $pid || error "chmod failed"
3733 echo "done ($(date +%H:%M:%S))"
3735 # check chmod succeed
3736 for i in $(seq $num); do
3737 checkstat -vp 0600 $DIR/$tdir/file-$i
3742 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3751 [[ $(lctl get_param mdc.*.import |
3752 grep "connect_flags:.*multi_mod_rpc") ]] ||
3753 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3755 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3756 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3757 facet="mds$((0x$idx + 1))"
3759 # get current value of max_mod_rcps_in_flight
3760 num=$($LCTL get_param -n \
3761 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3762 # set default value if client does not support multi mod RPCs
3763 [ -z "$num" ] && num=1
3765 echo "creating $num files ..."
3767 for i in $(seq $num); do
3768 touch $DIR/$tdir/file-$i
3772 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3773 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3774 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3775 for i in $(seq $num); do
3776 chmod 0600 $DIR/$tdir/file-$i &
3781 # write MDT transactions to disk
3782 do_facet $facet "sync; sync; sync"
3784 do_facet $facet "$LCTL set_param fail_loc=0"
3789 for pid in $pids; do
3790 wait $pid || error "chmod failed"
3792 echo "done ($(date +%H:%M:%S))"
3794 # check chmod succeed
3795 for i in $(seq $num); do
3796 checkstat -vp 0600 $DIR/$tdir/file-$i
3801 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3804 remote_mds_nodsh && skip "remote MDS with nodsh"
3805 [[ "$MDS1_VERSION" -gt $(version_code 2.8.54) ]] ||
3806 skip "Need MDS version 2.8.54+"
3808 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3809 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3812 createmany -o $DIR/$tdir/t- 30 ||
3813 error "create files on remote directory failed"
3815 rm -rf $DIR/$tdir/t-*
3817 #MDS should crash with tr->otr_next_id overflow
3820 run_test 103 "Check otr_next_id overflow"
3823 check_striped_dir_110()
3825 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3826 error "create striped dir failed"
3827 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3828 [ $stripe_count -eq $MDSCOUNT ] ||
3829 error "$stripe_count != 2 after recovery"
3833 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3834 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3835 skip "Need MDS version at least 2.7.56"
3837 ([ $FAILURE_MODE == "HARD" ] &&
3838 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3839 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3844 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3847 check_striped_dir_110 || error "check striped_dir failed"
3848 rm -rf $DIR/$tdir || error "rmdir failed"
3852 run_test 110a "DNE: create striped dir, fail MDT1"
3855 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3856 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3857 skip "Need MDS version at least 2.7.56"
3859 ([ $FAILURE_MODE == "HARD" ] &&
3860 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3861 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3866 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3869 zconf_mount $(hostname) $MOUNT
3870 client_up || return 1
3872 check_striped_dir_110 || error "check striped_dir failed"
3874 rm -rf $DIR/$tdir || error "rmdir failed"
3878 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3881 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3882 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3883 skip "Need MDS version at least 2.7.56"
3885 ([ $FAILURE_MODE == "HARD" ] &&
3886 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3887 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3892 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3895 check_striped_dir_110 || error "check striped_dir failed"
3897 rm -rf $DIR/$tdir || error "rmdir failed"
3901 run_test 110c "DNE: create striped dir, fail MDT2"
3904 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3905 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3906 skip "Need MDS version at least 2.7.56"
3908 ([ $FAILURE_MODE == "HARD" ] &&
3909 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3910 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3915 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3918 zconf_mount $(hostname) $MOUNT
3919 client_up || return 1
3921 check_striped_dir_110 || error "check striped_dir failed"
3923 rm -rf $DIR/$tdir || error "rmdir failed"
3927 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3930 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3931 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3932 skip "Need MDS version at least 2.7.56"
3934 ([ $FAILURE_MODE == "HARD" ] &&
3935 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3936 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3941 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3945 zconf_mount $(hostname) $MOUNT
3946 client_up || return 1
3948 check_striped_dir_110 || error "check striped_dir failed"
3950 rm -rf $DIR/$tdir || error "rmdir failed"
3954 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3957 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3958 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3959 skip "Need MDS version at least 2.7.56"
3961 ([ $FAILURE_MODE == "HARD" ] &&
3962 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3963 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3969 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3972 check_striped_dir_110 || error "check striped_dir failed"
3974 rm -rf $DIR/$tdir || error "rmdir failed"
3978 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3981 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3982 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3983 skip "Need MDS version at least 2.7.56"
3985 ([ $FAILURE_MODE == "HARD" ] &&
3986 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3987 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3992 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3996 zconf_mount $(hostname) $MOUNT
3997 client_up || return 1
3999 check_striped_dir_110 || error "check striped_dir failed"
4001 rm -rf $DIR/$tdir || error "rmdir failed"
4005 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4008 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4009 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4010 skip "Need MDS version at least 2.7.56"
4012 ([ $FAILURE_MODE == "HARD" ] &&
4013 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4014 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4018 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4020 rm -rf $DIR/$tdir/striped_dir
4023 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4024 error "striped dir still exists"
4027 run_test 111a "DNE: unlink striped dir, fail MDT1"
4030 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4031 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4032 skip "Need MDS version at least 2.7.56"
4034 ([ $FAILURE_MODE == "HARD" ] &&
4035 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4036 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4040 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4042 rm -rf $DIR/$tdir/striped_dir
4045 zconf_mount $(hostname) $MOUNT
4046 client_up || return 1
4048 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4049 error "striped dir still exists"
4052 run_test 111b "DNE: unlink striped dir, fail MDT2"
4055 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4056 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4057 skip "Need MDS version at least 2.7.56"
4059 ([ $FAILURE_MODE == "HARD" ] &&
4060 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4061 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4065 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4067 rm -rf $DIR/$tdir/striped_dir
4071 zconf_mount $(hostname) $MOUNT
4072 client_up || return 1
4073 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4074 error "striped dir still exists"
4077 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4080 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4081 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4082 skip "Need MDS version at least 2.7.56"
4084 ([ $FAILURE_MODE == "HARD" ] &&
4085 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4086 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4090 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4092 rm -rf $DIR/$tdir/striped_dir
4096 zconf_mount $(hostname) $MOUNT
4097 client_up || return 1
4098 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4099 error "striped dir still exists"
4103 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4106 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4107 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4108 skip "Need MDS version at least 2.7.56"
4110 ([ $FAILURE_MODE == "HARD" ] &&
4111 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4112 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4116 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4118 rm -rf $DIR/$tdir/striped_dir
4121 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4122 error "striped dir still exists"
4125 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4128 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4129 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4130 skip "Need MDS version at least 2.7.56"
4132 ([ $FAILURE_MODE == "HARD" ] &&
4133 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4134 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4138 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4140 rm -rf $DIR/$tdir/striped_dir
4143 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4144 error "striped dir still exists"
4147 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4150 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4151 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4152 skip "Need MDS version at least 2.7.56"
4154 ([ $FAILURE_MODE == "HARD" ] &&
4155 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4156 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4160 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4163 rm -rf $DIR/$tdir/striped_dir
4165 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4166 error "striped dir still exists"
4169 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4171 test_112_rename_prepare() {
4172 mkdir_on_mdt0 $DIR/$tdir
4173 mkdir -p $DIR/$tdir/src_dir
4174 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4175 error "create remote source failed"
4177 touch $DIR/$tdir/src_dir/src_child/a
4179 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4180 error "create remote target dir failed"
4182 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4183 error "create remote target child failed"
4188 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4189 error "src_child still exists after rename"
4191 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4192 error "missing file(a) after rename"
4196 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4197 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4198 skip "Need MDS version at least 2.7.56"
4200 ([ $FAILURE_MODE == "HARD" ] &&
4201 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4202 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4205 test_112_rename_prepare
4208 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4209 error "rename dir cross MDT failed!"
4213 rm -rf $DIR/$tdir || error "rmdir failed"
4215 run_test 112a "DNE: cross MDT rename, fail MDT1"
4218 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4219 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4220 skip "Need MDS version at least 2.7.56"
4222 ([ $FAILURE_MODE == "HARD" ] &&
4223 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4224 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4227 test_112_rename_prepare
4230 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4231 error "rename dir cross MDT failed!"
4236 rm -rf $DIR/$tdir || error "rmdir failed"
4238 run_test 112b "DNE: cross MDT rename, fail MDT2"
4241 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4242 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4243 skip "Need MDS version at least 2.7.56"
4245 ([ $FAILURE_MODE == "HARD" ] &&
4246 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4247 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4250 test_112_rename_prepare
4253 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4254 error "rename dir cross MDT failed!"
4259 rm -rf $DIR/$tdir || error "rmdir failed"
4261 run_test 112c "DNE: cross MDT rename, fail MDT3"
4264 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4265 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4266 skip "Need MDS version at least 2.7.56"
4268 ([ $FAILURE_MODE == "HARD" ] &&
4269 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4270 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4273 test_112_rename_prepare
4276 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4277 error "rename dir cross MDT failed!"
4282 rm -rf $DIR/$tdir || error "rmdir failed"
4284 run_test 112d "DNE: cross MDT rename, fail MDT4"
4287 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4288 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4289 skip "Need MDS version at least 2.7.56"
4291 ([ $FAILURE_MODE == "HARD" ] &&
4292 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4293 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4296 test_112_rename_prepare
4300 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4301 error "rename dir cross MDT failed!"
4306 rm -rf $DIR/$tdir || error "rmdir failed"
4308 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4311 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4312 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4313 skip "Need MDS version at least 2.7.56"
4315 ([ $FAILURE_MODE == "HARD" ] &&
4316 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4317 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4320 test_112_rename_prepare
4324 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4325 error "rename dir cross MDT failed!"
4330 rm -rf $DIR/$tdir || error "rmdir failed"
4332 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4335 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4336 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4337 skip "Need MDS version at least 2.7.56"
4339 ([ $FAILURE_MODE == "HARD" ] &&
4340 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4341 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4344 test_112_rename_prepare
4348 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4349 error "rename dir cross MDT failed!"
4354 rm -rf $DIR/$tdir || error "rmdir failed"
4356 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4359 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4360 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4361 skip "Need MDS version at least 2.7.56"
4363 ([ $FAILURE_MODE == "HARD" ] &&
4364 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4365 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4368 test_112_rename_prepare
4372 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4373 error "rename dir cross MDT failed!"
4378 rm -rf $DIR/$tdir || error "rmdir failed"
4380 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4383 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4384 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4385 skip "Need MDS version at least 2.7.56"
4387 ([ $FAILURE_MODE == "HARD" ] &&
4388 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4389 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4392 test_112_rename_prepare
4396 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4397 error "rename dir cross MDT failed!"
4402 rm -rf $DIR/$tdir || error "rmdir failed"
4404 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4407 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4408 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4409 skip "Need MDS version at least 2.7.56"
4411 ([ $FAILURE_MODE == "HARD" ] &&
4412 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4413 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4416 test_112_rename_prepare
4420 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4421 error "rename dir cross MDT failed!"
4426 rm -rf $DIR/$tdir || error "rmdir failed"
4428 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4431 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4432 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4433 skip "Need MDS version at least 2.7.56"
4435 ([ $FAILURE_MODE == "HARD" ] &&
4436 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4437 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4440 test_112_rename_prepare
4445 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4446 error "rename dir cross MDT failed!"
4451 rm -rf $DIR/$tdir || error "rmdir failed"
4453 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4456 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4457 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4458 skip "Need MDS version at least 2.7.56"
4460 ([ $FAILURE_MODE == "HARD" ] &&
4461 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4462 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4465 test_112_rename_prepare
4470 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4471 error "rename dir cross MDT failed!"
4476 rm -rf $DIR/$tdir || error "rmdir failed"
4478 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4481 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4482 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4483 skip "Need MDS version at least 2.7.56"
4485 ([ $FAILURE_MODE == "HARD" ] &&
4486 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4487 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4490 test_112_rename_prepare
4495 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4496 error "rename dir cross MDT failed!"
4501 rm -rf $DIR/$tdir || error "rmdir failed"
4503 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4506 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4507 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4508 skip "Need MDS version at least 2.7.56"
4510 ([ $FAILURE_MODE == "HARD" ] &&
4511 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4512 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4515 test_112_rename_prepare
4520 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4521 error "rename dir cross MDT failed!"
4526 rm -rf $DIR/$tdir || error "rmdir failed"
4528 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4531 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4532 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4533 skip "Need MDS version at least 2.7.56"
4535 ([ $FAILURE_MODE == "HARD" ] &&
4536 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4537 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4545 for ((j=0;j<$((MDSCOUNT));j++)); do
4546 fail_index=$((fail_index+1))
4547 index=$((fail_index % MDSCOUNT))
4548 replay_barrier mds$((index + 1))
4549 for ((i=0;i<5;i++)); do
4550 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4551 error "create striped dir $DIR/$tdir/test_$i"
4554 fail mds$((index + 1))
4555 for ((i=0;i<5;i++)); do
4556 checkstat -t dir $DIR/$tdir/test_$i ||
4557 error "$DIR/$tdir/test_$i does not exist!"
4559 rm -rf $DIR/$tdir/test_* ||
4563 run_test 115 "failover for create/unlink striped directory"
4566 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4567 [ "$MDS1_VERSION" -lt $(version_code 2.7.55) ] &&
4568 skip "Do not support large update log before 2.7.55" &&
4570 ([ $FAILURE_MODE == "HARD" ] &&
4571 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4572 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4576 mkdir_on_mdt0 $DIR/$tdir
4579 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4580 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4581 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4584 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4585 error "stried_dir does not exists"
4587 run_test 116a "large update log master MDT recovery"
4590 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4591 [ "$MDS1_VERSION" -lt $(version_code 2.7.55) ] &&
4592 skip "Do not support large update log before 2.7.55" &&
4595 ([ $FAILURE_MODE == "HARD" ] &&
4596 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4597 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4601 mkdir_on_mdt0 $DIR/$tdir
4604 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4605 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4606 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4609 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4610 error "stried_dir does not exists"
4612 run_test 116b "large update log slave MDT recovery"
4615 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4616 ([ $FAILURE_MODE == "HARD" ] &&
4617 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4618 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4624 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4625 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4628 # Let's set rdonly on all MDTs, so client will send
4629 # replay requests on all MDTs and replay these requests
4630 # at the same time. This test will verify the recovery
4631 # will not be deadlock in this case, LU-7531.
4632 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4633 replay_barrier mds$((index + 1))
4634 if [ -z $mds_indexs ]; then
4635 mds_indexs="${mds_indexs}mds$((index+1))"
4637 mds_indexs="${mds_indexs},mds$((index+1))"
4641 rm -rf $DIR/$tdir/remote_dir
4642 rm -rf $DIR/$tdir/remote_dir_1
4646 rm -rf $DIR/$tdir || error "rmdir failed"
4648 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4651 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4652 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4653 skip "Do not support large update log before 2.7.64" &&
4658 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4659 error "setdirstripe fails"
4660 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4661 error "setdirstripe fails 1"
4662 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4664 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4665 do_facet mds1 "lctl set_param fail_loc=0x1705"
4666 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4667 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4668 do_facet mds1 "lctl set_param fail_loc=0x0"
4671 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4672 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4677 run_test 118 "invalidate osp update will not cause update log corruption"
4680 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4681 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4682 skip "Do not support large update log before 2.7.64" &&
4685 local hard_timeout=$(do_facet mds1 \
4686 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4688 local clients=${CLIENTS:-$HOSTNAME}
4689 local time_min=$(recovery_time_min)
4691 mkdir_on_mdt0 $DIR/$tdir
4692 mkdir $DIR/$tdir/tmp
4693 rmdir $DIR/$tdir/tmp
4696 mkdir $DIR/$tdir/dir_1
4697 for ((i = 0; i < 20; i++)); do
4698 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4705 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4706 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4707 #sleep (timeout + 5), so mds will evict the client exports,
4708 #but DNE update recovery will keep going.
4709 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4711 mount_facet mds1 "-o recovery_time_hard=$time_min"
4713 wait_clients_import_state "$clients" mds1 FULL
4715 clients_up || clients_up || error "failover df: $?"
4717 #revert back the hard timeout
4718 do_facet mds1 $LCTL set_param \
4719 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4721 for ((i = 0; i < 20; i++)); do
4722 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4723 [ $stripe_count == 2 ] || {
4724 error "stripe_dir-$i creation replay fails"
4729 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4732 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4733 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4734 skip "Do not support large update log before 2.7.64" &&
4737 mkdir_on_mdt0 $DIR/$tdir
4738 replay_barrier_nosync mds1
4739 for ((i = 0; i < 20; i++)); do
4740 mkdir $DIR/$tdir/dir-$i || {
4741 error "create dir-$i fails"
4744 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4745 error "create stripe_dir-$i fails"
4752 for ((i = 0; i < 20; i++)); do
4753 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4754 error "dir-$i still exists"
4757 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4758 error "stripe_dir-$i still exists"
4763 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4766 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4767 skip "Don't support it before 2.11" &&
4770 local at_max_saved=$(at_max_get mds)
4772 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4773 cancel_lru_locks mdc
4775 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4778 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4784 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4785 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4789 wait_clients_import_state "$clients" mds1 FULL
4790 clients_up || clients_up || error "failover df: $?"
4793 wait $mpid || error "multiop_bg_pause pid failed"
4795 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4796 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4797 at_max_set $at_max_saved mds
4800 run_test 121 "lock replay timed out and race"
4803 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4804 skip "Do not support Data-on-MDT before 2.11"
4806 replay_barrier $SINGLEMDS
4807 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4810 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4811 error "Fail to replay DoM file creation"
4813 run_test 130a "DoM file create (setstripe) replay"
4816 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4817 skip "Do not support Data-on-MDT before 2.11"
4819 mkdir_on_mdt0 $DIR/$tdir
4820 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4821 replay_barrier $SINGLEMDS
4822 touch $DIR/$tdir/$tfile
4825 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4826 error "Fail to replay DoM file creation"
4828 run_test 130b "DoM file create (inherited) replay"
4831 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4832 skip "Do not support Data-on-MDT before 2.11"
4834 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4835 replay_barrier $SINGLEMDS
4836 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4837 # lock is not canceled and will be replayed
4840 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4841 error "Wrong file content after failover"
4843 run_test 131a "DoM file write lock replay"
4846 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4847 skip "Do not support Data-on-MDT before 2.11"
4849 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4850 replay_barrier $SINGLEMDS
4851 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4852 cancel_lru_locks mdc
4856 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4857 error "Wrong file content after failover"
4859 run_test 131b "DoM file write replay"
4862 [ "$MDS1_VERSION" -lt $(version_code 2.12.0) ] &&
4863 skip "Need MDS version 2.12.0 or later"
4865 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4866 replay_barrier $SINGLEMDS
4867 # write over the first component size cause next component instantiation
4868 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4869 error "dd to $DIR/$tfile failed"
4870 lfs getstripe $DIR/$tfile
4872 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4873 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4874 error "Component #1 was not instantiated"
4878 lfs getstripe $DIR/$tfile
4879 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4880 error "Component #1 instantiation was not replayed"
4881 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4882 if [ $cksum != $cksum2 ] ; then
4883 error_noexit "New cksum $cksum2 does not match original $cksum"
4886 run_test 132a "PFL new component instantiate replay"
4889 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4890 ([ $FAILURE_MODE == "HARD" ] &&
4891 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4892 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4895 local remote_dir=$DIR/$tdir/remote_dir
4897 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4898 $LFS mkdir -i 1 $remote_dir
4901 do_facet mds2 $LCTL set_param seq.srv*MDT0001.space=clear
4903 zconf_mount $(hostname) $MOUNT
4904 client_up || return 1
4906 #define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123
4908 do_facet mds1 $LCTL set_param fail_val=700 fail_loc=0x80000123
4909 cp /etc/hosts $remote_dir/file &
4915 wait $pid || error "cp failed"
4916 rm -rf $DIR/$tdir || error "rmdir failed"
4920 run_test 133 "check resend of ongoing requests for lwp during failover"
4923 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return 0
4926 pool_add_targets pool_134 1 1
4928 mkdir -p $DIR/$tdir/{A,B}
4929 $LFS setstripe -p pool_134 $DIR/$tdir/A
4930 $LFS setstripe -E EOF -p pool_134 $DIR/$tdir/B
4934 touch $DIR/$tdir/A/$tfile || error "touch non-pfl file failed"
4935 touch $DIR/$tdir/B/$tfile || error "touch pfl failed"
4939 [ -f $DIR/$tdir/A/$tfile ] || error "non-pfl file does not exist"
4940 [ -f $DIR/$tdir/B/$tfile ] || error "pfl file does not exist"
4942 run_test 134 "replay creation of a file created in a pool"
4946 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4949 $LFS setstripe -S $((128 * 1024)) -i 0 $DIR/$tdir
4953 # Create 20 files so we have 20 ost locks
4954 for i in $(seq 20) ; do
4955 echo blah > $DIR/$tdir/file.${i}
4963 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x32d
4964 # Make sure lock replay server side never completes and errors out.
4965 do_facet ost1 "$LCTL set_param fail_val=20"
4966 do_facet ost1 "$LCTL set_param fail_loc=0x32d"
4970 # Now make sure we notice
4973 sleep 20 # should we do something proactive to make reconnects go?
4974 kill -0 $PID || error "Unexpected sync success"
4981 do_facet ost1 "$LCTL set_param fail_loc=0"
4983 echo blah > $DIR/$tdir/file.test2
4987 run_test 135 "Server failure in lock replay phase"
4990 check_and_cleanup_lustre