5 LUSTRE=${LUSTRE:-$(dirname $0)/..}
6 . $LUSTRE/tests/test-framework.sh
10 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
12 if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
13 # bug number for skipped test: LU-11388
14 ALWAYS_EXCEPT+=" 131b"
15 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 # bug number for skipped tests: LU-9795 (all below)
19 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0b 0c 0d 34 45"
20 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 47 58b 58c 71a 85a"
21 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 85b 86 88 89 90"
22 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 93a 100a 100b 120"
25 # time in minutes: 7.5 (min)"
26 [ "$SLOW" = "no" ] && EXCEPT_SLOW="44b"
30 CHECK_GRANT=${CHECK_GRANT:-"yes"}
31 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
33 require_dsh_mds || exit 0
34 check_and_setup_lustre
39 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
41 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
42 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
44 do_facet $SINGLEMDS sync
47 test_0a() { # was test_0
48 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
49 replay_barrier $SINGLEMDS
53 run_test 0a "empty replay"
56 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
58 # this test attempts to trigger a race in the precreation code,
59 # and must run before any other objects are created on the filesystem
61 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
62 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
64 run_test 0b "ensure object created after recover exists. (3284)"
67 replay_barrier $SINGLEMDS
70 facet_failover $SINGLEMDS
71 zconf_mount $(hostname) $MOUNT || error "mount fails"
72 client_up || error "post-failover df failed"
73 # file shouldn't exist if replay-barrier works as expected
74 rm $DIR/$tfile && error "File exists and it shouldn't"
77 run_test 0c "check replay-barrier"
80 replay_barrier $SINGLEMDS
82 facet_failover $SINGLEMDS
83 zconf_mount $(hostname) $MOUNT || error "mount fails"
84 client_up || error "post-failover df failed"
86 run_test 0d "expired recovery with no clients"
89 replay_barrier $SINGLEMDS
92 $CHECKSTAT -t file $DIR/$tfile ||
93 error "$CHECKSTAT $DIR/$tfile attribute check failed"
96 run_test 1 "simple create"
99 replay_barrier $SINGLEMDS
102 $CHECKSTAT -t file $DIR/$tfile ||
103 error "$CHECKSTAT $DIR/$tfile attribute check failed"
109 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
110 replay_barrier $SINGLEMDS
113 $CHECKSTAT -t file $DIR/$tfile ||
114 error "$CHECKSTAT $DIR/$tfile attribute check failed"
120 replay_barrier $SINGLEMDS
121 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
123 $CHECKSTAT -t file $DIR/$tfile ||
124 error "$CHECKSTAT $DIR/$tfile check failed"
126 run_test 2c "setstripe replay"
129 [[ $mds1_FSTYPE = "zfs" ]] &&
130 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
131 skip "requires LU-10143 fix on MDS"
132 replay_barrier $SINGLEMDS
133 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
135 $CHECKSTAT -t dir $DIR/$tdir ||
136 error "$CHECKSTAT $DIR/$tdir check failed"
138 run_test 2d "setdirstripe replay"
141 local file=$DIR/$tfile
142 replay_barrier $SINGLEMDS
144 openfile -f O_DIRECTORY $file
146 $CHECKSTAT -t file $file ||
147 error "$CHECKSTAT $file attribute check failed"
150 run_test 3a "replay failed open(O_DIRECTORY)"
153 replay_barrier $SINGLEMDS
154 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
155 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
157 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
159 $CHECKSTAT -t file $DIR/$tfile &&
160 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
163 run_test 3b "replay failed open -ENOMEM"
166 replay_barrier $SINGLEMDS
167 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
168 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
170 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 3c "replay failed open -ENOMEM"
179 test_4a() { # was test_4
180 replay_barrier $SINGLEMDS
181 for i in $(seq 10); do
182 echo "tag-$i" > $DIR/$tfile-$i
185 for i in $(seq 10); do
186 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
189 run_test 4a "|x| 10 open(O_CREAT)s"
192 for i in $(seq 10); do
193 echo "tag-$i" > $DIR/$tfile-$i
195 replay_barrier $SINGLEMDS
198 $CHECKSTAT -t file $DIR/$tfile-* &&
199 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
202 run_test 4b "|x| rm 10 files"
204 # The idea is to get past the first block of precreated files on both
205 # osts, and then replay.
207 replay_barrier $SINGLEMDS
208 for i in $(seq 220); do
209 echo "tag-$i" > $DIR/$tfile-$i
212 for i in $(seq 220); do
213 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
217 # waiting for commitment of removal
219 run_test 5 "|x| 220 open(O_CREAT)"
221 test_6a() { # was test_6
222 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
223 replay_barrier $SINGLEMDS
224 mcreate $DIR/$tdir/$tfile
226 $CHECKSTAT -t dir $DIR/$tdir ||
227 error "$CHECKSTAT $DIR/$tdir attribute check failed"
228 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
229 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
231 # waiting for log process thread
233 run_test 6a "mkdir + contained create"
236 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
237 replay_barrier $SINGLEMDS
240 $CHECKSTAT -t dir $DIR/$tdir &&
241 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
244 run_test 6b "|X| rmdir"
247 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
248 replay_barrier $SINGLEMDS
249 mcreate $DIR/$tdir/$tfile
251 $CHECKSTAT -t dir $DIR/$tdir ||
252 error "$CHECKSTAT $DIR/$tdir attribute check failed"
253 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
254 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
257 run_test 7 "mkdir |X| contained create"
260 replay_barrier $SINGLEMDS
261 multiop_bg_pause $DIR/$tfile mo_c ||
262 error "multiop mknod $DIR/$tfile failed"
266 $CHECKSTAT -t file $DIR/$tfile ||
267 error "$CHECKSTAT $DIR/$tfile attribute check failed"
268 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
269 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
272 run_test 8 "creat open |X| close"
275 replay_barrier $SINGLEMDS
277 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
279 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
281 echo " old_inum == $old_inum, new_inum == $new_inum"
282 if [ $old_inum -eq $new_inum ] ;
284 echo "old_inum and new_inum match"
286 echo " old_inum and new_inum do not match"
287 error "old index($old_inum) does not match new index($new_inum)"
291 run_test 9 "|X| create (same inum/gen)"
294 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
295 replay_barrier $SINGLEMDS
296 mv $DIR/$tfile $DIR/$tfile-2
299 $CHECKSTAT $DIR/$tfile &&
300 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
301 $CHECKSTAT $DIR/$tfile-2 ||
302 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
306 run_test 10 "create |X| rename unlink"
309 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
310 echo "old" > $DIR/$tfile
311 mv $DIR/$tfile $DIR/$tfile-2
312 replay_barrier $SINGLEMDS
313 echo "new" > $DIR/$tfile
315 grep old $DIR/$tfile-2
317 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
318 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
320 run_test 11 "create open write rename |X| create-old-name read"
323 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
324 multiop_bg_pause $DIR/$tfile o_tSc ||
325 error "multiop_bg_pause $DIR/$tfile failed"
328 replay_barrier $SINGLEMDS
329 kill -USR1 $pid || error "multiop $pid not running"
330 wait $pid || error "multiop $pid failed"
333 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
336 run_test 12 "open, unlink |X| close"
338 # 1777 - replay open after committed chmod that would make
339 # a regular open a failure
341 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
342 multiop_bg_pause $DIR/$tfile O_wc ||
343 error "multiop_bg_pause $DIR/$tfile failed"
346 $CHECKSTAT -p 0 $DIR/$tfile ||
347 error "$CHECKSTAT $DIR/$tfile attribute check failed"
348 replay_barrier $SINGLEMDS
350 kill -USR1 $pid || error "multiop $pid not running"
351 wait $pid || error "multiop $pid failed"
353 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
354 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
355 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
358 run_test 13 "open chmod 0 |x| write close"
361 multiop_bg_pause $DIR/$tfile O_tSc ||
362 error "multiop_bg_pause $DIR/$tfile failed"
365 replay_barrier $SINGLEMDS
366 kill -USR1 $pid || error "multiop $pid not running"
367 wait $pid || error "multiop $pid failed"
370 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
373 run_test 14 "open(O_CREAT), unlink |X| close"
376 multiop_bg_pause $DIR/$tfile O_tSc ||
377 error "multiop_bg_pause $DIR/$tfile failed"
380 replay_barrier $SINGLEMDS
381 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
382 kill -USR1 $pid || error "multiop $pid not running"
383 wait $pid || error "multiop $pid failed"
386 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
387 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
390 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
393 replay_barrier $SINGLEMDS
396 mcreate $DIR/$tfile-2
398 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
399 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
400 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
402 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
405 replay_barrier $SINGLEMDS
406 multiop_bg_pause $DIR/$tfile O_c ||
407 error "multiop_bg_pause $DIR/$tfile failed"
410 kill -USR1 $pid || error "multiop $pid not running"
411 wait $pid || error "multiop $pid failed"
412 $CHECKSTAT -t file $DIR/$tfile ||
413 error "$CHECKSTAT $DIR/$tfile attribute check failed"
416 run_test 17 "|X| open(O_CREAT), |replay| close"
419 replay_barrier $SINGLEMDS
420 multiop_bg_pause $DIR/$tfile O_tSc ||
421 error "multiop_bg_pause $DIR/$tfile failed"
424 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
425 echo "pid: $pid will close"
426 kill -USR1 $pid || error "multiop $pid not running"
427 wait $pid || error "multiop $pid failed"
430 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
431 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
432 # this touch frequently fails
433 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
434 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
435 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
438 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
440 # bug 1855 (a simpler form of test_11 above)
442 replay_barrier $SINGLEMDS
444 echo "old" > $DIR/$tfile
445 mv $DIR/$tfile $DIR/$tfile-2
446 grep old $DIR/$tfile-2
448 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
450 run_test 19 "mcreate, open, write, rename "
452 test_20a() { # was test_20
453 replay_barrier $SINGLEMDS
454 multiop_bg_pause $DIR/$tfile O_tSc ||
455 error "multiop_bg_pause $DIR/$tfile failed"
460 kill -USR1 $pid || error "multiop $pid not running"
461 wait $pid || error "multiop $pid failed"
462 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
465 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
467 test_20b() { # bug 10480
468 local wait_timeout=$((TIMEOUT * 4))
469 local extra=$(fs_log_size)
473 $LFS setstripe -i 0 -c 1 $DIR
475 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
477 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
478 while [ ! -e $DIR/$tfile ] ; do
479 usleep 60 # give dd a chance to start
482 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
484 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
486 client_up || client_up || true # reconnect
488 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
490 fail $SINGLEMDS # start orphan recovery
491 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
492 wait_delete_completed $wait_timeout || error "delete did not finish"
496 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
497 log "before $beforeused, after $afterused"
499 (( $beforeused + $extra >= $afterused )) && break
500 n_attempts=$((n_attempts + 1))
501 [ $n_attempts -gt 3 ] &&
502 error "after $afterused > before $beforeused + $extra"
504 wait_zfs_commit $SINGLEMDS 5
509 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
511 test_20c() { # bug 10480
512 multiop_bg_pause $DIR/$tfile Ow_c ||
513 error "multiop_bg_pause $DIR/$tfile failed"
519 client_up || client_up || true # reconnect
521 kill -USR1 $pid || error "multiop $pid not running"
522 wait $pid || error "multiop $pid failed"
523 [ -s $DIR/$tfile ] || error "File was truncated"
527 run_test 20c "check that client eviction does not affect file content"
530 replay_barrier $SINGLEMDS
531 multiop_bg_pause $DIR/$tfile O_tSc ||
532 error "multiop_bg_pause $DIR/$tfile failed"
535 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
538 kill -USR1 $pid || error "multiop $pid not running"
539 wait $pid || error "multiop $pid failed"
540 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
541 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
544 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
547 multiop_bg_pause $DIR/$tfile O_tSc ||
548 error "multiop_bg_pause $DIR/$tfile failed"
551 replay_barrier $SINGLEMDS
555 kill -USR1 $pid || error "multiop $pid not running"
556 wait $pid || error "multiop $pid failed"
557 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
560 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
563 multiop_bg_pause $DIR/$tfile O_tSc ||
564 error "multiop_bg_pause $DIR/$tfile failed"
567 replay_barrier $SINGLEMDS
569 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
572 kill -USR1 $pid || error "multiop $pid not running"
573 wait $pid || error "multiop $pid failed"
574 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
575 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
578 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
581 multiop_bg_pause $DIR/$tfile O_tSc ||
582 error "multiop_bg_pause $DIR/$tfile failed"
585 replay_barrier $SINGLEMDS
588 kill -USR1 $pid || error "multiop $pid not running"
589 wait $pid || error "multiop $pid failed"
590 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
593 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
596 multiop_bg_pause $DIR/$tfile O_tSc ||
597 error "multiop_bg_pause $DIR/$tfile failed"
601 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 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
611 replay_barrier $SINGLEMDS
612 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
613 error "multiop_bg_pause $DIR/$tfile-1 failed"
615 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
616 error "multiop_bg_pause $DIR/$tfile-2 failed"
620 kill -USR1 $pid2 || error "second multiop $pid2 not running"
621 wait $pid2 || error "second multiop $pid2 failed"
624 kill -USR1 $pid1 || error "multiop $pid1 not running"
625 wait $pid1 || error "multiop $pid1 failed"
626 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
627 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
630 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
633 replay_barrier $SINGLEMDS
634 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
635 error "multiop_bg_pause $DIR/$tfile-1 failed"
637 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
638 error "multiop_bg_pause $DIR/$tfile-2 failed"
644 kill -USR1 $pid1 || error "multiop $pid1 not running"
645 wait $pid1 || error "multiop $pid1 failed"
646 kill -USR1 $pid2 || error "second multiop $pid2 not running"
647 wait $pid2 || error "second multiop $pid2 failed"
648 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
649 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
652 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
655 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
656 error "multiop_bg_pause $DIR/$tfile-1 failed"
658 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
659 error "multiop_bg_pause $DIR/$tfile-2 failed"
661 replay_barrier $SINGLEMDS
664 kill -USR1 $pid2 || error "second multiop $pid2 not running"
665 wait $pid2 || error "second multiop $pid2 failed"
668 kill -USR1 $pid1 || error "multiop $pid1 not running"
669 wait $pid1 || error "multiop $pid1 failed"
670 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
671 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
674 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
677 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
678 error "multiop_bg_pause $DIR/$tfile-1 failed"
680 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
681 error "multiop_bg_pause $DIR/$tfile-2 failed"
683 replay_barrier $SINGLEMDS
688 kill -USR1 $pid1 || error "multiop $pid1 not running"
689 wait $pid1 || error "multiop $pid1 failed"
690 kill -USR1 $pid2 || error "second multiop $pid2 not running"
691 wait $pid2 || error "second multiop $pid2 failed"
692 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
693 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
696 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
699 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
700 error "multiop_bg_pause $DIR/$tfile-1 failed"
702 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
703 error "multiop_bg_pause $DIR/$tfile-2 failed"
708 replay_barrier $SINGLEMDS
710 kill -USR1 $pid1 || error "multiop $pid1 not running"
711 wait $pid1 || error "multiop $pid1 failed"
712 kill -USR1 $pid2 || error "second multiop $pid2 not running"
713 wait $pid2 || error "second multiop $pid2 failed"
714 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
715 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
718 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
721 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
722 error "multiop_bg_pause $DIR/$tfile-1 failed"
724 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
725 error "multiop_bg_pause $DIR/$tfile-2 failed"
729 replay_barrier $SINGLEMDS
732 kill -USR1 $pid1 || error "multiop $pid1 not running"
733 wait $pid1 || error "multiop $pid1 failed"
734 kill -USR1 $pid2 || error "second multiop $pid2 not running"
735 wait $pid2 || error "second multiop $pid2 failed"
736 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
737 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
740 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
742 # tests for bug 2104; completion without crashing is success. The close is
743 # stale, but we always return 0 for close, so the app never sees it.
745 multiop_bg_pause $DIR/$tfile O_c ||
746 error "multiop_bg_pause $DIR/$tfile failed"
748 multiop_bg_pause $DIR/$tfile O_c ||
749 error "second multiop_bg_pause $DIR/$tfile failed"
752 client_up || client_up || error "client_up failed"
753 kill -USR1 $pid1 || error "multiop $pid1 not running"
754 kill -USR1 $pid2 || error "second multiop $pid2 not running"
755 wait $pid1 || error "multiop $pid1 failed"
756 wait $pid2 || error "second multiop $pid2 failed"
759 run_test 32 "close() notices client eviction; close() after client eviction"
762 createmany -o $DIR/$tfile-%d 10 ||
763 error "createmany create $DIR/$tfile failed"
764 replay_barrier_nosync $SINGLEMDS
765 fail_abort $SINGLEMDS
766 # recreate shouldn't fail
767 createmany -o $DIR/$tfile--%d 10 ||
768 error "createmany recreate $DIR/$tfile failed"
772 run_test 33a "fid seq shouldn't be reused after abort recovery"
775 #define OBD_FAIL_SEQ_ALLOC 0x1311
776 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
778 createmany -o $DIR/$tfile-%d 10
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 33b "test fid seq allocation"
790 multiop_bg_pause $DIR/$tfile O_c ||
791 error "multiop_bg_pause $DIR/$tfile failed"
795 replay_barrier $SINGLEMDS
796 fail_abort $SINGLEMDS
797 kill -USR1 $pid || error "multiop $pid not running"
798 wait $pid || error "multiop $pid failed"
799 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
803 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
805 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
807 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
809 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
810 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
815 # give a chance to remove from MDS
816 fail_abort $SINGLEMDS
817 $CHECKSTAT -t file $DIR/$tfile &&
818 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
821 run_test 35 "test recovery from llog for unlink op"
823 # b=2432 resent cancel after replay uses wrong cookie,
824 # so don't resend cancels
826 replay_barrier $SINGLEMDS
828 checkstat $DIR/$tfile
829 facet_failover $SINGLEMDS
831 if dmesg | grep "unknown lock cookie"; then
832 error "cancel after replay failed"
835 run_test 36 "don't resend cancel"
838 # directory orphans can't be unlinked from PENDING directory
840 rmdir $DIR/$tfile 2>/dev/null
841 multiop_bg_pause $DIR/$tfile dD_c ||
842 error "multiop_bg_pause $DIR/$tfile failed"
846 replay_barrier $SINGLEMDS
847 # clear the dmesg buffer so we only see errors from this recovery
848 do_facet $SINGLEMDS dmesg -c >/dev/null
849 fail_abort $SINGLEMDS
850 kill -USR1 $pid || error "multiop $pid not running"
851 do_facet $SINGLEMDS dmesg | grep "error .* unlinking .* from PENDING" &&
852 error "error unlinking files"
853 wait $pid || error "multiop $pid failed"
857 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
860 createmany -o $DIR/$tfile-%d 800 ||
861 error "createmany -o $DIR/$tfile failed"
862 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
863 replay_barrier $SINGLEMDS
865 unlinkmany $DIR/$tfile-%d 400 400 ||
866 error "unlinkmany $DIR/$tfile 400 failed"
868 $CHECKSTAT -t file $DIR/$tfile-* &&
869 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
872 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
874 test_39() { # bug 4176
875 createmany -o $DIR/$tfile-%d 800 ||
876 error "createmany -o $DIR/$tfile failed"
877 replay_barrier $SINGLEMDS
878 unlinkmany $DIR/$tfile-%d 0 400
880 unlinkmany $DIR/$tfile-%d 400 400 ||
881 error "unlinkmany $DIR/$tfile 400 failed"
883 $CHECKSTAT -t file $DIR/$tfile-* &&
884 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
887 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
890 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
895 # always need connection to MDS to verify layout during IO. LU-2628.
896 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
897 skip "layout_lock needs MDS connection for IO" && return 0
899 $LCTL mark multiop $MOUNT/$tfile OS_c
900 multiop $MOUNT/$tfile OS_c &
902 writeme -s $MOUNT/${tfile}-2 &
905 facet_failover $SINGLEMDS
906 #define OBD_FAIL_MDS_CONNECT_NET 0x117
907 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
909 stat1=$(count_ost_writes)
911 stat2=$(count_ost_writes)
912 echo "$stat1, $stat2"
913 if [ $stat1 -lt $stat2 ]; then
914 echo "writes continuing during recovery"
917 echo "writes not continuing during recovery, bug 2477"
920 echo "waiting for writeme $WRITE_PID"
924 echo "waiting for multiop $PID"
925 wait $PID || error "multiop $PID failed"
926 do_facet client munlink $MOUNT/$tfile ||
927 error "munlink $MOUNT/$tfile failed"
928 do_facet client munlink $MOUNT/${tfile}-2 ||
929 error "munlink $MOUNT/$tfile-2 failed"
932 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
935 # make sure that a read to one osc doesn't try to double-unlock its page just
936 # because another osc is invalid. trigger_group_io used to mistakenly return
937 # an error if any oscs were invalid even after having successfully put rpcs
938 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
939 # the page, guarnateeing that the unlock from the RPC completion would
940 # assert on trying to unlock the unlocked page.
942 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
944 local f=$MOUNT/$tfile
945 # make sure the start of the file is ost1
946 $LFS setstripe -S $((128 * 1024)) -i 0 $f
947 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
948 error "dd on client failed"
950 # fail ost2 and read from ost1
951 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
952 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
953 grep $mdtosc | awk '{print $1}')
954 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
955 lctl get_param -n devices &&
956 error "OST 2 $osc2dev does not exist"
957 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
958 error "deactive device on $SINGLEMDS failed"
959 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
960 error "second dd on client failed"
961 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
962 error "active device on $SINGLEMDS failed"
965 run_test 41 "read from a valid osc while other oscs are invalid"
967 # test MDS recovery after ost failure
969 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
970 createmany -o $DIR/$tfile-%d 800 ||
971 error "createmany -o $DIR/$tfile failed"
973 unlinkmany $DIR/$tfile-%d 0 400
975 lctl set_param debug=-1
978 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
979 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
980 #[ $blocks_after -lt $blocks ] || return 1
981 echo "wait for MDS to timeout and recover"
982 sleep $((TIMEOUT * 2))
984 unlinkmany $DIR/$tfile-%d 400 400 ||
985 error "unlinkmany $DIR/$tfile 400 failed"
986 $CHECKSTAT -t file $DIR/$tfile-* &&
987 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
990 run_test 42 "recovery after ost failure"
992 # timeout in MDS/OST recovery RPC will LBUG MDS
993 test_43() { # bug 2530
994 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
996 replay_barrier $SINGLEMDS
998 # OBD_FAIL_OST_CREATE_NET 0x204
999 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1005 run_test 43 "mds osc import failure during recovery; don't LBUG"
1007 test_44a() { # was test_44
1008 local at_max_saved=0
1010 local mdcdev=$($LCTL dl |
1011 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1012 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
1013 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1014 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1016 # adaptive timeouts slow this way down
1017 if at_is_enabled; then
1018 at_max_saved=$(at_max_get mds)
1022 for i in $(seq 1 10); do
1023 echo "$i of 10 ($(date +%s))"
1024 do_facet $SINGLEMDS \
1025 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1026 #define OBD_FAIL_TGT_CONN_RACE 0x701
1027 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1028 # lctl below may fail, it is valid case
1029 $LCTL --device $mdcdev recover
1032 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1033 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1036 run_test 44a "race in target handle connect"
1039 local mdcdev=$($LCTL dl |
1040 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1041 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1042 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1043 { echo mdcdev=$mdcdev; $LCTL dl;
1044 error "more than one ${FSNAME}-MDT0000-mdc"; }
1046 for i in $(seq 1 10); do
1047 echo "$i of 10 ($(date +%s))"
1048 do_facet $SINGLEMDS \
1049 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1050 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1051 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1052 # lctl below may fail, it is valid case
1053 $LCTL --device $mdcdev recover
1058 run_test 44b "race in target handle connect"
1061 replay_barrier $SINGLEMDS
1062 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1063 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1064 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1065 fail_abort $SINGLEMDS
1066 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1068 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1071 run_test 44c "race in target handle connect"
1073 # Handle failed close
1075 local mdcdev=$($LCTL get_param -n devices |
1076 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1077 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1078 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1079 { echo mdcdev=$mdcdev; $LCTL dl;
1080 error "more than one ${FSNAME}-MDT0000-mdc"; }
1082 $LCTL --device $mdcdev recover ||
1083 error "$LCTL --device $mdcdev recover failed"
1085 multiop_bg_pause $DIR/$tfile O_c ||
1086 error "multiop_bg_pause $DIR/$tfile failed"
1089 # This will cause the CLOSE to fail before even
1090 # allocating a reply buffer
1091 $LCTL --device $mdcdev deactivate ||
1092 error "$LCTL --device $mdcdev deactivate failed"
1095 kill -USR1 $pid || error "multiop $pid not running"
1096 wait $pid || error "multiop $pid failed"
1098 $LCTL --device $mdcdev activate ||
1099 error "$LCTL --device $mdcdev activate failed"
1102 $CHECKSTAT -t file $DIR/$tfile ||
1103 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1106 run_test 45 "Handle failed close"
1110 drop_reply "touch $DIR/$tfile"
1112 # ironically, the previous test, 45, will cause a real forced close,
1113 # so just look for one for this test
1114 dmesg | grep -i "force closing client file handle for $tfile" &&
1115 error "found force closing in dmesg"
1118 run_test 46 "Don't leak file handle after open resend (3325)"
1120 test_47() { # bug 2824
1121 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1123 # create some files to make sure precreate has been done on all
1124 # OSTs. (just in case this test is run independently)
1125 createmany -o $DIR/$tfile 20 ||
1126 error "createmany create $DIR/$tfile failed"
1128 # OBD_FAIL_OST_CREATE_NET 0x204
1130 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1131 client_up || error "client_up failed"
1133 # let the MDS discover the OST failure, attempt to recover, fail
1134 # and recover again.
1135 sleep $((3 * TIMEOUT))
1137 # Without 2824, this createmany would hang
1138 createmany -o $DIR/$tfile 20 ||
1139 error "createmany recraete $DIR/$tfile failed"
1140 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1144 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1147 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1148 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1150 replay_barrier $SINGLEMDS
1151 createmany -o $DIR/$tfile 20 ||
1152 error "createmany -o $DIR/$tfile failed"
1153 # OBD_FAIL_OST_EROFS 0x216
1154 facet_failover $SINGLEMDS
1155 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1156 client_up || error "client_up failed"
1158 # let the MDS discover the OST failure, attempt to recover, fail
1159 # and recover again.
1160 sleep $((3 * TIMEOUT))
1162 createmany -o $DIR/$tfile 20 20 ||
1163 error "createmany recraete $DIR/$tfile failed"
1164 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1167 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1170 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1171 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1172 grep $mdtosc | awk '{print $1}')
1173 [ "$oscdev" ] || error "could not find OSC device on MDS"
1174 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1175 error "OSC device $oscdev recovery failed"
1176 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1177 error "second OSC device $oscdev recovery failed"
1178 # give the mds_lov_sync threads a chance to run
1181 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1183 # b3764 timed out lock replay
1185 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.6.90) ] &&
1186 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly" &&
1189 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1190 cancel_lru_locks mdc
1192 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1195 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1196 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1197 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1199 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1201 wait $mpid || error "multiop_bg_pause pid failed"
1203 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1204 lctl set_param fail_loc=0x0
1205 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1208 run_test 52 "time out lock replay (3764)"
1210 # bug 3462 - simultaneous MDC requests
1212 [[ $(lctl get_param mdc.*.import |
1213 grep "connect_flags:.*multi_mod_rpc") ]] ||
1214 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1216 cancel_lru_locks mdc # cleanup locks from former test cases
1217 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1218 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1219 multiop $DIR/${tdir}-1/f O_c &
1221 # give multiop a change to open
1224 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1225 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1226 kill -USR1 $close_pid
1227 cancel_lru_locks mdc # force the close
1228 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1230 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1232 # close should still be here
1233 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1235 replay_barrier_nodf $SINGLEMDS
1237 wait $close_pid || error "close_pid $close_pid failed"
1239 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1240 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1241 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1242 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1243 rm -rf $DIR/${tdir}-*
1245 run_test 53a "|X| close request while two MDC requests in flight"
1248 cancel_lru_locks mdc # cleanup locks from former test cases
1250 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1251 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1252 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1253 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1256 #define OBD_FAIL_MDS_REINT_NET 0x107
1257 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1258 mcreate $DIR/${tdir}-2/f &
1262 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1263 kill -USR1 $close_pid
1264 cancel_lru_locks mdc # force the close
1265 wait $close_pid || error "close_pid $close_pid failed"
1266 # open should still be here
1267 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1269 replay_barrier_nodf $SINGLEMDS
1271 wait $open_pid || error "open_pid failed"
1273 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1274 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1275 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1276 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1277 rm -rf $DIR/${tdir}-*
1279 run_test 53b "|X| open request while two MDC requests in flight"
1282 cancel_lru_locks mdc # cleanup locks from former test cases
1284 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1285 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1286 multiop $DIR/${tdir}-1/f O_c &
1289 #define OBD_FAIL_MDS_REINT_NET 0x107
1290 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1291 mcreate $DIR/${tdir}-2/f &
1295 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1296 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1297 kill -USR1 $close_pid
1298 cancel_lru_locks mdc # force the close
1300 #bz20647: make sure all pids exist before failover
1301 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1302 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1303 replay_barrier_nodf $SINGLEMDS
1304 fail_nodf $SINGLEMDS
1305 wait $open_pid || error "open_pid failed"
1307 # close should be gone
1308 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1309 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1311 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1312 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1313 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1314 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1315 rm -rf $DIR/${tdir}-*
1317 run_test 53c "|X| open request and close request while two MDC requests in flight"
1320 [[ $(lctl get_param mdc.*.import |
1321 grep "connect_flags:.*multi_mod_rpc") ]] ||
1322 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1324 cancel_lru_locks mdc # cleanup locks from former test cases
1326 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1327 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1328 multiop $DIR/${tdir}-1/f O_c &
1330 # give multiop a chance to open
1333 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1334 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1335 kill -USR1 $close_pid
1336 cancel_lru_locks mdc # force the close
1337 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1338 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1340 # close should still be here
1341 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1343 wait $close_pid || error "close_pid failed"
1345 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1346 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1347 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1348 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1349 rm -rf $DIR/${tdir}-*
1351 run_test 53d "close reply while two MDC requests in flight"
1354 cancel_lru_locks mdc # cleanup locks from former test cases
1356 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1357 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1358 multiop $DIR/${tdir}-1/f O_c &
1361 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1362 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1363 mcreate $DIR/${tdir}-2/f &
1367 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1368 kill -USR1 $close_pid
1369 cancel_lru_locks mdc # force the close
1370 wait $close_pid || error "close_pid failed"
1371 # open should still be here
1372 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1374 replay_barrier_nodf $SINGLEMDS
1376 wait $open_pid || error "open_pid failed"
1378 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1379 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1380 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1381 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1382 rm -rf $DIR/${tdir}-*
1384 run_test 53e "|X| open reply while two MDC requests in flight"
1387 cancel_lru_locks mdc # cleanup locks from former test cases
1389 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1390 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1391 multiop $DIR/${tdir}-1/f O_c &
1394 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1395 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1396 mcreate $DIR/${tdir}-2/f &
1400 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1401 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1402 kill -USR1 $close_pid
1403 cancel_lru_locks mdc # force the close
1405 #bz20647: make sure all pids are exists before failover
1406 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1407 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1408 replay_barrier_nodf $SINGLEMDS
1409 fail_nodf $SINGLEMDS
1410 wait $open_pid || error "open_pid failed"
1412 # close should be gone
1413 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1414 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1416 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1417 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1418 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1419 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1420 rm -rf $DIR/${tdir}-*
1422 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1425 cancel_lru_locks mdc # cleanup locks from former test cases
1427 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1428 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1429 multiop $DIR/${tdir}-1/f O_c &
1432 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1433 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1434 mcreate $DIR/${tdir}-2/f &
1438 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1439 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1440 kill -USR1 $close_pid
1441 cancel_lru_locks mdc # force the close
1442 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1444 #bz20647: make sure all pids are exists before failover
1445 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1446 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1447 replay_barrier_nodf $SINGLEMDS
1448 fail_nodf $SINGLEMDS
1449 wait $open_pid || error "open_pid failed"
1451 # close should be gone
1452 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1454 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1455 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1456 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1457 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1458 rm -rf $DIR/${tdir}-*
1460 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1463 cancel_lru_locks mdc # cleanup locks from former test cases
1465 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1466 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1467 multiop $DIR/${tdir}-1/f O_c &
1470 #define OBD_FAIL_MDS_REINT_NET 0x107
1471 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1472 mcreate $DIR/${tdir}-2/f &
1476 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1477 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1478 kill -USR1 $close_pid
1479 cancel_lru_locks mdc # force the close
1482 #bz20647: make sure all pids are exists before failover
1483 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1484 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1485 replay_barrier_nodf $SINGLEMDS
1486 fail_nodf $SINGLEMDS
1487 wait $open_pid || error "open_pid failed"
1489 # close should be gone
1490 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1491 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1493 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1494 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1495 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1496 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1497 rm -rf $DIR/${tdir}-*
1499 run_test 53h "open request and close reply while two MDC requests in flight"
1501 #b3761 ASSERTION(hash != 0) failed
1503 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1504 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1506 # give touch a chance to run
1508 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1512 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1514 #b3440 ASSERTION(rec->ur_fid2->id) failed
1516 ln -s foo $DIR/$tfile
1517 replay_barrier $SINGLEMDS
1518 #drop_reply "cat $DIR/$tfile"
1522 run_test 56 "don't replay a symlink open request (3440)"
1524 #recovery one mds-ost setattr from llog
1526 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1527 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1528 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1529 replay_barrier $SINGLEMDS
1531 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1532 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1533 $CHECKSTAT -t file $DIR/$tfile ||
1534 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1535 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1538 run_test 57 "test recovery from llog for setattr op"
1541 zconf_umount $(hostname) $MOUNT2
1545 #recovery many mds-ost setattr from llog
1547 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1548 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1549 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1550 createmany -o $DIR/$tdir/$tfile-%d 2500
1551 replay_barrier $SINGLEMDS
1554 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1555 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1556 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1557 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1558 error "unlinkmany $DIR/$tfile failed"
1561 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1567 trap cleanup_58 EXIT
1569 large_xattr_enabled &&
1570 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1571 # Original extended attribute can be long. Print a small version of
1572 # attribute if an error occurs
1573 local sm_msg=$(printf "%.9s" $orig)
1575 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1576 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1577 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1578 replay_barrier $SINGLEMDS
1579 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1581 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1582 [[ "$new" = "$orig" ]] ||
1583 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1584 rm -f $DIR/$tdir/$tfile
1587 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1589 run_test 58b "test replay of setxattr op"
1591 test_58c() { # bug 16570
1596 trap cleanup_58 EXIT
1598 if large_xattr_enabled; then
1599 local xattr_size=$(max_xattr_size)
1600 orig="$(generate_string $((xattr_size / 2)))"
1601 orig1="$(generate_string $xattr_size)"
1607 # PING_INTERVAL max(obd_timeout / 4, 1U)
1608 sleep $((TIMEOUT / 4))
1610 # Original extended attribute can be long. Print a small version of
1611 # attribute if an error occurs
1612 local sm_msg=$(printf "%.9s" $orig)
1613 local sm_msg1=$(printf "%.9s" $orig1)
1615 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1616 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1617 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1618 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1619 error "drop_request for setfattr failed"
1620 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1621 [[ "$new" = "$orig" ]] ||
1622 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1623 drop_reint_reply "setfattr -n trusted.foo1 \
1624 -v $orig1 $DIR/$tdir/$tfile" ||
1625 error "drop_reint_reply for setfattr failed"
1626 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1627 [[ "$new" = "$orig1" ]] ||
1628 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1629 rm -f $DIR/$tdir/$tfile
1633 run_test 58c "resend/reconstruct setxattr op"
1635 # log_commit_thread vs filter_destroy race used to lead to import use after free
1638 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1640 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1641 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1642 error "createmany create files failed"
1644 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1645 error "unlinkmany $DIR/$tdir/$tfile failed"
1646 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1647 do_facet ost1 "lctl set_param fail_loc=0x507"
1650 do_facet ost1 "lctl set_param fail_loc=0x0"
1654 run_test 59 "test log_commit_thread vs filter_destroy race"
1656 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1657 # bug 12086: should no oops and No ctxt error for this test
1659 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1660 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1661 error "createmany create files failed"
1662 replay_barrier $SINGLEMDS
1663 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1665 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1666 local no_ctxt=$(dmesg | grep "No ctxt")
1667 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1669 run_test 60 "test llog post recovery init vs llog unlink"
1671 #test race llog recovery thread vs llog cleanup
1672 test_61a() { # was test_61
1673 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1675 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1676 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1677 error "createmany create files failed"
1679 unlinkmany $DIR/$tdir/$tfile-%d 800
1680 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1681 set_nodes_failloc "$(osts_nodes)" 0x80000221
1686 set_nodes_failloc "$(osts_nodes)" 0x0
1688 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1689 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1692 run_test 61a "test race llog recovery vs llog cleanup"
1694 #test race mds llog sync vs llog cleanup
1696 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1697 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1698 facet_failover $SINGLEMDS
1701 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1704 run_test 61b "test race mds llog sync vs llog cleanup"
1706 #test race cancel cookie cb vs llog cleanup
1708 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1710 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1711 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1712 set_nodes_failloc "$(osts_nodes)" 0x80000222
1716 set_nodes_failloc "$(osts_nodes)" 0x0
1718 run_test 61c "test race mds llog sync vs llog cleanup"
1720 test_61d() { # bug 16002 # bug 17466 # bug 22137
1721 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1723 do_facet mgs "lctl set_param fail_loc=0x80000605"
1724 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1725 error "mgs start should have failed"
1726 do_facet mgs "lctl set_param fail_loc=0"
1727 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1729 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1731 test_62() { # Bug 15756 - don't mis-drop resent replay
1732 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1733 replay_barrier $SINGLEMDS
1734 createmany -o $DIR/$tdir/$tfile- 25 ||
1735 error "createmany create files failed"
1736 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1737 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1739 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1740 unlinkmany $DIR/$tdir/$tfile- 25 ||
1741 error "unlinkmany $DIR/$tdir/$tfile failed"
1744 run_test 62 "don't mis-drop resent replay"
1746 #Adaptive Timeouts (bug 3055)
1754 echo "Cleaning up AT ..."
1755 if [ -n "$ATOLDBASE" ]; then
1756 local at_history=$($LCTL get_param -n at_history)
1757 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1758 do_facet ost1 "lctl set_param at_history=$at_history" || true
1761 if [ $AT_MAX_SET -ne 0 ]; then
1762 for facet in mds client ost; do
1763 var=AT_MAX_SAVE_${facet}
1764 echo restore AT on $facet to saved value ${!var}
1765 at_max_set ${!var} $facet
1766 at_new=$(at_max_get $facet)
1767 echo Restored AT value on $facet $at_new
1768 [ $at_new -eq ${!var} ] ||
1769 error "AT value not restored SAVED ${!var} NEW $at_new"
1776 local at_max_new=600
1778 # Save at_max original values
1780 if [ $AT_MAX_SET -eq 0 ]; then
1781 # Suppose that all osts have the same at_max
1782 for facet in mds client ost; do
1783 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1787 for facet in mds client ost; do
1788 at_max=$(at_max_get $facet)
1789 if [ $at_max -ne $at_max_new ]; then
1790 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1791 at_max_set $at_max_new $facet
1796 if [ -z "$ATOLDBASE" ]; then
1797 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1798 # speed up the timebase so we can check decreasing AT
1799 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1800 do_facet ost1 "lctl set_param at_history=8" || true
1802 # sleep for a while to cool down, should be > 8s and also allow
1803 # at least one ping to be sent. simply use TIMEOUT to be safe.
1808 test_65a() #bug 3055
1810 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1812 at_start || return 0
1813 $LCTL dk > /dev/null
1815 $LCTL set_param debug="other"
1816 # Slow down a request to the current service time, this is critical
1817 # because previous tests may have caused this value to increase.
1818 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1819 awk '/portal 12/ {print $5}'`
1820 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1822 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1823 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1824 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1825 createmany -o $DIR/$tfile 10 > /dev/null
1826 unlinkmany $DIR/$tfile 10 > /dev/null
1827 # check for log message
1828 $LCTL dk | grep "Early reply #" || error "No early reply"
1830 # client should show REQ_DELAY estimates
1831 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1833 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1835 run_test 65a "AT: verify early replies"
1837 test_65b() #bug 3055
1839 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1841 at_start || return 0
1844 $LCTL set_param debug="other trace"
1845 $LCTL dk > /dev/null
1846 # Slow down a request to the current service time, this is critical
1847 # because previous tests may have caused this value to increase.
1848 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1849 error "$LFS setstripe failed for $DIR/$tfile"
1851 multiop $DIR/$tfile Ow1yc
1852 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1853 awk '/portal 6/ {print $5}'`
1854 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1856 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1857 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1858 do_facet ost1 $LCTL set_param fail_loc=0x224
1861 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1862 error "$LFS setstripe failed"
1863 # force some real bulk transfer
1864 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1866 do_facet ost1 $LCTL set_param fail_loc=0
1867 # check for log message
1868 $LCTL dk | grep "Early reply #" || error "No early reply"
1870 # client should show REQ_DELAY estimates
1871 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1873 run_test 65b "AT: verify early replies on packed reply / bulk"
1875 test_66a() #bug 3055
1877 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1879 at_start || return 0
1880 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1881 # adjust 5s at a time so no early reply is sent (within deadline)
1882 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1883 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1884 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1885 createmany -o $DIR/$tfile 20 > /dev/null
1886 unlinkmany $DIR/$tfile 20 > /dev/null
1887 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1888 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1889 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1890 createmany -o $DIR/$tfile 20 > /dev/null
1891 unlinkmany $DIR/$tfile 20 > /dev/null
1892 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1893 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1895 createmany -o $DIR/$tfile 20 > /dev/null
1896 unlinkmany $DIR/$tfile 20 > /dev/null
1897 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1898 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1899 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1900 echo "Current MDT timeout $CUR, worst $WORST"
1901 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1903 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1905 test_66b() #bug 3055
1907 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1909 at_start || return 0
1910 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1911 awk '/network/ {print $4}')
1912 $LCTL set_param fail_val=$(($ORIG + 5))
1913 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1914 $LCTL set_param fail_loc=0x50c
1915 touch $DIR/$tfile > /dev/null 2>&1
1916 $LCTL set_param fail_loc=0
1917 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1918 awk '/network/ {print $4}')
1919 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1920 awk '/network/ {print $6}')
1921 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1922 [ $WORST -gt $ORIG ] ||
1923 error "Worst $WORST should be worse than orig $ORIG"
1925 run_test 66b "AT: verify net latency adjusts"
1927 test_67a() #bug 3055
1929 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1931 at_start || return 0
1932 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1933 # sleeping threads may drive values above this
1934 do_facet ost1 "$LCTL set_param fail_val=400"
1935 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1936 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1937 createmany -o $DIR/$tfile 20 > /dev/null
1938 unlinkmany $DIR/$tfile 20 > /dev/null
1939 do_facet ost1 "$LCTL set_param fail_loc=0"
1940 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1941 ATTEMPTS=$(($CONN2 - $CONN1))
1942 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1943 [ $ATTEMPTS -gt 0 ] &&
1944 error_ignore bz13721 "AT should have prevented reconnect"
1947 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1949 test_67b() #bug 3055
1951 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1953 at_start || return 0
1954 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1956 # exhaust precreations on ost1
1957 local OST=$(ostname_from_index 0)
1958 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1959 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1960 osp.$mdtosc.prealloc_last_id)
1961 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1962 osp.$mdtosc.prealloc_next_id)
1964 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1965 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${OST} ||
1966 error "$LFS setstripe failed"
1967 echo "Creating to objid $last_id on ost $OST..."
1968 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1969 do_facet ost1 "$LCTL set_param fail_val=20000"
1970 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1971 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1974 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1976 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1977 ATTEMPTS=$(($CONN2 - $CONN1))
1978 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1979 # do it again; should not timeout
1980 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1981 cp /etc/profile $DIR/$tfile || error "cp failed"
1982 do_facet ost1 "$LCTL set_param fail_loc=0"
1984 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1985 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1986 ATTEMPTS=$(($CONN3 - $CONN2))
1987 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1988 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1991 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1993 test_68 () #bug 13813
1995 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1997 at_start || return 0
1998 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1999 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
2000 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
2001 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
2002 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2003 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2004 echo $TIMEOUT >> $ldlm_enqueue_min
2005 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2007 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2008 $LFS setstripe --stripe-index=0 -c 1 $DIR/$tdir ||
2009 error "$LFS setstripe failed for $DIR/$tdir"
2010 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2011 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2012 $LCTL set_param fail_loc=0x80000312
2013 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2014 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2015 $LCTL set_param fail_loc=0x80000312
2016 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2017 $LCTL set_param fail_loc=0
2019 echo $ENQ_MIN >> $ldlm_enqueue_min
2020 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2024 run_test 68 "AT: verify slowing locks"
2027 # end of AT tests includes above lines
2029 # start multi-client tests
2031 [ -z "$CLIENTS" ] &&
2032 { skip "Need two or more clients." && return; }
2033 [ $CLIENTCOUNT -lt 2 ] &&
2034 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2036 echo "mount clients $CLIENTS ..."
2037 zconf_mount_clients $CLIENTS $MOUNT
2039 local clients=${CLIENTS//,/ }
2040 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2041 for CLIENT in $clients; do
2042 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2043 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2044 error "dd failed on $CLIENT"
2047 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2048 for C in ${CLIENTS//,/ }; do
2049 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2050 of=/dev/null 2>/dev/null ||
2051 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2057 run_test 70a "check multi client t-f"
2059 check_for_process () {
2064 killall_process $clients "$prog" -0
2068 local clients=${CLIENTS:-$HOSTNAME}
2070 zconf_mount_clients $clients $MOUNT
2073 [ "$SLOW" = "no" ] && duration=120
2074 # set duration to 900 because it takes some time to boot node
2075 [ "$FAILURE_MODE" = HARD ] && duration=900
2078 local start_ts=$(date +%s)
2079 local cmd="rundbench 1 -t $duration"
2081 if [ $MDSCOUNT -ge 2 ]; then
2082 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2083 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2085 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2086 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2087 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2088 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2091 #LU-1897 wait for all dbench copies to start
2092 while ! check_for_process $clients dbench; do
2093 elapsed=$(($(date +%s) - start_ts))
2094 if [ $elapsed -gt $duration ]; then
2095 killall_process $clients dbench
2096 error "dbench failed to start on $clients!"
2101 log "Started rundbench load pid=$pid ..."
2103 elapsed=$(($(date +%s) - start_ts))
2104 local num_failovers=0
2106 while [ $elapsed -lt $duration ]; do
2107 if ! check_for_process $clients dbench; then
2108 error_noexit "dbench stopped on some of $clients!"
2109 killall_process $clients dbench
2113 replay_barrier mds$fail_index
2114 sleep 1 # give clients a time to do operations
2115 # Increment the number of failovers
2116 num_failovers=$((num_failovers+1))
2117 log "$TESTNAME fail mds$fail_index $num_failovers times"
2119 elapsed=$(($(date +%s) - start_ts))
2120 if [ $fail_index -ge $MDSCOUNT ]; then
2123 fail_index=$((fail_index+1))
2127 wait $pid || error "rundbench load on $clients failed!"
2129 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2130 # end multi-client tests
2135 local monitor_pid=$3
2137 local start_ts=$(date +%s)
2138 local num_failovers=0
2141 elapsed=$(($(date +%s) - start_ts))
2142 while [ $elapsed -lt $duration ]; do
2143 fail_index=$((RANDOM%max_index+1))
2144 kill -0 $monitor_pid ||
2145 error "$monitor_pid stopped"
2147 replay_barrier mds$fail_index
2149 # Increment the number of failovers
2150 num_failovers=$((num_failovers+1))
2151 log "$TESTNAME fail mds$fail_index $num_failovers times"
2153 elapsed=$(($(date +%s) - start_ts))
2159 rm -f $DIR/replay-single.70c.lck
2164 local clients=${CLIENTS:-$HOSTNAME}
2167 zconf_mount_clients $clients $MOUNT
2170 [ "$SLOW" = "no" ] && duration=180
2171 # set duration to 900 because it takes some time to boot node
2172 [ "$FAILURE_MODE" = HARD ] && duration=600
2175 local start_ts=$(date +%s)
2177 trap cleanup_70c EXIT
2179 while [ ! -e $DIR/replay-single.70c.lck ]; do
2180 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2181 if [ $MDSCOUNT -ge 2 ]; then
2182 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2183 error "set default dirstripe failed"
2185 cd $DIR/$tdir || break
2186 tar cf - /etc | tar xf - || error "tar failed in loop"
2190 echo "Started tar $tar_70c_pid"
2192 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2193 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2195 touch $DIR/replay-single.70c.lck
2196 wait $tar_70c_pid || error "$?: tar failed"
2201 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2205 kill -9 $mkdir_70d_pid
2209 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2210 local clients=${CLIENTS:-$HOSTNAME}
2213 zconf_mount_clients $clients $MOUNT
2216 [ "$SLOW" = "no" ] && duration=180
2217 # set duration to 900 because it takes some time to boot node
2218 [ "$FAILURE_MODE" = HARD ] && duration=900
2223 local start_ts=$(date +%s)
2225 trap cleanup_70d EXIT
2228 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2232 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2237 touch $DIR/$tdir/test/a || {
2241 mkdir $DIR/$tdir/test/b || {
2245 rm -rf $DIR/$tdir/test || {
2251 touch $DIR/$tdir/test1/a || {
2255 mkdir $DIR/$tdir/test1/b || {
2260 rm -rf $DIR/$tdir/test1 || {
2262 ls -lR $DIR/$tdir/test1
2268 echo "Started $mkdir_70d_pid"
2270 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2271 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2276 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2279 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2280 local clients=${CLIENTS:-$HOSTNAME}
2283 lctl set_param debug=+ha
2284 zconf_mount_clients $clients $MOUNT
2287 [ "$SLOW" = "no" ] && duration=180
2288 # set duration to 900 because it takes some time to boot node
2289 [ "$FAILURE_MODE" = HARD ] && duration=900
2292 $LFS mkdir -i0 $DIR/$tdir/test_0
2293 $LFS mkdir -i0 $DIR/$tdir/test_1
2294 touch $DIR/$tdir/test_0/a
2295 touch $DIR/$tdir/test_1/b
2298 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2303 checkstat $DIR/$tdir/test_0/a && {
2304 echo "a still exists"
2308 checkstat $DIR/$tdir/test_1/b || {
2309 echo "b still exists"
2313 touch $DIR/$tdir/test_0/a || {
2314 echo "touch a fails"
2318 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2325 stack_trap "kill -9 $rename_70e_pid" EXIT
2326 echo "Started PID=$rename_70e_pid"
2328 random_fail_mdt 2 $duration $rename_70e_pid
2329 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2331 run_test 70e "rename cross-MDT with random fails"
2333 test_70f_write_and_read(){
2338 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2339 for client in ${CLIENTS//,/ }; do
2340 [ -f $stopflag ] || return
2342 local tgtfile=$DIR/$tdir/$tfile.$client
2343 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2344 of=$tgtfile 2>/dev/null ||
2345 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2346 "of=$tgtfile failed on $client, rc=$?"
2349 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2352 for client in ${CLIENTS//,/ }; do
2353 [ -f $stopflag ] || return
2355 # flush client cache in case test is running on only one client
2356 # do_node $client cancel_lru_locks osc
2357 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2359 tgtfile=$DIR/$tdir/$tfile.$client
2360 local md5=$(do_node $prev_client "md5sum $tgtfile")
2361 [ ${checksum[$index]// */} = ${md5// */} ] ||
2362 error "$tgtfile: checksum doesn't match on $prev_client"
2363 index=$((index + 1))
2373 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2374 $LFS setstripe -c -1 $DIR/$tdir ||
2375 error "cannot $LFS setstripe $DIR/$tdir"
2378 while [ -f $stopflag ]; do
2379 test_70f_write_and_read $srcfile $stopflag
2380 # use direct IO and buffer cache in turns if loop
2381 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2385 test_70f_cleanup() {
2387 rm -f $TMP/$tfile.stop
2388 do_nodes $CLIENTS rm -f $TMP/$tfile
2389 rm -f $DIR/$tdir/$tfile.*
2393 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2394 # { skip "Failover host not defined" && return; }
2395 # [ -z "$CLIENTS" ] &&
2396 # { skip "CLIENTS are not specified." && return; }
2397 # [ $CLIENTCOUNT -lt 2 ] &&
2398 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2400 [[ $(lustre_version_code ost1) -lt $(version_code 2.9.53) ]] &&
2401 skip "Need server version at least 2.9.53" && return
2403 echo "mount clients $CLIENTS ..."
2404 zconf_mount_clients $CLIENTS $MOUNT
2406 local srcfile=$TMP/$tfile
2410 trap test_70f_cleanup EXIT
2411 # create a different source file local to each client node so we can
2412 # detect if the file wasn't written out properly after failover
2413 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2414 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2415 for client in ${CLIENTS//,/ }; do
2416 checksum[$index]=$(do_node $client "md5sum $srcfile")
2417 index=$((index + 1))
2421 [ "$SLOW" = "no" ] && duration=60
2422 # set duration to 900 because it takes some time to boot node
2423 [ "$FAILURE_MODE" = HARD ] && duration=900
2425 local stopflag=$TMP/$tfile.stop
2426 test_70f_loop $srcfile $stopflag &
2430 local num_failovers=0
2431 local start_ts=$SECONDS
2432 while [ $elapsed -lt $duration ]; do
2436 num_failovers=$((num_failovers + 1))
2437 log "$TESTNAME failing OST $num_failovers times"
2440 elapsed=$((SECONDS - start_ts))
2447 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2451 kill -9 $mkdir_71a_pid
2454 random_double_fail_mdt() {
2457 local monitor_pid=$3
2459 local start_ts=$(date +%s)
2460 local num_failovers=0
2464 elapsed=$(($(date +%s) - start_ts))
2465 while [ $elapsed -lt $duration ]; do
2466 fail_index=$((RANDOM%max_index + 1))
2467 if [ $fail_index -eq $max_index ]; then
2470 second_index=$((fail_index + 1))
2472 kill -0 $monitor_pid ||
2473 error "$monitor_pid stopped"
2475 replay_barrier mds$fail_index
2476 replay_barrier mds$second_index
2478 # Increment the number of failovers
2479 num_failovers=$((num_failovers+1))
2480 log "fail mds$fail_index mds$second_index $num_failovers times"
2481 fail mds${fail_index},mds${second_index}
2482 elapsed=$(($(date +%s) - start_ts))
2487 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2488 local clients=${CLIENTS:-$HOSTNAME}
2491 zconf_mount_clients $clients $MOUNT
2494 [ "$SLOW" = "no" ] && duration=180
2495 # set duration to 900 because it takes some time to boot node
2496 [ "$FAILURE_MODE" = HARD ] && duration=900
2501 local start_ts=$(date +%s)
2503 trap cleanup_71a EXIT
2506 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2507 rmdir $DIR/$tdir/test
2511 echo "Started $mkdir_71a_pid"
2513 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2514 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2519 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2522 multiop_bg_pause $DIR/$tfile O_tSc ||
2523 error "multiop_bg_pause $DIR/$tfile failed"
2527 replay_barrier $SINGLEMDS
2528 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2529 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2532 wait $pid || error "multiop pid failed"
2533 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2536 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2539 multiop_bg_pause $DIR/$tfile O_tSc ||
2540 error "multiop_bg_pause $DIR/$tfile failed"
2544 replay_barrier $SINGLEMDS
2545 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
2546 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
2549 wait $pid || error "multiop pid failed"
2550 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2553 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2557 local clients=${CLIENTS:-$HOSTNAME}
2559 zconf_umount_clients $clients $MOUNT
2561 facet_failover $SINGLEMDS
2562 zconf_mount_clients $clients $MOUNT
2564 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2565 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2566 clients_up || error "client evicted: $?"
2569 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2571 remote_dir_check_80() {
2576 diridx=$($LFS getstripe -m $remote_dir) ||
2577 error "$LFS getstripe -m $remote_dir failed"
2578 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2580 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2581 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2582 error "$LFS getstripe -m $remote_dir/f-1 failed"
2583 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2589 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2590 ([ $FAILURE_MODE == "HARD" ] &&
2591 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2592 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2596 local remote_dir=$DIR/$tdir/remote_dir
2598 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2599 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2600 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2601 $LFS mkdir -i $MDTIDX $remote_dir &
2607 wait $CLIENT_PID || error "remote creation failed"
2609 remote_dir_check_80 || error "remote dir check failed"
2610 rm -rf $DIR/$tdir || error "rmdir failed"
2614 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2617 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2618 ([ $FAILURE_MODE == "HARD" ] &&
2619 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2620 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2624 local remote_dir=$DIR/$tdir/remote_dir
2626 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2627 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2628 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2629 $LFS mkdir -i $MDTIDX $remote_dir &
2634 fail mds$((MDTIDX + 1))
2636 wait $CLIENT_PID || error "remote creation failed"
2638 remote_dir_check_80 || error "remote dir check failed"
2639 rm -rf $DIR/$tdir || error "rmdir failed"
2643 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2646 [[ $mds1_FSTYPE = "zfs" ]] &&
2647 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2648 skip "requires LU-10143 fix on MDS"
2649 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2650 ([ $FAILURE_MODE == "HARD" ] &&
2651 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2652 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2656 local remote_dir=$DIR/$tdir/remote_dir
2658 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2659 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2660 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2661 $LFS mkdir -i $MDTIDX $remote_dir &
2667 fail mds$((MDTIDX + 1))
2669 wait $CLIENT_PID || error "remote creation failed"
2671 remote_dir_check_80 || error "remote dir check failed"
2672 rm -rf $DIR/$tdir || error "rmdir failed"
2676 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2679 [[ $mds1_FSTYPE = "zfs" ]] &&
2680 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2681 skip "requires LU-10143 fix on MDS"
2682 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2684 local remote_dir=$DIR/$tdir/remote_dir
2686 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2687 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2688 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2689 $LFS mkdir -i $MDTIDX $remote_dir &
2692 # sleep 3 seconds to make sure MDTs are failed after
2693 # lfs mkdir -i has finished on all of MDTs.
2698 fail mds${MDTIDX},mds$((MDTIDX + 1))
2700 wait $CLIENT_PID || error "remote creation failed"
2702 remote_dir_check_80 || error "remote dir check failed"
2703 rm -rf $DIR/$tdir || error "rmdir failed"
2707 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2710 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2711 ([ $FAILURE_MODE == "HARD" ] &&
2712 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2713 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2717 local remote_dir=$DIR/$tdir/remote_dir
2719 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2720 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2721 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2722 $LFS mkdir -i $MDTIDX $remote_dir &
2725 # sleep 3 seconds to make sure MDTs are failed after
2726 # lfs mkdir -i has finished on all of MDTs.
2732 wait $CLIENT_PID || error "remote creation failed"
2734 remote_dir_check_80 || error "remote dir check failed"
2735 rm -rf $DIR/$tdir || error "rmdir failed"
2739 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2742 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2743 ([ $FAILURE_MODE == "HARD" ] &&
2744 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2745 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2748 local remote_dir=$DIR/$tdir/remote_dir
2750 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2751 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2752 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2753 $LFS mkdir -i $MDTIDX $remote_dir &
2757 fail mds$((MDTIDX + 1))
2759 wait $CLIENT_PID || error "remote creation failed"
2761 remote_dir_check_80 || error "remote dir check failed"
2762 rm -rf $DIR/$tdir || error "rmdir failed"
2766 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2769 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2770 ([ $FAILURE_MODE == "HARD" ] &&
2771 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2772 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2776 local remote_dir=$DIR/$tdir/remote_dir
2778 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2779 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2780 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2781 $LFS mkdir -i $MDTIDX $remote_dir &
2784 # sleep 3 seconds to make sure MDTs are failed after
2785 # lfs mkdir -i has finished on all of MDTs.
2791 fail mds$((MDTIDX + 1))
2793 wait $CLIENT_PID || error "remote creation failed"
2795 remote_dir_check_80 || error "remote dir check failed"
2796 rm -rf $DIR/$tdir || error "rmdir failed"
2800 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2803 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2805 local remote_dir=$DIR/$tdir/remote_dir
2807 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2808 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2809 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2810 $LFS mkdir -i $MDTIDX $remote_dir &
2813 # sleep 3 seconds to make sure MDTs are failed after
2814 # lfs mkdir -i has finished on all of MDTs.
2819 fail mds${MDTIDX},mds$((MDTIDX + 1))
2821 wait $CLIENT_PID || error "remote dir creation failed"
2823 remote_dir_check_80 || error "remote dir check failed"
2824 rm -rf $DIR/$tdir || error "rmdir failed"
2828 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2831 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2832 ([ $FAILURE_MODE == "HARD" ] &&
2833 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2834 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2838 local remote_dir=$DIR/$tdir/remote_dir
2840 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2841 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2843 touch $remote_dir || error "touch $remote_dir failed"
2844 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2845 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2850 fail mds$((MDTIDX + 1))
2852 wait $CLIENT_PID || error "rm remote dir failed"
2854 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2856 rm -rf $DIR/$tdir || error "rmdir failed"
2860 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2863 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2864 ([ $FAILURE_MODE == "HARD" ] &&
2865 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2866 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2869 local remote_dir=$DIR/$tdir/remote_dir
2871 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2872 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2874 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2875 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2882 wait $CLIENT_PID || error "rm remote dir failed"
2884 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2886 rm -rf $DIR/$tdir || error "rmdir failed"
2890 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2893 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2894 ([ $FAILURE_MODE == "HARD" ] &&
2895 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2896 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2900 local remote_dir=$DIR/$tdir/remote_dir
2902 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2903 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2905 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2906 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2913 fail mds$((MDTIDX + 1))
2915 wait $CLIENT_PID || error "rm remote dir failed"
2917 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2919 rm -rf $DIR/$tdir || error "rmdir failed"
2923 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2926 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2928 local remote_dir=$DIR/$tdir/remote_dir
2930 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2931 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2933 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2934 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2940 fail mds${MDTIDX},mds$((MDTIDX + 1))
2942 wait $CLIENT_PID || error "rm remote dir failed"
2944 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2946 rm -rf $DIR/$tdir || error "rmdir failed"
2950 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2953 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2954 ([ $FAILURE_MODE == "HARD" ] &&
2955 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2956 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2960 local remote_dir=$DIR/$tdir/remote_dir
2962 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2963 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2965 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2966 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2969 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2974 wait $CLIENT_PID || error "rm remote dir failed"
2976 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2978 rm -rf $DIR/$tdir || error "rmdir failed"
2982 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2985 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2986 ([ $FAILURE_MODE == "HARD" ] &&
2987 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2988 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2992 local remote_dir=$DIR/$tdir/remote_dir
2994 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2995 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2997 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2998 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3003 fail mds$((MDTIDX + 1))
3005 wait $CLIENT_PID || error "rm remote dir failed"
3007 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3009 rm -rf $DIR/$tdir || error "rmdir failed"
3013 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3016 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3017 ([ $FAILURE_MODE == "HARD" ] &&
3018 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3019 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3023 local remote_dir=$DIR/$tdir/remote_dir
3025 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3026 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3028 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3029 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3036 fail mds$((MDTIDX + 1))
3038 wait $CLIENT_PID || error "rm remote dir failed"
3040 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3042 rm -rf $DIR/$tdir || error "rmdir failed"
3046 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3049 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3051 local remote_dir=$DIR/$tdir/remote_dir
3053 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3054 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3056 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3057 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3063 fail mds${MDTIDX},mds$((MDTIDX + 1))
3065 wait $CLIENT_PID || error "rm remote dir failed"
3067 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3069 rm -rf $DIR/$tdir || error "rmdir failed"
3073 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3076 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3077 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3078 createmany -o $DIR/$tfile- 1 &
3082 client_up || client_up || true # reconnect
3084 run_test 84a "stale open during export disconnect"
3086 test_85a() { #bug 16774
3087 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3089 for i in $(seq 100); do
3090 echo "tag-$i" > $DIR/$tfile-$i
3091 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3094 lov_id=$(lctl dl | grep "clilov")
3095 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3096 count=$(lctl get_param -n \
3097 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3098 echo "before recovery: unused locks count = $count"
3102 count2=$(lctl get_param -n \
3103 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3104 echo "after recovery: unused locks count = $count2"
3106 if [ $count2 -ge $count ]; then
3107 error "unused locks are not canceled"
3110 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3112 test_85b() { #bug 16774
3116 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3118 if ! combined_mgs_mds ; then
3122 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3124 for i in $(seq 100); do
3125 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3126 count=32 >/dev/null 2>&1
3129 cancel_lru_locks osc
3131 for i in $(seq 100); do
3132 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3133 count=32 >/dev/null 2>&1
3136 lov_id=$(lctl dl | grep "clilov")
3137 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3138 count=$(lctl get_param -n \
3139 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3140 echo "before recovery: unused locks count = $count"
3141 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3145 count2=$(lctl get_param \
3146 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3147 echo "after recovery: unused locks count = $count2"
3149 if ! combined_mgs_mds ; then
3153 if [ $count2 -ge $count ]; then
3154 error "unused locks are not canceled"
3159 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3162 local clients=${CLIENTS:-$HOSTNAME}
3164 zconf_umount_clients $clients $MOUNT
3165 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3166 remount_facet $SINGLEMDS
3167 zconf_mount_clients $clients $MOUNT
3169 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3172 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3175 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3176 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3177 error "dd to $DIR/$tfile failed"
3178 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3179 cancel_lru_locks osc
3181 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3182 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3183 if [ $cksum != $cksum2 ] ; then
3184 error "New checksum $cksum2 does not match original $cksum"
3187 run_test 87a "write replay"
3190 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3193 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3194 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3195 error "dd to $DIR/$tfile failed"
3196 sleep 1 # Give it a chance to flush dirty data
3197 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3198 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3199 cancel_lru_locks osc
3201 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3202 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3203 if [ $cksum != $cksum2 ] ; then
3204 error "New checksum $cksum2 does not match original $cksum"
3207 run_test 87b "write replay with changed data (checksum resend)"
3209 test_88() { #bug 17485
3210 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3211 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3213 $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "$LFS setstripe failed"
3216 replay_barrier $SINGLEMDS
3218 # exhaust precreations on ost1
3219 local OST=$(ostname_from_index 0)
3220 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3221 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3222 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3223 echo "before test: last_id = $last_id, next_id = $next_id"
3225 echo "Creating to objid $last_id on ost $OST..."
3226 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3227 error "createmany create files to last_id failed"
3229 #create some files to use some uncommitted objids
3230 last_id=$(($last_id + 1))
3231 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3232 error "createmany create files with uncommitted objids failed"
3234 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3235 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3236 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3238 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3239 # it has to take care about the affected facets, bug20407
3240 local affected_mds1=$(affected_facets mds1)
3241 local affected_ost1=$(affected_facets ost1)
3243 shutdown_facet $SINGLEMDS
3246 reboot_facet $SINGLEMDS
3247 change_active $affected_mds1
3248 wait_for_facet $affected_mds1
3249 mount_facets $affected_mds1 || error "Restart of mds failed"
3252 change_active $affected_ost1
3253 wait_for_facet $affected_ost1
3254 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3258 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3259 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3260 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3262 # create new files, which should use new objids, and ensure the orphan
3263 # cleanup phase for ost1 is completed at the same time
3264 for i in $(seq 8); do
3265 file_id=$(($last_id + 10 + $i))
3266 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3269 # if the objids were not recreated, then "ls" will fail with -ENOENT
3270 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3273 # write into previously created files
3274 for i in $(seq 8); do
3275 file_id=$(($last_id + $i))
3276 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3277 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3280 # compare the content
3281 for i in $(seq 8); do
3282 file_id=$(($last_id + $i))
3283 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3284 error "the content of file is modified!"
3289 run_test 88 "MDS should not assign same objid to different files "
3291 function calc_osc_kbytes_used() {
3292 local kbtotal=$(calc_osc_kbytes kbytestotal)
3293 local kbfree=$(calc_osc_kbytes kbytesfree)
3294 echo $((kbtotal-kbfree))
3298 cancel_lru_locks osc
3299 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3300 rm -f $DIR/$tdir/$tfile
3301 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3302 wait_delete_completed || error "initial wait delete timed out"
3303 local blocks1=$(calc_osc_kbytes_used)
3304 local write_size=$(fs_log_size)
3306 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile
3307 [ $write_size -lt 1024 ] && write_size=1024
3308 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3311 facet_failover $SINGLEMDS
3312 rm $DIR/$tdir/$tfile
3315 zconf_mount $(hostname) $MOUNT || error "mount fails"
3316 client_up || error "client_up failed"
3318 # wait for the remounted client to connect to ost1
3319 local target=$(get_osc_import_name client ost1)
3320 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3321 $(max_recovery_time)
3323 wait_mds_ost_sync || error "MDS-OST sync timed out"
3324 wait_delete_completed || error "wait delete timed out"
3325 local blocks2=$(calc_osc_kbytes_used)
3327 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3328 error $((blocks2 - blocks1)) blocks leaked
3330 run_test 89 "no disk space leak on late ost connection"
3337 change_active $facet
3338 wait_for_facet $facet
3339 mount_facet $facet || error "Restart of $facet failed"
3343 test_90() { # bug 19494
3344 local dir=$DIR/$tdir
3345 local ostfail=$(get_random_entry $(get_facets OST))
3347 if [[ $FAILURE_MODE = HARD ]]; then
3348 local affected=$(affected_facets $ostfail);
3349 if [[ "$affected" != $ostfail ]]; then
3350 skip not functional with FAILURE_MODE=$FAILURE_MODE, affected: $affected
3354 # ensure all OSTs are active to allow allocations
3357 mkdir $dir || error "mkdir $dir failed"
3359 echo "Create the files"
3361 # file "f${index}" striped over 1 OST
3362 # file "all" striped over all OSTs
3364 $LFS setstripe -c $OSTCOUNT $dir/all ||
3365 error "setstripe failed to create $dir/all"
3367 for ((i = 0; i < $OSTCOUNT; i++)); do
3370 $LFS setstripe -i $i -c 1 $f ||
3371 error "$LFS setstripe failed to create $f"
3373 # confirm setstripe actually created stripe on requested OST
3374 local uuid=$(ostuuid_from_index $i)
3376 for file in f$i all; do
3377 local found=$($LFS find --obd $uuid --name $file $dir)
3379 if [[ $dir/$file != $found ]]; then
3380 $LFS getstripe $dir/$file
3381 error "wrong stripe: $file, uuid: $uuid"
3386 # Before failing an OST, get its obd name and index
3387 local varsvc=${ostfail}_svc
3388 local obd=$(do_facet $ostfail lctl get_param \
3389 -n obdfilter.${!varsvc}.uuid)
3390 local index=$(($(facet_number $ostfail) - 1))
3392 echo "Fail $ostfail $obd, display the list of affected files"
3393 shutdown_facet $ostfail || error "shutdown_facet $ostfail failed"
3395 trap "cleanup_90 $ostfail" EXIT INT
3396 echo "General Query: lfs find $dir"
3397 local list=$($LFS find $dir)
3399 for (( i=0; i<$OSTCOUNT; i++ )); do
3400 list_member "$list" $dir/f$i ||
3401 error_noexit "lfs find $dir: no file f$i"
3403 list_member "$list" $dir/all ||
3404 error_noexit "lfs find $dir: no file all"
3406 # focus on the missing OST,
3407 # we expect to see only two files affected: "f$(index)" and "all"
3409 echo "Querying files on shutdown $ostfail: lfs find --obd $obd"
3410 list=$($LFS find --obd $obd $dir)
3412 for file in all f$index; do
3413 list_member "$list" $dir/$file ||
3414 error_noexit "lfs find does not report the affected $obd for $file"
3417 [[ $(echo $list | wc -w) -eq 2 ]] ||
3418 error_noexit "lfs find reports the wrong list of affected files ${#list[@]}"
3420 echo "Check getstripe: $LFS getstripe -r --obd $obd"
3421 list=$($LFS getstripe -r --obd $obd $dir)
3423 for file in all f$index; do
3424 echo "$list" | grep $dir/$file ||
3425 error_noexit "lfs getsripe does not report the affected $obd for $file"
3430 run_test 90 "lfs find identifies the missing striped file segments"
3433 local server_version=$(lustre_version_code $SINGLEMDS)
3434 [[ $server_version -ge $(version_code 2.6.90) ]] ||
3435 [[ $server_version -ge $(version_code 2.5.4) &&
3436 $server_version -lt $(version_code 2.5.50) ]] ||
3437 { skip "Need MDS version 2.5.4+ or 2.6.90+"; return; }
3439 cancel_lru_locks osc
3441 $LFS setstripe -i 0 -c 1 $DIR/$tfile ||
3442 error "$LFS setstripe $DIR/$tfile failed"
3443 dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 ||
3444 error "dd to $DIR/$tfile failed"
3445 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3446 # We need to emulate a state that OST is waiting for other clients
3447 # not completing the recovery. Final ping is queued, but reply will be
3448 # sent on the recovery completion. It is done by sleep before
3449 # processing final pings
3450 do_facet ost1 "$LCTL set_param fail_val=40"
3451 do_facet ost1 "$LCTL set_param fail_loc=0x715"
3454 run_test 93a "replay + reconnect"
3457 local server_version=$(lustre_version_code $SINGLEMDS)
3458 [[ $server_version -ge $(version_code 2.7.90) ]] ||
3459 { skip "Need MDS version 2.7.90+"; return; }
3461 cancel_lru_locks mdc
3463 createmany -o $DIR/$tfile 20 ||
3464 error "createmany -o $DIR/$tfile failed"
3466 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715
3467 # We need to emulate a state that MDT is waiting for other clients
3468 # not completing the recovery. Final ping is queued, but reply will be
3469 # sent on the recovery completion. It is done by sleep before
3470 # processing final pings
3471 do_facet mds1 "$LCTL set_param fail_val=80"
3472 do_facet mds1 "$LCTL set_param fail_loc=0x715"
3475 run_test 93b "replay + reconnect on mds"
3477 striped_dir_check_100() {
3478 local striped_dir=$DIR/$tdir/striped_dir
3479 local stripe_count=$($LFS getdirstripe -c $striped_dir)
3481 $LFS getdirstripe $striped_dir
3482 [ $stripe_count -eq 2 ] || error "$stripe_count != 2"
3484 createmany -o $striped_dir/f-%d 20 ||
3485 error "creation failed under striped dir"
3489 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3490 ([ $FAILURE_MODE == "HARD" ] &&
3491 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3492 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3495 local striped_dir=$DIR/$tdir/striped_dir
3498 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3500 #To make sure MDT1 and MDT0 are connected
3501 #otherwise it may create single stripe dir here
3502 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3504 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
3505 do_facet mds$((MDTIDX+1)) lctl set_param fail_loc=0x1701
3506 $LFS setdirstripe -i0 -c2 $striped_dir &
3509 fail mds$((MDTIDX + 1))
3511 wait $CLIENT_PID || error "striped dir creation failed"
3513 striped_dir_check_100 || error "striped dir check failed"
3514 rm -rf $DIR/$tdir || error "rmdir failed"
3516 run_test 100a "DNE: create striped dir, drop update rep from MDT1, fail MDT1"
3519 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3520 ([ $FAILURE_MODE == "HARD" ] &&
3521 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3522 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3525 local striped_dir=$DIR/$tdir/striped_dir
3528 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3530 #To make sure MDT1 and MDT0 are connected
3531 #otherwise it may create single stripe dir here
3532 $LFS setdirstripe -i1 $DIR/$tdir/remote_dir
3534 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3535 do_facet mds$MDTIDX lctl set_param fail_loc=0x119
3536 $LFS mkdir -i0 -c2 $striped_dir &
3541 wait $CLIENT_PID || error "striped dir creation failed"
3543 striped_dir_check_100 || error "striped dir check failed"
3544 rm -rf $DIR/$tdir || error "rmdir failed"
3546 run_test 100b "DNE: create striped dir, fail MDT0"
3548 test_101() { #LU-5648
3549 mkdir -p $DIR/$tdir/d1
3550 mkdir -p $DIR/$tdir/d2
3551 touch $DIR/$tdir/file0
3554 replay_barrier $SINGLEMDS
3555 for i in $(seq $num) ; do
3556 echo test$i > $DIR/$tdir/d1/file$i
3559 fail_abort $SINGLEMDS
3560 for i in $(seq $num) ; do
3561 touch $DIR/$tdir/d2/file$i
3562 test -s $DIR/$tdir/d2/file$i &&
3563 ls -al $DIR/$tdir/d2/file$i && error "file$i's size > 0"
3568 run_test 101 "Shouldn't reassign precreated objs to other files after recovery"
3577 [[ $(lctl get_param mdc.*.import |
3578 grep "connect_flags:.*multi_mod_rpc") ]] ||
3579 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3581 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3582 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3583 facet="mds$((0x$idx + 1))"
3585 # get current value of max_mod_rcps_in_flight
3586 num=$($LCTL get_param -n \
3587 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3588 # set default value if client does not support multi mod RPCs
3589 [ -z "$num" ] && num=1
3591 echo "creating $num files ..."
3593 for i in $(seq $num); do
3594 touch $DIR/$tdir/file-$i
3597 # drop request on MDT to force resend
3598 #define OBD_FAIL_MDS_REINT_MULTI_NET 0x159
3599 do_facet $facet "$LCTL set_param fail_loc=0x159"
3600 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3601 for i in $(seq $num); do
3602 chmod 0600 $DIR/$tdir/file-$i &
3606 do_facet $facet "$LCTL set_param fail_loc=0"
3607 for pid in $pids; do
3608 wait $pid || error "chmod failed"
3610 echo "done ($(date +%H:%M:%S))"
3612 # check chmod succeed
3613 for i in $(seq $num); do
3614 checkstat -vp 0600 $DIR/$tdir/file-$i
3619 run_test 102a "check resend (request lost) with multiple modify RPCs in flight"
3628 [[ $(lctl get_param mdc.*.import |
3629 grep "connect_flags:.*multi_mod_rpc") ]] ||
3630 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3632 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3633 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3634 facet="mds$((0x$idx + 1))"
3636 # get current value of max_mod_rcps_in_flight
3637 num=$($LCTL get_param -n \
3638 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3639 # set default value if client does not support multi mod RPCs
3640 [ -z "$num" ] && num=1
3642 echo "creating $num files ..."
3644 for i in $(seq $num); do
3645 touch $DIR/$tdir/file-$i
3648 # drop reply on MDT to force reconstruction
3649 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3650 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3651 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3652 for i in $(seq $num); do
3653 chmod 0600 $DIR/$tdir/file-$i &
3657 do_facet $facet "$LCTL set_param fail_loc=0"
3658 for pid in $pids; do
3659 wait $pid || error "chmod failed"
3661 echo "done ($(date +%H:%M:%S))"
3663 # check chmod succeed
3664 for i in $(seq $num); do
3665 checkstat -vp 0600 $DIR/$tdir/file-$i
3670 run_test 102b "check resend (reply lost) with multiple modify RPCs in flight"
3679 [[ $(lctl get_param mdc.*.import |
3680 grep "connect_flags:.*multi_mod_rpc") ]] ||
3681 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3683 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3684 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3685 facet="mds$((0x$idx + 1))"
3687 # get current value of max_mod_rcps_in_flight
3688 num=$($LCTL get_param -n \
3689 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3690 # set default value if client does not support multi mod RPCs
3691 [ -z "$num" ] && num=1
3693 echo "creating $num files ..."
3695 for i in $(seq $num); do
3696 touch $DIR/$tdir/file-$i
3699 replay_barrier $facet
3702 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3703 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3704 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3705 for i in $(seq $num); do
3706 chmod 0600 $DIR/$tdir/file-$i &
3710 do_facet $facet "$LCTL set_param fail_loc=0"
3715 for pid in $pids; do
3716 wait $pid || error "chmod failed"
3718 echo "done ($(date +%H:%M:%S))"
3720 # check chmod succeed
3721 for i in $(seq $num); do
3722 checkstat -vp 0600 $DIR/$tdir/file-$i
3727 run_test 102c "check replay w/o reconstruction with multiple mod RPCs in flight"
3736 [[ $(lctl get_param mdc.*.import |
3737 grep "connect_flags:.*multi_mod_rpc") ]] ||
3738 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
3740 $LFS mkdir -c1 $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3741 idx=$(printf "%04x" $($LFS getdirstripe -i $DIR/$tdir))
3742 facet="mds$((0x$idx + 1))"
3744 # get current value of max_mod_rcps_in_flight
3745 num=$($LCTL get_param -n \
3746 mdc.$FSNAME-MDT$idx-mdc-*.max_mod_rpcs_in_flight)
3747 # set default value if client does not support multi mod RPCs
3748 [ -z "$num" ] && num=1
3750 echo "creating $num files ..."
3752 for i in $(seq $num); do
3753 touch $DIR/$tdir/file-$i
3757 #define OBD_FAIL_MDS_REINT_MULTI_NET_REP 0x15a
3758 do_facet $facet "$LCTL set_param fail_loc=0x15a"
3759 echo "launch $num chmod in parallel ($(date +%H:%M:%S)) ..."
3760 for i in $(seq $num); do
3761 chmod 0600 $DIR/$tdir/file-$i &
3766 # write MDT transactions to disk
3767 do_facet $facet "sync; sync; sync"
3769 do_facet $facet "$LCTL set_param fail_loc=0"
3774 for pid in $pids; do
3775 wait $pid || error "chmod failed"
3777 echo "done ($(date +%H:%M:%S))"
3779 # check chmod succeed
3780 for i in $(seq $num); do
3781 checkstat -vp 0600 $DIR/$tdir/file-$i
3786 run_test 102d "check replay & reconstruction with multiple mod RPCs in flight"
3789 remote_mds_nodsh && skip "remote MDS with nodsh" && return
3790 local mds_version=$(lustre_version_code $SINGLEMDS)
3791 [[ $mds_version -gt $(version_code 2.8.54) ]] ||
3792 { skip "Need MDS version 2.8.54+"; return; }
3794 #define OBD_FAIL_MDS_TRACK_OVERFLOW 0x162
3795 do_facet mds1 $LCTL set_param fail_loc=0x80000162
3798 createmany -o $DIR/$tdir/t- 30 ||
3799 error "create files on remote directory failed"
3801 rm -rf $DIR/$tdir/t-*
3803 #MDS should crash with tr->otr_next_id overflow
3806 run_test 103 "Check otr_next_id overflow"
3809 check_striped_dir_110()
3811 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
3812 error "create striped dir failed"
3813 local stripe_count=$($LFS getdirstripe -c $DIR/$tdir/striped_dir)
3814 [ $stripe_count -eq $MDSCOUNT ] ||
3815 error "$stripe_count != 2 after recovery"
3819 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3820 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3821 skip "Need MDS version at least 2.7.56"
3823 ([ $FAILURE_MODE == "HARD" ] &&
3824 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3825 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3830 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3833 check_striped_dir_110 || error "check striped_dir failed"
3834 rm -rf $DIR/$tdir || error "rmdir failed"
3838 run_test 110a "DNE: create striped dir, fail MDT1"
3841 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3842 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3843 skip "Need MDS version at least 2.7.56"
3845 ([ $FAILURE_MODE == "HARD" ] &&
3846 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3847 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3852 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3855 zconf_mount $(hostname) $MOUNT
3856 client_up || return 1
3858 check_striped_dir_110 || error "check striped_dir failed"
3860 rm -rf $DIR/$tdir || error "rmdir failed"
3864 run_test 110b "DNE: create striped dir, fail MDT1 and client"
3867 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3868 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3869 skip "Need MDS version at least 2.7.56"
3871 ([ $FAILURE_MODE == "HARD" ] &&
3872 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3873 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3878 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3881 check_striped_dir_110 || error "check striped_dir failed"
3883 rm -rf $DIR/$tdir || error "rmdir failed"
3887 run_test 110c "DNE: create striped dir, fail MDT2"
3890 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3891 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3892 skip "Need MDS version at least 2.7.56"
3894 ([ $FAILURE_MODE == "HARD" ] &&
3895 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3896 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3901 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3904 zconf_mount $(hostname) $MOUNT
3905 client_up || return 1
3907 check_striped_dir_110 || error "check striped_dir failed"
3909 rm -rf $DIR/$tdir || error "rmdir failed"
3913 run_test 110d "DNE: create striped dir, fail MDT2 and client"
3916 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3917 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3918 skip "Need MDS version at least 2.7.56"
3920 ([ $FAILURE_MODE == "HARD" ] &&
3921 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3922 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3927 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3931 zconf_mount $(hostname) $MOUNT
3932 client_up || return 1
3934 check_striped_dir_110 || error "check striped_dir failed"
3936 rm -rf $DIR/$tdir || error "rmdir failed"
3940 run_test 110e "DNE: create striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
3943 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3944 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3945 skip "Need MDS version at least 2.7.56"
3947 ([ $FAILURE_MODE == "HARD" ] &&
3948 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3949 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3955 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3958 check_striped_dir_110 || error "check striped_dir failed"
3960 rm -rf $DIR/$tdir || error "rmdir failed"
3964 run_test 110f "DNE: create striped dir, fail MDT1/MDT2"
3967 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3968 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3969 skip "Need MDS version at least 2.7.56"
3971 ([ $FAILURE_MODE == "HARD" ] &&
3972 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3973 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3978 $LFS mkdir -i1 -c$MDSCOUNT $DIR/$tdir/striped_dir
3982 zconf_mount $(hostname) $MOUNT
3983 client_up || return 1
3985 check_striped_dir_110 || error "check striped_dir failed"
3987 rm -rf $DIR/$tdir || error "rmdir failed"
3991 run_test 110g "DNE: create striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
3994 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3995 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
3996 skip "Need MDS version at least 2.7.56"
3998 ([ $FAILURE_MODE == "HARD" ] &&
3999 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4000 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4004 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4006 rm -rf $DIR/$tdir/striped_dir
4009 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4010 error "striped dir still exists"
4013 run_test 111a "DNE: unlink striped dir, fail MDT1"
4016 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4017 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4018 skip "Need MDS version at least 2.7.56"
4020 ([ $FAILURE_MODE == "HARD" ] &&
4021 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4022 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4026 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4028 rm -rf $DIR/$tdir/striped_dir
4031 zconf_mount $(hostname) $MOUNT
4032 client_up || return 1
4034 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4035 error "striped dir still exists"
4038 run_test 111b "DNE: unlink striped dir, fail MDT2"
4041 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4042 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4043 skip "Need MDS version at least 2.7.56"
4045 ([ $FAILURE_MODE == "HARD" ] &&
4046 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4047 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4051 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4053 rm -rf $DIR/$tdir/striped_dir
4057 zconf_mount $(hostname) $MOUNT
4058 client_up || return 1
4059 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4060 error "striped dir still exists"
4063 run_test 111c "DNE: unlink striped dir, uncommit on MDT1, fail client/MDT1/MDT2"
4066 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4067 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4068 skip "Need MDS version at least 2.7.56"
4070 ([ $FAILURE_MODE == "HARD" ] &&
4071 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4072 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4076 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4078 rm -rf $DIR/$tdir/striped_dir
4082 zconf_mount $(hostname) $MOUNT
4083 client_up || return 1
4084 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4085 error "striped dir still exists"
4089 run_test 111d "DNE: unlink striped dir, uncommit on MDT2, fail client/MDT1/MDT2"
4092 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4093 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4094 skip "Need MDS version at least 2.7.56"
4096 ([ $FAILURE_MODE == "HARD" ] &&
4097 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4098 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4102 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4104 rm -rf $DIR/$tdir/striped_dir
4107 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4108 error "striped dir still exists"
4111 run_test 111e "DNE: unlink striped dir, uncommit on MDT2, fail MDT1/MDT2"
4114 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4115 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4116 skip "Need MDS version at least 2.7.56"
4118 ([ $FAILURE_MODE == "HARD" ] &&
4119 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4120 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4124 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4126 rm -rf $DIR/$tdir/striped_dir
4129 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4130 error "striped dir still exists"
4133 run_test 111f "DNE: unlink striped dir, uncommit on MDT1, fail MDT1/MDT2"
4136 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4137 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4138 skip "Need MDS version at least 2.7.56"
4140 ([ $FAILURE_MODE == "HARD" ] &&
4141 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4142 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4146 $LFS mkdir -i1 -c2 $DIR/$tdir/striped_dir
4149 rm -rf $DIR/$tdir/striped_dir
4151 $CHECKSTAT -t dir $DIR/$tdir/striped_dir &&
4152 error "striped dir still exists"
4155 run_test 111g "DNE: unlink striped dir, fail MDT1/MDT2"
4157 test_112_rename_prepare() {
4158 mkdir -p $DIR/$tdir/src_dir
4159 $LFS mkdir -i 1 $DIR/$tdir/src_dir/src_child ||
4160 error "create remote source failed"
4162 touch $DIR/$tdir/src_dir/src_child/a
4164 $LFS mkdir -i 2 $DIR/$tdir/tgt_dir ||
4165 error "create remote target dir failed"
4167 $LFS mkdir -i 3 $DIR/$tdir/tgt_dir/tgt_child ||
4168 error "create remote target child failed"
4173 $CHECKSTAT -t dir $DIR/$tdir/src_dir/src_child &&
4174 error "src_child still exists after rename"
4176 $CHECKSTAT -t file $DIR/$tdir/tgt_dir/tgt_child/a ||
4177 error "missing file(a) after rename"
4181 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4182 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4183 skip "Need MDS version at least 2.7.56"
4185 ([ $FAILURE_MODE == "HARD" ] &&
4186 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4187 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4190 test_112_rename_prepare
4193 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4194 error "rename dir cross MDT failed!"
4198 rm -rf $DIR/$tdir || error "rmdir failed"
4200 run_test 112a "DNE: cross MDT rename, fail MDT1"
4203 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4204 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4205 skip "Need MDS version at least 2.7.56"
4207 ([ $FAILURE_MODE == "HARD" ] &&
4208 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4209 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4212 test_112_rename_prepare
4215 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4216 error "rename dir cross MDT failed!"
4221 rm -rf $DIR/$tdir || error "rmdir failed"
4223 run_test 112b "DNE: cross MDT rename, fail MDT2"
4226 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4227 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4228 skip "Need MDS version at least 2.7.56"
4230 ([ $FAILURE_MODE == "HARD" ] &&
4231 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4232 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4235 test_112_rename_prepare
4238 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4239 error "rename dir cross MDT failed!"
4244 rm -rf $DIR/$tdir || error "rmdir failed"
4246 run_test 112c "DNE: cross MDT rename, fail MDT3"
4249 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4250 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4251 skip "Need MDS version at least 2.7.56"
4253 ([ $FAILURE_MODE == "HARD" ] &&
4254 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4255 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4258 test_112_rename_prepare
4261 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4262 error "rename dir cross MDT failed!"
4267 rm -rf $DIR/$tdir || error "rmdir failed"
4269 run_test 112d "DNE: cross MDT rename, fail MDT4"
4272 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4273 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4274 skip "Need MDS version at least 2.7.56"
4276 ([ $FAILURE_MODE == "HARD" ] &&
4277 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4278 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4281 test_112_rename_prepare
4285 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4286 error "rename dir cross MDT failed!"
4291 rm -rf $DIR/$tdir || error "rmdir failed"
4293 run_test 112e "DNE: cross MDT rename, fail MDT1 and MDT2"
4296 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4297 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4298 skip "Need MDS version at least 2.7.56"
4300 ([ $FAILURE_MODE == "HARD" ] &&
4301 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4302 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4305 test_112_rename_prepare
4309 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4310 error "rename dir cross MDT failed!"
4315 rm -rf $DIR/$tdir || error "rmdir failed"
4317 run_test 112f "DNE: cross MDT rename, fail MDT1 and MDT3"
4320 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4321 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4322 skip "Need MDS version at least 2.7.56"
4324 ([ $FAILURE_MODE == "HARD" ] &&
4325 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4326 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4329 test_112_rename_prepare
4333 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4334 error "rename dir cross MDT failed!"
4339 rm -rf $DIR/$tdir || error "rmdir failed"
4341 run_test 112g "DNE: cross MDT rename, fail MDT1 and MDT4"
4344 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4345 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4346 skip "Need MDS version at least 2.7.56"
4348 ([ $FAILURE_MODE == "HARD" ] &&
4349 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4350 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4353 test_112_rename_prepare
4357 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4358 error "rename dir cross MDT failed!"
4363 rm -rf $DIR/$tdir || error "rmdir failed"
4365 run_test 112h "DNE: cross MDT rename, fail MDT2 and MDT3"
4368 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4369 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4370 skip "Need MDS version at least 2.7.56"
4372 ([ $FAILURE_MODE == "HARD" ] &&
4373 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4374 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4377 test_112_rename_prepare
4381 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4382 error "rename dir cross MDT failed!"
4387 rm -rf $DIR/$tdir || error "rmdir failed"
4389 run_test 112i "DNE: cross MDT rename, fail MDT2 and MDT4"
4392 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4393 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4394 skip "Need MDS version at least 2.7.56"
4396 ([ $FAILURE_MODE == "HARD" ] &&
4397 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4398 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4401 test_112_rename_prepare
4405 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4406 error "rename dir cross MDT failed!"
4411 rm -rf $DIR/$tdir || error "rmdir failed"
4413 run_test 112j "DNE: cross MDT rename, fail MDT3 and MDT4"
4416 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4417 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4418 skip "Need MDS version at least 2.7.56"
4420 ([ $FAILURE_MODE == "HARD" ] &&
4421 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4422 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4425 test_112_rename_prepare
4430 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4431 error "rename dir cross MDT failed!"
4436 rm -rf $DIR/$tdir || error "rmdir failed"
4438 run_test 112k "DNE: cross MDT rename, fail MDT1,MDT2,MDT3"
4441 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4442 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4443 skip "Need MDS version at least 2.7.56"
4445 ([ $FAILURE_MODE == "HARD" ] &&
4446 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4447 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4450 test_112_rename_prepare
4455 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4456 error "rename dir cross MDT failed!"
4461 rm -rf $DIR/$tdir || error "rmdir failed"
4463 run_test 112l "DNE: cross MDT rename, fail MDT1,MDT2,MDT4"
4466 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4467 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4468 skip "Need MDS version at least 2.7.56"
4470 ([ $FAILURE_MODE == "HARD" ] &&
4471 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4472 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4475 test_112_rename_prepare
4480 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4481 error "rename dir cross MDT failed!"
4486 rm -rf $DIR/$tdir || error "rmdir failed"
4488 run_test 112m "DNE: cross MDT rename, fail MDT1,MDT3,MDT4"
4491 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4492 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4493 skip "Need MDS version at least 2.7.56"
4495 ([ $FAILURE_MODE == "HARD" ] &&
4496 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4497 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4500 test_112_rename_prepare
4505 mrename $DIR/$tdir/src_dir/src_child $DIR/$tdir/tgt_dir/tgt_child ||
4506 error "rename dir cross MDT failed!"
4511 rm -rf $DIR/$tdir || error "rmdir failed"
4513 run_test 112n "DNE: cross MDT rename, fail MDT2,MDT3,MDT4"
4516 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4517 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.7.56) ]] ||
4518 skip "Need MDS version at least 2.7.56"
4520 ([ $FAILURE_MODE == "HARD" ] &&
4521 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4522 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4530 for ((j=0;j<$((MDSCOUNT));j++)); do
4531 fail_index=$((fail_index+1))
4532 index=$((fail_index % MDSCOUNT))
4533 replay_barrier mds$((index + 1))
4534 for ((i=0;i<5;i++)); do
4535 test_mkdir -i$index -c$MDSCOUNT $DIR/$tdir/test_$i ||
4536 error "create striped dir $DIR/$tdir/test_$i"
4539 fail mds$((index + 1))
4540 for ((i=0;i<5;i++)); do
4541 checkstat -t dir $DIR/$tdir/test_$i ||
4542 error "$DIR/$tdir/test_$i does not exist!"
4544 rm -rf $DIR/$tdir/test_* ||
4548 run_test 115 "failover for create/unlink striped directory"
4551 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4552 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4553 skip "Do not support large update log before 2.7.55" &&
4555 ([ $FAILURE_MODE == "HARD" ] &&
4556 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4557 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4564 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4565 do_facet mds1 "lctl set_param fail_loc=0x80001702"
4566 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4569 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4570 error "stried_dir does not exists"
4572 run_test 116a "large update log master MDT recovery"
4575 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4576 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.55) ] &&
4577 skip "Do not support large update log before 2.7.55" &&
4580 ([ $FAILURE_MODE == "HARD" ] &&
4581 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4582 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4589 # OBD_FAIL_SPLIT_UPDATE_REC 0x1702
4590 do_facet mds2 "lctl set_param fail_loc=0x80001702"
4591 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/striped_dir
4594 $CHECKSTAT -t dir $DIR/$tdir/striped_dir ||
4595 error "stried_dir does not exists"
4597 run_test 116b "large update log slave MDT recovery"
4600 [ $MDSCOUNT -lt 4 ] && skip "needs >= 4 MDTs" && return 0
4601 ([ $FAILURE_MODE == "HARD" ] &&
4602 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4603 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4609 $LFS setdirstripe -i0 -c$MDSCOUNT $DIR/$tdir/remote_dir
4610 $LFS setdirstripe -i1 -c$MDSCOUNT $DIR/$tdir/remote_dir_1
4613 # Let's set rdonly on all MDTs, so client will send
4614 # replay requests on all MDTs and replay these requests
4615 # at the same time. This test will verify the recovery
4616 # will not be deadlock in this case, LU-7531.
4617 for ((index = 0; index < $((MDSCOUNT)); index++)); do
4618 replay_barrier mds$((index + 1))
4619 if [ -z $mds_indexs ]; then
4620 mds_indexs="${mds_indexs}mds$((index+1))"
4622 mds_indexs="${mds_indexs},mds$((index+1))"
4626 rm -rf $DIR/$tdir/remote_dir
4627 rm -rf $DIR/$tdir/remote_dir_1
4631 rm -rf $DIR/$tdir || error "rmdir failed"
4633 run_test 117 "DNE: cross MDT unlink, fail MDT1 and MDT2"
4636 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4637 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4638 skip "Do not support large update log before 2.7.64" &&
4643 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir ||
4644 error "setdirstripe fails"
4645 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1 ||
4646 error "setdirstripe fails 1"
4647 rm -rf $DIR/$tdir/striped_dir* || error "rmdir fails"
4649 # OBD_FAIL_INVALIDATE_UPDATE 0x1705
4650 do_facet mds1 "lctl set_param fail_loc=0x1705"
4651 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4652 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4653 do_facet mds1 "lctl set_param fail_loc=0x0"
4656 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir
4657 $LFS setdirstripe -c2 $DIR/$tdir/striped_dir1
4662 run_test 118 "invalidate osp update will not cause update log corruption"
4665 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4666 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4667 skip "Do not support large update log before 2.7.64" &&
4670 local hard_timeout=$(do_facet mds1 \
4671 "lctl get_param -n mdt.$FSNAME-MDT0000.recovery_time_hard")
4673 local clients=${CLIENTS:-$HOSTNAME}
4674 local time_min=$(recovery_time_min)
4677 mkdir $DIR/$tdir/tmp
4678 rmdir $DIR/$tdir/tmp
4681 mkdir $DIR/$tdir/dir_1
4682 for ((i = 0; i < 20; i++)); do
4683 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i
4690 #define OBD_FAIL_TGT_REPLAY_DELAY 0x714
4691 do_facet mds1 $LCTL set_param fail_loc=0x80000714
4692 #sleep (timeout + 5), so mds will evict the client exports,
4693 #but DNE update recovery will keep going.
4694 do_facet mds1 $LCTL set_param fail_val=$((time_min + 5))
4696 mount_facet mds1 "-o recovery_time_hard=$time_min"
4698 wait_clients_import_state "$clients" mds1 FULL
4700 clients_up || clients_up || error "failover df: $?"
4702 #revert back the hard timeout
4703 do_facet mds1 $LCTL set_param \
4704 mdt.$FSNAME-MDT0000.recovery_time_hard=$hard_timeout
4706 for ((i = 0; i < 20; i++)); do
4707 stripe_count=$($LFS getdirstripe -c $DIR/$tdir/stripe_dir-$i)
4708 [ $stripe_count == 2 ] || {
4709 error "stripe_dir-$i creation replay fails"
4714 run_test 119 "timeout of normal replay does not cause DNE replay fails "
4717 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4718 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.64) ] &&
4719 skip "Do not support large update log before 2.7.64" &&
4723 replay_barrier_nosync mds1
4724 for ((i = 0; i < 20; i++)); do
4725 mkdir $DIR/$tdir/dir-$i || {
4726 error "create dir-$i fails"
4729 $LFS setdirstripe -i0 -c2 $DIR/$tdir/stripe_dir-$i || {
4730 error "create stripe_dir-$i fails"
4737 for ((i = 0; i < 20; i++)); do
4738 [ ! -e "$DIR/$tdir/dir-$i" ] || {
4739 error "dir-$i still exists"
4742 [ ! -e "$DIR/$tdir/stripe_dir-$i" ] || {
4743 error "stripe_dir-$i still exists"
4748 run_test 120 "DNE fail abort should stop both normal and DNE replay"
4751 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4752 skip "Don't support it before 2.11" &&
4755 local at_max_saved=$(at_max_get mds)
4757 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
4758 cancel_lru_locks mdc
4760 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
4763 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
4769 #define OBD_FAIL_TGT_RECOVERY_REQ_RACE 0x721
4770 do_facet $SINGLEMDS "lctl set_param fail_loc=0x721 fail_val=0"
4774 wait_clients_import_state "$clients" mds1 FULL
4775 clients_up || clients_up || error "failover df: $?"
4778 wait $mpid || error "multiop_bg_pause pid failed"
4780 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
4781 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
4782 at_max_set $at_max_saved mds
4785 run_test 121 "lock replay timed out and race"
4788 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4789 skip "Do not support Data-on-MDT before 2.11"
4791 replay_barrier $SINGLEMDS
4792 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4795 [ $($LFS getstripe -L $DIR/$tfile) == "mdt" ] ||
4796 error "Fail to replay DoM file creation"
4798 run_test 130a "DoM file create (setstripe) replay"
4801 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4802 skip "Do not support Data-on-MDT before 2.11"
4805 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tdir
4806 replay_barrier $SINGLEMDS
4807 touch $DIR/$tdir/$tfile
4810 [ $($LFS getstripe -L $DIR/$tdir/$tfile) == "mdt" ] ||
4811 error "Fail to replay DoM file creation"
4813 run_test 130b "DoM file create (inherited) replay"
4816 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4817 skip "Do not support Data-on-MDT before 2.11"
4819 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4820 replay_barrier $SINGLEMDS
4821 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4822 # lock is not canceled and will be replayed
4825 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4826 error "Wrong file content after failover"
4828 run_test 131a "DoM file write lock replay"
4831 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.90) ] &&
4832 skip "Do not support Data-on-MDT before 2.11"
4834 $LFS setstripe -E 1M -L mdt -E EOF -c 2 $DIR/$tfile
4835 replay_barrier $SINGLEMDS
4836 echo "dom_data" | dd of=$DIR/$tfile bs=8 count=1
4837 cancel_lru_locks mdc
4841 [ $(cat $DIR/$tfile) == "dom_data" ] ||
4842 error "Wrong file content after failover"
4844 run_test 131b "DoM file write replay"
4847 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.90) ] &&
4848 skip "Do not support PFL files before 2.10"
4850 $LFS setstripe -E 1M -c 1 -E EOF -c 2 $DIR/$tfile
4851 replay_barrier $SINGLEMDS
4852 # write over the first component size cause next component instantiation
4853 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 seek=1 ||
4854 error "dd to $DIR/$tfile failed"
4855 lfs getstripe $DIR/$tfile
4857 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
4858 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4859 error "Component #1 was not instantiated"
4863 lfs getstripe $DIR/$tfile
4864 $LFS getstripe -I2 $DIR/$tfile | grep -q lmm_objects ||
4865 error "Component #1 instantiation was not replayed"
4866 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
4867 if [ $cksum != $cksum2 ] ; then
4868 error_noexit "New cksum $cksum2 does not match original $cksum"
4871 run_test 132a "PFL new component instantiate replay"
4874 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
4875 ([ $FAILURE_MODE == "HARD" ] &&
4876 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
4877 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
4880 local remote_dir=$DIR/$tdir/remote_dir
4882 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
4883 $LFS mkdir -i 1 $remote_dir
4886 do_facet mds2 $LCTL set_param seq.srv*MDT0001.space=clear
4888 zconf_mount $(hostname) $MOUNT
4889 client_up || return 1
4891 #define OBD_FAIL_MDS_ALL_REQUEST_NET 0x123
4893 do_facet mds1 $LCTL set_param fail_val=700 fail_loc=0x80000123
4894 cp /etc/hosts $remote_dir/file &
4900 wait $pid || error "cp failed"
4901 rm -rf $DIR/$tdir || error "rmdir failed"
4905 run_test 133 "check resend of ongoing requests for lwp during failover"
4908 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return 0
4911 pool_add_targets pool_134 1 1
4914 $LFS setstripe -p pool_134 $DIR/$tdir
4918 touch $DIR/$tdir/$tfile
4922 [ -f $DIR/$tdir/$tfile ] || error "file does not exist"
4924 run_test 134 "replay creation of a file created in a pool"
4927 check_and_cleanup_lustre