5 # bug number: 10124 LU-8333
6 ALWAYS_EXCEPT="15c 21b $REPLAY_DUAL_EXCEPT"
9 PTLDEBUG=${PTLDEBUG:--1}
10 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
12 CLEANUP=${CLEANUP:-""}
13 MOUNT_2=${MOUNT_2:-"yes"}
14 export MULTIOP=${MULTIOP:-multiop}
15 . $LUSTRE/tests/test-framework.sh
18 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
21 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0
24 [ "$SLOW" = "no" ] && EXCEPT_SLOW="21b"
26 [[ $(facet_fstype $SINGLEMDS) == zfs ]] &&
27 # bug number for skipped test: LU-2230
28 ALWAYS_EXCEPT="$ALWAYS_EXCEPT 21b"
32 check_and_setup_lustre
33 MOUNTED=$(mounted_lustre_filesystems)
34 if ! $(echo $MOUNTED' ' | grep -w -q $MOUNT2' '); then
35 zconf_mount $HOSTNAME $MOUNT2
40 rm -rf $DIR/[df][0-9]*
42 [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
44 # if there is no CLIENT1 defined, some tests can be ran on localhost
45 CLIENT1=${CLIENT1:-$HOSTNAME}
46 # if CLIENT2 doesn't exist then use CLIENT1 instead
47 # All tests should use CLIENT2 with MOUNT2 only therefore it will work if
49 # Exception is the test which need two separate nodes
50 CLIENT2=${CLIENT2:-$CLIENT1}
52 # LU-482 Avert LVM and VM inability to flush caches in pre .33 kernels
53 if [ $LINUX_VERSION_CODE -lt $(version_code 2.6.33) ]; then
55 do_facet $SINGLEMDS "sync; sleep 10; sync; sleep 10; sync"
58 LU482_FAILED=$(mktemp -u $TMP/$TESTSUITE.lu482.XXXXXX)
60 echo "Check file is LU482_FAILED=$LU482_FAILED"
61 touch $MOUNT2/$tfile-A # force sync FLD/SEQ update before barrier
62 replay_barrier $SINGLEMDS
63 #define OBD_FAIL_PTLRPC_FINISH_REPLAY | OBD_FAIL_ONCE
65 createmany -o $MOUNT1/$tfile- 50
66 $LCTL set_param fail_loc=0x80000514
67 facet_failover $SINGLEMDS
68 [ -f "$LU482_FAILED" ] && skip "LU-482 failure" && return 0
72 zconf_mount `hostname` $MOUNT2 || error "mount2 fais"
73 unlinkmany $MOUNT1/$tfile- 50 || return 2
74 rm $MOUNT2/$tfile || return 3
75 rm $MOUNT2/$tfile-A || return 4
77 run_test 0a "expired recovery with lost client"
79 if [ -f "$LU482_FAILED" ]; then
80 log "Found check file $LU482_FAILED, aborting test script"
81 rm -vf "$LU482_FAILED"
83 do_nodes $CLIENTS umount -f $MOUNT2 || true
84 do_nodes $CLIENTS umount -f $MOUNT || true
85 # copied from stopall, but avoid the MDS recovery
86 for num in `seq $OSTCOUNT`; do
88 rm -f $TMP/ost${num}active
90 if ! combined_mgs_mds ; then
98 replay_barrier $SINGLEMDS
100 touch $MOUNT1/$tfile-2
102 facet_failover $SINGLEMDS
104 zconf_mount `hostname` $MOUNT1 || error "mount1 fais"
105 zconf_mount `hostname` $MOUNT2 || error "mount2 fais"
106 # it is uncertain if file-2 exists or not, remove it if it does
107 checkstat $MOUNT1/$tfile-2 && rm $MOUNT1/$tfile-2
108 checkstat $MOUNT2/$tfile && return 2
111 run_test 0b "lost client during waiting for next transno"
115 replay_barrier $SINGLEMDS
119 checkstat $MOUNT2/a || return 1
120 checkstat $MOUNT1/b || return 2
121 rm $MOUNT2/a $MOUNT1/b
122 checkstat $MOUNT1/a && return 3
123 checkstat $MOUNT2/b && return 4
127 run_test 1 "|X| simple create"
131 replay_barrier $SINGLEMDS
135 checkstat $MOUNT2/adir || return 1
137 checkstat $MOUNT2/adir && return 2
140 run_test 2 "|X| mkdir adir"
143 replay_barrier $SINGLEMDS
145 mkdir $MOUNT2/adir/bdir
148 checkstat $MOUNT2/adir || return 1
149 checkstat $MOUNT1/adir/bdir || return 2
150 rmdir $MOUNT2/adir/bdir $MOUNT1/adir
151 checkstat $MOUNT1/adir && return 3
152 checkstat $MOUNT2/adir/bdir && return 4
155 run_test 3 "|X| mkdir adir, mkdir adir/bdir "
159 replay_barrier $SINGLEMDS
160 mkdir $MOUNT1/adir && return 1
161 mkdir $MOUNT2/adir/bdir
164 checkstat $MOUNT2/adir || return 2
165 checkstat $MOUNT1/adir/bdir || return 3
167 rmdir $MOUNT2/adir/bdir $MOUNT1/adir
168 checkstat $MOUNT1/adir && return 4
169 checkstat $MOUNT2/adir/bdir && return 5
172 run_test 4 "|X| mkdir adir (-EEXIST), mkdir adir/bdir "
176 # multiclient version of replay_single.sh/test_8
178 multiop_bg_pause $MOUNT2/a o_tSc || return 1
181 replay_barrier $SINGLEMDS
183 wait $pid || return 1
186 [ -e $MOUNT2/a ] && return 2
189 run_test 5 "open, unlink |X| close"
194 multiop_bg_pause $MOUNT2/a o_c || return 1
196 multiop_bg_pause $MOUNT1/a o_c || return 1
199 replay_barrier $SINGLEMDS
201 wait $pid1 || return 1
205 wait $pid2 || return 1
206 [ -e $MOUNT2/a ] && return 2
209 run_test 6 "open1, open2, unlink |X| close1 [fail $SINGLEMDS] close2"
212 replay_barrier $SINGLEMDS
213 drop_reint_reply "mcreate $MOUNT1/$tfile" || return 1
215 checkstat $MOUNT2/$tfile || return 2
216 rm $MOUNT1/$tfile || return 3
220 run_test 8 "replay of resent request"
223 replay_barrier $SINGLEMDS
224 mcreate $MOUNT1/$tfile-1
225 mcreate $MOUNT2/$tfile-2
226 # drop first reint reply
227 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000119
229 do_facet $SINGLEMDS lctl set_param fail_loc=0
231 rm $MOUNT1/$tfile-[1,2] || return 1
235 run_test 9 "resending a replayed create"
238 mcreate $MOUNT1/$tfile-1
239 replay_barrier $SINGLEMDS
240 munlink $MOUNT1/$tfile-1
241 mcreate $MOUNT2/$tfile-2
242 # drop first reint reply
243 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000119
245 do_facet $SINGLEMDS lctl set_param fail_loc=0
247 checkstat $MOUNT1/$tfile-1 && return 1
248 checkstat $MOUNT1/$tfile-2 || return 2
253 run_test 10 "resending a replayed unlink"
256 replay_barrier $SINGLEMDS
257 mcreate $DIR1/$tfile-1
258 mcreate $DIR2/$tfile-2
259 mcreate $DIR1/$tfile-3
260 mcreate $DIR2/$tfile-4
261 mcreate $DIR1/$tfile-5
262 # drop all reint replies for a while
263 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x0119
264 # note that with this fail_loc set, facet_failover df will fail
265 facet_failover $SINGLEMDS
267 local clients=${CLIENTS:-$HOSTNAME}
268 wait_clients_import_state "$clients" $SINGLEMDS FULL
270 do_facet $SINGLEMDS $LCTL set_param fail_loc=0
272 rm $DIR1/$tfile-[1-5] || return 1
276 run_test 11 "both clients timeout during replay"
279 replay_barrier $SINGLEMDS
281 multiop_bg_pause $DIR/$tfile mo_c || return 1
284 #define OBD_FAIL_LDLM_ENQUEUE_NET 0x302
285 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000302
286 facet_failover $SINGLEMDS
287 do_facet $SINGLEMDS lctl set_param fail_loc=0
288 clients_up || return 1
291 kill -USR1 $MULTIPID || return 3
292 wait $MULTIPID || return 4
293 $CHECKSTAT -t file $DIR/$tfile || return 2
298 run_test 12 "open resend timeout"
301 multiop_bg_pause $DIR/$tfile mo_c || return 1
304 replay_barrier $SINGLEMDS
306 kill -USR1 $MULTIPID || return 3
307 wait $MULTIPID || return 4
310 do_facet $SINGLEMDS lctl set_param fail_loc=0x80000115
311 facet_failover $SINGLEMDS
312 do_facet $SINGLEMDS lctl set_param fail_loc=0
313 clients_up || return 1
316 $CHECKSTAT -t file $DIR/$tfile || return 2
321 run_test 13 "close resend timeout"
323 # test 14a removed after 18143 because it shouldn't fail anymore and do the same
328 wait_delete_completed
330 local beforeused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
332 mkdir -p $MOUNT1/$tdir
333 $SETSTRIPE -i 0 $MOUNT1/$tdir
334 replay_barrier $SINGLEMDS
335 createmany -o $MOUNT1/$tdir/$tfile- 5
337 $SETSTRIPE -i 0 $MOUNT2/$tfile-2
338 dd if=/dev/zero of=$MOUNT2/$tfile-2 bs=1M count=5
339 createmany -o $MOUNT1/$tdir/$tfile-3- 5
343 wait_recovery_complete $SINGLEMDS || error "MDS recovery not done"
345 # first set of files should have been replayed
346 unlinkmany $MOUNT1/$tdir/$tfile- 5 || error "first unlinks failed"
347 unlinkmany $MOUNT1/$tdir/$tfile-3- 5 || error "second unlinks failed"
349 zconf_mount $HOSTNAME $MOUNT2 || error "mount $MOUNT2 failed"
350 [ -f $MOUNT2/$tfile-2 ] && error "$MOUNT2/$tfile-2 exists!"
352 wait_mds_ost_sync || error "wait_mds_ost_sync failed"
353 wait_delete_completed || error "wait_delete_complete failed"
355 local afterused=$(df -P $DIR | tail -1 | awk '{ print $3 }')
356 log "before $beforeused, after $afterused"
357 # leave some margin for some files/dirs to be modified (OI, llog, etc)
358 [ $afterused -le $((beforeused + $(fs_log_size))) ] ||
359 error "after $afterused > before $beforeused"
361 run_test 14b "delete ost orphans if gap occured in objids due to VBR"
363 test_15a() { # was test_15
364 replay_barrier $SINGLEMDS
365 createmany -o $MOUNT1/$tfile- 25
366 createmany -o $MOUNT2/$tfile-2- 1
371 unlinkmany $MOUNT1/$tfile- 25 || return 2
372 [ -e $MOUNT1/$tfile-2-0 ] && error "$tfile-2-0 exists"
374 zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
377 run_test 15a "timeout waiting for lost client during replay, 1 client completes"
380 replay_barrier $SINGLEMDS
381 for ((i = 0; i < 2000; i++)); do
382 echo "data" > "$MOUNT2/${tfile}-$i" || error "create ${tfile}-$i failed"
388 zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
391 run_test 15c "remove multiple OST orphans"
394 replay_barrier $SINGLEMDS
395 createmany -o $MOUNT1/$tfile- 25
396 createmany -o $MOUNT2/$tfile-2- 1
399 facet_failover $SINGLEMDS
403 unlinkmany $MOUNT1/$tfile- 25 || return 2
405 zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
409 run_test 16 "fail MDS during recovery (3571)"
412 remote_ost_nodsh && skip "remote OST with nodsh" && return 0
414 createmany -o $MOUNT1/$tfile- 25
415 createmany -o $MOUNT2/$tfile-2- 1
417 # Make sure the disconnect is lost
425 unlinkmany $MOUNT1/$tfile- 25 || return 2
427 zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
431 run_test 17 "fail OST during recovery (3571)"
433 # cleanup with blocked enqueue fails until timer elapses (MDS busy), wait for it
436 test_18() { # bug 3822 - evicting client with enqueued lock
438 local DLMTRACE=$(do_facet $SINGLEMDS lctl get_param debug)
439 do_facet $SINGLEMDS lctl set_param debug=+dlmtrace
440 mkdir -p $MOUNT1/$tdir || error "mkdir $MOUNT1/$tdir failed"
441 touch $MOUNT1/$tdir/${tfile}0 || error "touch file failed"
442 statmany -s $MOUNT1/$tdir/$tfile 1 500 &
445 #define OBD_FAIL_LDLM_ENQUEUE_BLOCKED 0x30b
446 do_facet $SINGLEMDS lctl set_param fail_loc=0x8000030b # hold enqueue
448 #define OBD_FAIL_LDLM_BL_CALLBACK_NET 0x305
449 do_facet client lctl set_param ldlm.namespaces.*.early_lock_cancel=0
450 do_facet client lctl set_param fail_loc=0x80000305 # drop cb, evict
452 usleep 500 # wait to ensure first client is one that will be evicted
453 openfile -f O_RDONLY $MOUNT2/$tdir/$tfile
455 do_facet client lctl set_param ldlm.namespaces.*.early_lock_cancel=1
456 do_facet $SINGLEMDS lctl debug_kernel |
457 grep "not entering recovery" && error "client not evicted"
458 do_facet client "lctl set_param fail_loc=0"
459 do_facet $SINGLEMDS "lctl set_param fail_loc=0"
461 run_test 18 "ldlm_handle_enqueue succeeds on evicted export (3822)"
463 test_19() { # Bug 10991 - resend of open request does not fail assertion.
464 replay_barrier $SINGLEMDS
465 drop_ldlm_reply "createmany -o $DIR/$tfile 1" || return 1
467 checkstat $DIR2/${tfile}0 || return 2
468 rm $DIR/${tfile}0 || return 3
472 run_test 19 "resend of open request"
475 local before=$SECONDS
476 replay_barrier $SINGLEMDS
482 zconf_mount $HOSTNAME $DIR2 || error "mount $DIR2 fail"
483 local tier1=$((SECONDS - before))
486 replay_barrier $SINGLEMDS
492 zconf_mount $HOSTNAME $DIR2 || error "mount $DIR2 fail"
493 local tier2=$((SECONDS - before))
495 # timeout is more than 1.5x original timeout
496 ((tier2 < tier1 * 6 / 4)) ||
497 error "recovery time $tier2 >= 1.5x original time $tier1"
499 run_test 20 "recovery time is not increasing"
501 # commit on sharing tests
503 local param_file=$TMP/$tfile-params
505 save_lustre_params $SINGLEMDS "mdt.*.commit_on_sharing" > $param_file
506 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=1
507 touch $MOUNT1/$tfile-1
508 mv $MOUNT2/$tfile-1 $MOUNT2/$tfile-2
509 mv $MOUNT1/$tfile-2 $MOUNT1/$tfile-3
510 replay_barrier_nosync $SINGLEMDS
513 facet_failover $SINGLEMDS
515 # all renames are replayed
516 unlink $MOUNT1/$tfile-3 || return 2
518 zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail"
520 do_facet $SINGLEMDS lctl set_param mdt.*.commit_on_sharing=0
521 rm -rf $MOUNT1/$tfile-*
522 restore_lustre_params < $param_file
526 run_test 21a "commit on sharing"
530 do_node $CLIENT1 rm -f $MOUNT1/$tfile-*
533 do_node $CLIENT1 touch $MOUNT1/$tfile-1
534 do_node $CLIENT2 mv $MOUNT1/$tfile-1 $MOUNT1/$tfile-2
535 do_node $CLIENT1 mv $MOUNT1/$tfile-2 $MOUNT1/$tfile-3
537 replay_barrier_nosync $mds
538 shutdown_client $CLIENT2 $MOUNT1
542 # were renames replayed?
544 echo UNLINK $MOUNT1/$tfile-3
545 do_node $CLIENT1 unlink $MOUNT1/$tfile-3 ||
546 { echo "unlink $tfile-3 fail!" && rc=1; }
549 zconf_mount_clients $CLIENT2 $MOUNT1 ||
550 error "mount $CLIENT2 $MOUNT1 fail"
556 [ -z "$CLIENTS" ] && skip "Need two or more clients" && return
557 [ $CLIENTCOUNT -lt 2 ] &&
558 { skip "Need 2+ clients, have $CLIENTCOUNT" && return; }
560 if [ "$FAILURE_MODE" = "HARD" ] && mixed_mdt_devs; then
561 skip "Several MDTs on one MDS with FAILURE_MODE=$FAILURE_MODE"
565 zconf_umount_clients $CLIENTS $MOUNT2
566 zconf_mount_clients $CLIENTS $MOUNT1
568 local param_file=$TMP/$tfile-params
570 local mdtidx=$($LFS getstripe -M $MOUNT1)
571 local facet=mds$((mdtidx + 1))
573 save_lustre_params $facet "mdt.*.commit_on_sharing" > $param_file
577 do_facet $facet lctl set_param mdt.*.commit_on_sharing=$COS
579 test_21b_sub $facet || error "Not all renames are replayed. COS=$COS"
581 # there is still a window when transactions may be written to disk
582 # before the mds device is set R/O. To avoid such a rare test failure,
583 # the check is repeated several times.
587 # COS disabled (should fail)
588 do_facet $facet lctl set_param mdt.*.commit_on_sharing=$COS
590 test_21b_sub $facet || break
591 n_attempts=$((n_attempts + 1))
592 [ $n_attempts -gt 3 ] &&
593 error "can't check if COS works: rename replied w/o COS"
595 zconf_mount_clients $CLIENTS $MOUNT2
596 restore_lustre_params < $param_file
600 run_test 21b "commit on sharing, two clients"
603 checkstat $MOUNT1/$remote_dir || return 1
604 checkstat $MOUNT1/$remote_dir/dir || return 2
605 checkstat $MOUNT1/$remote_dir/$tfile-1 || return 3
606 checkstat $MOUNT1/$remote_dir/dir/$tfile-1 || return 4
610 create_remote_dir_files_22() {
611 do_node $CLIENT2 mkdir ${MOUNT2}/$remote_dir/dir || return 1
612 do_node $CLIENT1 createmany -o $MOUNT1/$remote_dir/dir/$tfile- 2 ||
614 do_node $CLIENT2 createmany -o $MOUNT2/$remote_dir/$tfile- 2 ||
620 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
621 ([ $FAILURE_MODE == "HARD" ] &&
622 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
623 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
627 local remote_dir=${tdir}/remote_dir
629 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
631 # OBD_FAIL_MDS_REINT_NET_REP 0x119
632 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
633 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir &
636 fail mds$((MDTIDX + 1))
637 wait $CLIENT_PID || error "lfs mkdir failed"
639 replay_barrier mds$MDTIDX
640 create_remote_dir_files_22 || error "Remote creation failed $?"
643 checkstat_22 || error "check stat failed $?"
645 rm -rf $MOUNT1/$tdir || error "rmdir remote_dir failed"
648 run_test 22a "c1 lfs mkdir -i 1 dir1, M1 drop reply & fail, c2 mkdir dir1/dir"
651 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
653 local remote_dir=$tdir/remote_dir
655 # OBD_FAIL_MDS_REINT_NET_REP 0x119
656 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
658 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
659 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir &
662 fail mds${MDTIDX},mds$((MDTIDX + 1))
663 wait $CLIENT_PID || error "lfs mkdir failed"
665 replay_barrier mds$MDTIDX
666 create_remote_dir_files_22 || error "Remote creation failed $?"
669 checkstat_22 || error "check stat failed $?"
671 rm -rf $MOUNT1/$tdir || error "rmdir remote_dir failed"
674 run_test 22b "c1 lfs mkdir -i 1 d1, M1 drop reply & fail M0/M1, c2 mkdir d1/dir"
677 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
678 ([ $FAILURE_MODE == "HARD" ] &&
679 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
680 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
683 local remote_dir=${tdir}/remote_dir
685 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
687 # OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
688 do_facet mds$MDTIDX lctl set_param fail_loc=0x1701
689 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir &
691 do_facet mds$MDTIDX lctl set_param fail_loc=0
694 wait $CLIENT_PID || error "lfs mkdir failed"
696 replay_barrier mds$MDTIDX
697 create_remote_dir_files_22 || error "Remote creation failed $?"
700 checkstat_22 || error "check stat failed $?"
702 rm -rf $MOUNT1/$tdir || error "rmdir remote_dir failed"
705 run_test 22c "c1 lfs mkdir -i 1 d1, M1 drop update & fail M1, c2 mkdir d1/dir"
708 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
710 local remote_dir=${tdir}/remote_dir
712 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
714 # OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
715 do_facet mds$MDTIDX lctl set_param fail_loc=0x1701
716 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir &
718 do_facet mds$MDTIDX lctl set_param fail_loc=0
720 fail mds${MDTIDX},mds$((MDTIDX + 1))
721 wait $CLIENT_PID || error "lfs mkdir failed"
723 replay_barrier mds$MDTIDX
724 create_remote_dir_files_22 || error "Remote creation failed $?"
727 checkstat_22 || error "check stat failed $?"
729 rm -rf $MOUNT1/$tdir || error "rmdir remote_dir failed"
732 run_test 22d "c1 lfs mkdir -i 1 d1, M1 drop update & fail M0/M1,c2 mkdir d1/dir"
735 checkstat $MOUNT1/$remote_dir || return 1
736 checkstat $MOUNT1/$remote_dir/$tfile-1 || return 2
740 create_remote_dir_files_23() {
741 do_node $CLIENT2 mkdir ${MOUNT2}/$remote_dir || return 1
742 do_node $CLIENT2 createmany -o $MOUNT2/$remote_dir/$tfile- 2 || return 2
747 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
748 ([ $FAILURE_MODE == "HARD" ] &&
749 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
750 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
753 local remote_dir=$tdir/remote_dir
755 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
756 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir ||
757 error "lfs mkdir failed"
758 # OBD_FAIL_MDS_REINT_NET_REP 0x119
759 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
760 do_node $CLIENT1 rmdir $MOUNT1/$remote_dir &
762 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
764 fail mds$((MDTIDX + 1))
765 wait $CLIENT_PID || error "rmdir remote dir failed"
767 replay_barrier mds${MDTIDX}
768 create_remote_dir_files_23 || error "Remote creation failed $?"
771 checkstat_23 || error "check stat failed $?"
773 rm -rf $MOUNT1/$tdir || error "rmdir remote_dir failed"
776 run_test 23a "c1 rmdir d1, M1 drop reply and fail, client2 mkdir d1"
779 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
781 local remote_dir=$tdir/remote_dir
783 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
784 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir ||
785 error "lfs mkdir failed"
787 # OBD_FAIL_MDS_REINT_NET_REP 0x119
788 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0x119
789 do_node $CLIENT1 rmdir $MOUNT1/$remote_dir &
791 do_facet mds$((MDTIDX + 1)) lctl set_param fail_loc=0
793 fail mds${MDTIDX},mds$((MDTIDX + 1))
794 wait $CLIENT_PID || error "rmdir remote dir failed"
796 replay_barrier mds${MDTIDX}
797 create_remote_dir_files_23 || error "Remote creation failed $?"
800 checkstat_23 || error "check stat failed $?"
802 rm -rf $MOUNT1/$tdir || error "rmdir remote_dir failed"
805 run_test 23b "c1 rmdir d1, M1 drop reply and fail M0/M1, c2 mkdir d1"
808 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
810 ([ $FAILURE_MODE == "HARD" ] &&
811 [ "$(facet_host mds1)" == "$(facet_host mds2)" ]) &&
812 skip "MDTs needs to be on diff hosts for HARD fail mode" &&
815 local remote_dir=$tdir/remote_dir
817 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
818 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir ||
819 error "lfs mkdir failed"
821 # OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701
822 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
823 do_node $CLIENT1 rmdir $MOUNT1/$remote_dir &
825 do_facet mds${MDTIDX} lctl set_param fail_loc=0
828 wait $CLIENT_PID || error "rmdir remote dir failed"
830 replay_barrier mds${MDTIDX}
831 create_remote_dir_files_23 || error "Remote creation failed $?"
834 checkstat_23 || error "check stat failed $?"
836 rm -rf $MOUNT1/$tdir || return 6
839 run_test 23c "c1 rmdir d1, M0 drop update reply and fail M0, c2 mkdir d1"
842 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return 0
844 local remote_dir=$tdir/remote_dir
846 do_node $CLIENT1 mkdir -p $MOUNT1/${tdir}
847 do_node $CLIENT1 $LFS mkdir -i $MDTIDX $MOUNT1/$remote_dir ||
848 error "lfs mkdir failed"
850 # OBD_FAIL_UPDATE_OBJ_NET 0x1701
851 do_facet mds${MDTIDX} lctl set_param fail_loc=0x1701
852 do_node $CLIENT1 rmdir $MOUNT1/$remote_dir &
854 do_facet mds${MDTIDX} lctl set_param fail_loc=0
856 fail mds${MDTIDX},mds$((MDTIDX + 1))
857 wait $CLIENT_PID || error "rmdir remote dir failed"
859 replay_barrier mds${MDTIDX}
860 create_remote_dir_files_23 || error "Remote creation failed $?"
863 checkstat_23 || error "check stat failed $?"
865 rm -rf $MOUNT1/$tdir || return 6
868 run_test 23d "c1 rmdir d1, M0 drop update reply and fail M0/M1, c2 mkdir d1"
871 [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.5.2) ]] ||
872 { skip "Need MDS version newer than 2.5.2"; return 0; }
875 stat $MOUNT/$tfile >&/dev/null
876 # OBD_FAIL_MDS_REINT_NET_REP
877 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x119
878 $TRUNCATE $MOUNT/$tfile 100 &
881 do_facet $SINGLEMDS lctl set_param fail_loc=0
882 # sync to release rep-ack lock quickly
883 do_nodes $(comma_list $(mdts_nodes)) \
884 "lctl set_param -n osd*.*MDT*.force_sync 1"
888 run_test 24 "reconstruct on non-existing object"
890 # end commit on sharing tests
895 $SETSTRIPE -i 0 -c 1 $DIR/$tfile
897 # get lock for the 1st client
898 dd if=/dev/zero of=$DIR/$tfile count=1 >/dev/null ||
899 error "failed to write data"
901 # get waiting locks for the 2nd client
902 drop_ldlm_cancel "multiop $DIR2/$tfile Ow512" &
905 # failover, replay and resend replayed waiting locks
906 if [ $(lustre_version_code ost1) -ge $(version_code 2.6.90) ]; then
907 #define OBD_FAIL_LDLM_SRV_CP_AST 0x325
908 do_facet ost1 lctl set_param fail_loc=0x80000325
910 #define OBD_FAIL_OST_LDLM_REPLY_NET 0x213
911 do_facet ost1 lctl set_param fail_loc=0x80000213
916 # multiop does not finish because CP AST is skipped;
917 # it is ok to kill it in the test, because CP AST is already re-sent
918 # and it does not hung forever in real life
922 run_test 25 "replay|resend"
927 kill -9 $dbench_26_pid
932 local clients=${CLIENTS:-$HOSTNAME}
934 zconf_mount_clients $clients $MOUNT
937 [ "$SLOW" = "no" ] && duration=200
938 # set duration to 900 because it takes some time to boot node
939 [ "$FAILURE_MODE" = HARD ] && duration=900
941 local start_ts=$SECONDS
946 local tar_dir=$DIR/$tdir/run_tar
948 test_mkdir -p -c$MDSCOUNT $tar_dir || break
949 if [ $MDSCOUNT -ge 2 ]; then
950 $LFS setdirstripe -D -c$MDSCOUNT $tar_dir ||
951 error "set default dirstripe failed"
954 tar cf - /etc | tar xf - || error "tar failed"
955 cd $DIR/$tdir || break
956 rm -rf $tar_dir || break
960 echo "Started tar $tar_26_pid"
963 local dbench_dir=$DIR2/$tdir/run_dbench
965 test_mkdir -p -c$MDSCOUNT $dbench_dir || break
966 if [ $MDSCOUNT -ge 2 ]; then
967 $LFS setdirstripe -D -c$MDSCOUNT $dbench_dir ||
968 error "set default dirstripe failed"
970 cd $dbench_dir || break
971 rundbench 1 -D $dbench_dir -t 100 &>/dev/null || break
972 cd $DIR/$tdir || break
973 rm -rf $dbench_dir || break
977 echo "Started dbench $dbench_26_pid"
979 local num_failovers=0
981 while [ $((SECONDS - start_ts)) -lt $duration ]; do
982 kill -0 $tar_26_pid || error "tar $tar_26_pid missing"
983 kill -0 $dbench_26_pid || error "dbench $dbench_26_pid missing"
985 replay_barrier mds$fail_index
986 sleep 2 # give clients a time to do operations
987 # Increment the number of failovers
988 num_failovers=$((num_failovers + 1))
989 log "$TESTNAME fail mds$fail_index $num_failovers times"
991 if [ $fail_index -ge $MDSCOUNT ]; then
994 fail_index=$((fail_index + 1))
997 # stop the client loads
998 kill -0 $tar_26_pid || error "tar $tar_26_pid stopped"
999 kill -0 $dbench_26_pid || error "dbench $dbench_26_pid stopped"
1002 run_test 26 "dbench and tar with mds failover"
1005 $SETSTRIPE -i 0 -c 1 $DIR2/$tfile
1006 dd if=/dev/zero of=$DIR2/$tfile bs=4096 count=1
1008 #define OBD_FAIL_LDLM_SRV_BL_AST 0x324
1009 do_facet ost1 $LCTL set_param fail_loc=0x80000324
1011 dd if=/dev/zero of=$DIR/$tfile bs=4096 count=1 &
1015 #define OBD_FAIL_LDLM_GRANT_CHECK 0x32a
1016 do_facet ost1 $LCTL set_param fail_loc=0x32a
1021 cancel_lru_locks OST0000-osc
1022 wait $pid || error "dd failed"
1024 run_test 28 "lock replay should be ordered: waiting after granted"
1027 SLEEP=$((SECONDS - $NOW))
1028 [ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP
1029 [ "$MOUNTED2" = yes ] && zconf_umount $HOSTNAME $MOUNT2 || true
1030 check_and_cleanup_lustre