5 LUSTRE=${LUSTRE:-$(dirname $0)/..}
6 . $LUSTRE/tests/test-framework.sh
10 ALWAYS_EXCEPT="$REPLAY_SINGLE_EXCEPT "
11 # bug number for skipped test: LU-13614
14 if [ "$mds1_FSTYPE" = zfs ]; then
15 # bug number for skipped test: LU-11388
16 ALWAYS_EXCEPT+=" 131b"
19 # bug number for skipped tests: LU-9795 (all below)
20 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 0b 0c 0d 34 45"
21 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 47 58b 58c 71a 85a"
22 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 85b 86 88 89 90"
23 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 93a 100a 100b 120"
25 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
29 CHECK_GRANT=${CHECK_GRANT:-"yes"}
30 GRANT_CHECK_LIST=${GRANT_CHECK_LIST:-""}
32 require_dsh_mds || exit 0
33 check_and_setup_lustre
38 rm -rf $DIR/[df][0-9]* $DIR/f.$TESTSUITE.*
40 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
41 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
43 do_facet $SINGLEMDS sync
46 test_0a() { # was test_0
47 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
48 replay_barrier $SINGLEMDS
52 run_test 0a "empty replay"
55 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
57 # this test attempts to trigger a race in the precreation code,
58 # and must run before any other objects are created on the filesystem
60 createmany -o $DIR/$tfile 20 || error "createmany -o $DIR/$tfile failed"
61 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
63 run_test 0b "ensure object created after recover exists. (3284)"
66 replay_barrier $SINGLEMDS
69 facet_failover $SINGLEMDS
70 zconf_mount $(hostname) $MOUNT || error "mount fails"
71 client_up || error "post-failover df failed"
72 # file shouldn't exist if replay-barrier works as expected
73 rm $DIR/$tfile && error "File exists and it shouldn't"
76 run_test 0c "check replay-barrier"
79 replay_barrier $SINGLEMDS
81 facet_failover $SINGLEMDS
82 zconf_mount $(hostname) $MOUNT || error "mount fails"
83 client_up || error "post-failover df failed"
85 run_test 0d "expired recovery with no clients"
88 replay_barrier $SINGLEMDS
91 $CHECKSTAT -t file $DIR/$tfile ||
92 error "$CHECKSTAT $DIR/$tfile attribute check failed"
95 run_test 1 "simple create"
98 replay_barrier $SINGLEMDS
101 $CHECKSTAT -t file $DIR/$tfile ||
102 error "$CHECKSTAT $DIR/$tfile attribute check failed"
108 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
109 replay_barrier $SINGLEMDS
112 $CHECKSTAT -t file $DIR/$tfile ||
113 error "$CHECKSTAT $DIR/$tfile attribute check failed"
119 replay_barrier $SINGLEMDS
120 $LFS setstripe -c $OSTCOUNT $DIR/$tfile
122 $CHECKSTAT -t file $DIR/$tfile ||
123 error "$CHECKSTAT $DIR/$tfile check failed"
125 run_test 2c "setstripe replay"
128 [[ "$mds1_FSTYPE" = zfs ]] &&
129 [[ "$MDS1_VERSION" -lt $(version_code 2.12.51) ]] &&
130 skip "requires LU-10143 fix on MDS"
131 replay_barrier $SINGLEMDS
132 $LFS setdirstripe -i 0 -c $MDSCOUNT $DIR/$tdir
134 $CHECKSTAT -t dir $DIR/$tdir ||
135 error "$CHECKSTAT $DIR/$tdir check failed"
137 run_test 2d "setdirstripe replay"
140 local file=$DIR/$tfile
141 replay_barrier $SINGLEMDS
143 openfile -f O_DIRECTORY $file
145 $CHECKSTAT -t file $file ||
146 error "$CHECKSTAT $file attribute check failed"
149 run_test 3a "replay failed open(O_DIRECTORY)"
152 replay_barrier $SINGLEMDS
153 #define OBD_FAIL_MDS_OPEN_PACK | OBD_FAIL_ONCE
154 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000114"
156 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
158 $CHECKSTAT -t file $DIR/$tfile &&
159 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
162 run_test 3b "replay failed open -ENOMEM"
165 replay_barrier $SINGLEMDS
166 #define OBD_FAIL_MDS_ALLOC_OBDO | OBD_FAIL_ONCE
167 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000128"
169 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
172 $CHECKSTAT -t file $DIR/$tfile &&
173 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
176 run_test 3c "replay failed open -ENOMEM"
178 test_4a() { # was test_4
179 replay_barrier $SINGLEMDS
180 for i in $(seq 10); do
181 echo "tag-$i" > $DIR/$tfile-$i
184 for i in $(seq 10); do
185 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
188 run_test 4a "|x| 10 open(O_CREAT)s"
191 for i in $(seq 10); do
192 echo "tag-$i" > $DIR/$tfile-$i
194 replay_barrier $SINGLEMDS
197 $CHECKSTAT -t file $DIR/$tfile-* &&
198 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
201 run_test 4b "|x| rm 10 files"
203 # The idea is to get past the first block of precreated files on both
204 # osts, and then replay.
206 replay_barrier $SINGLEMDS
207 for i in $(seq 220); do
208 echo "tag-$i" > $DIR/$tfile-$i
211 for i in $(seq 220); do
212 grep -q "tag-$i" $DIR/$tfile-$i || error "$tfile-$i"
216 # waiting for commitment of removal
218 run_test 5 "|x| 220 open(O_CREAT)"
220 test_6a() { # was test_6
221 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
222 replay_barrier $SINGLEMDS
223 mcreate $DIR/$tdir/$tfile
225 $CHECKSTAT -t dir $DIR/$tdir ||
226 error "$CHECKSTAT $DIR/$tdir attribute check failed"
227 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
228 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
230 # waiting for log process thread
232 run_test 6a "mkdir + contained create"
235 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
236 replay_barrier $SINGLEMDS
239 $CHECKSTAT -t dir $DIR/$tdir &&
240 error "$CHECKSTAT $DIR/$tdir attribute check should fail" ||
243 run_test 6b "|X| rmdir"
246 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
247 replay_barrier $SINGLEMDS
248 mcreate $DIR/$tdir/$tfile
250 $CHECKSTAT -t dir $DIR/$tdir ||
251 error "$CHECKSTAT $DIR/$tdir attribute check failed"
252 $CHECKSTAT -t file $DIR/$tdir/$tfile ||
253 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check failed"
256 run_test 7 "mkdir |X| contained create"
259 replay_barrier $SINGLEMDS
260 multiop_bg_pause $DIR/$tfile mo_c ||
261 error "multiop mknod $DIR/$tfile failed"
265 $CHECKSTAT -t file $DIR/$tfile ||
266 error "$CHECKSTAT $DIR/$tfile attribute check failed"
267 kill -USR1 $MULTIPID || error "multiop mknod $MULTIPID not running"
268 wait $MULTIPID || error "multiop mknod $MULTIPID failed"
271 run_test 8 "creat open |X| close"
274 replay_barrier $SINGLEMDS
276 local old_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
278 local new_inum=$(ls -i $DIR/$tfile | awk '{print $1}')
280 echo " old_inum == $old_inum, new_inum == $new_inum"
281 if [ $old_inum -eq $new_inum ] ;
283 echo "old_inum and new_inum match"
285 echo " old_inum and new_inum do not match"
286 error "old index($old_inum) does not match new index($new_inum)"
290 run_test 9 "|X| create (same inum/gen)"
293 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
294 replay_barrier $SINGLEMDS
295 mv $DIR/$tfile $DIR/$tfile-2
298 $CHECKSTAT $DIR/$tfile &&
299 error "$CHECKSTAT $DIR/$tfile attribute check should fail"
300 $CHECKSTAT $DIR/$tfile-2 ||
301 error "$CHECKSTAT $DIR/$tfile-2 attribute check failed"
305 run_test 10 "create |X| rename unlink"
308 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
309 echo "old" > $DIR/$tfile
310 mv $DIR/$tfile $DIR/$tfile-2
311 replay_barrier $SINGLEMDS
312 echo "new" > $DIR/$tfile
314 grep old $DIR/$tfile-2
316 grep new $DIR/$tfile || error "grep $DIR/$tfile failed"
317 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
319 run_test 11 "create open write rename |X| create-old-name read"
322 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
323 multiop_bg_pause $DIR/$tfile o_tSc ||
324 error "multiop_bg_pause $DIR/$tfile failed"
327 replay_barrier $SINGLEMDS
328 kill -USR1 $pid || error "multiop $pid not running"
329 wait $pid || error "multiop $pid failed"
332 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
335 run_test 12 "open, unlink |X| close"
337 # 1777 - replay open after committed chmod that would make
338 # a regular open a failure
340 mcreate $DIR/$tfile || error "mcreate $DIR/$tfile failed"
341 multiop_bg_pause $DIR/$tfile O_wc ||
342 error "multiop_bg_pause $DIR/$tfile failed"
345 $CHECKSTAT -p 0 $DIR/$tfile ||
346 error "$CHECKSTAT $DIR/$tfile attribute check failed"
347 replay_barrier $SINGLEMDS
349 kill -USR1 $pid || error "multiop $pid not running"
350 wait $pid || error "multiop $pid failed"
352 $CHECKSTAT -s 1 -p 0 $DIR/$tfile ||
353 error "second $CHECKSTAT $DIR/$tfile attribute check failed"
354 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
357 run_test 13 "open chmod 0 |x| write close"
360 multiop_bg_pause $DIR/$tfile O_tSc ||
361 error "multiop_bg_pause $DIR/$tfile failed"
364 replay_barrier $SINGLEMDS
365 kill -USR1 $pid || error "multiop $pid not running"
366 wait $pid || error "multiop $pid failed"
369 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
372 run_test 14 "open(O_CREAT), unlink |X| close"
375 multiop_bg_pause $DIR/$tfile O_tSc ||
376 error "multiop_bg_pause $DIR/$tfile failed"
379 replay_barrier $SINGLEMDS
380 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
381 kill -USR1 $pid || error "multiop $pid not running"
382 wait $pid || error "multiop $pid failed"
385 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
386 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
389 run_test 15 "open(O_CREAT), unlink |X| touch new, close"
392 replay_barrier $SINGLEMDS
395 mcreate $DIR/$tfile-2
397 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
398 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
399 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
401 run_test 16 "|X| open(O_CREAT), unlink, touch new, unlink new"
404 replay_barrier $SINGLEMDS
405 multiop_bg_pause $DIR/$tfile O_c ||
406 error "multiop_bg_pause $DIR/$tfile failed"
409 kill -USR1 $pid || error "multiop $pid not running"
410 wait $pid || error "multiop $pid failed"
411 $CHECKSTAT -t file $DIR/$tfile ||
412 error "$CHECKSTAT $DIR/$tfile attribute check failed"
415 run_test 17 "|X| open(O_CREAT), |replay| close"
418 replay_barrier $SINGLEMDS
419 multiop_bg_pause $DIR/$tfile O_tSc ||
420 error "multiop_bg_pause $DIR/$tfile failed"
423 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
424 echo "pid: $pid will close"
425 kill -USR1 $pid || error "multiop $pid not running"
426 wait $pid || error "multiop $pid failed"
429 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
430 [ -e $DIR/$tfile-2 ] || error "file $DIR/$tfile-2 does not exist"
431 # this touch frequently fails
432 touch $DIR/$tfile-3 || error "touch $DIR/$tfile-3 failed"
433 munlink $DIR/$tfile-2 || error "munlink $DIR/$tfile-2 failed"
434 munlink $DIR/$tfile-3 || error "munlink $DIR/$tfile-3 failed"
437 run_test 18 "open(O_CREAT), unlink, touch new, close, touch, unlink"
439 # bug 1855 (a simpler form of test_11 above)
441 replay_barrier $SINGLEMDS
443 echo "old" > $DIR/$tfile
444 mv $DIR/$tfile $DIR/$tfile-2
445 grep old $DIR/$tfile-2
447 grep old $DIR/$tfile-2 || error "grep $DIR/$tfile-2 failed"
449 run_test 19 "mcreate, open, write, rename "
451 test_20a() { # was test_20
452 replay_barrier $SINGLEMDS
453 multiop_bg_pause $DIR/$tfile O_tSc ||
454 error "multiop_bg_pause $DIR/$tfile failed"
459 kill -USR1 $pid || error "multiop $pid not running"
460 wait $pid || error "multiop $pid failed"
461 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
464 run_test 20a "|X| open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
466 test_20b() { # bug 10480
467 local wait_timeout=$((TIMEOUT * 4))
468 local extra=$(fs_log_size)
472 $LFS setstripe -i 0 -c 1 $DIR
474 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
476 dd if=/dev/zero of=$DIR/$tfile bs=4k count=10000 &
477 while [ ! -e $DIR/$tfile ] ; do
478 sleep 0.01 # give dd a chance to start
481 $LFS getstripe $DIR/$tfile || error "$LFS getstripe $DIR/$tfile failed"
483 rm -f $DIR/$tfile || error "rm -f $DIR/$tfile failed"
485 client_up || client_up || true # reconnect
487 do_facet $SINGLEMDS "lctl set_param -n osd*.*MDT*.force_sync=1"
489 fail $SINGLEMDS # start orphan recovery
490 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
491 wait_delete_completed $wait_timeout || error "delete did not finish"
495 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
496 log "before $beforeused, after $afterused"
498 (( $beforeused + $extra >= $afterused )) && break
499 n_attempts=$((n_attempts + 1))
500 [ $n_attempts -gt 3 ] &&
501 error "after $afterused > before $beforeused + $extra"
503 wait_zfs_commit $SINGLEMDS 5
508 run_test 20b "write, unlink, eviction, replay (test mds_cleanup_orphans)"
510 test_20c() { # bug 10480
511 multiop_bg_pause $DIR/$tfile Ow_c ||
512 error "multiop_bg_pause $DIR/$tfile failed"
518 client_up || client_up || true # reconnect
520 kill -USR1 $pid || error "multiop $pid not running"
521 wait $pid || error "multiop $pid failed"
522 [ -s $DIR/$tfile ] || error "File was truncated"
526 run_test 20c "check that client eviction does not affect file content"
529 replay_barrier $SINGLEMDS
530 multiop_bg_pause $DIR/$tfile O_tSc ||
531 error "multiop_bg_pause $DIR/$tfile failed"
534 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
537 kill -USR1 $pid || error "multiop $pid not running"
538 wait $pid || error "multiop $pid failed"
539 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
540 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
543 run_test 21 "|X| open(O_CREAT), unlink touch new, replay, close (test mds_cleanup_orphans)"
546 multiop_bg_pause $DIR/$tfile O_tSc ||
547 error "multiop_bg_pause $DIR/$tfile failed"
550 replay_barrier $SINGLEMDS
554 kill -USR1 $pid || error "multiop $pid not running"
555 wait $pid || error "multiop $pid failed"
556 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
559 run_test 22 "open(O_CREAT), |X| unlink, replay, close (test mds_cleanup_orphans)"
562 multiop_bg_pause $DIR/$tfile O_tSc ||
563 error "multiop_bg_pause $DIR/$tfile failed"
566 replay_barrier $SINGLEMDS
568 touch $DIR/$tfile-1 || error "touch $DIR/$tfile-1 failed"
571 kill -USR1 $pid || error "multiop $pid not running"
572 wait $pid || error "multiop $pid failed"
573 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
574 touch $DIR/$tfile-2 || error "touch $DIR/$tfile-2 failed"
577 run_test 23 "open(O_CREAT), |X| unlink touch new, replay, close (test mds_cleanup_orphans)"
580 multiop_bg_pause $DIR/$tfile O_tSc ||
581 error "multiop_bg_pause $DIR/$tfile failed"
584 replay_barrier $SINGLEMDS
587 kill -USR1 $pid || error "multiop $pid not running"
588 wait $pid || error "multiop $pid failed"
589 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
592 run_test 24 "open(O_CREAT), replay, unlink, close (test mds_cleanup_orphans)"
595 multiop_bg_pause $DIR/$tfile O_tSc ||
596 error "multiop_bg_pause $DIR/$tfile failed"
600 replay_barrier $SINGLEMDS
602 kill -USR1 $pid || error "multiop $pid not running"
603 wait $pid || error "multiop $pid failed"
604 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
607 run_test 25 "open(O_CREAT), unlink, replay, close (test mds_cleanup_orphans)"
610 replay_barrier $SINGLEMDS
611 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
612 error "multiop_bg_pause $DIR/$tfile-1 failed"
614 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
615 error "multiop_bg_pause $DIR/$tfile-2 failed"
619 kill -USR1 $pid2 || error "second multiop $pid2 not running"
620 wait $pid2 || error "second multiop $pid2 failed"
623 kill -USR1 $pid1 || error "multiop $pid1 not running"
624 wait $pid1 || error "multiop $pid1 failed"
625 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
626 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
629 run_test 26 "|X| open(O_CREAT), unlink two, close one, replay, close one (test mds_cleanup_orphans)"
632 replay_barrier $SINGLEMDS
633 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
634 error "multiop_bg_pause $DIR/$tfile-1 failed"
636 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
637 error "multiop_bg_pause $DIR/$tfile-2 failed"
643 kill -USR1 $pid1 || error "multiop $pid1 not running"
644 wait $pid1 || error "multiop $pid1 failed"
645 kill -USR1 $pid2 || error "second multiop $pid2 not running"
646 wait $pid2 || error "second multiop $pid2 failed"
647 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
648 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
651 run_test 27 "|X| open(O_CREAT), unlink two, replay, close two (test mds_cleanup_orphans)"
654 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
655 error "multiop_bg_pause $DIR/$tfile-1 failed"
657 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
658 error "multiop_bg_pause $DIR/$tfile-2 failed"
660 replay_barrier $SINGLEMDS
663 kill -USR1 $pid2 || error "second multiop $pid2 not running"
664 wait $pid2 || error "second multiop $pid2 failed"
667 kill -USR1 $pid1 || error "multiop $pid1 not running"
668 wait $pid1 || error "multiop $pid1 failed"
669 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
670 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
673 run_test 28 "open(O_CREAT), |X| unlink two, close one, replay, close one (test mds_cleanup_orphans)"
676 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
677 error "multiop_bg_pause $DIR/$tfile-1 failed"
679 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
680 error "multiop_bg_pause $DIR/$tfile-2 failed"
682 replay_barrier $SINGLEMDS
687 kill -USR1 $pid1 || error "multiop $pid1 not running"
688 wait $pid1 || error "multiop $pid1 failed"
689 kill -USR1 $pid2 || error "second multiop $pid2 not running"
690 wait $pid2 || error "second multiop $pid2 failed"
691 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
692 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
695 run_test 29 "open(O_CREAT), |X| unlink two, replay, close two (test mds_cleanup_orphans)"
698 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
699 error "multiop_bg_pause $DIR/$tfile-1 failed"
701 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
702 error "multiop_bg_pause $DIR/$tfile-2 failed"
707 replay_barrier $SINGLEMDS
709 kill -USR1 $pid1 || error "multiop $pid1 not running"
710 wait $pid1 || error "multiop $pid1 failed"
711 kill -USR1 $pid2 || error "second multiop $pid2 not running"
712 wait $pid2 || error "second multiop $pid2 failed"
713 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
714 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
717 run_test 30 "open(O_CREAT) two, unlink two, replay, close two (test mds_cleanup_orphans)"
720 multiop_bg_pause $DIR/$tfile-1 O_tSc ||
721 error "multiop_bg_pause $DIR/$tfile-1 failed"
723 multiop_bg_pause $DIR/$tfile-2 O_tSc ||
724 error "multiop_bg_pause $DIR/$tfile-2 failed"
728 replay_barrier $SINGLEMDS
731 kill -USR1 $pid1 || error "multiop $pid1 not running"
732 wait $pid1 || error "multiop $pid1 failed"
733 kill -USR1 $pid2 || error "second multiop $pid2 not running"
734 wait $pid2 || error "second multiop $pid2 failed"
735 [ -e $DIR/$tfile-1 ] && error "file $DIR/$tfile-1 should not exist"
736 [ -e $DIR/$tfile-2 ] && error "file $DIR/$tfile-2 should not exist"
739 run_test 31 "open(O_CREAT) two, unlink one, |X| unlink one, close two (test mds_cleanup_orphans)"
741 # tests for bug 2104; completion without crashing is success. The close is
742 # stale, but we always return 0 for close, so the app never sees it.
744 multiop_bg_pause $DIR/$tfile O_c ||
745 error "multiop_bg_pause $DIR/$tfile failed"
747 multiop_bg_pause $DIR/$tfile O_c ||
748 error "second multiop_bg_pause $DIR/$tfile failed"
751 client_up || client_up || error "client_up failed"
752 kill -USR1 $pid1 || error "multiop $pid1 not running"
753 kill -USR1 $pid2 || error "second multiop $pid2 not running"
754 wait $pid1 || error "multiop $pid1 failed"
755 wait $pid2 || error "second multiop $pid2 failed"
758 run_test 32 "close() notices client eviction; close() after client eviction"
761 createmany -o $DIR/$tfile-%d 10 ||
762 error "createmany create $DIR/$tfile failed"
763 replay_barrier_nosync $SINGLEMDS
764 fail_abort $SINGLEMDS
765 # recreate shouldn't fail
766 createmany -o $DIR/$tfile--%d 10 ||
767 error "createmany recreate $DIR/$tfile failed"
771 run_test 33a "fid seq shouldn't be reused after abort recovery"
774 #define OBD_FAIL_SEQ_ALLOC 0x1311
775 do_facet $SINGLEMDS "lctl set_param fail_loc=0x1311"
777 createmany -o $DIR/$tfile-%d 10
778 replay_barrier_nosync $SINGLEMDS
779 fail_abort $SINGLEMDS
780 # recreate shouldn't fail
781 createmany -o $DIR/$tfile--%d 10 ||
782 error "createmany recreate $DIR/$tfile failed"
786 run_test 33b "test fid seq allocation"
789 multiop_bg_pause $DIR/$tfile O_c ||
790 error "multiop_bg_pause $DIR/$tfile failed"
794 replay_barrier $SINGLEMDS
795 fail_abort $SINGLEMDS
796 kill -USR1 $pid || error "multiop $pid not running"
797 wait $pid || error "multiop $pid failed"
798 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
802 run_test 34 "abort recovery before client does replay (test mds_cleanup_orphans)"
804 # bug 2278 - generate one orphan on OST, then destroy it during recovery from llog
806 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
808 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
809 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000119"
814 # give a chance to remove from MDS
815 fail_abort $SINGLEMDS
816 $CHECKSTAT -t file $DIR/$tfile &&
817 error "$CHECKSTAT $DIR/$tfile attribute check should fail" ||
820 run_test 35 "test recovery from llog for unlink op"
822 # b=2432 resent cancel after replay uses wrong cookie,
823 # so don't resend cancels
825 replay_barrier $SINGLEMDS
827 checkstat $DIR/$tfile
828 facet_failover $SINGLEMDS
830 if $LCTL dk | grep "stale lock .*cookie"; then
831 error "cancel after replay failed"
834 run_test 36 "don't resend cancel"
837 # directory orphans can't be unlinked from PENDING directory
839 rmdir $DIR/$tfile 2>/dev/null
840 multiop_bg_pause $DIR/$tfile dD_c ||
841 error "multiop_bg_pause $DIR/$tfile failed"
845 replay_barrier $SINGLEMDS
846 # clear the dmesg buffer so we only see errors from this recovery
847 do_facet $SINGLEMDS dmesg -c >/dev/null
848 fail_abort $SINGLEMDS
849 kill -USR1 $pid || error "multiop $pid not running"
850 do_facet $SINGLEMDS dmesg | grep "error unlinking orphan" &&
851 error "error unlinking files"
852 wait $pid || error "multiop $pid failed"
856 run_test 37 "abort recovery before client does replay (test mds_cleanup_orphans for directories)"
859 createmany -o $DIR/$tfile-%d 800 ||
860 error "createmany -o $DIR/$tfile failed"
861 unlinkmany $DIR/$tfile-%d 0 400 || error "unlinkmany $DIR/$tfile failed"
862 replay_barrier $SINGLEMDS
864 unlinkmany $DIR/$tfile-%d 400 400 ||
865 error "unlinkmany $DIR/$tfile 400 failed"
867 $CHECKSTAT -t file $DIR/$tfile-* &&
868 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
871 run_test 38 "test recovery from unlink llog (test llog_gen_rec) "
873 test_39() { # bug 4176
874 createmany -o $DIR/$tfile-%d 800 ||
875 error "createmany -o $DIR/$tfile failed"
876 replay_barrier $SINGLEMDS
877 unlinkmany $DIR/$tfile-%d 0 400
879 unlinkmany $DIR/$tfile-%d 400 400 ||
880 error "unlinkmany $DIR/$tfile 400 failed"
882 $CHECKSTAT -t file $DIR/$tfile-* &&
883 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
886 run_test 39 "test recovery from unlink llog (test llog_gen_rec) "
889 lctl get_param -n osc.*.stats | awk -vwrites=0 '/ost_write/ { writes += $2 } END { print writes; }'
894 # always need connection to MDS to verify layout during IO. LU-2628.
895 lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
896 skip "layout_lock needs MDS connection for IO" && return 0
898 $LCTL mark multiop $MOUNT/$tfile OS_c
899 multiop $MOUNT/$tfile OS_c &
901 writeme -s $MOUNT/${tfile}-2 &
904 facet_failover $SINGLEMDS
905 #define OBD_FAIL_MDS_CONNECT_NET 0x117
906 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000117"
908 stat1=$(count_ost_writes)
910 stat2=$(count_ost_writes)
911 echo "$stat1, $stat2"
912 if [ $stat1 -lt $stat2 ]; then
913 echo "writes continuing during recovery"
916 echo "writes not continuing during recovery, bug 2477"
919 echo "waiting for writeme $WRITE_PID"
923 echo "waiting for multiop $PID"
924 wait $PID || error "multiop $PID failed"
925 do_facet client munlink $MOUNT/$tfile ||
926 error "munlink $MOUNT/$tfile failed"
927 do_facet client munlink $MOUNT/${tfile}-2 ||
928 error "munlink $MOUNT/$tfile-2 failed"
931 run_test 40 "cause recovery in ptlrpc, ensure IO continues"
934 # make sure that a read to one osc doesn't try to double-unlock its page just
935 # because another osc is invalid. trigger_group_io used to mistakenly return
936 # an error if any oscs were invalid even after having successfully put rpcs
937 # on valid oscs. This was fatal if the caller was ll_readpage who unlocked
938 # the page, guarnateeing that the unlock from the RPC completion would
939 # assert on trying to unlock the unlocked page.
941 [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" && return
943 local f=$MOUNT/$tfile
944 # make sure the start of the file is ost1
945 $LFS setstripe -S $((128 * 1024)) -i 0 $f
946 do_facet client dd if=/dev/zero of=$f bs=4k count=1 ||
947 error "dd on client failed"
949 # fail ost2 and read from ost1
950 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc)
951 local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
952 grep $mdtosc | awk '{print $1}')
953 [ -z "$osc2dev" ] && echo "OST: $ost2_svc" &&
954 lctl get_param -n devices &&
955 error "OST 2 $osc2dev does not exist"
956 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate ||
957 error "deactive device on $SINGLEMDS failed"
958 do_facet client dd if=$f of=/dev/null bs=4k count=1 ||
959 error "second dd on client failed"
960 do_facet $SINGLEMDS $LCTL --device $osc2dev activate ||
961 error "active device on $SINGLEMDS failed"
964 run_test 41 "read from a valid osc while other oscs are invalid"
966 # test MDS recovery after ost failure
968 blocks=$(df -P $MOUNT | tail -n 1 | awk '{ print $2 }')
969 createmany -o $DIR/$tfile-%d 800 ||
970 error "createmany -o $DIR/$tfile failed"
972 unlinkmany $DIR/$tfile-%d 0 400
974 lctl set_param debug=-1
977 # osc is evicted, fs is smaller (but only with failout OSTs (bug 7287)
978 #blocks_after=`df -P $MOUNT | tail -n 1 | awk '{ print $2 }'`
979 #[ $blocks_after -lt $blocks ] || return 1
980 echo "wait for MDS to timeout and recover"
981 sleep $((TIMEOUT * 2))
983 unlinkmany $DIR/$tfile-%d 400 400 ||
984 error "unlinkmany $DIR/$tfile 400 failed"
985 $CHECKSTAT -t file $DIR/$tfile-* &&
986 error "$CHECKSTAT $DIR/$tfile-* attribute check should fail" ||
989 run_test 42 "recovery after ost failure"
991 # timeout in MDS/OST recovery RPC will LBUG MDS
992 test_43() { # bug 2530
993 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
995 replay_barrier $SINGLEMDS
997 # OBD_FAIL_OST_CREATE_NET 0x204
998 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1004 run_test 43 "mds osc import failure during recovery; don't LBUG"
1006 test_44a() { # was test_44
1007 local at_max_saved=0
1009 local mdcdev=$($LCTL dl |
1010 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1011 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc- not UP"
1012 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1013 { $LCTL dl; error "looking for mdcdev=$mdcdev"; }
1015 # adaptive timeouts slow this way down
1016 if at_is_enabled; then
1017 at_max_saved=$(at_max_get mds)
1021 for i in $(seq 1 10); do
1022 echo "$i of 10 ($(date +%s))"
1023 do_facet $SINGLEMDS \
1024 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1025 #define OBD_FAIL_TGT_CONN_RACE 0x701
1026 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000701"
1027 # lctl below may fail, it is valid case
1028 $LCTL --device $mdcdev recover
1031 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1032 [ $at_max_saved -ne 0 ] && at_max_set $at_max_saved mds
1035 run_test 44a "race in target handle connect"
1038 local mdcdev=$($LCTL dl |
1039 awk "/${FSNAME}-MDT0000-mdc-/ {if (\$2 == \"UP\") {print \$1}}")
1040 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1041 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1042 { echo mdcdev=$mdcdev; $LCTL dl;
1043 error "more than one ${FSNAME}-MDT0000-mdc"; }
1045 for i in $(seq 1 10); do
1046 echo "$i of 10 ($(date +%s))"
1047 do_facet $SINGLEMDS \
1048 "lctl get_param -n md[ts].*.mdt.timeouts | grep service"
1049 #define OBD_FAIL_TGT_DELAY_RECONNECT 0x704
1050 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000704"
1051 # lctl below may fail, it is valid case
1052 $LCTL --device $mdcdev recover
1057 run_test 44b "race in target handle connect"
1060 replay_barrier $SINGLEMDS
1061 createmany -m $DIR/$tfile-%d 100 || error "failed to create directories"
1062 #define OBD_FAIL_TGT_RCVG_FLAG 0x712
1063 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000712"
1064 fail_abort $SINGLEMDS
1065 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail abort"
1067 unlinkmany $DIR/$tfile-%d 100 && error "unliked after fail"
1070 run_test 44c "race in target handle connect"
1072 # Handle failed close
1074 local mdcdev=$($LCTL get_param -n devices |
1075 awk "/ ${FSNAME}-MDT0000-mdc-/ {print \$1}")
1076 [ "$mdcdev" ] || error "${FSNAME}-MDT0000-mdc not up"
1077 [ $(echo $mdcdev | wc -w) -eq 1 ] ||
1078 { echo mdcdev=$mdcdev; $LCTL dl;
1079 error "more than one ${FSNAME}-MDT0000-mdc"; }
1081 $LCTL --device $mdcdev recover ||
1082 error "$LCTL --device $mdcdev recover failed"
1084 multiop_bg_pause $DIR/$tfile O_c ||
1085 error "multiop_bg_pause $DIR/$tfile failed"
1088 # This will cause the CLOSE to fail before even
1089 # allocating a reply buffer
1090 $LCTL --device $mdcdev deactivate ||
1091 error "$LCTL --device $mdcdev deactivate failed"
1094 kill -USR1 $pid || error "multiop $pid not running"
1095 wait $pid || error "multiop $pid failed"
1097 $LCTL --device $mdcdev activate ||
1098 error "$LCTL --device $mdcdev activate failed"
1101 $CHECKSTAT -t file $DIR/$tfile ||
1102 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1105 run_test 45 "Handle failed close"
1108 drop_reply "touch $DIR/$tfile"
1110 # ironically, the previous test, 45, will cause a real forced close,
1111 # so just look for one for this test
1112 local FID=$($LFS path2fid $tfile)
1113 $LCTL dk | grep -i "force closing file handle $FID" &&
1114 error "found force closing in dmesg"
1117 run_test 46 "Don't leak file handle after open resend (3325)"
1119 test_47() { # bug 2824
1120 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1122 # create some files to make sure precreate has been done on all
1123 # OSTs. (just in case this test is run independently)
1124 createmany -o $DIR/$tfile 20 ||
1125 error "createmany create $DIR/$tfile failed"
1127 # OBD_FAIL_OST_CREATE_NET 0x204
1129 do_facet ost1 "lctl set_param fail_loc=0x80000204"
1130 client_up || error "client_up failed"
1132 # let the MDS discover the OST failure, attempt to recover, fail
1133 # and recover again.
1134 sleep $((3 * TIMEOUT))
1136 # Without 2824, this createmany would hang
1137 createmany -o $DIR/$tfile 20 ||
1138 error "createmany recraete $DIR/$tfile failed"
1139 unlinkmany $DIR/$tfile 20 || error "unlinkmany $DIR/$tfile failed"
1143 run_test 47 "MDS->OSC failure during precreate cleanup (2824)"
1146 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1147 [ "$OSTCOUNT" -lt "2" ] && skip_env "needs >= 2 OSTs" && return
1149 replay_barrier $SINGLEMDS
1150 createmany -o $DIR/$tfile 20 ||
1151 error "createmany -o $DIR/$tfile failed"
1152 # OBD_FAIL_OST_EROFS 0x216
1153 facet_failover $SINGLEMDS
1154 do_facet ost1 "lctl set_param fail_loc=0x80000216"
1155 client_up || error "client_up failed"
1157 # let the MDS discover the OST failure, attempt to recover, fail
1158 # and recover again.
1159 sleep $((3 * TIMEOUT))
1161 createmany -o $DIR/$tfile 20 20 ||
1162 error "createmany recraete $DIR/$tfile failed"
1163 unlinkmany $DIR/$tfile 40 || error "unlinkmany $DIR/$tfile failed"
1166 run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
1169 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc)
1170 local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" |
1171 grep $mdtosc | awk '{print $1}')
1172 [ "$oscdev" ] || error "could not find OSC device on MDS"
1173 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1174 error "OSC device $oscdev recovery failed"
1175 do_facet $SINGLEMDS $LCTL --device $oscdev recover ||
1176 error "second OSC device $oscdev recovery failed"
1177 # give the mds_lov_sync threads a chance to run
1180 run_test 50 "Double OSC recovery, don't LASSERT (3812)"
1182 # b3764 timed out lock replay
1184 [ "$MDS1_VERSION" -lt $(version_code 2.6.90) ] &&
1185 skip "MDS prior to 2.6.90 handle LDLM_REPLY_NET incorrectly"
1187 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1188 cancel_lru_locks mdc
1190 multiop_bg_pause $DIR/$tfile s_s || error "multiop $DIR/$tfile failed"
1193 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
1194 lctl set_param -n ldlm.cancel_unused_locks_before_replay "0"
1195 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
1197 fail $SINGLEMDS || error "fail $SINGLEMDS failed"
1199 wait $mpid || error "multiop_bg_pause pid failed"
1201 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1202 lctl set_param fail_loc=0x0
1203 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
1206 run_test 52 "time out lock replay (3764)"
1208 # bug 3462 - simultaneous MDC requests
1210 [[ $(lctl get_param mdc.*.import |
1211 grep "connect_flags:.*multi_mod_rpc") ]] ||
1212 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1214 cancel_lru_locks mdc # cleanup locks from former test cases
1215 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1216 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1217 multiop $DIR/${tdir}-1/f O_c &
1219 # give multiop a change to open
1222 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1223 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1224 kill -USR1 $close_pid
1225 cancel_lru_locks mdc # force the close
1226 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1228 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1230 # close should still be here
1231 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1233 replay_barrier_nodf $SINGLEMDS
1235 wait $close_pid || error "close_pid $close_pid failed"
1237 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1238 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1239 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1240 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1241 rm -rf $DIR/${tdir}-*
1243 run_test 53a "|X| close request while two MDC requests in flight"
1246 cancel_lru_locks mdc # cleanup locks from former test cases
1248 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1249 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1250 multiop_bg_pause $DIR/${tdir}-1/f O_c ||
1251 error "multiop_bg_pause $DIR/${tdir}-1/f failed"
1254 #define OBD_FAIL_MDS_REINT_NET 0x107
1255 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1256 mcreate $DIR/${tdir}-2/f &
1260 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1261 kill -USR1 $close_pid
1262 cancel_lru_locks mdc # force the close
1263 wait $close_pid || error "close_pid $close_pid failed"
1264 # open should still be here
1265 [ -d /proc/$open_pid ] || error "open_pid doesn't exist"
1267 replay_barrier_nodf $SINGLEMDS
1269 wait $open_pid || error "open_pid failed"
1271 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1272 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1273 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1274 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1275 rm -rf $DIR/${tdir}-*
1277 run_test 53b "|X| open request while two MDC requests in flight"
1280 cancel_lru_locks mdc # cleanup locks from former test cases
1282 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1283 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1284 multiop $DIR/${tdir}-1/f O_c &
1287 #define OBD_FAIL_MDS_REINT_NET 0x107
1288 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1289 mcreate $DIR/${tdir}-2/f &
1293 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1294 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1295 kill -USR1 $close_pid
1296 cancel_lru_locks mdc # force the close
1298 #bz20647: make sure all pids exist before failover
1299 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1300 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1301 replay_barrier_nodf $SINGLEMDS
1302 fail_nodf $SINGLEMDS
1303 wait $open_pid || error "open_pid failed"
1305 # close should be gone
1306 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1307 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1309 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1310 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1311 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1312 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1313 rm -rf $DIR/${tdir}-*
1315 run_test 53c "|X| open request and close request while two MDC requests in flight"
1318 [[ $(lctl get_param mdc.*.import |
1319 grep "connect_flags:.*multi_mod_rpc") ]] ||
1320 { skip "Need MDC with 'multi_mod_rpcs' feature"; return 0; }
1322 cancel_lru_locks mdc # cleanup locks from former test cases
1324 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1325 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1326 multiop $DIR/${tdir}-1/f O_c &
1328 # give multiop a chance to open
1331 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1332 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1333 kill -USR1 $close_pid
1334 cancel_lru_locks mdc # force the close
1335 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1336 mcreate $DIR/${tdir}-2/f || error "mcreate $DIR/${tdir}-2/f failed"
1338 # close should still be here
1339 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1341 wait $close_pid || error "close_pid failed"
1343 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1344 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1345 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1346 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1347 rm -rf $DIR/${tdir}-*
1349 run_test 53d "close reply while two MDC requests in flight"
1352 cancel_lru_locks mdc # cleanup locks from former test cases
1354 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1355 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1356 multiop $DIR/${tdir}-1/f O_c &
1359 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1360 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1361 mcreate $DIR/${tdir}-2/f &
1365 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1366 kill -USR1 $close_pid
1367 cancel_lru_locks mdc # force the close
1368 wait $close_pid || error "close_pid failed"
1369 # open should still be here
1370 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1372 replay_barrier_nodf $SINGLEMDS
1374 wait $open_pid || error "open_pid failed"
1376 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1377 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1378 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1379 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1380 rm -rf $DIR/${tdir}-*
1382 run_test 53e "|X| open reply while two MDC requests in flight"
1385 cancel_lru_locks mdc # cleanup locks from former test cases
1387 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1388 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1389 multiop $DIR/${tdir}-1/f O_c &
1392 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1393 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1394 mcreate $DIR/${tdir}-2/f &
1398 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1399 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1400 kill -USR1 $close_pid
1401 cancel_lru_locks mdc # force the close
1403 #bz20647: make sure all pids are exists before failover
1404 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1405 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1406 replay_barrier_nodf $SINGLEMDS
1407 fail_nodf $SINGLEMDS
1408 wait $open_pid || error "open_pid failed"
1410 # close should be gone
1411 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1412 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1414 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1415 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1416 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1417 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1418 rm -rf $DIR/${tdir}-*
1420 run_test 53f "|X| open reply and close reply while two MDC requests in flight"
1423 cancel_lru_locks mdc # cleanup locks from former test cases
1425 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1426 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1427 multiop $DIR/${tdir}-1/f O_c &
1430 #define OBD_FAIL_MDS_REINT_NET_REP 0x119
1431 do_facet $SINGLEMDS "lctl set_param fail_loc=0x119"
1432 mcreate $DIR/${tdir}-2/f &
1436 #define OBD_FAIL_MDS_CLOSE_NET 0x115
1437 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000115"
1438 kill -USR1 $close_pid
1439 cancel_lru_locks mdc # force the close
1440 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1442 #bz20647: make sure all pids are exists before failover
1443 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1444 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1445 replay_barrier_nodf $SINGLEMDS
1446 fail_nodf $SINGLEMDS
1447 wait $open_pid || error "open_pid failed"
1449 # close should be gone
1450 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1452 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1453 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1454 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1455 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1456 rm -rf $DIR/${tdir}-*
1458 run_test 53g "|X| drop open reply and close request while close and open are both in flight"
1461 cancel_lru_locks mdc # cleanup locks from former test cases
1463 mkdir $DIR/${tdir}-1 || error "mkdir $DIR/${tdir}-1 failed"
1464 mkdir $DIR/${tdir}-2 || error "mkdir $DIR/${tdir}-2 failed"
1465 multiop $DIR/${tdir}-1/f O_c &
1468 #define OBD_FAIL_MDS_REINT_NET 0x107
1469 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000107"
1470 mcreate $DIR/${tdir}-2/f &
1474 #define OBD_FAIL_MDS_CLOSE_NET_REP 0x13b
1475 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013b"
1476 kill -USR1 $close_pid
1477 cancel_lru_locks mdc # force the close
1480 #bz20647: make sure all pids are exists before failover
1481 [ -d /proc/$close_pid ] || error "close_pid doesn't exist"
1482 [ -d /proc/$open_pid ] || error "open_pid doesn't exists"
1483 replay_barrier_nodf $SINGLEMDS
1484 fail_nodf $SINGLEMDS
1485 wait $open_pid || error "open_pid failed"
1487 # close should be gone
1488 [ -d /proc/$close_pid ] && error "close_pid should not exist"
1489 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1491 $CHECKSTAT -t file $DIR/${tdir}-1/f ||
1492 error "$CHECKSTAT $DIR/${tdir}-1/f attribute check failed"
1493 $CHECKSTAT -t file $DIR/${tdir}-2/f ||
1494 error "$CHECKSTAT $DIR/${tdir}-2/f attribute check failed"
1495 rm -rf $DIR/${tdir}-*
1497 run_test 53h "open request and close reply while two MDC requests in flight"
1499 #b3761 ASSERTION(hash != 0) failed
1501 # OBD_FAIL_MDS_OPEN_CREATE | OBD_FAIL_ONCE
1502 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012b"
1504 # give touch a chance to run
1506 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1510 run_test 55 "let MDS_CHECK_RESENT return the original return code instead of 0"
1512 #b3440 ASSERTION(rec->ur_fid2->id) failed
1514 ln -s foo $DIR/$tfile
1515 replay_barrier $SINGLEMDS
1516 #drop_reply "cat $DIR/$tfile"
1520 run_test 56 "don't replay a symlink open request (3440)"
1522 #recovery one mds-ost setattr from llog
1524 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1525 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1526 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1527 replay_barrier $SINGLEMDS
1529 wait_recovery_complete $SINGLEMDS || error "MDS recovery is not done"
1530 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
1531 $CHECKSTAT -t file $DIR/$tfile ||
1532 error "$CHECKSTAT $DIR/$tfile attribute check failed"
1533 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1536 run_test 57 "test recovery from llog for setattr op"
1539 zconf_umount $(hostname) $MOUNT2
1543 #recovery many mds-ost setattr from llog
1545 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1546 #define OBD_FAIL_MDS_OST_SETATTR 0x12c
1547 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000012c"
1548 createmany -o $DIR/$tdir/$tfile-%d 2500
1549 replay_barrier $SINGLEMDS
1552 $CHECKSTAT -t file $DIR/$tdir/$tfile-* >/dev/null ||
1553 error "$CHECKSTAT $DIR/$tfile-* attribute check failed"
1554 do_facet $SINGLEMDS "lctl set_param fail_loc=0x0"
1555 unlinkmany $DIR/$tdir/$tfile-%d 2500 ||
1556 error "unlinkmany $DIR/$tfile failed"
1559 run_test 58a "test recovery from llog for setattr op (test llog_gen_rec)"
1565 trap cleanup_58 EXIT
1567 large_xattr_enabled &&
1568 orig="$(generate_string $(max_xattr_size))" || orig="bar"
1569 # Original extended attribute can be long. Print a small version of
1570 # attribute if an error occurs
1571 local sm_msg=$(printf "%.9s" $orig)
1573 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1574 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1575 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1576 replay_barrier $SINGLEMDS
1577 setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile
1579 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1580 [[ "$new" = "$orig" ]] ||
1581 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1582 rm -f $DIR/$tdir/$tfile
1585 wait_clients_import_state ${CLIENTS:-$HOSTNAME} "mgs" FULL
1587 run_test 58b "test replay of setxattr op"
1589 test_58c() { # bug 16570
1594 trap cleanup_58 EXIT
1596 if large_xattr_enabled; then
1597 local xattr_size=$(max_xattr_size)
1598 orig="$(generate_string $((xattr_size / 2)))"
1599 orig1="$(generate_string $xattr_size)"
1605 # PING_INTERVAL max(obd_timeout / 4, 1U)
1606 sleep $((TIMEOUT / 4))
1608 # Original extended attribute can be long. Print a small version of
1609 # attribute if an error occurs
1610 local sm_msg=$(printf "%.9s" $orig)
1611 local sm_msg1=$(printf "%.9s" $orig1)
1613 mount_client $MOUNT2 || error "mount_client on $MOUNT2 failed"
1614 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1615 touch $DIR/$tdir/$tfile || error "touch $DIR/$tdir/$tfile failed"
1616 drop_request "setfattr -n trusted.foo -v $orig $DIR/$tdir/$tfile" ||
1617 error "drop_request for setfattr failed"
1618 new=$(get_xattr_value trusted.foo $MOUNT2/$tdir/$tfile)
1619 [[ "$new" = "$orig" ]] ||
1620 error "xattr set ($sm_msg...) differs from xattr get ($new)"
1621 drop_reint_reply "setfattr -n trusted.foo1 \
1622 -v $orig1 $DIR/$tdir/$tfile" ||
1623 error "drop_reint_reply for setfattr failed"
1624 new=$(get_xattr_value trusted.foo1 $MOUNT2/$tdir/$tfile)
1625 [[ "$new" = "$orig1" ]] ||
1626 error "second xattr set ($sm_msg1...) differs xattr get ($new)"
1627 rm -f $DIR/$tdir/$tfile
1631 run_test 58c "resend/reconstruct setxattr op"
1633 # log_commit_thread vs filter_destroy race used to lead to import use after free
1636 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1638 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1639 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1640 error "createmany create files failed"
1642 unlinkmany $DIR/$tdir/$tfile-%d 200 ||
1643 error "unlinkmany $DIR/$tdir/$tfile failed"
1644 #define OBD_FAIL_PTLRPC_DELAY_RECOV 0x507
1645 do_facet ost1 "lctl set_param fail_loc=0x507"
1648 do_facet ost1 "lctl set_param fail_loc=0x0"
1652 run_test 59 "test log_commit_thread vs filter_destroy race"
1654 # race between add unlink llog vs cat log init in post_recovery (only for b1_6)
1655 # bug 12086: should no oops and No ctxt error for this test
1657 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1658 createmany -o $DIR/$tdir/$tfile-%d 200 ||
1659 error "createmany create files failed"
1660 replay_barrier $SINGLEMDS
1661 unlinkmany $DIR/$tdir/$tfile-%d 0 100
1663 unlinkmany $DIR/$tdir/$tfile-%d 100 100
1664 local no_ctxt=$(dmesg | grep "No ctxt")
1665 [ -z "$no_ctxt" ] || error "ctxt is not initialized in recovery"
1667 run_test 60 "test llog post recovery init vs llog unlink"
1669 #test race llog recovery thread vs llog cleanup
1670 test_61a() { # was test_61
1671 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1673 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1674 createmany -o $DIR/$tdir/$tfile-%d 800 ||
1675 error "createmany create files failed"
1677 unlinkmany $DIR/$tdir/$tfile-%d 800
1678 # OBD_FAIL_OST_LLOG_RECOVERY_TIMEOUT 0x221
1679 set_nodes_failloc "$(osts_nodes)" 0x80000221
1684 set_nodes_failloc "$(osts_nodes)" 0x0
1686 $CHECKSTAT -t file $DIR/$tdir/$tfile-* &&
1687 error "$CHECKSTAT $DIR/$tdir/$tfile attribute check should fail"
1690 run_test 61a "test race llog recovery vs llog cleanup"
1692 #test race mds llog sync vs llog cleanup
1694 # OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT 0x13a
1695 do_facet $SINGLEMDS "lctl set_param fail_loc=0x8000013a"
1696 facet_failover $SINGLEMDS
1699 do_facet client dd if=/dev/zero of=$DIR/$tfile bs=4k count=1 ||
1702 run_test 61b "test race mds llog sync vs llog cleanup"
1704 #test race cancel cookie cb vs llog cleanup
1706 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1708 # OBD_FAIL_OST_CANCEL_COOKIE_TIMEOUT 0x222
1709 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
1710 set_nodes_failloc "$(osts_nodes)" 0x80000222
1714 set_nodes_failloc "$(osts_nodes)" 0x0
1716 run_test 61c "test race mds llog sync vs llog cleanup"
1718 test_61d() { # bug 16002 # bug 17466 # bug 22137
1719 # OBD_FAIL_OBD_LLOG_SETUP 0x605
1721 do_facet mgs "lctl set_param fail_loc=0x80000605"
1722 start mgs $(mgsdevname) $MGS_MOUNT_OPTS &&
1723 error "mgs start should have failed"
1724 do_facet mgs "lctl set_param fail_loc=0"
1725 start mgs $(mgsdevname) $MGS_MOUNT_OPTS || error "cannot restart mgs"
1727 run_test 61d "error in llog_setup should cleanup the llog context correctly"
1729 test_62() { # Bug 15756 - don't mis-drop resent replay
1730 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
1731 replay_barrier $SINGLEMDS
1732 createmany -o $DIR/$tdir/$tfile- 25 ||
1733 error "createmany create files failed"
1734 #define OBD_FAIL_TGT_REPLAY_DROP 0x707
1735 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000707"
1737 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
1738 unlinkmany $DIR/$tdir/$tfile- 25 ||
1739 error "unlinkmany $DIR/$tdir/$tfile failed"
1742 run_test 62 "don't mis-drop resent replay"
1744 #Adaptive Timeouts (bug 3055)
1752 echo "Cleaning up AT ..."
1753 if [ -n "$ATOLDBASE" ]; then
1754 local at_history=$($LCTL get_param -n at_history)
1755 do_facet $SINGLEMDS "lctl set_param at_history=$at_history" || true
1756 do_facet ost1 "lctl set_param at_history=$at_history" || true
1759 if [ $AT_MAX_SET -ne 0 ]; then
1760 for facet in mds client ost; do
1761 var=AT_MAX_SAVE_${facet}
1762 echo restore AT on $facet to saved value ${!var}
1763 at_max_set ${!var} $facet
1764 at_new=$(at_max_get $facet)
1765 echo Restored AT value on $facet $at_new
1766 [ $at_new -eq ${!var} ] ||
1767 error "AT value not restored SAVED ${!var} NEW $at_new"
1774 local at_max_new=600
1776 # Save at_max original values
1778 if [ $AT_MAX_SET -eq 0 ]; then
1779 # Suppose that all osts have the same at_max
1780 for facet in mds client ost; do
1781 eval AT_MAX_SAVE_${facet}=$(at_max_get $facet)
1785 for facet in mds client ost; do
1786 at_max=$(at_max_get $facet)
1787 if [ $at_max -ne $at_max_new ]; then
1788 echo "AT value on $facet is $at_max, set it by force temporarily to $at_max_new"
1789 at_max_set $at_max_new $facet
1794 if [ -z "$ATOLDBASE" ]; then
1795 ATOLDBASE=$(do_facet $SINGLEMDS "lctl get_param -n at_history")
1796 # speed up the timebase so we can check decreasing AT
1797 do_facet $SINGLEMDS "lctl set_param at_history=8" || true
1798 do_facet ost1 "lctl set_param at_history=8" || true
1800 # sleep for a while to cool down, should be > 8s and also allow
1801 # at least one ping to be sent. simply use TIMEOUT to be safe.
1806 test_65a() #bug 3055
1808 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1810 at_start || return 0
1811 $LCTL dk > /dev/null
1813 $LCTL set_param debug="other"
1814 # Slow down a request to the current service time, this is critical
1815 # because previous tests may have caused this value to increase.
1816 REQ_DELAY=`lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts |
1817 awk '/portal 12/ {print $5}'`
1818 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1820 do_facet $SINGLEMDS lctl set_param fail_val=$((${REQ_DELAY} * 1000))
1821 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1822 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x8000050a
1823 createmany -o $DIR/$tfile 10 > /dev/null
1824 unlinkmany $DIR/$tfile 10 > /dev/null
1825 # check for log message
1826 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1828 # client should show REQ_DELAY estimates
1829 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1831 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep portal
1833 run_test 65a "AT: verify early replies"
1835 test_65b() #bug 3055
1837 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1839 at_start || return 0
1842 $LCTL set_param debug="other trace"
1843 $LCTL dk > /dev/null
1844 # Slow down a request to the current service time, this is critical
1845 # because previous tests may have caused this value to increase.
1846 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1847 error "$LFS setstripe failed for $DIR/$tfile"
1849 multiop $DIR/$tfile Ow1yc
1850 REQ_DELAY=`lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts |
1851 awk '/portal 6/ {print $5}'`
1852 REQ_DELAY=$((${REQ_DELAY} + ${REQ_DELAY} / 4 + 5))
1854 do_facet ost1 lctl set_param fail_val=${REQ_DELAY}
1855 #define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
1856 do_facet ost1 $LCTL set_param fail_loc=0x224
1859 $LFS setstripe --stripe-index=0 --stripe-count=1 $DIR/$tfile ||
1860 error "$LFS setstripe failed"
1861 # force some real bulk transfer
1862 multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
1864 do_facet ost1 $LCTL set_param fail_loc=0
1865 # check for log message
1866 $LCTL dk | grep -i "Early reply #" || error "No early reply"
1868 # client should show REQ_DELAY estimates
1869 lctl get_param -n osc.${FSNAME}-OST0000-osc-*.timeouts | grep portal
1871 run_test 65b "AT: verify early replies on packed reply / bulk"
1873 test_66a() #bug 3055
1875 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1877 at_start || return 0
1878 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1879 # adjust 5s at a time so no early reply is sent (within deadline)
1880 do_facet $SINGLEMDS "$LCTL set_param fail_val=5000"
1881 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1882 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1883 createmany -o $DIR/$tfile 20 > /dev/null
1884 unlinkmany $DIR/$tfile 20 > /dev/null
1885 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1886 do_facet $SINGLEMDS "$LCTL set_param fail_val=10000"
1887 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x8000050a"
1888 createmany -o $DIR/$tfile 20 > /dev/null
1889 unlinkmany $DIR/$tfile 20 > /dev/null
1890 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1891 do_facet $SINGLEMDS "$LCTL set_param fail_loc=0"
1893 createmany -o $DIR/$tfile 20 > /dev/null
1894 unlinkmany $DIR/$tfile 20 > /dev/null
1895 lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | grep "portal 12"
1896 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $5}')
1897 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000-mdc-*.timeouts | awk '/portal 12/ {print $7}')
1898 echo "Current MDT timeout $CUR, worst $WORST"
1899 [ $CUR -lt $WORST ] || error "Current $CUR should be less than worst $WORST"
1901 run_test 66a "AT: verify MDT service time adjusts with no early replies"
1903 test_66b() #bug 3055
1905 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1907 at_start || return 0
1908 ORIG=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1909 awk '/network/ {print $4}')
1910 $LCTL set_param fail_val=$(($ORIG + 5))
1911 #define OBD_FAIL_PTLRPC_PAUSE_REP 0x50c
1912 $LCTL set_param fail_loc=0x50c
1913 touch $DIR/$tfile > /dev/null 2>&1
1914 $LCTL set_param fail_loc=0
1915 CUR=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1916 awk '/network/ {print $4}')
1917 WORST=$(lctl get_param -n mdc.${FSNAME}-MDT0000*.timeouts |
1918 awk '/network/ {print $6}')
1919 echo "network timeout orig $ORIG, cur $CUR, worst $WORST"
1920 [ $WORST -gt $ORIG ] ||
1921 error "Worst $WORST should be worse than orig $ORIG"
1923 run_test 66b "AT: verify net latency adjusts"
1925 test_67a() #bug 3055
1927 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1929 at_start || return 0
1930 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1931 # sleeping threads may drive values above this
1932 do_facet ost1 "$LCTL set_param fail_val=400"
1933 #define OBD_FAIL_PTLRPC_PAUSE_REQ 0x50a
1934 do_facet ost1 "$LCTL set_param fail_loc=0x50a"
1935 createmany -o $DIR/$tfile 20 > /dev/null
1936 unlinkmany $DIR/$tfile 20 > /dev/null
1937 do_facet ost1 "$LCTL set_param fail_loc=0"
1938 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1939 ATTEMPTS=$(($CONN2 - $CONN1))
1940 echo "$ATTEMPTS osc reconnect attempts on gradual slow"
1941 [ $ATTEMPTS -gt 0 ] &&
1942 error_ignore bz13721 "AT should have prevented reconnect"
1945 run_test 67a "AT: verify slow request processing doesn't induce reconnects"
1947 test_67b() #bug 3055
1949 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1951 at_start || return 0
1952 CONN1=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1954 # exhaust precreations on ost1
1955 local OST=$(ostname_from_index 0)
1956 local mdtosc=$(get_mdtosc_proc_path mds $OST)
1957 local last_id=$(do_facet $SINGLEMDS lctl get_param -n \
1958 osp.$mdtosc.prealloc_last_id)
1959 local next_id=$(do_facet $SINGLEMDS lctl get_param -n \
1960 osp.$mdtosc.prealloc_next_id)
1962 mkdir -p $DIR/$tdir/${OST} || error "mkdir $DIR/$tdir/${OST} failed"
1963 $LFS setstripe -i 0 -c 1 $DIR/$tdir/${OST} ||
1964 error "$LFS setstripe failed"
1965 echo "Creating to objid $last_id on ost $OST..."
1966 #define OBD_FAIL_OST_PAUSE_CREATE 0x223
1967 do_facet ost1 "$LCTL set_param fail_val=20000"
1968 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1969 createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
1972 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1974 CONN2=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1975 ATTEMPTS=$(($CONN2 - $CONN1))
1976 echo "$ATTEMPTS osc reconnect attempts on instant slow"
1977 # do it again; should not timeout
1978 do_facet ost1 "$LCTL set_param fail_loc=0x80000223"
1979 cp /etc/profile $DIR/$tfile || error "cp failed"
1980 do_facet ost1 "$LCTL set_param fail_loc=0"
1982 do_facet ost1 "lctl get_param -n ost.OSS.ost_create.timeouts"
1983 CONN3=$(lctl get_param -n osc.*.stats | awk '/_connect/ {total+=$2} END {print total}')
1984 ATTEMPTS=$(($CONN3 - $CONN2))
1985 echo "$ATTEMPTS osc reconnect attempts on 2nd slow"
1986 [ $ATTEMPTS -gt 0 ] && error "AT should have prevented reconnect"
1989 run_test 67b "AT: verify instant slowdown doesn't induce reconnects"
1991 test_68 () #bug 13813
1993 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
1995 at_start || return 0
1996 local ldlm_enqueue_min=$(find /sys -name ldlm_enqueue_min)
1997 [ -z "$ldlm_enqueue_min" ] && skip "missing /sys/.../ldlm_enqueue_min" && return 0
1998 local ldlm_enqueue_min_r=$(do_facet ost1 "find /sys -name ldlm_enqueue_min")
1999 [ -z "$ldlm_enqueue_min_r" ] && skip "missing /sys/.../ldlm_enqueue_min in the ost1" && return 0
2000 local ENQ_MIN=$(cat $ldlm_enqueue_min)
2001 local ENQ_MIN_R=$(do_facet ost1 "cat $ldlm_enqueue_min_r")
2002 echo $TIMEOUT >> $ldlm_enqueue_min
2003 do_facet ost1 "echo $TIMEOUT >> $ldlm_enqueue_min_r"
2005 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2006 $LFS setstripe --stripe-index=0 -c 1 $DIR/$tdir ||
2007 error "$LFS setstripe failed for $DIR/$tdir"
2008 #define OBD_FAIL_LDLM_PAUSE_CANCEL 0x312
2009 $LCTL set_param fail_val=$(($TIMEOUT - 1))
2010 $LCTL set_param fail_loc=0x80000312
2011 cp /etc/profile $DIR/$tdir/${tfile}_1 || error "1st cp failed $?"
2012 $LCTL set_param fail_val=$((TIMEOUT * 5 / 4))
2013 $LCTL set_param fail_loc=0x80000312
2014 cp /etc/profile $DIR/$tdir/${tfile}_2 || error "2nd cp failed $?"
2015 $LCTL set_param fail_loc=0
2017 echo $ENQ_MIN >> $ldlm_enqueue_min
2018 do_facet ost1 "echo $ENQ_MIN_R >> $ldlm_enqueue_min_r"
2022 run_test 68 "AT: verify slowing locks"
2025 # end of AT tests includes above lines
2027 # start multi-client tests
2029 [ -z "$CLIENTS" ] &&
2030 { skip "Need two or more clients." && return; }
2031 [ $CLIENTCOUNT -lt 2 ] &&
2032 { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
2034 echo "mount clients $CLIENTS ..."
2035 zconf_mount_clients $CLIENTS $MOUNT
2037 local clients=${CLIENTS//,/ }
2038 echo "Write/read files on $DIR ; clients $CLIENTS ... "
2039 for CLIENT in $clients; do
2040 do_node $CLIENT dd bs=1M count=10 if=/dev/zero \
2041 of=$DIR/${tfile}_${CLIENT} 2>/dev/null ||
2042 error "dd failed on $CLIENT"
2045 local prev_client=$(echo $clients | sed 's/^.* \(.\+\)$/\1/')
2046 for C in ${CLIENTS//,/ }; do
2047 do_node $prev_client dd if=$DIR/${tfile}_${C} \
2048 of=/dev/null 2>/dev/null ||
2049 error "dd if=$DIR/${tfile}_${C} failed on $prev_client"
2055 run_test 70a "check multi client t-f"
2057 check_for_process () {
2062 killall_process $clients "$prog" -0
2066 local clients=${CLIENTS:-$HOSTNAME}
2068 zconf_mount_clients $clients $MOUNT
2071 [ "$SLOW" = "no" ] && duration=120
2072 # set duration to 900 because it takes some time to boot node
2073 [ "$FAILURE_MODE" = HARD ] && duration=900
2076 local start_ts=$(date +%s)
2077 local cmd="rundbench 1 -t $duration"
2079 if [ $MDSCOUNT -ge 2 ]; then
2080 test_mkdir -p -c$MDSCOUNT $DIR/$tdir
2081 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir
2083 do_nodesv $clients "set -x; MISSING_DBENCH_OK=$MISSING_DBENCH_OK \
2084 PATH=\$PATH:$LUSTRE/utils:$LUSTRE/tests/:$DBENCH_LIB \
2085 DBENCH_LIB=$DBENCH_LIB TESTSUITE=$TESTSUITE TESTNAME=$TESTNAME \
2086 MOUNT=$MOUNT DIR=$DIR/$tdir/\\\$(hostname) LCTL=$LCTL $cmd" &
2089 #LU-1897 wait for all dbench copies to start
2090 while ! check_for_process $clients dbench; do
2091 elapsed=$(($(date +%s) - start_ts))
2092 if [ $elapsed -gt $duration ]; then
2093 killall_process $clients dbench
2094 error "dbench failed to start on $clients!"
2099 log "Started rundbench load pid=$pid ..."
2101 elapsed=$(($(date +%s) - start_ts))
2102 local num_failovers=0
2104 while [ $elapsed -lt $duration ]; do
2105 if ! check_for_process $clients dbench; then
2106 error_noexit "dbench stopped on some of $clients!"
2107 killall_process $clients dbench
2111 replay_barrier mds$fail_index
2112 sleep 1 # give clients a time to do operations
2113 # Increment the number of failovers
2114 num_failovers=$((num_failovers+1))
2115 log "$TESTNAME fail mds$fail_index $num_failovers times"
2117 elapsed=$(($(date +%s) - start_ts))
2118 if [ $fail_index -ge $MDSCOUNT ]; then
2121 fail_index=$((fail_index+1))
2125 wait $pid || error "rundbench load on $clients failed!"
2127 run_test 70b "dbench ${MDSCOUNT}mdts recovery; $CLIENTCOUNT clients"
2128 # end multi-client tests
2133 local monitor_pid=$3
2135 local start_ts=$(date +%s)
2136 local num_failovers=0
2139 elapsed=$(($(date +%s) - start_ts))
2140 while [ $elapsed -lt $duration ]; do
2141 fail_index=$((RANDOM%max_index+1))
2142 kill -0 $monitor_pid ||
2143 error "$monitor_pid stopped"
2145 replay_barrier mds$fail_index
2147 # Increment the number of failovers
2148 num_failovers=$((num_failovers+1))
2149 log "$TESTNAME fail mds$fail_index $num_failovers times"
2151 elapsed=$(($(date +%s) - start_ts))
2157 rm -f $DIR/replay-single.70c.lck
2162 local clients=${CLIENTS:-$HOSTNAME}
2165 zconf_mount_clients $clients $MOUNT
2168 [ "$SLOW" = "no" ] && duration=180
2169 # set duration to 900 because it takes some time to boot node
2170 [ "$FAILURE_MODE" = HARD ] && duration=600
2173 local start_ts=$(date +%s)
2175 trap cleanup_70c EXIT
2177 while [ ! -e $DIR/replay-single.70c.lck ]; do
2178 test_mkdir -p -c$MDSCOUNT $DIR/$tdir || break
2179 if [ $MDSCOUNT -ge 2 ]; then
2180 $LFS setdirstripe -D -c$MDSCOUNT $DIR/$tdir ||
2181 error "set default dirstripe failed"
2183 cd $DIR/$tdir || break
2184 tar cf - /etc | tar xf - || error "tar failed in loop"
2188 echo "Started tar $tar_70c_pid"
2190 random_fail_mdt $MDSCOUNT $duration $tar_70c_pid
2191 kill -0 $tar_70c_pid || error "tar $tar_70c_pid stopped"
2193 touch $DIR/replay-single.70c.lck
2194 wait $tar_70c_pid || error "$?: tar failed"
2199 run_test 70c "tar ${MDSCOUNT}mdts recovery"
2203 kill -9 $mkdir_70d_pid
2207 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2208 local clients=${CLIENTS:-$HOSTNAME}
2211 zconf_mount_clients $clients $MOUNT
2214 [ "$SLOW" = "no" ] && duration=180
2215 # set duration to 900 because it takes some time to boot node
2216 [ "$FAILURE_MODE" = HARD ] && duration=900
2221 local start_ts=$(date +%s)
2223 trap cleanup_70d EXIT
2226 $LFS mkdir -i0 -c2 $DIR/$tdir/test || {
2230 $LFS mkdir -i1 -c2 $DIR/$tdir/test1 || {
2235 touch $DIR/$tdir/test/a || {
2239 mkdir $DIR/$tdir/test/b || {
2243 rm -rf $DIR/$tdir/test || {
2249 touch $DIR/$tdir/test1/a || {
2253 mkdir $DIR/$tdir/test1/b || {
2258 rm -rf $DIR/$tdir/test1 || {
2260 ls -lR $DIR/$tdir/test1
2266 echo "Started $mkdir_70d_pid"
2268 random_fail_mdt $MDSCOUNT $duration $mkdir_70d_pid
2269 kill -0 $mkdir_70d_pid || error "mkdir/rmdir $mkdir_70d_pid stopped"
2274 run_test 70d "mkdir/rmdir striped dir ${MDSCOUNT}mdts recovery"
2277 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2278 local clients=${CLIENTS:-$HOSTNAME}
2281 lctl set_param debug=+ha
2282 zconf_mount_clients $clients $MOUNT
2285 [ "$SLOW" = "no" ] && duration=180
2286 # set duration to 900 because it takes some time to boot node
2287 [ "$FAILURE_MODE" = HARD ] && duration=900
2290 $LFS mkdir -i0 $DIR/$tdir/test_0
2291 $LFS mkdir -i0 $DIR/$tdir/test_1
2292 touch $DIR/$tdir/test_0/a
2293 touch $DIR/$tdir/test_1/b
2296 mrename $DIR/$tdir/test_0/a $DIR/$tdir/test_1/b > /dev/null || {
2301 checkstat $DIR/$tdir/test_0/a && {
2302 echo "a still exists"
2306 checkstat $DIR/$tdir/test_1/b || {
2307 echo "b still exists"
2311 touch $DIR/$tdir/test_0/a || {
2312 echo "touch a fails"
2316 mrename $DIR/$tdir/test_1/b $DIR/$tdir/test_0/a > /dev/null || {
2323 stack_trap "kill -9 $rename_70e_pid" EXIT
2324 echo "Started PID=$rename_70e_pid"
2326 random_fail_mdt 2 $duration $rename_70e_pid
2327 kill -0 $rename_70e_pid || error "rename $rename_70e_pid stopped"
2329 run_test 70e "rename cross-MDT with random fails"
2331 test_70f_write_and_read(){
2336 echo "Write/read files in: '$DIR/$tdir', clients: '$CLIENTS' ..."
2337 for client in ${CLIENTS//,/ }; do
2338 [ -f $stopflag ] || return
2340 local tgtfile=$DIR/$tdir/$tfile.$client
2341 do_node $client dd $DD_OPTS bs=1M count=10 if=$srcfile \
2342 of=$tgtfile 2>/dev/null ||
2343 error "dd $DD_OPTS bs=1M count=10 if=$srcfile " \
2344 "of=$tgtfile failed on $client, rc=$?"
2347 local prev_client=$(echo ${CLIENTS//,/ } | awk '{ print $NF }')
2350 for client in ${CLIENTS//,/ }; do
2351 [ -f $stopflag ] || return
2353 # flush client cache in case test is running on only one client
2354 # do_node $client cancel_lru_locks osc
2355 do_node $client $LCTL set_param ldlm.namespaces.*.lru_size=clear
2357 tgtfile=$DIR/$tdir/$tfile.$client
2358 local md5=$(do_node $prev_client "md5sum $tgtfile")
2359 [ ${checksum[$index]// */} = ${md5// */} ] ||
2360 error "$tgtfile: checksum doesn't match on $prev_client"
2361 index=$((index + 1))
2371 mkdir -p $DIR/$tdir || error "cannot create $DIR/$tdir directory"
2372 $LFS setstripe -c -1 $DIR/$tdir ||
2373 error "cannot $LFS setstripe $DIR/$tdir"
2376 while [ -f $stopflag ]; do
2377 test_70f_write_and_read $srcfile $stopflag
2378 # use direct IO and buffer cache in turns if loop
2379 [ -n "$DD_OPTS" ] && DD_OPTS="" || DD_OPTS="oflag=direct"
2383 test_70f_cleanup() {
2385 rm -f $TMP/$tfile.stop
2386 do_nodes $CLIENTS rm -f $TMP/$tfile
2387 rm -f $DIR/$tdir/$tfile.*
2391 # [ x$ost1failover_HOST = x$ost_HOST ] &&
2392 # { skip "Failover host not defined" && return; }
2393 # [ -z "$CLIENTS" ] &&
2394 # { skip "CLIENTS are not specified." && return; }
2395 # [ $CLIENTCOUNT -lt 2 ] &&
2396 # { skip "Need 2 or more clients, have $CLIENTCOUNT" && return; }
2398 [[ "$OST1_VERSION" -lt $(version_code 2.9.53) ]] &&
2399 skip "Need server version at least 2.9.53"
2401 echo "mount clients $CLIENTS ..."
2402 zconf_mount_clients $CLIENTS $MOUNT
2404 local srcfile=$TMP/$tfile
2408 trap test_70f_cleanup EXIT
2409 # create a different source file local to each client node so we can
2410 # detect if the file wasn't written out properly after failover
2411 do_nodes $CLIENTS dd bs=1M count=10 if=/dev/urandom of=$srcfile \
2412 2>/dev/null || error "can't create $srcfile on $CLIENTS"
2413 for client in ${CLIENTS//,/ }; do
2414 checksum[$index]=$(do_node $client "md5sum $srcfile")
2415 index=$((index + 1))
2419 [ "$SLOW" = "no" ] && duration=60
2420 # set duration to 900 because it takes some time to boot node
2421 [ "$FAILURE_MODE" = HARD ] && duration=900
2423 local stopflag=$TMP/$tfile.stop
2424 test_70f_loop $srcfile $stopflag &
2428 local num_failovers=0
2429 local start_ts=$SECONDS
2430 while [ $elapsed -lt $duration ]; do
2434 num_failovers=$((num_failovers + 1))
2435 log "$TESTNAME failing OST $num_failovers times"
2438 elapsed=$((SECONDS - start_ts))
2445 run_test 70f "OSS O_DIRECT recovery with $CLIENTCOUNT clients"
2449 kill -9 $mkdir_71a_pid
2452 random_double_fail_mdt() {
2455 local monitor_pid=$3
2457 local start_ts=$(date +%s)
2458 local num_failovers=0
2462 elapsed=$(($(date +%s) - start_ts))
2463 while [ $elapsed -lt $duration ]; do
2464 fail_index=$((RANDOM%max_index + 1))
2465 if [ $fail_index -eq $max_index ]; then
2468 second_index=$((fail_index + 1))
2470 kill -0 $monitor_pid ||
2471 error "$monitor_pid stopped"
2473 replay_barrier mds$fail_index
2474 replay_barrier mds$second_index
2476 # Increment the number of failovers
2477 num_failovers=$((num_failovers+1))
2478 log "fail mds$fail_index mds$second_index $num_failovers times"
2479 fail mds${fail_index},mds${second_index}
2480 elapsed=$(($(date +%s) - start_ts))
2485 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2486 local clients=${CLIENTS:-$HOSTNAME}
2489 zconf_mount_clients $clients $MOUNT
2492 [ "$SLOW" = "no" ] && duration=180
2493 # set duration to 900 because it takes some time to boot node
2494 [ "$FAILURE_MODE" = HARD ] && duration=900
2499 local start_ts=$(date +%s)
2501 trap cleanup_71a EXIT
2504 $LFS mkdir -i0 -c2 $DIR/$tdir/test
2505 rmdir $DIR/$tdir/test
2509 echo "Started $mkdir_71a_pid"
2511 random_double_fail_mdt 2 $duration $mkdir_71a_pid
2512 kill -0 $mkdir_71a_pid || error "mkdir/rmdir $mkdir_71a_pid stopped"
2517 run_test 71a "mkdir/rmdir striped dir with 2 mdts recovery"
2520 multiop_bg_pause $DIR/$tfile O_tSc ||
2521 error "multiop_bg_pause $DIR/$tfile failed"
2525 replay_barrier $SINGLEMDS
2526 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
2527 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000302"
2530 wait $pid || error "multiop pid failed"
2531 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2534 run_test 73a "open(O_CREAT), unlink, replay, reconnect before open replay, close"
2537 multiop_bg_pause $DIR/$tfile O_tSc ||
2538 error "multiop_bg_pause $DIR/$tfile failed"
2542 replay_barrier $SINGLEMDS
2543 #define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157
2544 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000157"
2547 wait $pid || error "multiop pid failed"
2548 [ -e $DIR/$tfile ] && error "file $DIR/$tfile should not exist"
2551 run_test 73b "open(O_CREAT), unlink, replay, reconnect at open_replay reply, close"
2555 local clients=${CLIENTS:-$HOSTNAME}
2557 zconf_umount_clients $clients $MOUNT
2559 facet_failover $SINGLEMDS
2560 zconf_mount_clients $clients $MOUNT
2562 touch $DIR/$tfile || error "touch $DIR/$tfile failed"
2563 rm $DIR/$tfile || error "rm $DIR/$tfile failed"
2564 clients_up || error "client evicted: $?"
2567 run_test 74 "Ensure applications don't fail waiting for OST recovery"
2569 remote_dir_check_80() {
2574 diridx=$($LFS getstripe -m $remote_dir) ||
2575 error "$LFS getstripe -m $remote_dir failed"
2576 [ $diridx -eq $mdtidx ] || error "$diridx != $mdtidx"
2578 createmany -o $remote_dir/f-%d 20 || error "creation failed"
2579 fileidx=$($LFS getstripe -m $remote_dir/f-1) ||
2580 error "$LFS getstripe -m $remote_dir/f-1 failed"
2581 [ $fileidx -eq $mdtidx ] || error "$fileidx != $mdtidx"
2587 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2588 ([ $FAILURE_MODE == "HARD" ] &&
2589 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2590 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2594 local remote_dir=$DIR/$tdir/remote_dir
2596 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2597 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2598 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2599 $LFS mkdir -i $MDTIDX $remote_dir &
2605 wait $CLIENT_PID || error "remote creation failed"
2607 remote_dir_check_80 || error "remote dir check failed"
2608 rm -rf $DIR/$tdir || error "rmdir failed"
2612 run_test 80a "DNE: create remote dir, drop update rep from MDT0, fail MDT0"
2615 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2616 ([ $FAILURE_MODE == "HARD" ] &&
2617 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2618 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2622 local remote_dir=$DIR/$tdir/remote_dir
2624 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2625 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2626 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2627 $LFS mkdir -i $MDTIDX $remote_dir &
2632 fail mds$((MDTIDX + 1))
2634 wait $CLIENT_PID || error "remote creation failed"
2636 remote_dir_check_80 || error "remote dir check failed"
2637 rm -rf $DIR/$tdir || error "rmdir failed"
2641 run_test 80b "DNE: create remote dir, drop update rep from MDT0, fail MDT1"
2644 [[ "$mds1_FSTYPE" = zfs ]] &&
2645 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2646 skip "requires LU-10143 fix on MDS"
2647 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2648 ([ $FAILURE_MODE == "HARD" ] &&
2649 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2650 skip "MDTs needs to be on diff hosts for HARD fail mode"
2653 local remote_dir=$DIR/$tdir/remote_dir
2655 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2656 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2657 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2658 $LFS mkdir -i $MDTIDX $remote_dir &
2664 fail mds$((MDTIDX + 1))
2666 wait $CLIENT_PID || error "remote creation failed"
2668 remote_dir_check_80 || error "remote dir check failed"
2669 rm -rf $DIR/$tdir || error "rmdir failed"
2673 run_test 80c "DNE: create remote dir, drop update rep from MDT1, fail MDT[0,1]"
2676 [[ "$mds1_FSTYPE" = zfs ]] &&
2677 [[ $MDS1_VERSION -lt $(version_code 2.12.51) ]] &&
2678 skip "requires LU-10143 fix on MDS"
2679 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs"
2681 local remote_dir=$DIR/$tdir/remote_dir
2683 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2684 #define OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2685 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2686 $LFS mkdir -i $MDTIDX $remote_dir &
2689 # sleep 3 seconds to make sure MDTs are failed after
2690 # lfs mkdir -i has finished on all of MDTs.
2695 fail mds${MDTIDX},mds$((MDTIDX + 1))
2697 wait $CLIENT_PID || error "remote creation failed"
2699 remote_dir_check_80 || error "remote dir check failed"
2700 rm -rf $DIR/$tdir || error "rmdir failed"
2704 run_test 80d "DNE: create remote dir, drop update rep from MDT1, fail 2 MDTs"
2707 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2708 ([ $FAILURE_MODE == "HARD" ] &&
2709 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2710 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2714 local remote_dir=$DIR/$tdir/remote_dir
2716 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2717 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2718 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2719 $LFS mkdir -i $MDTIDX $remote_dir &
2722 # sleep 3 seconds to make sure MDTs are failed after
2723 # lfs mkdir -i has finished on all of MDTs.
2729 wait $CLIENT_PID || error "remote creation failed"
2731 remote_dir_check_80 || error "remote dir check failed"
2732 rm -rf $DIR/$tdir || error "rmdir failed"
2736 run_test 80e "DNE: create remote dir, drop MDT1 rep, fail MDT0"
2739 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2740 ([ $FAILURE_MODE == "HARD" ] &&
2741 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2742 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2745 local remote_dir=$DIR/$tdir/remote_dir
2747 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2748 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2749 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2750 $LFS mkdir -i $MDTIDX $remote_dir &
2754 fail mds$((MDTIDX + 1))
2756 wait $CLIENT_PID || error "remote creation failed"
2758 remote_dir_check_80 || error "remote dir check failed"
2759 rm -rf $DIR/$tdir || error "rmdir failed"
2763 run_test 80f "DNE: create remote dir, drop MDT1 rep, fail MDT1"
2766 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2767 ([ $FAILURE_MODE == "HARD" ] &&
2768 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2769 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2773 local remote_dir=$DIR/$tdir/remote_dir
2775 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2776 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2777 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2778 $LFS mkdir -i $MDTIDX $remote_dir &
2781 # sleep 3 seconds to make sure MDTs are failed after
2782 # lfs mkdir -i has finished on all of MDTs.
2788 fail mds$((MDTIDX + 1))
2790 wait $CLIENT_PID || error "remote creation failed"
2792 remote_dir_check_80 || error "remote dir check failed"
2793 rm -rf $DIR/$tdir || error "rmdir failed"
2797 run_test 80g "DNE: create remote dir, drop MDT1 rep, fail MDT0, then MDT1"
2800 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2802 local remote_dir=$DIR/$tdir/remote_dir
2804 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2805 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2806 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2807 $LFS mkdir -i $MDTIDX $remote_dir &
2810 # sleep 3 seconds to make sure MDTs are failed after
2811 # lfs mkdir -i has finished on all of MDTs.
2816 fail mds${MDTIDX},mds$((MDTIDX + 1))
2818 wait $CLIENT_PID || error "remote dir creation failed"
2820 remote_dir_check_80 || error "remote dir check failed"
2821 rm -rf $DIR/$tdir || error "rmdir failed"
2825 run_test 80h "DNE: create remote dir, drop MDT1 rep, fail 2 MDTs"
2828 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2829 ([ $FAILURE_MODE == "HARD" ] &&
2830 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2831 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2835 local remote_dir=$DIR/$tdir/remote_dir
2837 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2838 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2840 touch $remote_dir || error "touch $remote_dir failed"
2841 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2842 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2847 fail mds$((MDTIDX + 1))
2849 wait $CLIENT_PID || error "rm remote dir failed"
2851 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2853 rm -rf $DIR/$tdir || error "rmdir failed"
2857 run_test 81a "DNE: unlink remote dir, drop MDT0 update rep, fail MDT1"
2860 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2861 ([ $FAILURE_MODE == "HARD" ] &&
2862 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2863 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2866 local remote_dir=$DIR/$tdir/remote_dir
2868 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2869 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2871 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2872 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2879 wait $CLIENT_PID || error "rm remote dir failed"
2881 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2883 rm -rf $DIR/$tdir || error "rmdir failed"
2887 run_test 81b "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0"
2890 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2891 ([ $FAILURE_MODE == "HARD" ] &&
2892 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2893 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2897 local remote_dir=$DIR/$tdir/remote_dir
2899 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2900 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2902 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2903 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2910 fail mds$((MDTIDX + 1))
2912 wait $CLIENT_PID || error "rm remote dir failed"
2914 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2916 rm -rf $DIR/$tdir || error "rmdir failed"
2920 run_test 81c "DNE: unlink remote dir, drop MDT0 update reply, fail MDT0,MDT1"
2923 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2925 local remote_dir=$DIR/$tdir/remote_dir
2927 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2928 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2930 # OBD_FAIL_OUT_UPDATE_NET_REP 0x1701
2931 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
2937 fail mds${MDTIDX},mds$((MDTIDX + 1))
2939 wait $CLIENT_PID || error "rm remote dir failed"
2941 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2943 rm -rf $DIR/$tdir || error "rmdir failed"
2947 run_test 81d "DNE: unlink remote dir, drop MDT0 update reply, fail 2 MDTs"
2950 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2951 ([ $FAILURE_MODE == "HARD" ] &&
2952 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2953 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2957 local remote_dir=$DIR/$tdir/remote_dir
2959 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2960 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2962 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2963 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
2966 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
2971 wait $CLIENT_PID || error "rm remote dir failed"
2973 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
2975 rm -rf $DIR/$tdir || error "rmdir failed"
2979 run_test 81e "DNE: unlink remote dir, drop MDT1 req reply, fail MDT0"
2982 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
2983 ([ $FAILURE_MODE == "HARD" ] &&
2984 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
2985 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
2989 local remote_dir=$DIR/$tdir/remote_dir
2991 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2992 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
2994 # OBD_FAIL_MDS_REINT_NET_REP 0x119
2995 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3000 fail mds$((MDTIDX + 1))
3002 wait $CLIENT_PID || error "rm remote dir failed"
3004 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3006 rm -rf $DIR/$tdir || error "rmdir failed"
3010 run_test 81f "DNE: unlink remote dir, drop MDT1 req reply, fail MDT1"
3013 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3014 ([ $FAILURE_MODE == "HARD" ] &&
3015 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
3016 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
3020 local remote_dir=$DIR/$tdir/remote_dir
3022 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3023 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3025 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3026 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3033 fail mds$((MDTIDX + 1))
3035 wait $CLIENT_PID || error "rm remote dir failed"
3037 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3039 rm -rf $DIR/$tdir || error "rmdir failed"
3043 run_test 81g "DNE: unlink remote dir, drop req reply, fail M0, then M1"
3046 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
3048 local remote_dir=$DIR/$tdir/remote_dir
3050 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3051 $LFS mkdir -i $MDTIDX $remote_dir || error "lfs mkdir failed"
3053 # OBD_FAIL_MDS_REINT_NET_REP 0x119
3054 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
3060 fail mds${MDTIDX},mds$((MDTIDX + 1))
3062 wait $CLIENT_PID || error "rm remote dir failed"
3064 stat $remote_dir &>/dev/null && error "$remote_dir still exist!"
3066 rm -rf $DIR/$tdir || error "rmdir failed"
3070 run_test 81h "DNE: unlink remote dir, drop request reply, fail 2 MDTs"
3073 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE 0x144
3074 do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000144"
3075 createmany -o $DIR/$tfile- 1 &
3079 client_up || client_up || true # reconnect
3081 run_test 84a "stale open during export disconnect"
3083 test_85a() { #bug 16774
3084 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3086 for i in $(seq 100); do
3087 echo "tag-$i" > $DIR/$tfile-$i
3088 grep -q "tag-$i" $DIR/$tfile-$i || error "f2-$i"
3091 lov_id=$(lctl dl | grep "clilov")
3092 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3093 count=$(lctl get_param -n \
3094 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3095 echo "before recovery: unused locks count = $count"
3099 count2=$(lctl get_param -n \
3100 ldlm.namespaces.*MDT0000*$addr.lock_unused_count)
3101 echo "after recovery: unused locks count = $count2"
3103 if [ $count2 -ge $count ]; then
3104 error "unused locks are not canceled"
3107 run_test 85a "check the cancellation of unused locks during recovery(IBITS)"
3109 test_85b() { #bug 16774
3113 lctl set_param -n ldlm.cancel_unused_locks_before_replay "1"
3115 $LFS setstripe -c 1 -i 0 $DIR/$tdir
3117 for i in $(seq 100); do
3118 dd if=/dev/urandom of=$DIR/$tdir/$tfile-$i bs=4096 \
3119 count=32 >/dev/null 2>&1
3122 cancel_lru_locks osc
3124 for i in $(seq 100); do
3125 dd if=$DIR/$tdir/$tfile-$i of=/dev/null bs=4096 \
3126 count=32 >/dev/null 2>&1
3129 lov_id=$(lctl dl | grep "clilov")
3130 addr=$(echo $lov_id | awk '{print $4}' | awk -F '-' '{print $NF}')
3131 count=$(lctl get_param -n \
3132 ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3133 echo "before recovery: unused locks count = $count"
3134 [ $count -ne 0 ] || error "unused locks ($count) should be zero"
3138 count2=$(lctl get_param \
3139 -n ldlm.namespaces.*OST0000*$addr.lock_unused_count)
3140 echo "after recovery: unused locks count = $count2"
3142 if [ $count2 -ge $count ]; then
3143 error "unused locks are not canceled"
3148 run_test 85b "check the cancellation of unused locks during recovery(EXTENT)"
3151 local clients=${CLIENTS:-$HOSTNAME}
3153 zconf_umount_clients $clients $MOUNT
3154 do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT*.exports.clear=0
3155 remount_facet $SINGLEMDS
3156 zconf_mount_clients $clients $MOUNT
3158 run_test 86 "umount server after clear nid_stats should not hit LBUG"
3161 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3164 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3165 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3166 error "dd to $DIR/$tfile failed"
3167 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3168 cancel_lru_locks osc
3170 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3171 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3172 if [ $cksum != $cksum2 ] ; then
3173 error "New checksum $cksum2 does not match original $cksum"
3176 run_test 87a "write replay"
3179 do_facet ost1 "lctl set_param -n obdfilter.${ost1_svc}.sync_journal 0"
3182 $LFS setstripe -i 0 -c 1 $DIR/$tfile
3183 dd if=/dev/urandom of=$DIR/$tfile bs=1024k count=8 ||
3184 error "dd to $DIR/$tfile failed"
3185 sleep 1 # Give it a chance to flush dirty data
3186 echo TESTTEST | dd of=$DIR/$tfile bs=1 count=8 seek=64
3187 cksum=$(md5sum $DIR/$tfile | awk '{print $1}')
3188 cancel_lru_locks osc
3190 dd if=$DIR/$tfile of=/dev/null bs=1024k count=8 || error "Cannot read"
3191 cksum2=$(md5sum $DIR/$tfile | awk '{print $1}')
3192 if [ $cksum != $cksum2 ] ; then
3193 error "New checksum $cksum2 does not match original $cksum"
3196 run_test 87b "write replay with changed data (checksum resend)"
3198 test_88() { #bug 17485
3199 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3200 mkdir -p $TMP/$tdir || error "mkdir $TMP/$tdir failed"
3202 $LFS setstripe -i 0 -c 1 $DIR/$tdir || error "$LFS setstripe failed"
3205 replay_barrier $SINGLEMDS
3207 # exhaust precreations on ost1
3208 local OST=$(ostname_from_index 0)
3209 local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $OST)
3210 local last_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3211 local next_id=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3212 echo "before test: last_id = $last_id, next_id = $next_id"
3214 echo "Creating to objid $last_id on ost $OST..."
3215 createmany -o $DIR/$tdir/f-%d $next_id $((last_id - next_id + 2)) ||
3216 error "createmany create files to last_id failed"
3218 #create some files to use some uncommitted objids
3219 last_id=$(($last_id + 1))
3220 createmany -o $DIR/$tdir/f-%d $last_id 8 ||
3221 error "createmany create files with uncommitted objids failed"
3223 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3224 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3225 echo "before recovery: last_id = $last_id2, next_id = $next_id2"
3227 # if test uses shutdown_facet && reboot_facet instead of facet_failover ()
3228 # it has to take care about the affected facets, bug20407
3229 local affected_mds1=$(affected_facets mds1)
3230 local affected_ost1=$(affected_facets ost1)
3232 shutdown_facet $SINGLEMDS
3235 reboot_facet $SINGLEMDS
3236 change_active $affected_mds1
3237 wait_for_facet $affected_mds1
3238 mount_facets $affected_mds1 || error "Restart of mds failed"
3241 change_active $affected_ost1
3242 wait_for_facet $affected_ost1
3243 mount_facets $affected_ost1 || error "Restart of ost1 failed"
3247 last_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_last_id)
3248 next_id2=$(do_facet $SINGLEMDS lctl get_param -n osp.$mdtosc.prealloc_next_id)
3249 echo "after recovery: last_id = $last_id2, next_id = $next_id2"
3251 # create new files, which should use new objids, and ensure the orphan
3252 # cleanup phase for ost1 is completed at the same time
3253 for i in $(seq 8); do
3254 file_id=$(($last_id + 10 + $i))
3255 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3258 # if the objids were not recreated, then "ls" will fail with -ENOENT
3259 ls -l $DIR/$tdir/* || error "can't get the status of precreated files"
3262 # write into previously created files
3263 for i in $(seq 8); do
3264 file_id=$(($last_id + $i))
3265 dd if=/dev/urandom of=$DIR/$tdir/f-$file_id bs=4096 count=128
3266 cp -f $DIR/$tdir/f-$file_id $TMP/$tdir/
3269 # compare the content
3270 for i in $(seq 8); do
3271 file_id=$(($last_id + $i))
3272 cmp $TMP/$tdir/f-$file_id $DIR/$tdir/f-$file_id ||
3273 error "the content of file is modified!"
3278 run_test 88 "MDS should not assign same objid to different files "
3280 function calc_osc_kbytes_used() {
3281 local kbtotal=$(calc_osc_kbytes kbytestotal)
3282 local kbfree=$(calc_osc_kbytes kbytesfree)
3283 echo $((kbtotal-kbfree))
3287 cancel_lru_locks osc
3288 mkdir $DIR/$tdir || error "mkdir $DIR/$tdir failed"
3289 rm -f $DIR/$tdir/$tfile
3290 wait_mds_ost_sync || error "initial MDS-OST sync timed out"
3291 wait_delete_completed || error "initial wait delete timed out"
3292 local blocks1=$(calc_osc_kbytes_used)
3293 local write_size=$(fs_log_size)
3295 $LFS setstripe -i 0 -c 1 $DIR/$tdir/$tfile
3296 [ $write_size -lt 1024 ] && write_size=1024
3297 dd if=/dev/zero bs=${write_size}k count=10 of=$DIR/$tdir/$tfile
3300 facet_failover $SINGLEMDS
3301 rm $DIR/$tdir/$tfile
3304 zconf_mount $(hostname) $MOUNT || error "mount fails"
3305 client_up || error "client_up failed"
3307 # wait for the remounted client to connect to ost1
3308 local target=$(get_osc_import_name client ost1)
3309 wait_import_state "FULL" "osc.${target}.ost_server_uuid" \
3310 $(max_recovery_time)
3312 wait_mds_ost_sync || error "MDS-OST sync timed out"
3313 wait_delete_completed || error "wait delete timed out"
3314 local blocks2=$(calc_osc_kbytes_used)
3316 [ $((blocks2 - blocks1)) -le $(fs_log_size) ] ||
3317 error $((blocks2 - blocks1)) blocks leaked
3319 run_test 89 "no disk space leak on late ost connection"