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 testid=$(echo $TESTNAME | tr '_' ' ')
139 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
140 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000013b"
141 openfile -f O_CREAT:O_EXCL $DIR/$tfile &
143 replay_barrier $SINGLEMDS
146 $CHECKSTAT -t file $DIR/$tfile ||
147 error "$CHECKSTAT $DIR/$tfile attribute check failed"
148 dmesg | tac | sed "/$testid/,$ d" | \
149 grep "Open request replay failed with -17" &&
150 error "open replay failed" || true
152 run_test 2e "O_CREAT|O_EXCL create replay"
155 local file=$DIR/$tfile
156 replay_barrier $SINGLEMDS
158 openfile -f O_DIRECTORY $file
160 $CHECKSTAT -t file $file ||
161 error "$CHECKSTAT $file attribute check failed"
164 run_test 3a "replay failed open(O_DIRECTORY)"
167 replay_barrier $SINGLEMDS
168 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
169 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
171 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
173 $CHECKSTAT -t file $DIR/$tfile &&
174 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
177 run_test 3b "replay failed open -ENOMEM"
180 replay_barrier $SINGLEMDS
181 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
182 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
184 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
187 $CHECKSTAT -t file $DIR/$tfile &&
188 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
191 run_test 3c "replay failed open -ENOMEM"
193 test_4a() { # was test_4
194 replay_barrier $SINGLEMDS
195 for i in $(seq 10); do
196 echo "tag-$i" > $DIR/$tfile-$i
199 for i in $(seq 10); do
200 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
203 run_test 4a "|x| 10 open(O_CREAT)s"
206 for i in $(seq 10); do
207 echo "tag-$i" > $DIR/$tfile-$i
209 replay_barrier $SINGLEMDS
212 $CHECKSTAT -t file $DIR/$tfile-* &&
213 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
216 run_test 4b "|x| rm 10 files"
218 # The idea is to get past the first block of precreated files on both
219 # osts, and then replay.
221 replay_barrier $SINGLEMDS
222 for i in $(seq 220); do
223 echo "tag-$i" > $DIR/$tfile-$i
226 for i in $(seq 220); do
227 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
231 # waiting for commitment of removal
233 run_test 5 "|x| 220 open(O_CREAT)"
235 test_6a() { # was test_6
236 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
237 replay_barrier $SINGLEMDS
238 mcreate $DIR/$tdir/$tfile
240 $CHECKSTAT -t dir $DIR/$tdir ||
241 error "$CHECKSTAT $DIR/$tdir attribute check failed"
242 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
243 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
245 # waiting for log process thread
247 run_test 6a "mkdir + contained create"
250 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
251 replay_barrier $SINGLEMDS
254 $CHECKSTAT -t dir $DIR/$tdir &&
255 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
258 run_test 6b "|X| rmdir"
261 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
262 replay_barrier $SINGLEMDS
263 mcreate $DIR/$tdir/$tfile
265 $CHECKSTAT -t dir $DIR/$tdir ||
266 error "$CHECKSTAT $DIR/$tdir attribute check failed"
267 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
268 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
271 run_test 7 "mkdir |X| contained create"
274 replay_barrier $SINGLEMDS
275 multiop_bg_pause $DIR/$tfile mo_c ||
276 error "multiop mknod $DIR/$tfile failed"
280 $CHECKSTAT -t file $DIR/$tfile ||
281 error "$CHECKSTAT $DIR/$tfile attribute check failed"
282 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
283 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
286 run_test 8 "creat open |X| close"
289 replay_barrier $SINGLEMDS
291 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
293 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
295 echo " old_inum == $old_inum, new_inum == $new_inum"
296 if [ $old_inum -eq $new_inum ] ;
298 echo "old_inum and new_inum match"
300 echo " old_inum and new_inum do not match"
301 error "old index($old_inum) does not match new index($new_inum)"
305 run_test 9 "|X| create (same inum/gen)"
308 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
309 replay_barrier $SINGLEMDS
310 mv $DIR/$tfile $DIR/$tfile-2
313 $CHECKSTAT $DIR/$tfile &&
314 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
315 $CHECKSTAT $DIR/$tfile-2 ||
316 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
320 run_test 10 "create |X| rename unlink"
323 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
324 echo "old" > $DIR/$tfile
325 mv $DIR/$tfile $DIR/$tfile-2
326 replay_barrier $SINGLEMDS
327 echo "new" > $DIR/$tfile
329 grep old $DIR/$tfile-2
331 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
332 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
334 run_test 11 "create open write rename |X| create-old-name read"
337 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
338 multiop_bg_pause $DIR/$tfile o_tSc ||
339 error "multiop_bg_pause $DIR/$tfile failed"
342 replay_barrier $SINGLEMDS
343 kill -USR1 $pid || error "multiop $pid not running"
344 wait $pid || error "multiop $pid failed"
347 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
350 run_test 12 "open, unlink |X| close"
352 # 1777 - replay open after committed chmod that would make
353 # a regular open a failure
355 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
356 multiop_bg_pause $DIR/$tfile O_wc ||
357 error "multiop_bg_pause $DIR/$tfile failed"
360 $CHECKSTAT -p 0 $DIR/$tfile ||
361 error "$CHECKSTAT $DIR/$tfile attribute check failed"
362 replay_barrier $SINGLEMDS
364 kill -USR1 $pid || error "multiop $pid not running"
365 wait $pid || error "multiop $pid failed"
367 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
368 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
369 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
372 run_test 13 "open chmod 0 |x| write close"
375 multiop_bg_pause $DIR/$tfile O_tSc ||
376 error "multiop_bg_pause $DIR/$tfile failed"
379 replay_barrier $SINGLEMDS
380 kill -USR1 $pid || error "multiop $pid not running"
381 wait $pid || error "multiop $pid failed"
384 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
387 run_test 14 "open(O_CREAT), unlink |X| close"
390 multiop_bg_pause $DIR/$tfile O_tSc ||
391 error "multiop_bg_pause $DIR/$tfile failed"
394 replay_barrier $SINGLEMDS
395 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
396 kill -USR1 $pid || error "multiop $pid not running"
397 wait $pid || error "multiop $pid failed"
400 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
401 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
404 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
407 replay_barrier $SINGLEMDS
410 mcreate $DIR/$tfile-2
412 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
413 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
414 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
416 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
419 replay_barrier $SINGLEMDS
420 multiop_bg_pause $DIR/$tfile O_c ||
421 error "multiop_bg_pause $DIR/$tfile failed"
424 kill -USR1 $pid || error "multiop $pid not running"
425 wait $pid || error "multiop $pid failed"
426 $CHECKSTAT -t file $DIR/$tfile ||
427 error "$CHECKSTAT $DIR/$tfile attribute check failed"
430 run_test 17 "|X| open(O_CREAT), |replay| close"
433 replay_barrier $SINGLEMDS
434 multiop_bg_pause $DIR/$tfile O_tSc ||
435 error "multiop_bg_pause $DIR/$tfile failed"
438 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
439 echo "pid: $pid will close"
440 kill -USR1 $pid || error "multiop $pid not running"
441 wait $pid || error "multiop $pid failed"
444 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
445 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
446 # this touch frequently fails
447 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
448 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
449 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
452 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
454 # bug 1855 (a simpler form of test_11 above)
456 replay_barrier $SINGLEMDS
458 echo "old" > $DIR/$tfile
459 mv $DIR/$tfile $DIR/$tfile-2
460 grep old $DIR/$tfile-2
462 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
464 run_test 19 "mcreate, open, write, rename "
466 test_20a() { # was test_20
467 replay_barrier $SINGLEMDS
468 multiop_bg_pause $DIR/$tfile O_tSc ||
469 error "multiop_bg_pause $DIR/$tfile failed"
474 kill -USR1 $pid || error "multiop $pid not running"
475 wait $pid || error "multiop $pid failed"
476 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
479 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
481 test_20b() { # bug 10480
482 local wait_timeout=$((TIMEOUT * 4))
483 local extra=$(fs_log_size)
487 save_layout_restore_at_exit $MOUNT
488 $LFS setstripe -i 0 -c 1 $DIR
490 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
492 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
493 while [ ! -e $DIR/$tfile ] ; do
494 sleep 0.01 # give dd a chance to start
497 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
499 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
501 client_up || client_up || true # reconnect
503 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
505 fail $SINGLEMDS # start orphan recovery
506 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
507 wait_delete_completed $wait_timeout || error "delete did not finish"
511 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
512 log "before $beforeused, after $afterused"
514 (( $beforeused + $extra >= $afterused )) && break
515 n_attempts=$((n_attempts + 1))
516 [ $n_attempts -gt 3 ] &&
517 error "after $afterused > before $beforeused + $extra"
519 wait_zfs_commit $SINGLEMDS 5
524 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
526 test_20c() { # bug 10480
527 multiop_bg_pause $DIR/$tfile Ow_c ||
528 error "multiop_bg_pause $DIR/$tfile failed"
534 client_up || client_up || true # reconnect
536 kill -USR1 $pid || error "multiop $pid not running"
537 wait $pid || error "multiop $pid failed"
538 [ -s $DIR/$tfile ] || error "File was truncated"
542 run_test 20c "check that client eviction does not affect file content"
545 replay_barrier $SINGLEMDS
546 multiop_bg_pause $DIR/$tfile O_tSc ||
547 error "multiop_bg_pause $DIR/$tfile failed"
550 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
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"
556 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
559 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
562 multiop_bg_pause $DIR/$tfile O_tSc ||
563 error "multiop_bg_pause $DIR/$tfile failed"
566 replay_barrier $SINGLEMDS
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"
575 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
578 multiop_bg_pause $DIR/$tfile O_tSc ||
579 error "multiop_bg_pause $DIR/$tfile failed"
582 replay_barrier $SINGLEMDS
584 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
587 kill -USR1 $pid || error "multiop $pid not running"
588 wait $pid || error "multiop $pid failed"
589 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
590 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
593 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
596 multiop_bg_pause $DIR/$tfile O_tSc ||
597 error "multiop_bg_pause $DIR/$tfile failed"
600 replay_barrier $SINGLEMDS
603 kill -USR1 $pid || error "multiop $pid not running"
604 wait $pid || error "multiop $pid failed"
605 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
608 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
611 multiop_bg_pause $DIR/$tfile O_tSc ||
612 error "multiop_bg_pause $DIR/$tfile failed"
616 replay_barrier $SINGLEMDS
618 kill -USR1 $pid || error "multiop $pid not running"
619 wait $pid || error "multiop $pid failed"
620 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
623 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
626 replay_barrier $SINGLEMDS
627 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
628 error "multiop_bg_pause $DIR/$tfile-1 failed"
630 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
631 error "multiop_bg_pause $DIR/$tfile-2 failed"
635 kill -USR1 $pid2 || error "second multiop $pid2 not running"
636 wait $pid2 || error "second multiop $pid2 failed"
639 kill -USR1 $pid1 || error "multiop $pid1 not running"
640 wait $pid1 || error "multiop $pid1 failed"
641 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
642 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
645 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
648 replay_barrier $SINGLEMDS
649 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
650 error "multiop_bg_pause $DIR/$tfile-1 failed"
652 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
653 error "multiop_bg_pause $DIR/$tfile-2 failed"
659 kill -USR1 $pid1 || error "multiop $pid1 not running"
660 wait $pid1 || error "multiop $pid1 failed"
661 kill -USR1 $pid2 || error "second multiop $pid2 not running"
662 wait $pid2 || error "second multiop $pid2 failed"
663 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
664 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
667 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
670 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
671 error "multiop_bg_pause $DIR/$tfile-1 failed"
673 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
674 error "multiop_bg_pause $DIR/$tfile-2 failed"
676 replay_barrier $SINGLEMDS
679 kill -USR1 $pid2 || error "second multiop $pid2 not running"
680 wait $pid2 || error "second multiop $pid2 failed"
683 kill -USR1 $pid1 || error "multiop $pid1 not running"
684 wait $pid1 || error "multiop $pid1 failed"
685 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
686 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
689 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
692 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
693 error "multiop_bg_pause $DIR/$tfile-1 failed"
695 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
696 error "multiop_bg_pause $DIR/$tfile-2 failed"
698 replay_barrier $SINGLEMDS
703 kill -USR1 $pid1 || error "multiop $pid1 not running"
704 wait $pid1 || error "multiop $pid1 failed"
705 kill -USR1 $pid2 || error "second multiop $pid2 not running"
706 wait $pid2 || error "second multiop $pid2 failed"
707 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
708 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
711 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
714 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
715 error "multiop_bg_pause $DIR/$tfile-1 failed"
717 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
718 error "multiop_bg_pause $DIR/$tfile-2 failed"
723 replay_barrier $SINGLEMDS
725 kill -USR1 $pid1 || error "multiop $pid1 not running"
726 wait $pid1 || error "multiop $pid1 failed"
727 kill -USR1 $pid2 || error "second multiop $pid2 not running"
728 wait $pid2 || error "second multiop $pid2 failed"
729 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
730 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
733 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
736 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
737 error "multiop_bg_pause $DIR/$tfile-1 failed"
739 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
740 error "multiop_bg_pause $DIR/$tfile-2 failed"
744 replay_barrier $SINGLEMDS
747 kill -USR1 $pid1 || error "multiop $pid1 not running"
748 wait $pid1 || error "multiop $pid1 failed"
749 kill -USR1 $pid2 || error "second multiop $pid2 not running"
750 wait $pid2 || error "second multiop $pid2 failed"
751 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
752 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
755 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
757 # tests for bug 2104; completion without crashing is success. The close is
758 # stale, but we always return 0 for close, so the app never sees it.
760 multiop_bg_pause $DIR/$tfile O_c ||
761 error "multiop_bg_pause $DIR/$tfile failed"
763 multiop_bg_pause $DIR/$tfile O_c ||
764 error "second multiop_bg_pause $DIR/$tfile failed"
767 client_up || client_up || error "client_up failed"
768 kill -USR1 $pid1 || error "multiop $pid1 not running"
769 kill -USR1 $pid2 || error "second multiop $pid2 not running"
770 wait $pid1 || error "multiop $pid1 failed"
771 wait $pid2 || error "second multiop $pid2 failed"
774 run_test 32 "close() notices client eviction; close() after client eviction"
777 createmany -o $DIR/$tfile-%d 10 ||
778 error "createmany create $DIR/$tfile failed"
779 replay_barrier_nosync $SINGLEMDS
780 fail_abort $SINGLEMDS
781 # recreate shouldn't fail
782 createmany -o $DIR/$tfile--%d 10 ||
783 error "createmany recreate $DIR/$tfile failed"
787 run_test 33a "fid seq shouldn't be reused after abort recovery"
790 #define OBD_FAIL_SEQ_ALLOC 0x1311
791 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
793 createmany -o $DIR/$tfile-%d 10
794 replay_barrier_nosync $SINGLEMDS
795 fail_abort $SINGLEMDS
796 # recreate shouldn't fail
797 createmany -o $DIR/$tfile--%d 10 ||
798 error "createmany recreate $DIR/$tfile failed"
802 run_test 33b "test fid seq allocation"
805 multiop_bg_pause $DIR/$tfile O_c ||
806 error "multiop_bg_pause $DIR/$tfile failed"
810 replay_barrier $SINGLEMDS
811 fail_abort $SINGLEMDS
812 kill -USR1 $pid || error "multiop $pid not running"
813 wait $pid || error "multiop $pid failed"
814 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
818 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
820 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
822 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
824 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
825 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
830 # give a chance to remove from MDS
831 fail_abort $SINGLEMDS
832 $CHECKSTAT -t file $DIR/$tfile &&
833 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
836 run_test 35 "test recovery from llog for unlink op"
838 # b=2432 resent cancel after replay uses wrong cookie,
839 # so don't resend cancels
841 replay_barrier $SINGLEMDS
843 checkstat $DIR/$tfile
844 facet_failover $SINGLEMDS
846 if $LCTL dk | grep "stale lock .*cookie"; then
847 error "cancel after replay failed"
850 run_test 36 "don't resend cancel"
853 # directory orphans can't be unlinked from PENDING directory
855 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $tdir failed"
856 rmdir $DIR/$tdir/$tfile 2>/dev/null
857 multiop_bg_pause $DIR/$tdir/$tfile dD_c ||
858 error "multiop_bg_pause $tfile failed"
860 rmdir $DIR/$tdir/$tfile
862 replay_barrier $SINGLEMDS
863 # clear the dmesg buffer so we only see errors from this recovery
864 do_facet $SINGLEMDS dmesg -c >/dev/null
865 fail_abort $SINGLEMDS
866 kill -USR1 $pid || error "multiop $pid not running"
867 do_facet $SINGLEMDS dmesg | grep "error unlinking orphan" &&
868 error "error unlinking files"
869 wait $pid || error "multiop $pid failed"
873 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
876 createmany -o $DIR/$tfile-%d 800 ||
877 error "createmany -o $DIR/$tfile failed"
878 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
879 replay_barrier $SINGLEMDS
881 unlinkmany $DIR/$tfile-%d 400 400 ||
882 error "unlinkmany $DIR/$tfile 400 failed"
884 $CHECKSTAT -t file $DIR/$tfile-* &&
885 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
888 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
890 test_39() { # bug 4176
891 createmany -o $DIR/$tfile-%d 800 ||
892 error "createmany -o $DIR/$tfile failed"
893 replay_barrier $SINGLEMDS
894 unlinkmany $DIR/$tfile-%d 0 400
896 unlinkmany $DIR/$tfile-%d 400 400 ||
897 error "unlinkmany $DIR/$tfile 400 failed"
899 $CHECKSTAT -t file $DIR/$tfile-* &&
900 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
903 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
906 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
911 # always need connection to MDS to verify layout during IO. LU-2628.
912 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
913 skip "layout_lock needs MDS connection for IO" && return 0
915 $LCTL mark multiop $MOUNT/$tfile OS_c
916 multiop $MOUNT/$tfile OS_c &
918 writeme -s $MOUNT/${tfile}-2 &
921 facet_failover $SINGLEMDS
922 #define OBD_FAIL_MDS_CONNECT_NET 0x117
923 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
925 stat1=$(count_ost_writes)
927 stat2=$(count_ost_writes)
928 echo "$stat1, $stat2"
929 if [ $stat1 -lt $stat2 ]; then
930 echo "writes continuing during recovery"
933 echo "writes not continuing during recovery, bug 2477"
936 echo "waiting for writeme $WRITE_PID"
940 echo "waiting for multiop $PID"
941 wait $PID || error "multiop $PID failed"
942 do_facet client munlink $MOUNT/$tfile ||
943 error "munlink $MOUNT/$tfile failed"
944 do_facet client munlink $MOUNT/${tfile}-2 ||
945 error "munlink $MOUNT/$tfile-2 failed"
948 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
951 # make sure that a read to one osc doesn't try to double-unlock its page just
952 # because another osc is invalid. trigger_group_io used to mistakenly return
953 # an error if any oscs were invalid even after having successfully put rpcs
954 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
955 # the page, guarnateeing that the unlock from the RPC completion would
956 # assert on trying to unlock the unlocked page.
958 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
960 local f=$MOUNT/$tfile
961 # make sure the start of the file is ost1
962 $LFS setstripe -S $((128 * 1024)) -i 0 $f
963 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
964 error "dd on client failed"
966 # fail ost2 and read from ost1
967 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
968 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
969 grep $mdtosc | awk '{print $1}')
970 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
971 lctl get_param -n devices &&
972 error "OST 2 $osc2dev does not exist"
973 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
974 error "deactive device on $SINGLEMDS failed"
975 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
976 error "second dd on client failed"
977 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
978 error "active device on $SINGLEMDS failed"
981 run_test 41 "read from a valid osc while other oscs are invalid"
983 # test MDS recovery after ost failure
985 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
986 createmany -o $DIR/$tfile-%d 800 ||
987 error "createmany -o $DIR/$tfile failed"
989 unlinkmany $DIR/$tfile-%d 0 400
991 lctl set_param debug=-1
994 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
995 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
996 #[ $blocks_after -lt $blocks ] || return 1
997 echo "wait for MDS to timeout and recover"
998 sleep $((TIMEOUT * 2))
1000 unlinkmany $DIR/$tfile-%d 400 400 ||
1001 error "unlinkmany $DIR/$tfile 400 failed"
1002 $CHECKSTAT -t file $DIR/$tfile-* &&
1003 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
1006 run_test 42 "recovery after ost failure"
1008 # timeout in MDS/OST recovery RPC will LBUG MDS
1009 test_43() { # bug 2530
1010 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1012 replay_barrier $SINGLEMDS
1014 # OBD_FAIL_OST_CREATE_NET 0x204
1015 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1021 run_test 43 "mds osc import failure during recovery; don't LBUG"
1023 test_44a() { # was test_44
1024 local at_max_saved=0
1026 local mdcdev=$($LCTL dl |
1027 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1028 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
1029 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1030 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1032 # adaptive timeouts slow this way down
1033 if at_is_enabled; then
1034 at_max_saved=$(at_max_get mds)
1038 for i in $(seq 1 10); do
1039 echo "$i of 10 ($(date +%s))"
1040 do_facet $SINGLEMDS \
1041 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1042 #define OBD_FAIL_TGT_CONN_RACE 0x701
1043 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1044 # lctl below may fail, it is valid case
1045 $LCTL --device $mdcdev recover
1048 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1049 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1052 run_test 44a "race in target handle connect"
1055 local mdcdev=$($LCTL dl |
1056 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1057 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1058 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1059 { echo mdcdev=$mdcdev; $LCTL dl;
1060 error "more than one ${FSNAME}-MDT0000-mdc"; }
1062 for i in $(seq 1 10); do
1063 echo "$i of 10 ($(date +%s))"
1064 do_facet $SINGLEMDS \
1065 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1066 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1067 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1068 # lctl below may fail, it is valid case
1069 $LCTL --device $mdcdev recover
1074 run_test 44b "race in target handle connect"
1077 replay_barrier $SINGLEMDS
1078 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1079 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1080 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1081 fail_abort $SINGLEMDS
1082 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1084 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1087 run_test 44c "race in target handle connect"
1089 # Handle failed close
1091 local mdcdev=$($LCTL get_param -n devices |
1092 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1093 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1094 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1095 { echo mdcdev=$mdcdev; $LCTL dl;
1096 error "more than one ${FSNAME}-MDT0000-mdc"; }
1098 $LCTL --device $mdcdev recover ||
1099 error "$LCTL --device $mdcdev recover failed"
1101 multiop_bg_pause $DIR/$tfile O_c ||
1102 error "multiop_bg_pause $DIR/$tfile failed"
1105 # This will cause the CLOSE to fail before even
1106 # allocating a reply buffer
1107 $LCTL --device $mdcdev deactivate ||
1108 error "$LCTL --device $mdcdev deactivate failed"
1111 kill -USR1 $pid || error "multiop $pid not running"
1112 wait $pid || error "multiop $pid failed"
1114 $LCTL --device $mdcdev activate ||
1115 error "$LCTL --device $mdcdev activate failed"
1118 $CHECKSTAT -t file $DIR/$tfile ||
1119 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1122 run_test 45 "Handle failed close"
1125 drop_reply "touch $DIR/$tfile"
1127 # ironically, the previous test, 45, will cause a real forced close,
1128 # so just look for one for this test
1129 local FID=$($LFS path2fid $tfile)
1130 $LCTL dk | grep -i "force closing file handle $FID" &&
1131 error "found force closing in dmesg"
1134 run_test 46 "Don't leak file handle after open resend (3325)"
1136 test_47() { # bug 2824
1137 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1139 # create some files to make sure precreate has been done on all
1140 # OSTs. (just in case this test is run independently)
1141 createmany -o $DIR/$tfile 20 ||
1142 error "createmany create $DIR/$tfile failed"
1144 # OBD_FAIL_OST_CREATE_NET 0x204
1146 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1147 client_up || error "client_up failed"
1149 # let the MDS discover the OST failure, attempt to recover, fail
1150 # and recover again.
1151 sleep $((3 * TIMEOUT))
1153 # Without 2824, this createmany would hang
1154 createmany -o $DIR/$tfile 20 ||
1155 error "createmany recraete $DIR/$tfile failed"
1156 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1160 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1163 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1164 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1166 replay_barrier $SINGLEMDS
1167 createmany -o $DIR/$tfile 20 ||
1168 error "createmany -o $DIR/$tfile failed"
1169 # OBD_FAIL_OST_EROFS 0x216
1170 facet_failover $SINGLEMDS
1171 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1172 client_up || error "client_up failed"
1174 # let the MDS discover the OST failure, attempt to recover, fail
1175 # and recover again.
1176 sleep $((3 * TIMEOUT))
1178 createmany -o $DIR/$tfile 20 20 ||
1179 error "createmany recraete $DIR/$tfile failed"
1180 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1183 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1186 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1187 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1188 grep $mdtosc | awk '{print $1}')
1189 [ "$oscdev" ] || error "could not find OSC device on MDS"
1190 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1191 error "OSC device $oscdev recovery failed"
1192 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1193 error "second OSC device $oscdev recovery failed"
1194 # give the mds_lov_sync threads a chance to run
1197 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1199 # b3764 timed out lock replay
1201 [ "$MDS1_VERSION" -lt $(version_code 2.6.90) ] &&
1202 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly"
1204 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1205 cancel_lru_locks mdc
1207 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1210 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1211 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1212 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1214 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1216 wait $mpid || error "multiop_bg_pause pid failed"
1218 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1219 lctl set_param fail_loc=0x0
1220 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1223 run_test 52 "time out lock replay (3764)"
1225 # bug 3462 - simultaneous MDC requests
1227 [[ $(lctl get_param mdc.*.import |
1228 grep "connect_flags:.*multi_mod_rpc") ]] ||
1229 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1231 cancel_lru_locks mdc # cleanup locks from former test cases
1232 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1233 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1234 multiop $DIR/${tdir}-1/f O_c &
1236 # give multiop a change to open
1239 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1240 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1241 kill -USR1 $close_pid
1242 cancel_lru_locks mdc # force the close
1243 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1245 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1247 # close should still be here
1248 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1250 replay_barrier_nodf $SINGLEMDS
1252 wait $close_pid || error "close_pid $close_pid failed"
1254 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1255 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1256 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1257 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1258 rm -rf $DIR/${tdir}-*
1260 run_test 53a "|X| close request while two MDC requests in flight"
1263 cancel_lru_locks mdc # cleanup locks from former test cases
1265 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1266 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1267 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1268 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1271 #define OBD_FAIL_MDS_REINT_NET 0x107
1272 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1273 mcreate $DIR/${tdir}-2/f &
1277 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1278 kill -USR1 $close_pid
1279 cancel_lru_locks mdc # force the close
1280 wait $close_pid || error "close_pid $close_pid failed"
1281 # open should still be here
1282 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1284 replay_barrier_nodf $SINGLEMDS
1286 wait $open_pid || error "open_pid failed"
1288 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1289 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1290 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1291 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1292 rm -rf $DIR/${tdir}-*
1294 run_test 53b "|X| open request while two MDC requests in flight"
1297 cancel_lru_locks mdc # cleanup locks from former test cases
1299 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1300 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1301 multiop $DIR/${tdir}-1/f O_c &
1304 #define OBD_FAIL_MDS_REINT_NET 0x107
1305 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1306 mcreate $DIR/${tdir}-2/f &
1310 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1311 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1312 kill -USR1 $close_pid
1313 cancel_lru_locks mdc # force the close
1315 #bz20647: make sure all pids exist before failover
1316 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1317 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1318 replay_barrier_nodf $SINGLEMDS
1319 fail_nodf $SINGLEMDS
1320 wait $open_pid || error "open_pid failed"
1322 # close should be gone
1323 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1324 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1326 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1327 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1328 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1329 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1330 rm -rf $DIR/${tdir}-*
1332 run_test 53c "|X| open request and close request while two MDC requests in flight"
1335 [[ $(lctl get_param mdc.*.import |
1336 grep "connect_flags:.*multi_mod_rpc") ]] ||
1337 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1339 cancel_lru_locks mdc # cleanup locks from former test cases
1341 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1342 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1343 multiop $DIR/${tdir}-1/f O_c &
1345 # give multiop a chance to open
1348 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1349 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1350 kill -USR1 $close_pid
1351 cancel_lru_locks mdc # force the close
1352 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1353 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1355 # close should still be here
1356 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1358 wait $close_pid || error "close_pid failed"
1360 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1361 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1362 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1363 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1364 rm -rf $DIR/${tdir}-*
1366 run_test 53d "close reply while two MDC requests in flight"
1369 cancel_lru_locks mdc # cleanup locks from former test cases
1371 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1372 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1373 multiop $DIR/${tdir}-1/f O_c &
1376 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1377 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1378 mcreate $DIR/${tdir}-2/f &
1382 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1383 kill -USR1 $close_pid
1384 cancel_lru_locks mdc # force the close
1385 wait $close_pid || error "close_pid failed"
1386 # open should still be here
1387 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1389 replay_barrier_nodf $SINGLEMDS
1391 wait $open_pid || error "open_pid failed"
1393 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1394 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1395 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1396 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1397 rm -rf $DIR/${tdir}-*
1399 run_test 53e "|X| open reply while two MDC requests in flight"
1402 cancel_lru_locks mdc # cleanup locks from former test cases
1404 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1405 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1406 multiop $DIR/${tdir}-1/f O_c &
1409 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1410 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1411 mcreate $DIR/${tdir}-2/f &
1415 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1416 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1417 kill -USR1 $close_pid
1418 cancel_lru_locks mdc # force the close
1420 #bz20647: make sure all pids are exists before failover
1421 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1422 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1423 replay_barrier_nodf $SINGLEMDS
1424 fail_nodf $SINGLEMDS
1425 wait $open_pid || error "open_pid failed"
1427 # close should be gone
1428 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1429 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1431 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1432 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1433 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1434 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1435 rm -rf $DIR/${tdir}-*
1437 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1440 cancel_lru_locks mdc # cleanup locks from former test cases
1442 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1443 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1444 multiop $DIR/${tdir}-1/f O_c &
1447 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1448 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1449 mcreate $DIR/${tdir}-2/f &
1453 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1454 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1455 kill -USR1 $close_pid
1456 cancel_lru_locks mdc # force the close
1457 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1459 #bz20647: make sure all pids are exists before failover
1460 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1461 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1462 replay_barrier_nodf $SINGLEMDS
1463 fail_nodf $SINGLEMDS
1464 wait $open_pid || error "open_pid failed"
1466 # close should be gone
1467 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1469 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1470 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1471 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1472 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1473 rm -rf $DIR/${tdir}-*
1475 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1478 cancel_lru_locks mdc # cleanup locks from former test cases
1480 mkdir_on_mdt0 $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1481 mkdir_on_mdt0 $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1482 multiop $DIR/${tdir}-1/f O_c &
1485 #define OBD_FAIL_MDS_REINT_NET 0x107
1486 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1487 mcreate $DIR/${tdir}-2/f &
1491 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1492 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1493 kill -USR1 $close_pid
1494 cancel_lru_locks mdc # force the close
1497 #bz20647: make sure all pids are exists before failover
1498 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1499 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1500 replay_barrier_nodf $SINGLEMDS
1501 fail_nodf $SINGLEMDS
1502 wait $open_pid || error "open_pid failed"
1504 # close should be gone
1505 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1506 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1508 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1509 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1510 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1511 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1512 rm -rf $DIR/${tdir}-*
1514 run_test 53h "open request and close reply while two MDC requests in flight"
1516 #b3761 ASSERTION(hash != 0) failed
1518 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1519 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1521 # give touch a chance to run
1523 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1527 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1529 #b3440 ASSERTION(rec->ur_fid2->id) failed
1531 ln -s foo $DIR/$tfile
1532 replay_barrier $SINGLEMDS
1533 #drop_reply "cat $DIR/$tfile"
1537 run_test 56 "don't replay a symlink open request (3440)"
1539 #recovery one mds-ost setattr from llog
1541 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1542 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1543 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1544 replay_barrier $SINGLEMDS
1546 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1547 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1548 $CHECKSTAT -t file $DIR/$tfile ||
1549 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1550 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1553 run_test 57 "test recovery from llog for setattr op"
1556 zconf_umount $(hostname) $MOUNT2
1560 #recovery many mds-ost setattr from llog
1562 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1563 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1564 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1565 createmany -o $DIR/$tdir/$tfile-%d 2500
1566 replay_barrier $SINGLEMDS
1569 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1570 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1571 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1572 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1573 error "unlinkmany $DIR/$tfile failed"
1576 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1582 trap cleanup_58 EXIT
1584 large_xattr_enabled &&
1585 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1586 # Original extended attribute can be long. Print a small version of
1587 # attribute if an error occurs
1588 local sm_msg=$(printf "%.9s" $orig)
1590 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1591 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1592 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1593 replay_barrier $SINGLEMDS
1594 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1596 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1597 [[ "$new" = "$orig" ]] ||
1598 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1599 rm -f $DIR/$tdir/$tfile
1602 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1604 run_test 58b "test replay of setxattr op"
1606 test_58c() { # bug 16570
1611 trap cleanup_58 EXIT
1613 if large_xattr_enabled; then
1614 local xattr_size=$(max_xattr_size)
1615 orig="$(generate_string $((xattr_size / 2)))"
1616 orig1="$(generate_string $xattr_size)"
1622 # PING_INTERVAL max(obd_timeout / 4, 1U)
1623 sleep $((TIMEOUT / 4))
1625 # Original extended attribute can be long. Print a small version of
1626 # attribute if an error occurs
1627 local sm_msg=$(printf "%.9s" $orig)
1628 local sm_msg1=$(printf "%.9s" $orig1)
1630 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1631 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1632 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1633 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1634 error "drop_request for setfattr failed"
1635 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1636 [[ "$new" = "$orig" ]] ||
1637 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1638 drop_reint_reply "setfattr -n trusted.foo1 \
1639 -v $orig1 $DIR/$tdir/$tfile" ||
1640 error "drop_reint_reply for setfattr failed"
1641 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1642 [[ "$new" = "$orig1" ]] ||
1643 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1644 rm -f $DIR/$tdir/$tfile
1648 run_test 58c "resend/reconstruct setxattr op"
1650 # log_commit_thread vs filter_destroy race used to lead to import use after free
1653 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1655 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1656 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1657 error "createmany create files failed"
1659 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1660 error "unlinkmany $DIR/$tdir/$tfile failed"
1661 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1662 do_facet ost1 "lctl set_param fail_loc=0x507"
1665 do_facet ost1 "lctl set_param fail_loc=0x0"
1669 run_test 59 "test log_commit_thread vs filter_destroy race"
1671 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1672 # bug 12086: should no oops and No ctxt error for this test
1674 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1675 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1676 error "createmany create files failed"
1677 replay_barrier $SINGLEMDS
1678 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1680 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1681 local no_ctxt=$(dmesg | grep "No ctxt")
1682 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1684 run_test 60 "test llog post recovery init vs llog unlink"
1686 #test race llog recovery thread vs llog cleanup
1687 test_61a() { # was test_61
1688 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1690 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1691 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1692 error "createmany create files failed"
1694 unlinkmany $DIR/$tdir/$tfile-%d 800
1695 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1696 set_nodes_failloc "$(osts_nodes)" 0x80000221
1701 set_nodes_failloc "$(osts_nodes)" 0x0
1703 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1704 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1707 run_test 61a "test race llog recovery vs llog cleanup"
1709 #test race mds llog sync vs llog cleanup
1711 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1712 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1713 facet_failover $SINGLEMDS
1716 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1719 run_test 61b "test race mds llog sync vs llog cleanup"
1721 #test race cancel cookie cb vs llog cleanup
1723 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1725 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1726 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1727 set_nodes_failloc "$(osts_nodes)" 0x80000222
1731 set_nodes_failloc "$(osts_nodes)" 0x0
1733 run_test 61c "test race mds llog sync vs llog cleanup"
1735 test_61d() { # bug 16002 # bug 17466 # bug 22137
1736 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1738 do_facet mgs "lctl set_param fail_loc=0x80000605"
1739 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1740 error "mgs start should have failed"
1741 do_facet mgs "lctl set_param fail_loc=0"
1742 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1744 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1746 test_62() { # Bug 15756 - don't mis-drop resent replay
1747 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1748 replay_barrier $SINGLEMDS
1749 createmany -o $DIR/$tdir/$tfile- 25 ||
1750 error "createmany create files failed"
1751 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1752 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1754 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1755 unlinkmany $DIR/$tdir/$tfile- 25 ||
1756 error "unlinkmany $DIR/$tdir/$tfile failed"
1759 run_test 62 "don't mis-drop resent replay"
1761 #Adaptive Timeouts (bug 3055)
1769 echo "Cleaning up AT ..."
1770 if [ -n "$ATOLDBASE" ]; then
1771 local at_history=$($LCTL get_param -n at_history)
1772 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1773 do_facet ost1 "lctl set_param at_history=$at_history" || true
1776 if [ $AT_MAX_SET -ne 0 ]; then
1777 for facet in mds client ost; do
1778 var=AT_MAX_SAVE_${facet}
1779 echo restore AT on $facet to saved value ${!var}
1780 at_max_set ${!var} $facet
1781 at_new=$(at_max_get $facet)
1782 echo Restored AT value on $facet $at_new
1783 [ $at_new -eq ${!var} ] ||
1784 error "AT value not restored SAVED ${!var} NEW $at_new"
1791 local at_max_new=600
1793 # Save at_max original values
1795 if [ $AT_MAX_SET -eq 0 ]; then
1796 # Suppose that all osts have the same at_max
1797 for facet in mds client ost; do
1798 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1802 for facet in mds client ost; do
1803 at_max=$(at_max_get $facet)
1804 if [ $at_max -ne $at_max_new ]; then
1805 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1806 at_max_set $at_max_new $facet
1811 if [ -z "$ATOLDBASE" ]; then
1812 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1813 # speed up the timebase so we can check decreasing AT
1814 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1815 do_facet ost1 "lctl set_param at_history=8" || true
1817 # sleep for a while to cool down, should be > 8s and also allow
1818 # at least one ping to be sent. simply use TIMEOUT to be safe.
1823 test_65a() #bug 3055
1825 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1827 at_start || return 0
1828 $LCTL dk > /dev/null
1830 $LCTL set_param debug="other"
1831 # Slow down a request to the current service time, this is critical
1832 # because previous tests may have caused this value to increase.
1833 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1834 awk '/portal 12/ {print $5}'`
1835 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1837 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1838 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1839 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1840 createmany -o $DIR/$tfile 10 > /dev/null
1841 unlinkmany $DIR/$tfile 10 > /dev/null
1842 # check for log message
1843 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1845 # client should show REQ_DELAY estimates
1846 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1848 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1850 run_test 65a "AT: verify early replies"
1852 test_65b() #bug 3055
1854 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1856 at_start || return 0
1859 $LCTL set_param debug="other trace"
1860 $LCTL dk > /dev/null
1861 # Slow down a request to the current service time, this is critical
1862 # because previous tests may have caused this value to increase.
1863 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1864 error "$LFS setstripe failed for $DIR/$tfile"
1866 multiop $DIR/$tfile Ow1yc
1867 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1868 awk '/portal 6/ {print $5}'`
1869 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1871 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1872 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1873 do_facet ost1 $LCTL set_param fail_loc=0x224
1876 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1877 error "$LFS setstripe failed"
1878 # force some real bulk transfer
1879 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1881 do_facet ost1 $LCTL set_param fail_loc=0
1882 # check for log message
1883 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1885 # client should show REQ_DELAY estimates
1886 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1888 run_test 65b "AT: verify early replies on packed reply / bulk"
1890 test_66a() #bug 3055
1892 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1894 at_start || return 0
1895 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1896 # adjust 5s at a time so no early reply is sent (within deadline)
1897 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1898 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1899 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1900 createmany -o $DIR/$tfile 20 > /dev/null
1901 unlinkmany $DIR/$tfile 20 > /dev/null
1902 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1903 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1904 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1905 createmany -o $DIR/$tfile 20 > /dev/null
1906 unlinkmany $DIR/$tfile 20 > /dev/null
1907 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1908 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1910 createmany -o $DIR/$tfile 20 > /dev/null
1911 unlinkmany $DIR/$tfile 20 > /dev/null
1912 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1913 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1914 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1915 echo "Current MDT timeout $CUR, worst $WORST"
1916 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1918 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1920 test_66b() #bug 3055
1922 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1924 at_start || return 0
1925 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1926 awk '/network/ {print $4}')
1927 $LCTL set_param fail_val=$(($ORIG + 5))
1928 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1929 $LCTL set_param fail_loc=0x50c
1930 touch $DIR/$tfile > /dev/null 2>&1
1931 $LCTL set_param fail_loc=0
1932 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1933 awk '/network/ {print $4}')
1934 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1935 awk '/network/ {print $6}')
1936 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1937 [ $WORST -gt $ORIG ] ||
1938 error "Worst $WORST should be worse than orig $ORIG"
1940 run_test 66b "AT: verify net latency adjusts"
1942 test_67a() #bug 3055
1944 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1946 at_start || return 0
1947 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1948 # sleeping threads may drive values above this
1949 do_facet ost1 "$LCTL set_param fail_val=400"
1950 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1951 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1952 createmany -o $DIR/$tfile 20 > /dev/null
1953 unlinkmany $DIR/$tfile 20 > /dev/null
1954 do_facet ost1 "$LCTL set_param fail_loc=0"
1955 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1956 ATTEMPTS=$(($CONN2 - $CONN1))
1957 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1958 [ $ATTEMPTS -gt 0 ] &&
1959 error_ignore bz13721 "AT should have prevented reconnect"
1962 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1964 test_67b() #bug 3055
1966 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1968 at_start || return 0
1969 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1971 # exhaust precreations on ost1
1972 local OST=$(ostname_from_index 0)
1973 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1974 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1975 osp.$mdtosc.prealloc_last_id)
1976 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1977 osp.$mdtosc.prealloc_next_id)
1979 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1980 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${OST} ||
1981 error "$LFS setstripe failed"
1982 echo "Creating to objid $last_id on ost $OST..."
1983 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1984 do_facet ost1 "$LCTL set_param fail_val=20000"
1985 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1986 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1989 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1991 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1992 ATTEMPTS=$(($CONN2 - $CONN1))
1993 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1994 # do it again; should not timeout
1995 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1996 cp /etc/profile $DIR/$tfile || error "cp failed"
1997 do_facet ost1 "$LCTL set_param fail_loc=0"
1999 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
2000 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
2001 ATTEMPTS=$(($CONN3 - $CONN2))
2002 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
2003 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
2006 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
2008 test_68 () #bug 13813
2010 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
2012 at_start || return 0
2013 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
2014 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
2015 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
2016 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
2017 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2018 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2019 echo $TIMEOUT >> $ldlm_enqueue_min
2020 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2022 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2023 $LFS setstripe --stripe-index=0 -c 1 $DIR/$tdir ||
2024 error "$LFS setstripe failed for $DIR/$tdir"
2025 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2026 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2027 $LCTL set_param fail_loc=0x80000312
2028 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2029 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2030 $LCTL set_param fail_loc=0x80000312
2031 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2032 $LCTL set_param fail_loc=0
2034 echo $ENQ_MIN >> $ldlm_enqueue_min
2035 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2039 run_test 68 "AT: verify slowing locks"
2042 # end of AT tests includes above lines
2044 # start multi-client tests
2046 [ -z "$CLIENTS" ] &&
2047 { skip "Need two or more clients." && return; }
2048 [ $CLIENTCOUNT -lt 2 ] &&
2049 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2051 echo "mount clients $CLIENTS ..."
2052 zconf_mount_clients $CLIENTS $MOUNT
2054 local clients=${CLIENTS//,/ }
2055 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2056 for CLIENT in $clients; do
2057 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2058 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2059 error "dd failed on $CLIENT"
2062 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2063 for C in ${CLIENTS//,/ }; do
2064 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2065 of=/dev/null 2>/dev/null ||
2066 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2072 run_test 70a "check multi client t-f"
2074 check_for_process () {
2079 killall_process $clients "$prog" -0
2083 local clients=${CLIENTS:-$HOSTNAME}
2085 zconf_mount_clients $clients $MOUNT
2088 [ "$SLOW" = "no" ] && duration=120
2089 # set duration to 900 because it takes some time to boot node
2090 [ "$FAILURE_MODE" = HARD ] && duration=900
2093 local start_ts=$(date +%s)
2094 local cmd="rundbench 1 -t $duration"
2096 if [ $MDSCOUNT -ge 2 ]; then
2097 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2098 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2100 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2101 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2102 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2103 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2106 #LU-1897 wait for all dbench copies to start
2107 while ! check_for_process $clients dbench; do
2108 elapsed=$(($(date +%s) - start_ts))
2109 if [ $elapsed -gt $duration ]; then
2110 killall_process $clients dbench
2111 error "dbench failed to start on $clients!"
2116 log "Started rundbench load pid=$pid ..."
2118 elapsed=$(($(date +%s) - start_ts))
2119 local num_failovers=0
2121 while [ $elapsed -lt $duration ]; do
2122 if ! check_for_process $clients dbench; then
2123 error_noexit "dbench stopped on some of $clients!"
2124 killall_process $clients dbench
2128 replay_barrier mds$fail_index
2129 sleep 1 # give clients a time to do operations
2130 # Increment the number of failovers
2131 num_failovers=$((num_failovers+1))
2132 log "$TESTNAME fail mds$fail_index $num_failovers times"
2134 elapsed=$(($(date +%s) - start_ts))
2135 if [ $fail_index -ge $MDSCOUNT ]; then
2138 fail_index=$((fail_index+1))
2142 wait $pid || error "rundbench load on $clients failed!"
2144 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2145 # end multi-client tests
2150 local monitor_pid=$3
2152 local start_ts=$(date +%s)
2153 local num_failovers=0
2156 elapsed=$(($(date +%s) - start_ts))
2157 while [ $elapsed -lt $duration ]; do
2158 fail_index=$((RANDOM%max_index+1))
2159 kill -0 $monitor_pid ||
2160 error "$monitor_pid stopped"
2162 replay_barrier mds$fail_index
2164 # Increment the number of failovers
2165 num_failovers=$((num_failovers+1))
2166 log "$TESTNAME fail mds$fail_index $num_failovers times"
2168 elapsed=$(($(date +%s) - start_ts))
2174 rm -f $DIR/replay-single.70c.lck
2179 local clients=${CLIENTS:-$HOSTNAME}
2182 zconf_mount_clients $clients $MOUNT
2185 [ "$SLOW" = "no" ] && duration=180
2186 # set duration to 900 because it takes some time to boot node
2187 [ "$FAILURE_MODE" = HARD ] && duration=600
2190 local start_ts=$(date +%s)
2192 trap cleanup_70c EXIT
2194 while [ ! -e $DIR/replay-single.70c.lck ]; do
2195 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2196 if [ $MDSCOUNT -ge 2 ]; then
2197 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2198 error "set default dirstripe failed"
2200 cd $DIR/$tdir || break
2201 tar cf - /etc | tar xf - || error "tar failed in loop"
2205 echo "Started tar $tar_70c_pid"
2207 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2208 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2210 touch $DIR/replay-single.70c.lck
2211 wait $tar_70c_pid || error "$?: tar failed"
2216 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2220 kill -9 $mkdir_70d_pid
2224 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2225 local clients=${CLIENTS:-$HOSTNAME}
2228 zconf_mount_clients $clients $MOUNT
2231 [ "$SLOW" = "no" ] && duration=180
2232 # set duration to 900 because it takes some time to boot node
2233 [ "$FAILURE_MODE" = HARD ] && duration=900
2238 local start_ts=$(date +%s)
2240 trap cleanup_70d EXIT
2243 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2247 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2252 touch $DIR/$tdir/test/a || {
2256 mkdir $DIR/$tdir/test/b || {
2260 rm -rf $DIR/$tdir/test || {
2266 touch $DIR/$tdir/test1/a || {
2270 mkdir $DIR/$tdir/test1/b || {
2275 rm -rf $DIR/$tdir/test1 || {
2277 ls -lR $DIR/$tdir/test1
2283 echo "Started $mkdir_70d_pid"
2285 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2286 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2291 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2294 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2295 local clients=${CLIENTS:-$HOSTNAME}
2298 lctl set_param debug=+ha
2299 zconf_mount_clients $clients $MOUNT
2302 [ "$SLOW" = "no" ] && duration=180
2303 # set duration to 900 because it takes some time to boot node
2304 [ "$FAILURE_MODE" = HARD ] && duration=900
2307 $LFS mkdir -i0 $DIR/$tdir/test_0
2308 $LFS mkdir -i0 $DIR/$tdir/test_1
2309 touch $DIR/$tdir/test_0/a
2310 touch $DIR/$tdir/test_1/b
2313 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2318 checkstat $DIR/$tdir/test_0/a && {
2319 echo "a still exists"
2323 checkstat $DIR/$tdir/test_1/b || {
2324 echo "b still exists"
2328 touch $DIR/$tdir/test_0/a || {
2329 echo "touch a fails"
2333 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2340 stack_trap "kill -9 $rename_70e_pid" EXIT
2341 echo "Started PID=$rename_70e_pid"
2343 random_fail_mdt 2 $duration $rename_70e_pid
2344 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2346 run_test 70e "rename cross-MDT with random fails"
2348 test_70f_write_and_read(){
2353 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2354 for client in ${CLIENTS//,/ }; do
2355 [ -f $stopflag ] || return
2357 local tgtfile=$DIR/$tdir/$tfile.$client
2358 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2359 of=$tgtfile 2>/dev/null ||
2360 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2361 "of=$tgtfile failed on $client, rc=$?"
2364 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2367 for client in ${CLIENTS//,/ }; do
2368 [ -f $stopflag ] || return
2370 # flush client cache in case test is running on only one client
2371 # do_node $client cancel_lru_locks osc
2372 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2374 tgtfile=$DIR/$tdir/$tfile.$client
2375 local md5=$(do_node $prev_client "md5sum $tgtfile")
2376 [ ${checksum[$index]// */} = ${md5// */} ] ||
2377 error "$tgtfile: checksum doesn't match on $prev_client"
2378 index=$((index + 1))
2388 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2389 $LFS setstripe -c -1 $DIR/$tdir ||
2390 error "cannot $LFS setstripe $DIR/$tdir"
2393 while [ -f $stopflag ]; do
2394 test_70f_write_and_read $srcfile $stopflag
2395 # use direct IO and buffer cache in turns if loop
2396 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2400 test_70f_cleanup() {
2402 rm -f $TMP/$tfile.stop
2403 do_nodes $CLIENTS rm -f $TMP/$tfile
2404 rm -f $DIR/$tdir/$tfile.*
2408 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2409 # { skip "Failover host not defined" && return; }
2410 # [ -z "$CLIENTS" ] &&
2411 # { skip "CLIENTS are not specified." && return; }
2412 # [ $CLIENTCOUNT -lt 2 ] &&
2413 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2415 [[ "$OST1_VERSION" -lt $(version_code 2.9.53) ]] &&
2416 skip "Need server version at least 2.9.53"
2418 echo "mount clients $CLIENTS ..."
2419 zconf_mount_clients $CLIENTS $MOUNT
2421 local srcfile=$TMP/$tfile
2425 trap test_70f_cleanup EXIT
2426 # create a different source file local to each client node so we can
2427 # detect if the file wasn't written out properly after failover
2428 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2429 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2430 for client in ${CLIENTS//,/ }; do
2431 checksum[$index]=$(do_node $client "md5sum $srcfile")
2432 index=$((index + 1))
2436 [ "$SLOW" = "no" ] && duration=60
2437 # set duration to 900 because it takes some time to boot node
2438 [ "$FAILURE_MODE" = HARD ] && duration=900
2440 local stopflag=$TMP/$tfile.stop
2441 test_70f_loop $srcfile $stopflag &
2445 local num_failovers=0
2446 local start_ts=$SECONDS
2447 while [ $elapsed -lt $duration ]; do
2451 num_failovers=$((num_failovers + 1))
2452 log "$TESTNAME failing OST $num_failovers times"
2455 elapsed=$((SECONDS - start_ts))
2462 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2466 kill -9 $mkdir_71a_pid
2469 random_double_fail_mdt() {
2472 local monitor_pid=$3
2474 local start_ts=$(date +%s)
2475 local num_failovers=0
2479 elapsed=$(($(date +%s) - start_ts))
2480 while [ $elapsed -lt $duration ]; do
2481 fail_index=$((RANDOM%max_index + 1))
2482 if [ $fail_index -eq $max_index ]; then
2485 second_index=$((fail_index + 1))
2487 kill -0 $monitor_pid ||
2488 error "$monitor_pid stopped"
2490 replay_barrier mds$fail_index
2491 replay_barrier mds$second_index
2493 # Increment the number of failovers
2494 num_failovers=$((num_failovers+1))
2495 log "fail mds$fail_index mds$second_index $num_failovers times"
2496 fail mds${fail_index},mds${second_index}
2497 elapsed=$(($(date +%s) - start_ts))
2502 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2503 local clients=${CLIENTS:-$HOSTNAME}
2506 zconf_mount_clients $clients $MOUNT
2509 [ "$SLOW" = "no" ] && duration=180
2510 # set duration to 900 because it takes some time to boot node
2511 [ "$FAILURE_MODE" = HARD ] && duration=900
2513 mkdir_on_mdt0 $DIR/$tdir
2516 local start_ts=$(date +%s)
2518 trap cleanup_71a EXIT
2521 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2522 rmdir $DIR/$tdir/test
2526 echo "Started $mkdir_71a_pid"
2528 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2529 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2534 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2537 multiop_bg_pause $DIR/$tfile O_tSc ||
2538 error "multiop_bg_pause $DIR/$tfile failed"
2542 replay_barrier $SINGLEMDS
2543 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2544 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2547 wait $pid || error "multiop pid failed"
2548 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2551 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2554 multiop_bg_pause $DIR/$tfile O_tSc ||
2555 error "multiop_bg_pause $DIR/$tfile failed"
2559 replay_barrier $SINGLEMDS
2560 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
2561 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
2564 wait $pid || error "multiop pid failed"
2565 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2568 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2572 local clients=${CLIENTS:-$HOSTNAME}
2574 zconf_umount_clients $clients $MOUNT
2576 facet_failover $SINGLEMDS
2577 zconf_mount_clients $clients $MOUNT
2579 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2580 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2581 clients_up || error "client evicted: $?"
2584 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2586 remote_dir_check_80() {
2591 diridx=$($LFS getstripe -m $remote_dir) ||
2592 error "$LFS getstripe -m $remote_dir failed"
2593 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2595 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2596 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2597 error "$LFS getstripe -m $remote_dir/f-1 failed"
2598 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2604 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2605 ([ $FAILURE_MODE == "HARD" ] &&
2606 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2607 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2611 local remote_dir=$DIR/$tdir/remote_dir
2613 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2614 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2615 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2616 $LFS mkdir -i $MDTIDX $remote_dir &
2622 wait $CLIENT_PID || error "remote creation failed"
2624 remote_dir_check_80 || error "remote dir check failed"
2625 rm -rf $DIR/$tdir || error "rmdir failed"
2629 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2632 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2633 ([ $FAILURE_MODE == "HARD" ] &&
2634 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2635 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2639 local remote_dir=$DIR/$tdir/remote_dir
2641 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2642 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2643 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2644 $LFS mkdir -i $MDTIDX $remote_dir &
2649 fail mds$((MDTIDX + 1))
2651 wait $CLIENT_PID || error "remote creation failed"
2653 remote_dir_check_80 || error "remote dir check failed"
2654 rm -rf $DIR/$tdir || error "rmdir failed"
2658 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2661 [[ "$mds1_FSTYPE" = zfs ]] &&
2662 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2663 skip "requires LU-10143 fix on MDS"
2664 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2665 ([ $FAILURE_MODE == "HARD" ] &&
2666 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2667 skip "MDTs needs to be on diff hosts for HARD fail mode"
2670 local remote_dir=$DIR/$tdir/remote_dir
2672 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2673 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2674 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2675 $LFS mkdir -i $MDTIDX $remote_dir &
2681 fail mds$((MDTIDX + 1))
2683 wait $CLIENT_PID || error "remote creation failed"
2685 remote_dir_check_80 || error "remote dir check failed"
2686 rm -rf $DIR/$tdir || error "rmdir failed"
2690 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2693 [[ "$mds1_FSTYPE" = zfs ]] &&
2694 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2695 skip "requires LU-10143 fix on MDS"
2696 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2698 local remote_dir=$DIR/$tdir/remote_dir
2700 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2701 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2702 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2703 $LFS mkdir -i $MDTIDX $remote_dir &
2706 # sleep 3 seconds to make sure MDTs are failed after
2707 # lfs mkdir -i has finished on all of MDTs.
2712 fail mds${MDTIDX},mds$((MDTIDX + 1))
2714 wait $CLIENT_PID || error "remote creation failed"
2716 remote_dir_check_80 || error "remote dir check failed"
2717 rm -rf $DIR/$tdir || error "rmdir failed"
2721 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2724 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2725 ([ $FAILURE_MODE == "HARD" ] &&
2726 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2727 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2731 local remote_dir=$DIR/$tdir/remote_dir
2733 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2734 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2735 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2736 $LFS mkdir -i $MDTIDX $remote_dir &
2739 # sleep 3 seconds to make sure MDTs are failed after
2740 # lfs mkdir -i has finished on all of MDTs.
2746 wait $CLIENT_PID || error "remote creation failed"
2748 remote_dir_check_80 || error "remote dir check failed"
2749 rm -rf $DIR/$tdir || error "rmdir failed"
2753 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2756 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2757 ([ $FAILURE_MODE == "HARD" ] &&
2758 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2759 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2762 local remote_dir=$DIR/$tdir/remote_dir
2764 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2765 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2766 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2767 $LFS mkdir -i $MDTIDX $remote_dir &
2771 fail mds$((MDTIDX + 1))
2773 wait $CLIENT_PID || error "remote creation failed"
2775 remote_dir_check_80 || error "remote dir check failed"
2776 rm -rf $DIR/$tdir || error "rmdir failed"
2780 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2783 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2784 ([ $FAILURE_MODE == "HARD" ] &&
2785 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2786 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2790 local remote_dir=$DIR/$tdir/remote_dir
2792 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2793 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2794 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2795 $LFS mkdir -i $MDTIDX $remote_dir &
2798 # sleep 3 seconds to make sure MDTs are failed after
2799 # lfs mkdir -i has finished on all of MDTs.
2805 fail mds$((MDTIDX + 1))
2807 wait $CLIENT_PID || error "remote creation failed"
2809 remote_dir_check_80 || error "remote dir check failed"
2810 rm -rf $DIR/$tdir || error "rmdir failed"
2814 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2817 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2819 local remote_dir=$DIR/$tdir/remote_dir
2821 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2822 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2823 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2824 $LFS mkdir -i $MDTIDX $remote_dir &
2827 # sleep 3 seconds to make sure MDTs are failed after
2828 # lfs mkdir -i has finished on all of MDTs.
2833 fail mds${MDTIDX},mds$((MDTIDX + 1))
2835 wait $CLIENT_PID || error "remote dir creation failed"
2837 remote_dir_check_80 || error "remote dir check failed"
2838 rm -rf $DIR/$tdir || error "rmdir failed"
2842 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2845 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2846 ([ $FAILURE_MODE == "HARD" ] &&
2847 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2848 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2852 local remote_dir=$DIR/$tdir/remote_dir
2854 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2855 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2857 touch $remote_dir || error "touch $remote_dir failed"
2858 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2859 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2864 fail mds$((MDTIDX + 1))
2866 wait $CLIENT_PID || error "rm remote dir failed"
2868 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2870 rm -rf $DIR/$tdir || error "rmdir failed"
2874 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2877 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2878 ([ $FAILURE_MODE == "HARD" ] &&
2879 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2880 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2883 local remote_dir=$DIR/$tdir/remote_dir
2885 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2886 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2888 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2889 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2896 wait $CLIENT_PID || error "rm remote dir failed"
2898 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2900 rm -rf $DIR/$tdir || error "rmdir failed"
2904 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2907 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2908 ([ $FAILURE_MODE == "HARD" ] &&
2909 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2910 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2914 local remote_dir=$DIR/$tdir/remote_dir
2916 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2917 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2919 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2920 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2927 fail mds$((MDTIDX + 1))
2929 wait $CLIENT_PID || error "rm remote dir failed"
2931 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2933 rm -rf $DIR/$tdir || error "rmdir failed"
2937 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2940 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2942 local remote_dir=$DIR/$tdir/remote_dir
2944 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2945 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2947 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2948 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2954 fail mds${MDTIDX},mds$((MDTIDX + 1))
2956 wait $CLIENT_PID || error "rm remote dir failed"
2958 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2960 rm -rf $DIR/$tdir || error "rmdir failed"
2964 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2967 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2968 ([ $FAILURE_MODE == "HARD" ] &&
2969 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2970 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2974 local remote_dir=$DIR/$tdir/remote_dir
2976 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2977 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2979 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2980 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2983 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2988 wait $CLIENT_PID || error "rm remote dir failed"
2990 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2992 rm -rf $DIR/$tdir || error "rmdir failed"
2996 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2999 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3000 ([ $FAILURE_MODE == "HARD" ] &&
3001 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3002 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3006 local remote_dir=$DIR/$tdir/remote_dir
3008 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3009 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3011 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3012 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3017 fail mds$((MDTIDX + 1))
3019 wait $CLIENT_PID || error "rm remote dir failed"
3021 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3023 rm -rf $DIR/$tdir || error "rmdir failed"
3027 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3030 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3031 ([ $FAILURE_MODE == "HARD" ] &&
3032 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3033 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3037 local remote_dir=$DIR/$tdir/remote_dir
3039 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3040 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3042 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3043 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3050 fail mds$((MDTIDX + 1))
3052 wait $CLIENT_PID || error "rm remote dir failed"
3054 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3056 rm -rf $DIR/$tdir || error "rmdir failed"
3060 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3063 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3065 local remote_dir=$DIR/$tdir/remote_dir
3067 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3068 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3070 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3071 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3077 fail mds${MDTIDX},mds$((MDTIDX + 1))
3079 wait $CLIENT_PID || error "rm remote dir failed"
3081 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3083 rm -rf $DIR/$tdir || error "rmdir failed"
3087 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3090 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3091 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3092 createmany -o $DIR/$tfile- 1 &
3096 client_up || client_up || true # reconnect
3098 run_test 84a "stale open during export disconnect"
3100 test_85a() { #bug 16774
3101 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3103 for i in $(seq 100); do
3104 echo "tag-$i" > $DIR/$tfile-$i
3105 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3108 lov_id=$(lctl dl | grep "clilov")
3109 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3110 count=$(lctl get_param -n \
3111 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3112 echo "before recovery: unused locks count = $count"
3116 count2=$(lctl get_param -n \
3117 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3118 echo "after recovery: unused locks count = $count2"
3120 if [ $count2 -ge $count ]; then
3121 error "unused locks are not canceled"
3124 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3126 test_85b() { #bug 16774
3130 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3132 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3134 for i in $(seq 100); do
3135 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3136 count=32 >/dev/null 2>&1
3139 cancel_lru_locks osc
3141 for i in $(seq 100); do
3142 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3143 count=32 >/dev/null 2>&1
3146 lov_id=$(lctl dl | grep "clilov")
3147 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3148 count=$(lctl get_param -n \
3149 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3150 echo "before recovery: unused locks count = $count"
3151 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3155 count2=$(lctl get_param \
3156 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3157 echo "after recovery: unused locks count = $count2"
3159 if [ $count2 -ge $count ]; then
3160 error "unused locks are not canceled"
3165 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3168 local clients=${CLIENTS:-$HOSTNAME}
3170 zconf_umount_clients $clients $MOUNT
3171 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3172 remount_facet $SINGLEMDS
3173 zconf_mount_clients $clients $MOUNT
3175 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3178 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3181 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3182 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3183 error "dd to $DIR/$tfile failed"
3184 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3185 cancel_lru_locks osc
3187 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3188 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3189 if [ $cksum != $cksum2 ] ; then
3190 error "New checksum $cksum2 does not match original $cksum"
3193 run_test 87a "write replay"
3196 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3199 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3200 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3201 error "dd to $DIR/$tfile failed"
3202 sleep 1 # Give it a chance to flush dirty data
3203 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3204 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3205 cancel_lru_locks osc
3207 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3208 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3209 if [ $cksum != $cksum2 ] ; then
3210 error "New checksum $cksum2 does not match original $cksum"
3213 run_test 87b "write replay with changed data (checksum resend)"
3215 test_88() { #bug 17485
3216 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3217 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3219 $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "$LFS setstripe failed"
3222 replay_barrier $SINGLEMDS
3224 # exhaust precreations on ost1
3225 local OST=$(ostname_from_index 0)
3226 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3227 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3228 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3229 echo "before test: last_id = $last_id, next_id = $next_id"
3231 echo "Creating to objid $last_id on ost $OST..."
3232 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3233 error "createmany create files to last_id failed"
3235 #create some files to use some uncommitted objids
3236 last_id=$(($last_id + 1))
3237 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3238 error "createmany create files with uncommitted objids failed"
3240 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3241 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3242 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3244 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3245 # it has to take care about the affected facets, bug20407
3246 local affected_mds1=$(affected_facets mds1)
3247 local affected_ost1=$(affected_facets ost1)
3249 shutdown_facet $SINGLEMDS
3252 reboot_facet $SINGLEMDS
3253 change_active $affected_mds1
3254 wait_for_facet $affected_mds1
3255 mount_facets $affected_mds1 || error "Restart of mds failed"
3258 change_active $affected_ost1
3259 wait_for_facet $affected_ost1
3260 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3264 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3265 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3266 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3268 # create new files, which should use new objids, and ensure the orphan
3269 # cleanup phase for ost1 is completed at the same time
3270 for i in $(seq 8); do
3271 file_id=$(($last_id + 10 + $i))
3272 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3275 # if the objids were not recreated, then "ls" will fail with -ENOENT
3276 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3279 # write into previously created files
3280 for i in $(seq 8); do
3281 file_id=$(($last_id + $i))
3282 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3283 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3286 # compare the content
3287 for i in $(seq 8); do
3288 file_id=$(($last_id + $i))
3289 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3290 error "the content of file is modified!"
3295 run_test 88 "MDS should not assign same objid to different files "
3297 function calc_osc_kbytes_used() {
3298 local kbtotal=$(calc_osc_kbytes kbytestotal)
3299 local kbfree=$(calc_osc_kbytes kbytesfree)
3300 echo $((kbtotal-kbfree))
3304 cancel_lru_locks osc
3305 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3306 rm -f $DIR/$tdir/$tfile
3307 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3308 wait_delete_completed || error "initial wait delete timed out"
3309 local blocks1=$(calc_osc_kbytes_used)
3310 local write_size=$(fs_log_size)
3312 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile
3313 [ $write_size -lt 1024 ] && write_size=1024
3314 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3317 facet_failover $SINGLEMDS
3318 rm $DIR/$tdir/$tfile
3321 zconf_mount $(hostname) $MOUNT || error "mount fails"
3322 client_up || error "client_up failed"
3324 # wait for the remounted client to connect to ost1
3325 local target=$(get_osc_import_name client ost1)
3326 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3327 $(max_recovery_time)
3329 wait_mds_ost_sync || error "MDS-OST sync timed out"
3330 wait_delete_completed || error "wait delete timed out"
3331 local blocks2=$(calc_osc_kbytes_used)
3333 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3334 error $((blocks2 - blocks1)) blocks leaked
3336 run_test 89 "no disk space leak on late ost connection"
3343 change_active $facet
3344 wait_for_facet $facet
3345 mount_facet $facet || error "Restart of $facet failed"
3349 test_90() { # bug 19494
3350 local dir=$DIR/$tdir
3351 local ostfail=$(get_random_entry $(get_facets OST))
3353 if [[ $FAILURE_MODE = HARD ]]; then
3354 local affected=$(affected_facets $ostfail);
3356 [[ "$affected" == $ostfail ]] ||
3357 skip "cannot use FAILURE_MODE=$FAILURE_MODE, affected: $affected"
3359 # ensure all OSTs are active to allow allocations
3362 mkdir $dir || error "mkdir $dir failed"
3364 echo "Create the files"
3366 # file "f${index}" striped over 1 OST
3367 # file "all" striped over all OSTs
3369 $LFS setstripe -c $OSTCOUNT $dir/all ||
3370 error "setstripe failed to create $dir/all"
3372 for ((i = 0; i < $OSTCOUNT; i++)); do
3375 $LFS setstripe -i $i -c 1 $f ||
3376 error "$LFS setstripe failed to create $f"
3378 # confirm setstripe actually created stripe on requested OST
3379 local uuid=$(ostuuid_from_index $i)
3381 for file in f$i all; do
3382 local found=$($LFS find --obd $uuid --name $file $dir)
3384 if [[ $dir/$file != $found ]]; then
3385 $LFS getstripe $dir/$file
3386 error "wrong stripe: $file, uuid: $uuid"
3391 # Before failing an OST, get its obd name and index
3392 local varsvc=${ostfail}_svc
3393 local obd=$(do_facet $ostfail lctl get_param \
3394 -n obdfilter.${!varsvc}.uuid)
3395 local index=$(($(facet_number $ostfail) - 1))
3397 echo "Fail $ostfail $obd, display the list of affected files"
3398 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3400 trap "cleanup_90 $ostfail" EXIT INT
3401 echo "General Query: lfs find $dir"
3402 local list=$($LFS find $dir)
3404 for (( i=0; i<$OSTCOUNT; i++ )); do
3405 list_member "$list" $dir/f$i ||
3406 error_noexit "lfs find $dir: no file f$i"
3408 list_member "$list" $dir/all ||
3409 error_noexit "lfs find $dir: no file all"
3411 # focus on the missing OST,
3412 # we expect to see only two files affected: "f$(index)" and "all"
3414 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3415 list=$($LFS find --obd $obd $dir)
3417 for file in all f$index; do
3418 list_member "$list" $dir/$file ||
3419 error_noexit "lfs find does not report the affected $obd for $file"
3422 [[ $(echo $list | wc -w) -eq 2 ]] ||
3423 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3425 echo "Check getstripe: $LFS getstripe -r --obd $obd"
3426 list=$($LFS getstripe -r --obd $obd $dir)
3428 for file in all f$index; do
3429 echo "$list" | grep $dir/$file ||
3430 error_noexit "lfs getsripe does not report the affected $obd for $file"
3435 run_test 90 "lfs find identifies the missing striped file segments"
3438 [[ "$MDS1_VERSION" -ge $(version_code 2.6.90) ]] ||
3439 [[ "$MDS1_VERSION" -ge $(version_code 2.5.4) &&
3440 "$MDS1_VERSION" -lt $(version_code 2.5.50) ]] ||
3441 skip "Need MDS version 2.5.4+ or 2.6.90+"
3443 cancel_lru_locks osc
3445 $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
3446 error "$LFS setstripe $DIR/$tfile failed"
3447 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3448 error "dd to $DIR/$tfile failed"
3449 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3450 # We need to emulate a state that OST is waiting for other clients
3451 # not completing the recovery. Final ping is queued, but reply will be
3452 # sent on the recovery completion. It is done by sleep before
3453 # processing final pings
3454 do_facet ost1 "$LCTL set_param fail_val=40"
3455 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3458 run_test 93a "replay + reconnect"
3461 [[ "$MDS1_VERSION" -ge $(version_code 2.7.90) ]] ||
3462 skip "Need MDS version 2.7.90+"
3464 cancel_lru_locks mdc
3466 createmany -o $DIR/$tfile 20 ||
3467 error "createmany -o $DIR/$tfile failed"
3469 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3470 # We need to emulate a state that MDT is waiting for other clients
3471 # not completing the recovery. Final ping is queued, but reply will be
3472 # sent on the recovery completion. It is done by sleep before
3473 # processing final pings
3474 do_facet mds1 "$LCTL set_param fail_val=80"
3475 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3478 run_test 93b "replay + reconnect on mds"
3480 striped_dir_check_100() {
3481 local striped_dir=$DIR/$tdir/striped_dir
3482 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3484 $LFS getdirstripe $striped_dir
3485 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3487 createmany -o $striped_dir/f-%d 20 ||
3488 error "creation failed under striped dir"
3492 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3493 ([ $FAILURE_MODE == "HARD" ] &&
3494 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3495 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3498 local striped_dir=$DIR/$tdir/striped_dir
3501 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3503 #To make sure MDT1 and MDT0 are connected
3504 #otherwise it may create single stripe dir here
3505 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3507 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3508 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3509 $LFS setdirstripe -i0 -c2 $striped_dir &
3512 fail mds$((MDTIDX + 1))
3514 wait $CLIENT_PID || error "striped dir creation failed"
3516 striped_dir_check_100 || error "striped dir check failed"
3517 rm -rf $DIR/$tdir || error "rmdir failed"
3519 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3522 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3523 ([ $FAILURE_MODE == "HARD" ] &&
3524 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3525 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3528 local striped_dir=$DIR/$tdir/striped_dir
3531 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3533 #To make sure MDT1 and MDT0 are connected
3534 #otherwise it may create single stripe dir here
3535 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3537 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3538 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3539 $LFS mkdir -i0 -c2 $striped_dir &
3544 wait $CLIENT_PID || error "striped dir creation failed"
3546 striped_dir_check_100 || error "striped dir check failed"
3547 rm -rf $DIR/$tdir || error "rmdir failed"
3549 run_test 100b "DNE: create striped dir, fail MDT0"
3552 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3553 ([ $FAILURE_MODE == "HARD" ] &&
3554 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3555 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3558 local striped_dir=$DIR/$tdir/striped_dir
3560 mkdir_on_mdt0 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3562 #To make sure MDT1 and MDT0 are connected
3563 #otherwise it may create single stripe dir here
3564 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3567 $LFS mkdir -i1 -c2 $striped_dir
3569 fail_abort mds2 abort_recov_mdt
3571 createmany -o $striped_dir/f-%d 20 &&
3572 error "createmany -o $DIR/$tfile should fail"
3575 striped_dir_check_100 || error "striped dir check failed"
3576 rm -rf $DIR/$tdir || error "rmdir failed"
3578 run_test 100c "DNE: create striped dir, fail MDT0"
3580 test_101() { #LU-5648
3581 mkdir -p $DIR/$tdir/d1
3582 mkdir -p $DIR/$tdir/d2
3583 touch $DIR/$tdir/file0
3586 replay_barrier $SINGLEMDS
3587 for i in $(seq $num) ; do
3588 echo test$i > $DIR/$tdir/d1/file$i
3591 fail_abort $SINGLEMDS
3592 for i in $(seq $num) ; do
3593 touch $DIR/$tdir/d2/file$i
3594 test -s $DIR/$tdir/d2/file$i &&
3595 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3600 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3609 [[ $(lctl get_param mdc.*.import |
3610 grep "connect_flags:.*multi_mod_rpc") ]] ||
3611 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3613 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3614 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3615 facet="mds$((0x$idx + 1))"
3617 # get current value of max_mod_rcps_in_flight
3618 num=$($LCTL get_param -n \
3619 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3620 # set default value if client does not support multi mod RPCs
3621 [ -z "$num" ] && num=1
3623 echo "creating $num files ..."
3625 for i in $(seq $num); do
3626 touch $DIR/$tdir/file-$i
3629 # drop request on MDT to force resend
3630 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3631 do_facet $facet "$LCTL set_param fail_loc=0x159"
3632 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3633 for i in $(seq $num); do
3634 chmod 0600 $DIR/$tdir/file-$i &
3638 do_facet $facet "$LCTL set_param fail_loc=0"
3639 for pid in $pids; do
3640 wait $pid || error "chmod failed"
3642 echo "done ($(date +%H:%M:%S))"
3644 # check chmod succeed
3645 for i in $(seq $num); do
3646 checkstat -vp 0600 $DIR/$tdir/file-$i
3651 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3660 [[ $(lctl get_param mdc.*.import |
3661 grep "connect_flags:.*multi_mod_rpc") ]] ||
3662 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3664 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3665 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3666 facet="mds$((0x$idx + 1))"
3668 # get current value of max_mod_rcps_in_flight
3669 num=$($LCTL get_param -n \
3670 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3671 # set default value if client does not support multi mod RPCs
3672 [ -z "$num" ] && num=1
3674 echo "creating $num files ..."
3676 for i in $(seq $num); do
3677 touch $DIR/$tdir/file-$i
3680 # drop reply on MDT to force reconstruction
3681 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3682 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3683 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3684 for i in $(seq $num); do
3685 chmod 0600 $DIR/$tdir/file-$i &
3689 do_facet $facet "$LCTL set_param fail_loc=0"
3690 for pid in $pids; do
3691 wait $pid || error "chmod failed"
3693 echo "done ($(date +%H:%M:%S))"
3695 # check chmod succeed
3696 for i in $(seq $num); do
3697 checkstat -vp 0600 $DIR/$tdir/file-$i
3702 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3711 [[ $(lctl get_param mdc.*.import |
3712 grep "connect_flags:.*multi_mod_rpc") ]] ||
3713 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3715 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3716 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3717 facet="mds$((0x$idx + 1))"
3719 # get current value of max_mod_rcps_in_flight
3720 num=$($LCTL get_param -n \
3721 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3722 # set default value if client does not support multi mod RPCs
3723 [ -z "$num" ] && num=1
3725 echo "creating $num files ..."
3727 for i in $(seq $num); do
3728 touch $DIR/$tdir/file-$i
3731 replay_barrier $facet
3734 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3735 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3736 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3737 for i in $(seq $num); do
3738 chmod 0600 $DIR/$tdir/file-$i &
3742 do_facet $facet "$LCTL set_param fail_loc=0"
3747 for pid in $pids; do
3748 wait $pid || error "chmod failed"
3750 echo "done ($(date +%H:%M:%S))"
3752 # check chmod succeed
3753 for i in $(seq $num); do
3754 checkstat -vp 0600 $DIR/$tdir/file-$i
3759 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3768 [[ $(lctl get_param mdc.*.import |
3769 grep "connect_flags:.*multi_mod_rpc") ]] ||
3770 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3772 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3773 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3774 facet="mds$((0x$idx + 1))"
3776 # get current value of max_mod_rcps_in_flight
3777 num=$($LCTL get_param -n \
3778 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3779 # set default value if client does not support multi mod RPCs
3780 [ -z "$num" ] && num=1
3782 echo "creating $num files ..."
3784 for i in $(seq $num); do
3785 touch $DIR/$tdir/file-$i
3789 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3790 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3791 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3792 for i in $(seq $num); do
3793 chmod 0600 $DIR/$tdir/file-$i &
3798 # write MDT transactions to disk
3799 do_facet $facet "sync; sync; sync"
3801 do_facet $facet "$LCTL set_param fail_loc=0"
3806 for pid in $pids; do
3807 wait $pid || error "chmod failed"
3809 echo "done ($(date +%H:%M:%S))"
3811 # check chmod succeed
3812 for i in $(seq $num); do
3813 checkstat -vp 0600 $DIR/$tdir/file-$i
3818 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3821 remote_mds_nodsh && skip "remote MDS with nodsh"
3822 [[ "$MDS1_VERSION" -gt $(version_code 2.8.54) ]] ||
3823 skip "Need MDS version 2.8.54+"
3825 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3826 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3829 createmany -o $DIR/$tdir/t- 30 ||
3830 error "create files on remote directory failed"
3832 rm -rf $DIR/$tdir/t-*
3834 #MDS should crash with tr->otr_next_id overflow
3837 run_test 103 "Check otr_next_id overflow"
3840 check_striped_dir_110()
3842 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3843 error "create striped dir failed"
3844 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3845 [ $stripe_count -eq $MDSCOUNT ] ||
3846 error "$stripe_count != 2 after recovery"
3850 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3851 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3852 skip "Need MDS version at least 2.7.56"
3854 ([ $FAILURE_MODE == "HARD" ] &&
3855 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3856 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3861 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3864 check_striped_dir_110 || error "check striped_dir failed"
3865 rm -rf $DIR/$tdir || error "rmdir failed"
3869 run_test 110a "DNE: create striped dir, fail MDT1"
3872 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3873 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3874 skip "Need MDS version at least 2.7.56"
3876 ([ $FAILURE_MODE == "HARD" ] &&
3877 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3878 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3883 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3886 zconf_mount $(hostname) $MOUNT
3887 client_up || return 1
3889 check_striped_dir_110 || error "check striped_dir failed"
3891 rm -rf $DIR/$tdir || error "rmdir failed"
3895 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3898 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3899 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3900 skip "Need MDS version at least 2.7.56"
3902 ([ $FAILURE_MODE == "HARD" ] &&
3903 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3904 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3909 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3912 check_striped_dir_110 || error "check striped_dir failed"
3914 rm -rf $DIR/$tdir || error "rmdir failed"
3918 run_test 110c "DNE: create striped dir, fail MDT2"
3921 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3922 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3923 skip "Need MDS version at least 2.7.56"
3925 ([ $FAILURE_MODE == "HARD" ] &&
3926 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3927 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3932 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3935 zconf_mount $(hostname) $MOUNT
3936 client_up || return 1
3938 check_striped_dir_110 || error "check striped_dir failed"
3940 rm -rf $DIR/$tdir || error "rmdir failed"
3944 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3947 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3948 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3949 skip "Need MDS version at least 2.7.56"
3951 ([ $FAILURE_MODE == "HARD" ] &&
3952 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3953 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3958 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3962 zconf_mount $(hostname) $MOUNT
3963 client_up || return 1
3965 check_striped_dir_110 || error "check striped_dir failed"
3967 rm -rf $DIR/$tdir || error "rmdir failed"
3971 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3974 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3975 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
3976 skip "Need MDS version at least 2.7.56"
3978 ([ $FAILURE_MODE == "HARD" ] &&
3979 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3980 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3986 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3989 check_striped_dir_110 || error "check striped_dir failed"
3991 rm -rf $DIR/$tdir || error "rmdir failed"
3995 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3998 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3999 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4000 skip "Need MDS version at least 2.7.56"
4002 ([ $FAILURE_MODE == "HARD" ] &&
4003 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4004 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4009 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
4013 zconf_mount $(hostname) $MOUNT
4014 client_up || return 1
4016 check_striped_dir_110 || error "check striped_dir failed"
4018 rm -rf $DIR/$tdir || error "rmdir failed"
4022 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4025 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4026 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4027 skip "Need MDS version at least 2.7.56"
4029 ([ $FAILURE_MODE == "HARD" ] &&
4030 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4031 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4035 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4037 rm -rf $DIR/$tdir/striped_dir
4040 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4041 error "striped dir still exists"
4044 run_test 111a "DNE: unlink striped dir, fail MDT1"
4047 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4048 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4049 skip "Need MDS version at least 2.7.56"
4051 ([ $FAILURE_MODE == "HARD" ] &&
4052 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4053 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4057 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4059 rm -rf $DIR/$tdir/striped_dir
4062 zconf_mount $(hostname) $MOUNT
4063 client_up || return 1
4065 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4066 error "striped dir still exists"
4069 run_test 111b "DNE: unlink striped dir, fail MDT2"
4072 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4073 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4074 skip "Need MDS version at least 2.7.56"
4076 ([ $FAILURE_MODE == "HARD" ] &&
4077 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4078 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4082 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4084 rm -rf $DIR/$tdir/striped_dir
4088 zconf_mount $(hostname) $MOUNT
4089 client_up || return 1
4090 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4091 error "striped dir still exists"
4094 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4097 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4098 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4099 skip "Need MDS version at least 2.7.56"
4101 ([ $FAILURE_MODE == "HARD" ] &&
4102 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4103 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4107 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4109 rm -rf $DIR/$tdir/striped_dir
4113 zconf_mount $(hostname) $MOUNT
4114 client_up || return 1
4115 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4116 error "striped dir still exists"
4120 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4123 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4124 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4125 skip "Need MDS version at least 2.7.56"
4127 ([ $FAILURE_MODE == "HARD" ] &&
4128 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4129 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4133 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4135 rm -rf $DIR/$tdir/striped_dir
4138 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4139 error "striped dir still exists"
4142 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4145 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4146 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4147 skip "Need MDS version at least 2.7.56"
4149 ([ $FAILURE_MODE == "HARD" ] &&
4150 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4151 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4155 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4157 rm -rf $DIR/$tdir/striped_dir
4160 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4161 error "striped dir still exists"
4164 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4167 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4168 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4169 skip "Need MDS version at least 2.7.56"
4171 ([ $FAILURE_MODE == "HARD" ] &&
4172 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4173 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4177 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4180 rm -rf $DIR/$tdir/striped_dir
4182 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4183 error "striped dir still exists"
4186 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4188 test_112_rename_prepare() {
4189 mkdir_on_mdt0 $DIR/$tdir
4190 mkdir -p $DIR/$tdir/src_dir
4191 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4192 error "create remote source failed"
4194 touch $DIR/$tdir/src_dir/src_child/a
4196 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4197 error "create remote target dir failed"
4199 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4200 error "create remote target child failed"
4205 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4206 error "src_child still exists after rename"
4208 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4209 error "missing file(a) after rename"
4213 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4214 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4215 skip "Need MDS version at least 2.7.56"
4217 ([ $FAILURE_MODE == "HARD" ] &&
4218 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4219 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4222 test_112_rename_prepare
4225 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4226 error "rename dir cross MDT failed!"
4230 rm -rf $DIR/$tdir || error "rmdir failed"
4232 run_test 112a "DNE: cross MDT rename, fail MDT1"
4235 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4236 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4237 skip "Need MDS version at least 2.7.56"
4239 ([ $FAILURE_MODE == "HARD" ] &&
4240 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4241 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4244 test_112_rename_prepare
4247 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4248 error "rename dir cross MDT failed!"
4253 rm -rf $DIR/$tdir || error "rmdir failed"
4255 run_test 112b "DNE: cross MDT rename, fail MDT2"
4258 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4259 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4260 skip "Need MDS version at least 2.7.56"
4262 ([ $FAILURE_MODE == "HARD" ] &&
4263 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4264 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4267 test_112_rename_prepare
4270 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4271 error "rename dir cross MDT failed!"
4276 rm -rf $DIR/$tdir || error "rmdir failed"
4278 run_test 112c "DNE: cross MDT rename, fail MDT3"
4281 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4282 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4283 skip "Need MDS version at least 2.7.56"
4285 ([ $FAILURE_MODE == "HARD" ] &&
4286 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4287 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4290 test_112_rename_prepare
4293 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4294 error "rename dir cross MDT failed!"
4299 rm -rf $DIR/$tdir || error "rmdir failed"
4301 run_test 112d "DNE: cross MDT rename, fail MDT4"
4304 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4305 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4306 skip "Need MDS version at least 2.7.56"
4308 ([ $FAILURE_MODE == "HARD" ] &&
4309 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4310 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4313 test_112_rename_prepare
4317 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4318 error "rename dir cross MDT failed!"
4323 rm -rf $DIR/$tdir || error "rmdir failed"
4325 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4328 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4329 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4330 skip "Need MDS version at least 2.7.56"
4332 ([ $FAILURE_MODE == "HARD" ] &&
4333 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4334 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4337 test_112_rename_prepare
4341 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4342 error "rename dir cross MDT failed!"
4347 rm -rf $DIR/$tdir || error "rmdir failed"
4349 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4352 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4353 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4354 skip "Need MDS version at least 2.7.56"
4356 ([ $FAILURE_MODE == "HARD" ] &&
4357 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4358 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4361 test_112_rename_prepare
4365 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4366 error "rename dir cross MDT failed!"
4371 rm -rf $DIR/$tdir || error "rmdir failed"
4373 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4376 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4377 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4378 skip "Need MDS version at least 2.7.56"
4380 ([ $FAILURE_MODE == "HARD" ] &&
4381 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4382 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4385 test_112_rename_prepare
4389 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4390 error "rename dir cross MDT failed!"
4395 rm -rf $DIR/$tdir || error "rmdir failed"
4397 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4400 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4401 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4402 skip "Need MDS version at least 2.7.56"
4404 ([ $FAILURE_MODE == "HARD" ] &&
4405 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4406 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4409 test_112_rename_prepare
4413 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4414 error "rename dir cross MDT failed!"
4419 rm -rf $DIR/$tdir || error "rmdir failed"
4421 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4424 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4425 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4426 skip "Need MDS version at least 2.7.56"
4428 ([ $FAILURE_MODE == "HARD" ] &&
4429 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4430 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4433 test_112_rename_prepare
4437 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4438 error "rename dir cross MDT failed!"
4443 rm -rf $DIR/$tdir || error "rmdir failed"
4445 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4448 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4449 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4450 skip "Need MDS version at least 2.7.56"
4452 ([ $FAILURE_MODE == "HARD" ] &&
4453 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4454 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4457 test_112_rename_prepare
4462 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4463 error "rename dir cross MDT failed!"
4468 rm -rf $DIR/$tdir || error "rmdir failed"
4470 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4473 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4474 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4475 skip "Need MDS version at least 2.7.56"
4477 ([ $FAILURE_MODE == "HARD" ] &&
4478 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4479 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4482 test_112_rename_prepare
4487 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4488 error "rename dir cross MDT failed!"
4493 rm -rf $DIR/$tdir || error "rmdir failed"
4495 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4498 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4499 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4500 skip "Need MDS version at least 2.7.56"
4502 ([ $FAILURE_MODE == "HARD" ] &&
4503 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4504 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4507 test_112_rename_prepare
4512 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4513 error "rename dir cross MDT failed!"
4518 rm -rf $DIR/$tdir || error "rmdir failed"
4520 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4523 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4524 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4525 skip "Need MDS version at least 2.7.56"
4527 ([ $FAILURE_MODE == "HARD" ] &&
4528 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4529 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4532 test_112_rename_prepare
4537 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4538 error "rename dir cross MDT failed!"
4543 rm -rf $DIR/$tdir || error "rmdir failed"
4545 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4548 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4549 [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
4550 skip "Need MDS version at least 2.7.56"
4552 ([ $FAILURE_MODE == "HARD" ] &&
4553 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4554 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4562 for ((j=0;j<$((MDSCOUNT));j++)); do
4563 fail_index=$((fail_index+1))
4564 index=$((fail_index % MDSCOUNT))
4565 replay_barrier mds$((index + 1))
4566 for ((i=0;i<5;i++)); do
4567 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4568 error "create striped dir $DIR/$tdir/test_$i"
4571 fail mds$((index + 1))
4572 for ((i=0;i<5;i++)); do
4573 checkstat -t dir $DIR/$tdir/test_$i ||
4574 error "$DIR/$tdir/test_$i does not exist!"
4576 rm -rf $DIR/$tdir/test_* ||
4580 run_test 115 "failover for create/unlink striped directory"
4583 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4584 [ "$MDS1_VERSION" -lt $(version_code 2.7.55) ] &&
4585 skip "Do not support large update log before 2.7.55" &&
4587 ([ $FAILURE_MODE == "HARD" ] &&
4588 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4589 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4593 mkdir_on_mdt0 $DIR/$tdir
4596 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4597 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4598 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4601 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4602 error "stried_dir does not exists"
4604 run_test 116a "large update log master MDT recovery"
4607 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4608 [ "$MDS1_VERSION" -lt $(version_code 2.7.55) ] &&
4609 skip "Do not support large update log before 2.7.55" &&
4612 ([ $FAILURE_MODE == "HARD" ] &&
4613 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4614 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4618 mkdir_on_mdt0 $DIR/$tdir
4621 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4622 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4623 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4626 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4627 error "stried_dir does not exists"
4629 run_test 116b "large update log slave MDT recovery"
4632 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4633 ([ $FAILURE_MODE == "HARD" ] &&
4634 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4635 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4641 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4642 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4645 # Let's set rdonly on all MDTs, so client will send
4646 # replay requests on all MDTs and replay these requests
4647 # at the same time. This test will verify the recovery
4648 # will not be deadlock in this case, LU-7531.
4649 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4650 replay_barrier mds$((index + 1))
4651 if [ -z $mds_indexs ]; then
4652 mds_indexs="${mds_indexs}mds$((index+1))"
4654 mds_indexs="${mds_indexs},mds$((index+1))"
4658 rm -rf $DIR/$tdir/remote_dir
4659 rm -rf $DIR/$tdir/remote_dir_1
4663 rm -rf $DIR/$tdir || error "rmdir failed"
4665 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4668 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4669 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4670 skip "Do not support large update log before 2.7.64" &&
4675 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4676 error "setdirstripe fails"
4677 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4678 error "setdirstripe fails 1"
4679 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4681 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4682 do_facet mds1 "lctl set_param fail_loc=0x1705"
4683 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4684 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4685 do_facet mds1 "lctl set_param fail_loc=0x0"
4688 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4689 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4694 run_test 118 "invalidate osp update will not cause update log corruption"
4697 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4698 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4699 skip "Do not support large update log before 2.7.64" &&
4702 local hard_timeout=$(do_facet mds1 \
4703 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4705 local clients=${CLIENTS:-$HOSTNAME}
4706 local time_min=$(recovery_time_min)
4708 mkdir_on_mdt0 $DIR/$tdir
4709 mkdir $DIR/$tdir/tmp
4710 rmdir $DIR/$tdir/tmp
4713 mkdir $DIR/$tdir/dir_1
4714 for ((i = 0; i < 20; i++)); do
4715 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4722 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4723 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4724 #sleep (timeout + 5), so mds will evict the client exports,
4725 #but DNE update recovery will keep going.
4726 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4728 mount_facet mds1 "-o recovery_time_hard=$time_min"
4730 wait_clients_import_state "$clients" mds1 FULL
4732 clients_up || clients_up || error "failover df: $?"
4734 #revert back the hard timeout
4735 do_facet mds1 $LCTL set_param \
4736 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4738 for ((i = 0; i < 20; i++)); do
4739 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4740 [ $stripe_count == 2 ] || {
4741 error "stripe_dir-$i creation replay fails"
4746 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4749 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4750 [ "$MDS1_VERSION" -lt $(version_code 2.7.64) ] &&
4751 skip "Do not support large update log before 2.7.64" &&
4754 mkdir_on_mdt0 $DIR/$tdir
4755 replay_barrier_nosync mds1
4756 for ((i = 0; i < 20; i++)); do
4757 mkdir $DIR/$tdir/dir-$i || {
4758 error "create dir-$i fails"
4761 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4762 error "create stripe_dir-$i fails"
4769 for ((i = 0; i < 20; i++)); do
4770 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4771 error "dir-$i still exists"
4774 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4775 error "stripe_dir-$i still exists"
4780 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4783 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4784 skip "Don't support it before 2.11" &&
4787 local at_max_saved=$(at_max_get mds)
4789 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4790 cancel_lru_locks mdc
4792 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4795 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4801 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4802 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4806 wait_clients_import_state "$clients" mds1 FULL
4807 clients_up || clients_up || error "failover df: $?"
4810 wait $mpid || error "multiop_bg_pause pid failed"
4812 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4813 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4814 at_max_set $at_max_saved mds
4817 run_test 121 "lock replay timed out and race"
4820 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4821 skip "Do not support Data-on-MDT before 2.11"
4823 replay_barrier $SINGLEMDS
4824 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4827 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4828 error "Fail to replay DoM file creation"
4830 run_test 130a "DoM file create (setstripe) replay"
4833 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4834 skip "Do not support Data-on-MDT before 2.11"
4836 mkdir_on_mdt0 $DIR/$tdir
4837 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4838 replay_barrier $SINGLEMDS
4839 touch $DIR/$tdir/$tfile
4842 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4843 error "Fail to replay DoM file creation"
4845 run_test 130b "DoM file create (inherited) replay"
4848 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4849 skip "Do not support Data-on-MDT before 2.11"
4851 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4852 replay_barrier $SINGLEMDS
4853 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4854 # lock is not canceled and will be replayed
4857 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4858 error "Wrong file content after failover"
4860 run_test 131a "DoM file write lock replay"
4863 [ "$MDS1_VERSION" -lt $(version_code 2.10.90) ] &&
4864 skip "Do not support Data-on-MDT before 2.11"
4866 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4867 replay_barrier $SINGLEMDS
4868 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4869 cancel_lru_locks mdc
4873 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4874 error "Wrong file content after failover"
4876 run_test 131b "DoM file write replay"
4879 [ "$MDS1_VERSION" -lt $(version_code 2.12.0) ] &&
4880 skip "Need MDS version 2.12.0 or later"
4882 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4883 replay_barrier $SINGLEMDS
4884 # write over the first component size cause next component instantiation
4885 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4886 error "dd to $DIR/$tfile failed"
4887 lfs getstripe $DIR/$tfile
4889 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4890 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4891 error "Component #1 was not instantiated"
4895 lfs getstripe $DIR/$tfile
4896 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4897 error "Component #1 instantiation was not replayed"
4898 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4899 if [ $cksum != $cksum2 ] ; then
4900 error_noexit "New cksum $cksum2 does not match original $cksum"
4903 run_test 132a "PFL new component instantiate replay"
4906 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4907 ([ $FAILURE_MODE == "HARD" ] &&
4908 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4909 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4912 local remote_dir=$DIR/$tdir/remote_dir
4914 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4915 $LFS mkdir -i 1 $remote_dir
4918 do_facet mds2 $LCTL set_param seq.srv*MDT0001.space=clear
4920 zconf_mount $(hostname) $MOUNT
4921 client_up || return 1
4923 #define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123
4925 do_facet mds1 $LCTL set_param fail_val=700 fail_loc=0x80000123
4926 cp /etc/hosts $remote_dir/file &
4932 wait $pid || error "cp failed"
4933 rm -rf $DIR/$tdir || error "rmdir failed"
4937 run_test 133 "check resend of ongoing requests for lwp during failover"
4940 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return 0
4941 (( $MDS1_VERSION >= $(version_code 2.13.56) )) ||
4942 skip "need MDS version >= 2.13.56"
4945 pool_add_targets pool_134 1 1
4947 mkdir -p $DIR/$tdir/{A,B}
4948 $LFS setstripe -p pool_134 $DIR/$tdir/A
4949 $LFS setstripe -E EOF -p pool_134 $DIR/$tdir/B
4953 touch $DIR/$tdir/A/$tfile || error "touch non-pfl file failed"
4954 touch $DIR/$tdir/B/$tfile || error "touch pfl failed"
4958 [ -f $DIR/$tdir/A/$tfile ] || error "non-pfl file does not exist"
4959 [ -f $DIR/$tdir/B/$tfile ] || error "pfl file does not exist"
4961 run_test 134 "replay creation of a file created in a pool"
4965 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4968 $LFS setstripe -S $((128 * 1024)) -i 0 $DIR/$tdir
4972 # Create 20 files so we have 20 ost locks
4973 for i in $(seq 20) ; do
4974 echo blah > $DIR/$tdir/file.${i}
4982 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x32d
4983 # Make sure lock replay server side never completes and errors out.
4984 do_facet ost1 "$LCTL set_param fail_val=20"
4985 do_facet ost1 "$LCTL set_param fail_loc=0x32d"
4989 # Now make sure we notice
4992 sleep 20 # should we do something proactive to make reconnects go?
4993 kill -0 $PID || error "Unexpected sync success"
5000 do_facet ost1 "$LCTL set_param fail_loc=0"
5002 echo blah > $DIR/$tdir/file.test2
5006 run_test 135 "Server failure in lock replay phase"
5009 check_and_cleanup_lustre