3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
11 LUSTRE=${LUSTRE:-$(dirname $0)/..}
12 . $LUSTRE/tests/test-framework.sh
16 ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT "
17 # Bug number for skipped test: LU-11381
19 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
23 [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] ||
24 { skip "Need MDS version at least 2.10.56"; exit 0; }
26 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] &&
27 error "\$RUNAS_ID set to 0, but \$UID is also 0!"
28 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
30 check_and_setup_lustre
35 rm -rf $DIR/[Rdfs][0-9]*
37 # global array to store mirror IDs
38 declare -a mirror_array
45 for id in $($LFS getstripe $tf | awk '/lcme_id/{print $2}'); do
46 array[${#array[@]}]=$((id >> 16))
49 mirror_array=($(printf "%s\n" "${array[@]}" | sort -u))
51 echo ${#mirror_array[@]}
55 echo 3 > /proc/sys/vm/drop_caches
66 wait_osc_import_state client ost$idx "\(DISCONN\|IDLE\)"
74 start ost$idx $(ostdevname $idx) $OST_MOUNT_OPTS ||
75 error "start ost$idx failed"
79 wait_recovery_complete ost$idx
84 # Verify mirror count with an expected value for a given file.
86 verify_mirror_count() {
89 local mirror_count=$($LFS getstripe -N $tf)
91 [[ $mirror_count = $expected ]] || {
93 error "verify mirror count failed on $tf:" \
94 "$mirror_count != $expected"
99 # Verify component count with an expected value for a given file.
100 # $1 coposited layout file
101 # $2 expected component number
103 verify_comp_count() {
106 local comp_count=$($LFS getstripe --component-count $tf)
108 [[ $comp_count = $expected ]] || {
109 $LFS getstripe -v $tf
110 error "verify component count failed on $tf:" \
111 "$comp_count != $expected"
116 # Verify component attribute with an expected value for a given file
124 local cmd="$LFS getstripe -I$comp_id"
125 local getstripe_cmd="$cmd -v"
129 stripe-size) cmd+=" -S $tf" ;;
130 stripe-count) cmd+=" -c $tf" ;;
131 stripe-index) cmd+=" -i $tf" ;;
132 pool) cmd+=" -p $tf" ;;
133 comp-start) cmd+=" --component-start $tf" ;;
134 comp-end) cmd+=" --component-end $tf" ;;
135 lcme_flags) cmd+=" $tf | awk '/lcme_flags:/ { print \$2 }'" ;;
136 *) error "invalid attribute $attr";;
141 [ $attr = lcme_flags ] && {
143 local expected_list=$(comma_list $expected)
144 for fl in ${expected_list//,/ }; do
147 [[ ${fl:0:1} = "^" ]] && neg=1
148 [[ $neg = 1 ]] && fl=${fl:1}
150 $(echo $value | grep -q $fl)
152 # 0: matched; 1: not matched
154 if [[ $neg = 0 && $match != 0 ||
155 $neg = 1 && $match = 0 ]]; then
157 [[ $neg = 0 ]] && # expect the flag
158 error "expected flag '$fl' not in $comp_id"
159 [[ $neg = 1 ]] && # not expect the flag
160 error "not expected flag '$fl' in $comp_id"
166 [[ $value = $expected ]] || {
168 error "verify $attr failed on $tf: $value != $expected"
173 # Verify component extent with expected start and end extent values
174 # for a given file and component ID.
176 verify_comp_extent() {
179 local expected_start=$3
180 local expected_end=$4
182 verify_comp_attr comp-start $tf $comp_id $expected_start
183 verify_comp_attr comp-end $tf $comp_id $expected_end
187 # Verify component attribute with parent directory for a given file
190 verify_comp_attr_with_parent() {
194 local td=$(cd $(dirname $tf); echo $PWD)
195 local tf_cmd="$LFS getstripe -I$comp_id"
196 local td_cmd="$LFS getstripe"
202 stripe-size) opt="-S" ;;
203 stripe-count) opt="-c" ;;
205 *) error "invalid attribute $attr";;
208 expected=$($td_cmd $opt $td)
209 [[ $expected = -1 ]] && expected=$OSTCOUNT
211 value=$($tf_cmd $opt $tf)
212 [[ $value = -1 ]] && value=$OSTCOUNT
214 [[ $value = $expected ]] || {
217 error "verify $attr failed with parent on $tf:" \
218 "$value != $expected"
223 # Verify component attribute with filesystem-wide default value for a given file
226 verify_comp_attr_with_default() {
230 local tf_cmd="$LFS getstripe -I$comp_id"
238 expected=$($LCTL get_param -n \
239 lov.$FSNAME-clilov-*.stripesize)
243 expected=$($LCTL get_param -n \
244 lov.$FSNAME-clilov-*.stripecount)
245 [[ $expected = -1 ]] && expected=$OSTCOUNT
247 *) error "invalid attribute $attr";;
250 value=$($tf_cmd $opt $tf)
251 [[ $value = -1 ]] && value=$OSTCOUNT
253 [[ $value = $expected ]] || {
255 error "verify $attr failed with default value on $tf:" \
256 "$value != $expected"
261 # Verify unspecified component attributes for a given file
264 # This will only verify the inherited attributes:
265 # stripe size, stripe count and OST pool name
267 verify_comp_attrs() {
271 verify_comp_attr_with_default stripe-size $tf $comp_id
272 verify_comp_attr_with_default stripe-count $tf $comp_id
273 verify_comp_attr_with_parent pool $tf $comp_id
276 # command line test cases
280 local mirror_count=16 # LUSTRE_MIRROR_COUNT_MAX
281 local mirror_cmd="$LFS mirror create"
286 # create parent directory
287 mkdir $td || error "mkdir $td failed"
289 $mirror_cmd $tf &> /dev/null && error "miss -N option"
291 $mirror_cmd -N $tf || error "create mirrored file $tf failed"
292 verify_mirror_count $tf 1
293 id=$($LFS getstripe -I $tf)
294 verify_comp_attrs $tf $id
295 verify_comp_extent $tf $id 0 EOF
297 $mirror_cmd -N0 $tf-1 &> /dev/null && error "invalid mirror count 0"
298 $mirror_cmd -N$((mirror_count + 1)) $tf-1 &> /dev/null &&
299 error "invalid mirror count $((mirror_count + 1))"
301 $mirror_cmd -N$mirror_count $tf-1 ||
302 error "create mirrored file $tf-1 failed"
303 verify_mirror_count $tf-1 $mirror_count
304 ids=($($LFS getstripe $tf-1 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
305 for ((i = 0; i < $mirror_count; i++)); do
306 verify_comp_attrs $tf-1 ${ids[$i]}
307 verify_comp_extent $tf-1 ${ids[$i]} 0 EOF
310 $mirror_cmd -N -N2 -N3 -N4 $tf-2 ||
311 error "create mirrored file $tf-2 failed"
312 verify_mirror_count $tf-2 10
313 ids=($($LFS getstripe $tf-2 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
314 for ((i = 0; i < 10; i++)); do
315 verify_comp_attrs $tf-2 ${ids[$i]}
316 verify_comp_extent $tf-2 ${ids[$i]} 0 EOF
319 run_test 0a "lfs mirror create with -N option"
322 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
326 local mirror_cmd="$LFS mirror create"
330 # create a new OST pool
331 local pool_name=$TESTNAME
332 create_pool $FSNAME.$pool_name ||
333 error "create OST pool $pool_name failed"
335 # add OSTs into the pool
336 pool_add_targets $pool_name 0 $((OSTCOUNT - 1)) ||
337 error "add OSTs into pool $pool_name failed"
339 # create parent directory
340 mkdir $td || error "mkdir $td failed"
341 $LFS setstripe -S 8M -c -1 -p $pool_name $td ||
342 error "$LFS setstripe $td failed"
344 # create a mirrored file with plain layout mirrors
345 $mirror_cmd -N -N -S 4M -c 2 -p flash -i 2 -o 2,3 \
346 -N -S 16M -N -c -1 -N -p archive -N -p none $tf ||
347 error "create mirrored file $tf failed"
348 verify_mirror_count $tf 6
349 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
350 for ((i = 0; i < 6; i++)); do
351 verify_comp_extent $tf ${ids[$i]} 0 EOF
354 # verify component ${ids[0]}
355 verify_comp_attrs $tf ${ids[0]}
357 # verify component ${ids[1]}
358 verify_comp_attr stripe-size $tf ${ids[1]} 4194304
359 verify_comp_attr stripe-count $tf ${ids[1]} 2
360 verify_comp_attr stripe-index $tf ${ids[1]} 2
361 verify_comp_attr pool $tf ${ids[1]} flash
363 # verify component ${ids[2]}
364 verify_comp_attr stripe-size $tf ${ids[2]} 16777216
365 verify_comp_attr stripe-count $tf ${ids[2]} 2
366 verify_comp_attr pool $tf ${ids[2]} flash
368 # verify component ${ids[3]}
369 verify_comp_attr stripe-size $tf ${ids[3]} 16777216
370 verify_comp_attr stripe-count $tf ${ids[3]} $OSTCOUNT
371 verify_comp_attr pool $tf ${ids[3]} flash
373 # verify component ${ids[4]}
374 verify_comp_attr stripe-size $tf ${ids[4]} 16777216
375 verify_comp_attr stripe-count $tf ${ids[4]} $OSTCOUNT
376 verify_comp_attr pool $tf ${ids[4]} archive
378 # verify component ${ids[5]}
379 verify_comp_attr stripe-size $tf ${ids[5]} 16777216
380 verify_comp_attr stripe-count $tf ${ids[5]} $OSTCOUNT
381 verify_comp_attr_with_parent pool $tf ${ids[5]}
383 if [ $MDS1_VERSION -ge $(version_code 2.12.55) ]; then
384 # LU-11022 - remove mirror by pool name
385 local=cnt cnt=$($LFS getstripe $tf | grep archive | wc -l)
386 [ "$cnt" != "1" ] && error "unexpected mirror count $cnt"
387 $LFS mirror split --pool archive -d $tf || error "delete mirror"
388 cnt=$($LFS getstripe $tf | grep archive | wc -l)
389 [ "$cnt" != "0" ] && error "mirror count after removal: $cnt"
395 run_test 0b "lfs mirror create plain layout mirrors"
398 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
402 local mirror_cmd="$LFS mirror create"
406 # create a new OST pool
407 local pool_name=$TESTNAME
408 create_pool $FSNAME.$pool_name ||
409 error "create OST pool $pool_name failed"
411 # add OSTs into the pool
412 pool_add_targets $pool_name 0 $((OSTCOUNT - 1)) ||
413 error "add OSTs into pool $pool_name failed"
415 # create parent directory
416 mkdir $td || error "mkdir $td failed"
417 $LFS setstripe -E 32M -S 8M -c -1 -p $pool_name -E eof -S 16M $td ||
418 error "$LFS setstripe $td failed"
420 # create a mirrored file with composite layout mirrors
421 $mirror_cmd -N2 -E 4M -c 2 -p flash -i 1 -o 1,3 -E eof -S 4M \
423 -N3 -E 512M -S 16M -p archive -E -1 -i -1 -c -1 $tf ||
424 error "create mirrored file $tf failed"
425 verify_mirror_count $tf 6
426 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
428 # verify components ${ids[0]} and ${ids[2]}
430 verify_comp_attr_with_default stripe-size $tf ${ids[$i]}
431 verify_comp_attr stripe-count $tf ${ids[$i]} 2
432 verify_comp_attr stripe-index $tf ${ids[$i]} 1
433 verify_comp_attr pool $tf ${ids[$i]} flash
434 verify_comp_extent $tf ${ids[$i]} 0 4194304
437 # verify components ${ids[1]} and ${ids[3]}
439 verify_comp_attr stripe-size $tf ${ids[$i]} 4194304
440 verify_comp_attr stripe-count $tf ${ids[$i]} 2
441 verify_comp_attr pool $tf ${ids[$i]} flash
442 verify_comp_extent $tf ${ids[$i]} 4194304 EOF
445 # verify component ${ids[4]}
446 verify_comp_attr stripe-size $tf ${ids[4]} 4194304
447 verify_comp_attr stripe-count $tf ${ids[4]} 4
448 verify_comp_attr_with_parent pool $tf ${ids[4]}
449 verify_comp_extent $tf ${ids[4]} 0 EOF
451 # verify components ${ids[5]}, ${ids[7]} and ${ids[9]}
453 verify_comp_attr stripe-size $tf ${ids[$i]} 16777216
454 verify_comp_attr stripe-count $tf ${ids[$i]} 4
455 verify_comp_attr pool $tf ${ids[$i]} archive
456 verify_comp_extent $tf ${ids[$i]} 0 536870912
459 # verify components ${ids[6]}, ${ids[8]} and ${ids[10]}
461 verify_comp_attr stripe-size $tf ${ids[$i]} 16777216
462 verify_comp_attr stripe-count $tf ${ids[$i]} -1
463 verify_comp_attr pool $tf ${ids[$i]} archive
464 verify_comp_extent $tf ${ids[$i]} 536870912 EOF
470 run_test 0c "lfs mirror create composite layout mirrors"
475 local mirror_count=16 # LUSTRE_MIRROR_COUNT_MAX
476 local mirror_cmd="$LFS mirror extend"
480 # create parent directory
481 mkdir $td || error "mkdir $td failed"
483 $mirror_cmd $tf &> /dev/null && error "miss -N option"
484 $mirror_cmd -N $tf &> /dev/null && error "$tf does not exist"
486 # create a non-mirrored file, convert it to a mirrored file and extend
487 touch $tf || error "touch $tf failed"
488 $mirror_cmd -N $tf || error "convert and extend $tf failed"
489 verify_mirror_count $tf 2
490 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
491 for ((i = 0; i < 2; i++)); do
492 verify_comp_attrs $tf ${ids[$i]}
493 verify_comp_extent $tf ${ids[$i]} 0 EOF
496 lfsck_verify_pfid $tf || error "PFID is not set"
498 # create a mirrored file and extend it
499 $LFS mirror create -N $tf-1 || error "create mirrored file $tf-1 failed"
500 $LFS mirror create -N $tf-2 || error "create mirrored file $tf-2 failed"
502 $mirror_cmd -N -S 4M -N -f $tf-2 $tf-1 &> /dev/null &&
503 error "setstripe options should not be specified with -f option"
505 $mirror_cmd -N$((mirror_count - 1)) $tf-1 ||
506 error "extend mirrored file $tf-1 failed"
507 verify_mirror_count $tf-1 $mirror_count
508 ids=($($LFS getstripe $tf-1 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
509 for ((i = 0; i < $mirror_count; i++)); do
510 verify_comp_attrs $tf-1 ${ids[$i]}
511 verify_comp_extent $tf-1 ${ids[$i]} 0 EOF
514 $mirror_cmd -N $tf-1 &> /dev/null &&
515 error "exceeded maximum mirror count $mirror_count" || true
517 run_test 0d "lfs mirror extend with -N option"
520 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
524 local mirror_cmd="$LFS mirror extend"
528 # create parent directory
529 mkdir $td || error "mkdir $td failed"
531 # create a mirrored file with plain layout mirrors
532 $LFS mirror create -N -S 32M -c 3 -p ssd -i 1 -o 1,2,3 $tf ||
533 error "create mirrored file $tf failed"
535 # extend the mirrored file with plain layout mirrors
536 $mirror_cmd -N -S 4M -c 2 -p flash -i 2 -o 2,3 \
537 -N -S 16M -N -c -1 -N -p archive -N -p none $tf ||
538 error "extend mirrored file $tf failed"
539 verify_mirror_count $tf 6
540 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
541 for ((i = 0; i < 6; i++)); do
542 verify_comp_extent $tf ${ids[$i]} 0 EOF
545 # verify component ${ids[0]}
546 verify_comp_attr stripe-size $tf ${ids[0]} 33554432
547 verify_comp_attr stripe-count $tf ${ids[0]} 3
548 verify_comp_attr stripe-index $tf ${ids[0]} 1
549 verify_comp_attr pool $tf ${ids[0]} ssd
551 # verify component ${ids[1]}
552 verify_comp_attr stripe-size $tf ${ids[1]} 4194304
553 verify_comp_attr stripe-count $tf ${ids[1]} 2
554 verify_comp_attr stripe-index $tf ${ids[1]} 2
555 verify_comp_attr pool $tf ${ids[1]} flash
557 # verify component ${ids[2]}
558 verify_comp_attr stripe-size $tf ${ids[2]} 16777216
559 verify_comp_attr stripe-count $tf ${ids[2]} 2
560 verify_comp_attr pool $tf ${ids[2]} flash
562 # verify component ${ids[3]}
563 verify_comp_attr stripe-size $tf ${ids[3]} 16777216
564 verify_comp_attr stripe-count $tf ${ids[3]} $OSTCOUNT
565 verify_comp_attr pool $tf ${ids[3]} flash
567 # verify component ${ids[4]}
568 verify_comp_attr stripe-size $tf ${ids[4]} 16777216
569 verify_comp_attr stripe-count $tf ${ids[4]} $OSTCOUNT
570 verify_comp_attr pool $tf ${ids[4]} archive
572 # verify component ${ids[5]}
573 verify_comp_attr stripe-size $tf ${ids[5]} 16777216
574 verify_comp_attr stripe-count $tf ${ids[5]} $OSTCOUNT
575 verify_comp_attr_with_parent pool $tf ${ids[5]}
577 run_test 0e "lfs mirror extend plain layout mirrors"
580 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
584 local mirror_cmd="$LFS mirror extend"
588 # create parent directory
589 mkdir $td || error "mkdir $td failed"
591 # create a mirrored file with composite layout mirror
592 $LFS mirror create -N -E 32M -S 16M -p ssd -E eof -S 32M $tf ||
593 error "create mirrored file $tf failed"
595 # extend the mirrored file with composite layout mirrors
596 $mirror_cmd -N2 -E 4M -c 2 -p flash -i 1 -o 1,3 -E eof -S 4M \
598 -N3 -E 512M -S 16M -p archive -E -1 -i -1 -c -1 $tf ||
599 error "extend mirrored file $tf failed"
600 verify_mirror_count $tf 7
601 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
603 # verify component ${ids[0]}
604 verify_comp_attr stripe-size $tf ${ids[0]} 16777216
605 verify_comp_attr_with_default stripe-count $tf ${ids[0]}
606 verify_comp_attr pool $tf ${ids[0]} ssd
607 verify_comp_extent $tf ${ids[0]} 0 33554432
609 # verify component ${ids[1]}
610 verify_comp_attr stripe-size $tf ${ids[1]} 33554432
611 verify_comp_attr_with_default stripe-count $tf ${ids[1]}
612 verify_comp_attr pool $tf ${ids[1]} ssd
613 verify_comp_extent $tf ${ids[1]} 33554432 EOF
615 # verify components ${ids[2]} and ${ids[4]}
617 verify_comp_attr_with_default stripe-size $tf ${ids[$i]}
618 verify_comp_attr stripe-count $tf ${ids[$i]} 2
619 verify_comp_attr stripe-index $tf ${ids[$i]} 1
620 verify_comp_attr pool $tf ${ids[$i]} flash
621 verify_comp_extent $tf ${ids[$i]} 0 4194304
624 # verify components ${ids[3]} and ${ids[5]}
626 verify_comp_attr stripe-size $tf ${ids[$i]} 4194304
627 verify_comp_attr stripe-count $tf ${ids[$i]} 2
628 verify_comp_attr pool $tf ${ids[$i]} flash
629 verify_comp_extent $tf ${ids[$i]} 4194304 EOF
632 # verify component ${ids[6]}
633 verify_comp_attr stripe-size $tf ${ids[6]} 4194304
634 verify_comp_attr stripe-count $tf ${ids[6]} $OSTCOUNT
635 verify_comp_attr_with_parent pool $tf ${ids[6]}
636 verify_comp_extent $tf ${ids[6]} 0 EOF
638 # verify components ${ids[7]}, ${ids[9]} and ${ids[11]}
640 verify_comp_attr stripe-size $tf ${ids[$i]} 16777216
641 verify_comp_attr stripe-count $tf ${ids[$i]} $OSTCOUNT
642 verify_comp_attr pool $tf ${ids[$i]} archive
643 verify_comp_extent $tf ${ids[$i]} 0 536870912
646 # verify components ${ids[8]}, ${ids[10]} and ${ids[12]}
648 verify_comp_attr stripe-size $tf ${ids[$i]} 16777216
649 verify_comp_attr stripe-count $tf ${ids[$i]} -1
650 verify_comp_attr pool $tf ${ids[$i]} archive
651 verify_comp_extent $tf ${ids[$i]} 536870912 EOF
654 run_test 0f "lfs mirror extend composite layout mirrors"
659 $LFS mirror create -N -E 1M -S 1M -o0 --flags=prefer -E eof -o1 \
660 -N -o1 $tf || error "create mirrored file $tf failed"
662 verify_comp_attr lcme_flags $tf 0x10001 prefer
663 verify_comp_attr lcme_flags $tf 0x10002 prefer
665 # write to the mirrored file and check primary
666 cp /etc/hosts $tf || error "error writing file '$tf'"
668 verify_comp_attr lcme_flags $tf 0x20003 stale
670 # resync file and check prefer flag
671 $LFS mirror resync $tf || error "error resync-ing file '$tf'"
674 $LCTL set_param osc.*.stats=clear
675 cat $tf &> /dev/null || error "error reading file '$tf'"
677 # verify that the data was provided by OST1 where mirror 1 resides
678 local nr_read=$($LCTL get_param -n osc.$FSNAME-OST0000-osc-[-0-9a-f]*.stats |
679 awk '/ost_read/{print $2}')
680 [ -n "$nr_read" ] || error "read was not provided by OST1"
682 run_test 0g "lfs mirror create flags support"
685 [ $MDS1_VERSION -lt $(version_code 2.11.57) ] &&
686 skip "Need MDS version at least 2.11.57"
693 # create parent directory
694 test_mkdir $td || error "mkdir $td failed"
696 $LFS setstripe -N -E 1M -S 1M --flags=prefer -E eof -N2 $td ||
697 error "set default mirrored layout on directory $td failed"
699 # verify flags are inherited from the directory
702 verify_comp_attr lcme_flags $tf 0x10001 prefer
703 verify_comp_attr lcme_flags $tf 0x10002 prefer
705 # set flags to the first component
706 $LFS setstripe --comp-set -I 0x10001 --comp-flags=^prefer,stale $tf
708 verify_comp_attr lcme_flags $tf 0x10001 stale
709 verify_comp_attr lcme_flags $tf 0x10002 prefer
711 $LFS setstripe --comp-set -I0x10001 --comp-flags=^stale $tf &&
712 error "clearing 'stale' should fail"
714 # write and resync file. It can't resync the file directly because the
715 # file state is still 'ro'
716 cp /etc/hosts $tf || error "error writing file '$tf'"
717 $LFS mirror resync $tf || error "error resync-ing file '$tf'"
719 $LFS setstripe --comp-set -I 0x20003 --comp-flags=prefer $tf ||
720 error "error setting flag prefer"
722 verify_comp_attr lcme_flags $tf 0x20003 prefer
724 run_test 0h "set, clear and test flags for FLR files"
728 local mirror_count=16 # LUSTRE_MIRROR_COUNT_MAX
729 local mirror_create_cmd="$LFS mirror create"
730 local stripes[0]=$OSTCOUNT
732 mirror_create_cmd+=" -N -c ${stripes[0]}"
733 for ((i = 1; i < $mirror_count; i++)); do
734 # add mirrors with different stripes to the file
735 stripes[$i]=$((RANDOM % OSTCOUNT))
736 [ ${stripes[$i]} -eq 0 ] && stripes[$i]=1
738 mirror_create_cmd+=" -N -c ${stripes[$i]}"
741 $mirror_create_cmd $tf || error "create mirrored file $tf failed"
742 verify_mirror_count $tf $mirror_count
744 # can't create mirrors exceeding LUSTRE_MIRROR_COUNT_MAX
745 $LFS mirror extend -N $tf &&
746 error "Creating the $((mirror_count+1))th mirror succeeded"
748 local ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' |
751 # verify the range of components and stripe counts
752 for ((i = 0; i < $mirror_count; i++)); do
753 verify_comp_attr stripe-count $tf ${ids[$i]} ${stripes[$i]}
754 verify_comp_extent $tf ${ids[$i]} 0 EOF
757 run_test 1 "create components with setstripe options"
761 local tf2=$DIR/$tfile-2
763 $LFS setstripe -E 1M -S 1M -E EOF -c 1 $tf
764 $LFS setstripe -E 2M -S 1M -E EOF -c -1 $tf2
766 $LFS mirror extend -N -f $tf2 $tf ||
767 error "merging $tf2 into $tf failed"
769 verify_mirror_count $tf 2
770 [[ ! -e $tf2 ]] || error "$tf2 was not unlinked"
772 run_test 2 "create components from existing files"
775 [[ $MDSCOUNT -lt 2 ]] && skip "need >= 2 MDTs" && return
777 for ((i = 0; i < 2; i++)); do
778 $LFS mkdir -i $i $DIR/$tdir-$i
779 $LFS setstripe -E -1 $DIR/$tdir-$i/$tfile
782 $LFS mirror extend -N -f $DIR/$tdir-1/$tfile \
783 $DIR/$tdir-0/$tfile || error "creating mirrors"
785 # mdt doesn't support to cancel layout lock for remote objects, do
789 # make sure the mirrorted file was created successfully
790 [[ $($LFS getstripe --component-count $DIR/$tdir-0/$tfile) -eq 2 ]] ||
791 { $LFS getstripe $DIR/$tdir-0/$tfile;
792 error "expected 2 components"; }
797 run_test 3 "create components from files located on different MDTs"
800 local tf=$DIR/$tdir/$tfile
803 test_mkdir $DIR/$tdir
805 # set mirror with setstripe options to directory
806 $LFS mirror create -N2 -E 1M -S 1M -E eof $DIR/$tdir ||
807 error "set mirror to directory error"
809 [ x$($LFS getstripe -v $DIR/$tdir | awk '/lcm_flags/{print $2}') = \
810 x"mirrored" ] || error "failed to create mirrored dir"
813 verify_mirror_count $tf 2
815 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
816 verify_comp_extent $tf ${ids[0]} 0 1048576
817 verify_comp_extent $tf ${ids[1]} 1048576 EOF
819 # sub directory should inherit mirror setting from parent
820 test_mkdir $DIR/$tdir/td
821 [ x$($LFS getstripe -v $DIR/$tdir/td | awk '/lcm_flags/{print $2}') = \
822 x"mirrored" ] || error "failed to inherit mirror from parent"
824 # mirror extend won't be applied to directory
825 $LFS mirror extend -N2 $DIR/$tdir &&
826 error "expecting mirror extend failure"
829 run_test 4 "Make sure mirror attributes can be inhertied from directory"
835 $MULTIOP $tf oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:T12345c ||
836 error "failed to create file with non-empty layout"
837 $CHECKSTAT -t file -s 12345 $tf || error "size error: expecting 12345"
839 $LFS mirror create -N3 $tf || error "failed to attach mirror layout"
840 verify_mirror_count $tf 3
842 $CHECKSTAT -t file -s 12345 $tf ||
843 error "size error after attaching layout "
845 run_test 5 "Make sure init size work for mirrored layout"
847 # LU=10112: disable dom+flr for phase 1
851 $LFS mirror create -N -E 1M -S 1M -L mdt -E eof -N -E eof $tf &&
852 error "expect failure to create mirrored file with DoM"
854 $LFS mirror create -N -E 1M -S 1M -E eof -N -E 1M -L mdt -E eof $tf &&
855 error "expect failure to create mirrored file with DoM"
857 $LFS setstripe -E 1M -S 1M -L mdt -E eof $tf
858 $LFS mirror extend -N2 $tf &&
859 error "expect failure to extend mirror with DoM"
861 $LFS mirror create -N2 -E 1M -S 1M -E eof $tf-2
862 $LFS mirror extend -N -f $tf $tf-2 &&
863 error "expect failure to extend mirrored file with DoM extent"
867 run_test 6 "DoM and FLR won't co-exist for phase 1"
871 local tf2=$DIR/$tfile-2
873 [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
875 $LFS setstripe -E EOF -o 0 $tf
876 $LFS setstripe -E EOF -o 1 $tf2
878 local dd_count=$((RANDOM % 20 + 1))
879 dd if=/dev/zero of=$tf bs=1M count=$dd_count oflag=sync
880 dd if=/dev/zero of=$tf2 bs=1M count=1 seek=$((dd_count - 1)) oflag=sync
882 # for zfs - sync OST dataset so that du below will return
884 [ "$FSTYPE" = "zfs" ] &&
885 do_nodes $(comma_list $(osts_nodes)) "$ZPOOL sync"
887 local blocks=$(du -kc $tf $tf2 | awk '/total/{print $1}')
890 $LFS mirror extend -N -f $tf2 $tf ||
891 error "merging $tf2 into $tf failed"
896 local new_blocks=$(du -k $tf | awk '{print $1}')
897 [ $new_blocks -eq $blocks ] ||
898 error "i_blocks error expected: $blocks, actual: $new_blocks"
900 run_test 21 "glimpse should report accurate i_blocks"
902 get_osc_lock_count() {
909 osc_name=${FSNAME}-OST$(printf "%04x" $((idx-1)))-osc-'[-0-9a-f]*'
910 count=$($LCTL get_param -n ldlm.namespaces.$osc_name.lock_count)
911 lock_count=$((lock_count + count))
919 $LFS setstripe -E EOF -o 0 $tf
920 dd if=/dev/zero of=$tf bs=1M count=$((RANDOM % 20 + 1))
922 # add component, two mirrors located on the same OST ;-)
923 $LFS mirror extend -N -o 0 $tf ||
924 error "extending mirrored file $tf failed"
926 size_blocks=$(stat --format="%b %s" $tf)
931 local new_size_blocks=$(stat --format="%b %s" $tf)
933 # make sure there is no lock cached
934 [ $(get_osc_lock_count 1) -eq 0 ] || error "glimpse requests were sent"
936 [ "$new_size_blocks" = "$size_blocks" ] ||
937 echo "size expected: $size_blocks, actual: $new_size_blocks"
941 run_test 22 "no glimpse to OSTs for READ_ONLY files"
946 $LFS mirror create -N -o 0 -N -o 1 $tf ||
947 error "creating mirrored file $tf failed"
949 #define OBD_FAIL_GLIMPSE_IMMUTABLE 0x1A00
950 $LCTL set_param fail_loc=0x1A00
953 for ((ost_idx = 1; ost_idx <= 2; ost_idx++)); do
957 local tmpfile=$(mktemp)
958 stat --format="%b %s" $tf > $tmpfile &
962 while [ $cnt -le 5 ]; do
963 kill -0 $pid > /dev/null 2>&1 || break
967 kill -0 $pid > /dev/null 2>&1 &&
968 error "stat process stuck due to unavailable OSTs"
970 # make sure glimpse request has been sent
971 [ $(get_osc_lock_count 1 2) -ne 0 ] ||
972 error "OST $ost_idx: no glimpse request was sent"
977 run_test 31 "make sure glimpse request can be retried"
980 [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
981 rm -f $DIR/$tfile $DIR/$tfile-2
983 $LFS setstripe -E EOF -o 0 $DIR/$tfile
984 dd if=/dev/urandom of=$DIR/$tfile bs=1M count=$((RANDOM % 10 + 2))
986 local fsize=$(stat -c %s $DIR/$tfile)
987 [[ $fsize -ne 0 ]] || error "file size is (wrongly) zero"
989 local cksum=$(md5sum $DIR/$tfile)
991 # create a new mirror in sync mode
992 $LFS mirror extend -N -o 1 $DIR/$tfile ||
993 error "extending mirrored file $DIR/$tfile failed"
995 # make sure the mirrored file was created successfully
996 [ $($LFS getstripe -N $DIR/$tfile) -eq 2 ] ||
997 { $LFS getstripe $DIR/$tfile; error "expected 2 mirrors"; }
1002 # check size is correct, glimpse request should go to the 2nd mirror
1003 $CHECKSTAT -t file -s $fsize $DIR/$tfile ||
1004 error "file size error $fsize vs. $(stat -c %s $DIR/$tfile)"
1006 echo "reading file from the 2nd mirror and verify checksum"
1007 [[ "$cksum" == "$(md5sum $DIR/$tfile)" ]] ||
1008 error "checksum error: expected $cksum"
1012 run_test 32 "data should be mirrored to newly created mirror"
1015 [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
1017 rm -f $DIR/$tfile $DIR/$tfile-2
1019 # create a file with two mirrors
1020 $LFS setstripe -E EOF -o 0 $DIR/$tfile
1023 while [ $count -lt $max_count ]; do
1024 echo "ost1" >> $DIR/$tfile
1025 count=$((count + 1));
1028 # tmp file that will be used as mirror
1029 $LFS setstripe -E EOF -o 1 $DIR/$tfile-2
1031 while [ $count -lt $max_count ]; do
1032 echo "ost2" >> $DIR/$tfile-2
1033 count=$((count + 1));
1036 # create a mirrored file
1037 $LFS mirror extend -N -f $DIR/$tfile-2 $DIR/$tfile &&
1038 error "merging $DIR/$tfile-2 into $DIR/$tfile" \
1039 "with verification should fail"
1040 $LFS mirror extend --no-verify -N -f $DIR/$tfile-2 $DIR/$tfile ||
1041 error "merging $DIR/$tfile-2 into $DIR/$tfile" \
1042 "without verification failed"
1044 # make sure that $tfile has two mirrors and $tfile-2 does not exist
1045 [ $($LFS getstripe -N $DIR/$tfile) -eq 2 ] ||
1046 { $LFS getstripe $DIR/$tfile; error "expected count 2"; }
1048 [[ ! -e $DIR/$tfile-2 ]] || error "$DIR/$tfile-2 was not unlinked"
1050 # execpted file size
1051 local fsize=$((5 * max_count))
1052 $CHECKSTAT -t file -s $fsize $DIR/$tfile ||
1053 error "mirrored file size is not $fsize"
1055 # read file - all OSTs are available
1056 echo "reading file (data can be provided by any ost)... "
1057 local rs=$(cat $DIR/$tfile | head -1)
1058 [[ "$rs" == "ost1" || "$rs" == "ost2" ]] ||
1059 error "file content error: expected: \"ost1\" or \"ost2\""
1061 # read file again with ost1 failed
1065 echo "reading file (data should be provided by ost2)..."
1066 local rs=$(cat $DIR/$tfile | head -1)
1067 [[ "$rs" == "ost2" ]] ||
1068 error "file content error: expected: \"ost2\", actual: \"$rs\""
1073 # read file again with ost2 failed
1077 # check size, glimpse should work
1078 $CHECKSTAT -t file -s $fsize $DIR/$tfile ||
1079 error "mirrored file size is not $fsize"
1081 echo "reading file (data should be provided by ost1)..."
1082 local rs=$(cat $DIR/$tfile | head -1)
1083 [[ "$rs" == "ost1" ]] ||
1084 error "file content error: expected: \"ost1\", actual: \"$rs\""
1088 run_test 33 "read can choose available mirror to read"
1091 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
1093 rm -f $DIR/$tfile $DIR/$tfile-2 $DIR/$tfile-ref
1096 $LFS setstripe -o 0 $DIR/$tfile-ref
1097 dd if=/dev/urandom of=$DIR/$tfile-ref bs=1M count=3
1099 # create a file with two mirrors
1100 $LFS setstripe -E -1 -o 0,1 -S 1M $DIR/$tfile
1101 dd if=$DIR/$tfile-ref of=$DIR/$tfile bs=1M
1103 $LFS setstripe -E -1 -o 2,3 -S 1M $DIR/$tfile-2
1104 dd if=$DIR/$tfile-ref of=$DIR/$tfile-2 bs=1M
1106 $CHECKSTAT -t file -s $((3 * 1024 * 1024)) $DIR/$tfile ||
1107 error "mirrored file size is not 3M"
1109 # merge a mirrored file
1110 $LFS mirror extend -N -f $DIR/$tfile-2 $DIR/$tfile ||
1111 error "merging $DIR/$tfile-2 into $DIR/$tfile failed"
1113 cancel_lru_locks osc
1115 # stop two OSTs, so the 2nd stripe of the 1st mirror and
1116 # the 1st stripe of the 2nd mirror will be inaccessible, ...
1119 echo "comparing files ... "
1121 # however, read can still return the correct data. It should return
1122 # the 1st stripe from mirror 1 and 2st stripe from mirror 2.
1123 cmp -n 2097152 <(rwv -f $DIR/$tfile -r -o -n 1 2097152) \
1124 $DIR/$tfile-ref || error "file reading error"
1128 run_test 34a "read mirrored file with multiple stripes"
1131 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
1133 rm -f $DIR/$tfile $DIR/$tfile-2 $DIR/$tfile-ref
1136 $LFS setstripe -o 0 $DIR/$tfile-ref
1137 dd if=/dev/urandom of=$DIR/$tfile-ref bs=1M count=3
1139 $LFS setstripe -E 1M -S 1M -o 0 -E eof -o 1 $DIR/$tfile
1140 dd if=$DIR/$tfile-ref of=$DIR/$tfile bs=1M
1142 $LFS setstripe -E 1M -S 1M -o 2 -E eof -o 3 $DIR/$tfile-2
1143 dd if=$DIR/$tfile-ref of=$DIR/$tfile-2 bs=1M
1145 $CHECKSTAT -t file -s $((3 * 1024 * 1024)) $DIR/$tfile ||
1146 error "mirrored file size is not 3M"
1148 # merge a mirrored file
1149 $LFS mirror extend -N -f $DIR/$tfile-2 $DIR/$tfile ||
1150 error "merging $DIR/$tfile-2 into $DIR/$tfile failed"
1152 cancel_lru_locks osc
1154 # stop two OSTs, so the 2nd component of the 1st mirror and
1155 # the 1st component of the 2nd mirror will be inaccessible, ...
1158 echo "comparing files ... "
1160 # however, read can still return the correct data. It should return
1161 # the 1st stripe from mirror 1 and 2st stripe from mirror 2.
1162 cmp -n 2097152 <(rwv -f $DIR/$tfile -r -o -n 1 2097152) \
1163 $DIR/$tfile-ref || error "file reading error"
1167 run_test 34b "read mirrored file with multiple components"
1170 local tf=$DIR/$tfile
1172 $LFS setstripe -E eof $tf
1174 # add an out-of-sync mirror to the file
1175 $LFS mirror extend -N -c 2 $tf ||
1176 error "extending mirrored file $tf failed"
1178 $MULTIOP $tf oO_WRONLY:c ||
1179 error "write open a mirrored file failed"
1181 # truncate file should return error
1182 $TRUNCATE $tf 100 || error "error truncating a mirrored file"
1184 run_test 35 "allow to write to mirrored files"
1186 verify_ost_layout_version() {
1189 # get file layout version
1190 local flv=$($LFS getstripe $tf | awk '/lcm_layout_gen/{print $2}')
1192 # layout version from OST objects
1193 local olv=$($MULTIOP $tf oXc | awk '/ostlayoutversion/{print $2}')
1195 [ $flv -eq $olv ] || error "layout version mismatch: $flv vs. $olv"
1202 $LFS setstripe -E 1M -S 1M -E 2M -E 4M -E eof -c -1 $tf
1203 $LFS setstripe -E 3M -S 1M -E 6M -E eof -c -1 $tf-tmp
1205 $LFS mirror extend -N -f $tf-tmp $tf ||
1206 error "merging $tf-tmp into $tf failed"
1211 local tf=$DIR/$tfile
1213 create_file_36 $tf $tf-2 $tf-3
1215 [ $($LFS getstripe -N $tf) -gt 1 ] || error "wrong mirror count"
1217 # test case 1 - check file write and verify layout version
1218 $MULTIOP $tf oO_WRONLY:c ||
1219 error "write open a mirrored file failed"
1221 # write open file should not return error
1222 $MULTIOP $tf oO_WRONLY:w1024Yc || error "write mirrored file error"
1224 # instantiate components should work
1225 dd if=/dev/zero of=$tf bs=1M count=12 || error "write file error"
1227 # verify OST layout version
1228 verify_ost_layout_version $tf
1231 local mds_facet=mds$(($($LFS getstripe -m $tf-2) + 1))
1234 do_facet $mds_facet $LCTL set_param fail_val=$delay_sec
1236 #define OBD_FAIL_FLR_LV_DELAY 0x1A01
1237 do_facet $mds_facet $LCTL set_param fail_loc=0x1A01
1239 # write should take at least $fail_loc seconds and succeed
1240 local st=$(date +%s)
1241 $MULTIOP $tf-2 oO_WRONLY:w1024Yc || error "write mirrored file error"
1243 [ $(date +%s) -ge $((st+delay_sec)) ] ||
1244 error "write finished before layout version is transmitted"
1246 # verify OST layout version
1247 verify_ost_layout_version $tf
1249 do_facet $mds_facet $LCTL set_param fail_loc=0
1252 mds_idx=mds$(($($LFS getstripe -m $tf-3) + 1))
1254 #define OBD_FAIL_FLR_LV_INC 0x1A02
1255 do_facet $mds_facet $LCTL set_param fail_loc=0x1A02
1257 # write open file should return error
1258 $MULTIOP $tf-3 oO_WRONLY:O_SYNC:w1024c &&
1259 error "write a mirrored file succeeded" || true
1261 do_facet $mds_facet $LCTL set_param fail_loc=0
1263 run_test 36 "write to mirrored files"
1269 echo "create test files with size $fsize .."
1273 $LFS setstripe -E 1M -S 1M -c 1 -E eof -c -1 $tf
1275 dd if=/dev/urandom of=$tf bs=1M count=16 &> /dev/null
1276 $TRUNCATE $tf $fsize
1282 [ $MDS1_VERSION -lt $(version_code 2.11.57) ] &&
1283 skip "Need MDS version at least 2.11.57"
1285 local tf=$DIR/$tfile
1286 local tf2=$DIR/$tfile-2
1287 local tf3=$DIR/$tfile-3
1288 local tf4=$DIR/$tfile-4
1290 create_files_37 $((RANDOM + 15 * 1048576)) $tf $tf2 $tf3
1294 # assume the mirror id will be 1, 2, and 3
1295 declare -A checksums
1296 checksums[1]=$(cat $tf | md5sum)
1297 checksums[2]=$(cat $tf2 | md5sum)
1298 checksums[3]=$(cat $tf3 | md5sum)
1300 printf '%s\n' "${checksums[@]}"
1302 # merge these files into a mirrored file
1303 $LFS mirror extend --no-verify -N -f $tf2 $tf ||
1304 error "merging $tf2 into $tf failed"
1305 $LFS mirror extend --no-verify -N -f $tf3 $tf ||
1306 error "merging $tf3 into $tf failed"
1310 # verify mirror read, checksums should equal to the original files'
1311 echo "Verifying mirror read .."
1314 for i in ${mirror_array[@]}; do
1315 $LCTL set_param ldlm.namespaces.*.lru_size=clear > /dev/null
1316 sum=$($LFS mirror read -N $i $tf | md5sum)
1317 [ "$sum" = "${checksums[$i]}" ] ||
1318 error "$i: mismatch: \'${checksums[$i]}\' vs. \'$sum\'"
1321 # verify mirror write
1322 echo "Verifying mirror write .."
1323 $LFS mirror write -N2 $tf < $tf4
1325 sum=$($LFS mirror read -N2 $tf | md5sum)
1326 [[ "$sum" = "${checksums[1]}" ]] ||
1327 error "2: mismatch \'${checksums[1]}\' vs. \'$sum\'"
1329 # verify mirror copy, write to this mirrored file will invalidate
1330 # the other two mirrors
1331 echo "Verifying mirror copy .."
1333 local osts=$(comma_list $(osts_nodes))
1335 $LFS mirror copy -i ${mirror_array[0]} -o-1 $tf ||
1336 error "mirror copy error"
1338 # verify copying is successful by checking checksums
1339 remount_client $MOUNT
1340 for i in ${mirror_array[@]}; do
1341 sum=$($LFS mirror read -N $i $tf | md5sum)
1342 [ "$sum" = "${checksums[1]}" ] ||
1343 error "$i: mismatch checksum after copy \'$sum\'"
1348 run_test 37 "mirror I/O API verification"
1353 local expected_state=$2
1355 local state=$($LFS getstripe -v $tf | awk '/lcm_flags/{ print $2 }')
1356 [ $expected_state = $state ] ||
1357 error "expected: $expected_state, actual $state"
1361 local tf=$DIR/$tfile
1362 local ref=$DIR/${tfile}-ref
1364 $LFS setstripe -E 1M -S 1M -c 1 -E 4M -c 2 -E eof -c -1 $tf ||
1365 error "creating $tf failed"
1366 $LFS setstripe -E 2M -S 1M -c 1 -E 6M -c 2 -E 8M -c -1 -E eof -c -1 \
1367 $tf-2 || error "creating $tf-2 failed"
1368 $LFS setstripe -E 4M -c 1 -E 8M -c 2 -E eof -c -1 $tf-3 ||
1369 error "creating $tf-3 failed"
1371 # instantiate all components
1372 $LFS mirror extend -N -f $tf-2 $tf ||
1373 error "merging $tf-2 into $tf failed"
1374 $LFS mirror extend -N -f $tf-3 $tf ||
1375 error "merging $tf-3 into $tf failed"
1376 $LFS mirror extend -N -c 1 $tf ||
1377 error "extending mirrored file $tf failed"
1379 verify_flr_state $tf "ro"
1381 dd if=/dev/urandom of=$ref bs=1M count=16 &> /dev/null
1383 local fsize=$((RANDOM << 8 + 1048576))
1384 $TRUNCATE $ref $fsize
1386 local ref_cksum=$(cat $ref | md5sum)
1388 # case 1: verify write to mirrored file & resync work
1389 cp $ref $tf || error "copy from $ref to $f error"
1390 verify_flr_state $tf "wp"
1392 local file_cksum=$(cat $tf | md5sum)
1393 [ "$file_cksum" = "$ref_cksum" ] || error "write failed, cksum mismatch"
1396 echo "mirror IDs: ${mirror_array[@]}"
1398 local valid_mirror stale_mirror id mirror_cksum
1399 for id in "${mirror_array[@]}"; do
1400 mirror_cksum=$($LFS mirror read -N $id $tf | md5sum)
1401 [ "$ref_cksum" == "$mirror_cksum" ] &&
1402 { valid_mirror=$id; continue; }
1407 [ -z "$stale_mirror" ] && error "stale mirror doesn't exist"
1408 [ -z "$valid_mirror" ] && error "valid mirror doesn't exist"
1410 mirror_io resync $tf || error "resync failed"
1411 verify_flr_state $tf "ro"
1413 mirror_cksum=$($LFS mirror read -N $stale_mirror $tf | md5sum)
1414 [ "$file_cksum" = "$ref_cksum" ] || error "resync failed"
1416 # case 2: inject an error to make mirror_io exit after changing
1417 # the file state to sync_pending so that we can start a concurrent
1419 $MULTIOP $tf oO_WRONLY:w$((RANDOM % 1048576 + 1024))c
1420 verify_flr_state $tf "wp"
1422 mirror_io resync -e resync_start $tf && error "resync succeeded"
1423 verify_flr_state $tf "sp"
1425 # from sync_pending to write_pending
1426 $MULTIOP $tf oO_WRONLY:w$((RANDOM % 1048576 + 1024))c
1427 verify_flr_state $tf "wp"
1429 mirror_io resync -e resync_start $tf && error "resync succeeded"
1430 verify_flr_state $tf "sp"
1432 # from sync_pending to read_only
1433 mirror_io resync $tf || error "resync failed"
1434 verify_flr_state $tf "ro"
1436 run_test 38 "resync"
1439 local tf=$DIR/$tfile
1442 $LFS mirror create -N2 -E1m -c1 -S1M -E-1 $tf ||
1443 error "create PFL file $tf failed"
1445 verify_mirror_count $tf 2
1446 verify_comp_count $tf 4
1448 rm -f $tf || error "delete $tf failed"
1450 run_test 39 "check FLR+PFL (a.k.a. PFLR) creation"
1453 local tf=$DIR/$tfile
1456 for ops in "conv=notrunc" ""; do
1459 $LFS mirror create -N -E 2M -S 1M -E 4M -E -1 --flags=prefer \
1460 -N -E 1M -E 2M -E 4M -E -1 $tf ||
1461 error "create PFLR file $tf failed"
1462 dd if=/dev/zero of=$tf $ops bs=1M seek=2 count=1 ||
1463 error "write PFLR file $tf failed"
1465 lfs getstripe -vy $tf
1469 # file mirror state should be write_pending
1470 flags=$($LFS getstripe -v $tf | awk '/lcm_flags:/ { print $2 }')
1472 error "file mirror state $flags"
1473 # the 1st component (in mirror 1) should be inited
1474 verify_comp_attr lcme_flags $tf 0x10001 init
1475 # the 2nd component (in mirror 1) should be inited
1476 verify_comp_attr lcme_flags $tf 0x10002 init
1477 # the 3rd component (in mirror 1) should be uninited
1478 verify_comp_attr lcme_flags $tf 0x10003 prefer
1479 # the 4th component (in mirror 2) should be inited
1480 verify_comp_attr lcme_flags $tf 0x20004 init
1481 # the 5th component (in mirror 2) should be uninited
1482 verify_comp_attr lcme_flags $tf 0x20005 0
1483 # the 6th component (in mirror 2) should be stale
1484 verify_comp_attr lcme_flags $tf 0x20006 stale
1485 # the 7th component (in mirror 2) should be uninited
1486 if [[ x$ops = "xconv=notrunc" ]]; then
1487 verify_comp_attr lcme_flags $tf 0x20007 0
1488 elif [[ x$ops = "x" ]]; then
1489 verify_comp_attr lcme_flags $tf 0x20007 stale
1493 rm -f $tf || error "delete $tf failed"
1495 run_test 40 "PFLR rdonly state instantiation check"
1498 local tf=$DIR/$tfile
1501 echo " **create two FLR files $tf $tf-1"
1502 $LFS mirror create -N -E 2M -S 1M -E 4M -E -1 \
1503 -N -E 1M -E 2M -E 3M -E -1 $tf ||
1504 error "create PFLR file $tf failed"
1505 $LFS mirror create -N -E 2M -S 1M -E eof \
1506 -N -E 1M -E eof --flags prefer \
1507 -N -E 4m -E eof $tf-1 ||
1508 error "create PFLR file $tf-1 failed"
1510 # file should be in ro status
1511 echo " **verify files be RDONLY"
1512 verify_flr_state $tf "ro"
1513 verify_flr_state $tf-1 "ro"
1515 # write data in [0, 2M)
1516 dd if=/dev/zero of=$tf bs=1M count=2 conv=notrunc ||
1517 error "writing $tf failed"
1518 dd if=/dev/urandom of=$tf-1 bs=1M count=4 conv=notrunc ||
1519 error "writing $tf-1 failed"
1521 local sum0=$(cat $tf-1 | md5sum)
1523 echo " **verify files be WRITE_PENDING"
1524 verify_flr_state $tf "wp"
1525 verify_flr_state $tf-1 "wp"
1527 # file should have stale component
1528 echo " **verify files have stale component"
1529 $LFS getstripe $tf | grep lcme_flags | grep stale > /dev/null ||
1530 error "after writing $tf, it does not contain stale component"
1531 $LFS getstripe $tf-1 | grep lcme_flags | grep stale > /dev/null ||
1532 error "after writing $tf-1, it does not contain stale component"
1534 echo " **full resync"
1535 $LFS mirror resync $tf $tf-1 || error "mirror resync $tf $tf-1 failed"
1537 echo " **verify $tf-1 data consistency in all mirrors"
1539 local sum=$($LFS mirror read -N$i $tf-1 | md5sum)
1540 [[ "$sum" = "$sum0" ]] ||
1541 error "$tf-1.$i: checksum mismatch: $sum != $sum0"
1544 echo " **verify files be RDONLY"
1545 verify_flr_state $tf "ro"
1546 verify_flr_state $tf-1 "ro"
1548 # file should not have stale component
1549 echo " **verify files do not contain stale component"
1550 $LFS getstripe $tf | grep lcme_flags | grep stale &&
1551 error "after resyncing $tf, it contains stale component"
1552 $LFS getstripe $tf-1 | grep lcme_flags | grep stale &&
1553 error "after resyncing $tf, it contains stale component"
1555 # verify partial resync
1556 echo " **write $tf-1 for partial resync test"
1557 dd if=/dev/zero of=$tf-1 bs=1M count=2 conv=notrunc ||
1558 error "writing $tf-1 failed"
1560 echo " **only resync mirror 2"
1561 verify_flr_state $tf-1 "wp"
1562 $LFS mirror resync --only 2 $tf-1 ||
1563 error "resync mirror 2 of $tf-1 failed"
1564 verify_flr_state $tf "ro"
1566 # resync synced mirror
1567 echo " **resync mirror 2 again"
1568 $LFS mirror resync --only 2 $tf-1 ||
1569 error "resync mirror 2 of $tf-1 failed"
1570 verify_flr_state $tf "ro"
1571 echo " **verify $tf-1 contains stale component"
1572 $LFS getstripe $tf-1 | grep lcme_flags | grep stale > /dev/null ||
1573 error "after writing $tf-1, it does not contain stale component"
1575 echo " **full resync $tf-1"
1576 $LFS mirror resync $tf-1 || error "resync of $tf-1 failed"
1577 verify_flr_state $tf "ro"
1578 echo " **full resync $tf-1 again"
1579 $LFS mirror resync $tf-1 || error "resync of $tf-1 failed"
1580 echo " **verify $tf-1 does not contain stale component"
1581 $LFS getstripe $tf | grep lcme_flags | grep stale &&
1582 error "after resyncing $tf, it contains stale component"
1586 run_test 41 "lfs mirror resync check"
1589 [[ $OSTCOUNT -lt 4 ]] && skip "need >= 4 OSTs" && return
1593 local mirror_cmd="$LFS mirror verify"
1596 # create parent directory
1597 mkdir $td || error "mkdir $td failed"
1599 $mirror_cmd &> /dev/null && error "no file name given"
1600 $mirror_cmd $tf &> /dev/null && error "cannot stat file $tf"
1601 $mirror_cmd $td &> /dev/null && error "$td is not a regular file"
1603 # create mirrored files
1604 $LFS mirror create -N -E 4M -S 1M -E 10M -E EOF $tf ||
1605 error "create mirrored file $tf failed"
1606 $LFS mirror create -N -E 2M -S 1M -E EOF \
1607 -N -E 6M -E 8M -E EOF \
1608 -N -E 16M -E EOF $tf-1 ||
1609 error "create mirrored file $tf-1 failed"
1610 $LFS mirror create -N -c 2 -o 1,3 -N -S 2M -c -1 $tf-2 ||
1611 error "create mirrored file $tf-2 failed"
1613 # write data in [0, 10M)
1614 for i in $tf $tf-1 $tf-2; do
1615 yes | dd of=$i bs=1M count=10 iflag=fullblock conv=notrunc ||
1616 error "write $i failed"
1619 # resync the mirrored files
1620 $LFS mirror resync $tf-1 $tf-2 ||
1621 error "resync $tf-1 $tf-2 failed"
1623 # verify the mirrored files
1624 $mirror_cmd $tf-1 $tf-2 ||
1625 error "verify $tf-1 $tf-2 failed"
1627 get_mirror_ids $tf-1
1628 $mirror_cmd --only ${mirror_array[0]} $tf-1 &> /dev/null &&
1629 error "at least 2 mirror ids needed with '--only' option"
1630 $mirror_cmd --only ${mirror_array[0]},${mirror_array[1]} $tf-1 $tf-2 \
1632 error "'--only' option cannot be used upon multiple files"
1633 $mirror_cmd --only 65534,${mirror_array[0]},65535 $tf-1 &&
1634 error "invalid specified mirror ids"
1636 # change the content of $tf and merge it into $tf-1
1638 echo a | dd of=$tf bs=1M seek=$i conv=notrunc ||
1639 error "change $tf with seek=$i failed"
1640 echo b | dd of=$tf-1 bs=1M seek=$i conv=notrunc ||
1641 error "change $tf-1 with seek=$i failed"
1644 $LFS mirror resync $tf-1 || error "resync $tf-1 failed"
1645 $LFS mirror extend --no-verify -N -f $tf $tf-1 ||
1646 error "merge $tf into $tf-1 failed"
1648 # verify the mirrored files
1649 echo "Verify $tf-1 without -v option:"
1650 $mirror_cmd $tf-1 &&
1651 error "verify $tf-1 should fail" || echo "PASS"
1653 echo "Verify $tf-1 with -v option:"
1654 $mirror_cmd -v $tf-1 &&
1655 error "verify $tf-1 should fail"
1657 get_mirror_ids $tf-1
1658 echo "Verify $tf-1 with --only option:"
1659 $mirror_cmd -v --only ${mirror_array[1]},${mirror_array[-1]} $tf-1 &&
1660 error "verify $tf-1 with mirror ${mirror_array[1]} and" \
1661 "${mirror_array[-1]} should fail"
1663 $mirror_cmd --only ${mirror_array[0]},${mirror_array[1]} $tf-1 ||
1664 error "verify $tf-1 with mirror ${mirror_array[0]} and" \
1665 "${mirror_array[1]} should succeed"
1667 # set stale components in $tf-1
1668 for i in 0x40002 0x40003; do
1669 $LFS setstripe --comp-set -I$i --comp-flags=stale $tf-1 ||
1670 error "set stale flag on component $i failed"
1673 # verify the mirrored file
1674 echo "Verify $tf-1 with stale components:"
1675 $mirror_cmd -vvv $tf-1 ||
1676 error "verify $tf-1 with stale components should succeed"
1678 echo "Verify $tf-1 with stale components and --only option:"
1679 $mirror_cmd -vvv --only ${mirror_array[1]},${mirror_array[-1]} $tf-1 ||
1680 error "verify $tf-1 with mirror ${mirror_array[1]} and" \
1681 "${mirror_array[-1]} should succeed"
1683 run_test 42 "lfs mirror verify"
1685 # inactivate one OST && write && restore the OST
1689 local PARAM="osp.${FSNAME}-OST000${ost}-osc-M*.active"
1692 wait=$(do_facet $SINGLEMDS \
1693 "$LCTL get_param -n lod.*MDT0000-*.qos_maxage")
1694 wait=${wait%%[^0-9]*}
1696 echo " **deactivate OST$ost, waiting for $((wait*2+2)) seconds"
1697 $(do_facet $SINGLEMDS "$LCTL set_param -n $PARAM 0")
1698 # lod_qos_statfs_update needs 2*$wait seconds to refresh targets statfs
1699 sleep $(($wait * 2 + 2))
1700 echo " **write $file"
1701 dd if=/dev/zero of=$file bs=1M count=1 || error "write $file failed"
1702 echo " **restore activating OST$ost, waiting for $((wait*2+2)) seconds"
1703 $(do_facet $SINGLEMDS "$LCTL set_param -n $PARAM 1")
1704 sleep $((wait * 2 + 2))
1706 local flags=$($LFS getstripe -v $file | awk '/lcm_flags:/ { print $2 }')
1707 [ $flags = wp ] || error "file mirror state $flags != wp"
1711 [ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs" && return
1713 local tf=$DIR/$tfile
1717 ## mirror 0 ost (0, 1)
1718 ## mirror 1 ost (1, 2)
1719 ## mirror 2 ost (2, 0)
1720 $LFS mirror create -N -Eeof -c2 -o0,1 -N -Eeof -c2 -o1,2 \
1721 -N -Eeof -c2 -o2,0 $tf ||
1722 error "create 3 mirrors file $tf failed"
1724 ################## OST0 ###########################################
1726 echo " **verify components"
1727 verify_comp_attr lcme_flags $tf 0x10001 init,stale
1728 verify_comp_attr lcme_flags $tf 0x20002 init
1729 verify_comp_attr lcme_flags $tf 0x30003 init,stale
1732 echo " **resync $tf"
1733 $LFS mirror resync $tf
1734 flags=$($LFS getstripe -v $tf | awk '/lcm_flags:/ { print $2 }')
1735 [ $flags = ro ] || error "file mirror state $flags != ro"
1737 ################## OST1 ###########################################
1739 echo " **verify components"
1740 verify_comp_attr lcme_flags $tf 0x10001 init,stale
1741 verify_comp_attr lcme_flags $tf 0x20002 init,stale
1742 verify_comp_attr lcme_flags $tf 0x30003 init
1745 echo " **resync $tf"
1746 $LFS mirror resync $tf
1747 flags=$($LFS getstripe -v $tf | awk '/lcm_flags:/ { print $2 }')
1748 [ $flags = ro ] || error "file mirror state $flags != ro"
1750 ################## OST2 ###########################################
1752 echo " **verify components"
1753 verify_comp_attr lcme_flags $tf 0x10001 init
1754 verify_comp_attr lcme_flags $tf 0x20002 init,stale
1755 verify_comp_attr lcme_flags $tf 0x30003 init,stale
1757 run_test 43 "mirror pick on write"
1760 [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
1763 local tf=$DIR/$tdir/$tfile
1764 local tf1=$DIR/$tdir-1/$tfile-1
1766 $LFS setdirstripe -i 0 -c 1 $DIR/$tdir ||
1767 error "create directory failed"
1768 $LFS setdirstripe -i 1 -c 1 $DIR/$tdir-1 ||
1769 error "create remote directory failed"
1770 rm -f $tf $tf1 $tf.mirror~2
1771 # create file with 4 mirrors
1772 $LFS mirror create -N -E 2M -S 1M -E 4M -E -1 \
1773 -N -E 1M -E 2M -E 3M -E -1 -N2 $tf ||
1774 error "create PFLR file $tf failed"
1776 # file should be in ro status
1777 verify_flr_state $tf "ro"
1779 # write data in [0, 3M)
1780 dd if=/dev/urandom of=$tf bs=1M count=3 conv=notrunc ||
1781 error "writing $tf failed"
1783 verify_flr_state $tf "wp"
1785 # synchronize all mirrors of the file
1786 $LFS mirror resync $tf || error "mirror resync $tf failed"
1788 verify_flr_state $tf "ro"
1791 $LFS mirror split --mirror-id 1 -f $tf1 $tf ||
1792 error "split to $tf1 failed"
1794 local idx0=$($LFS getstripe -m $tf)
1795 local idx1=$($LFS getstripe -m $tf1)
1797 [[ x$idx0 == x0 ]] || error "$tf is not on MDT0"
1798 [[ x$idx1 == x1 ]] || error "$tf1 is not on MDT1"
1800 # verify mirror count
1801 verify_mirror_count $tf 3
1802 verify_mirror_count $tf1 1
1804 $LFS mirror split --mirror-id 2 $tf ||
1805 error "split mirror 2 failed"
1807 verify_mirror_count $tf 2
1808 verify_mirror_count $tf.mirror~2 1
1810 $LFS mirror split --mirror-id 3 -d $tf ||
1811 error "split and delte mirror 3 failed"
1812 verify_mirror_count $tf 1
1814 # verify splitted file contains the same content as the orig file does
1815 diff $tf $tf1 || error "splited file $tf1 diffs from $tf"
1816 diff $tf $tf.mirror~2 ||
1817 error "splited file $tf.mirror~2 diffs from $tf"
1819 run_test 44 "lfs mirror split check"
1822 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1824 local file=$DIR/$tdir/$tfile
1825 local dir=$DIR/$tdir/$dir
1826 local temp=$DIR/$tdir/template
1828 test_mkdir $DIR/$tdir
1830 $LFS setstripe -N -E1m -S1m -c2 -o0,1 -E2m -Eeof -N -E4m -Eeof \
1831 -N -E3m -S1m -Eeof -N -E8m -Eeof $file ||
1832 error "Create $file failed"
1834 verify_yaml_layout $file $file.copy $temp "1. FLR file"
1835 rm -f $file $file.copy
1837 $LFS setstripe -N -E1m -S1m -c2 -o0,1 -E2m -Eeof -N -E4m -Eeof \
1838 -N -E3m -S1m -Eeof -N -E8m --flags=prefer -Eeof $file ||
1839 error "Create $file failed"
1841 verify_yaml_layout $file $file.copy $temp "2. FLR file with flags"
1843 run_test 45 "Verify setstripe/getstripe with YAML with FLR file"
1850 $LFS setstripe --copy=$src $dst || error "setstripe $dst failed"
1852 local layout1=$(get_layout_param $src)
1853 local layout2=$(get_layout_param $dst)
1854 # compare their layout info
1855 [ "$layout1" == "$layout2" ] ||
1856 error "$msg_prefix $src <=> $dst layouts are not equal"
1860 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
1862 local file=$DIR/$tdir/$tfile
1863 test_mkdir $DIR/$tdir
1865 ########################### 1. PFL file #############################
1866 echo " ** 1. PFL file"
1868 $LFS setstripe -E1m -S 1M -c2 -o0,1 -E2m -c2 -E3m -o1,0 -E4m -c1 -E-1 \
1869 $file || error "1. Create PFL $file failed"
1872 verify_46 $file $file.copy "1. PFL file"
1874 ########################### 2. plain file ###########################
1875 echo " ** 2. plain file"
1877 $LFS setstripe -c2 -o0,1 -i1 $file ||
1878 error "2. Create plain $file failed"
1881 verify_46 $file $file.copy "2. plain file"
1883 ########################### 3. FLR file #############################
1884 echo " ** 3. FLR file"
1885 $LFS setstripe -N -E1m -S 1M -c2 -o0,1 -E4m -c1 -Eeof -N -E16m -Eeof \
1886 $file || error "3. Create FLR $file failed"
1889 verify_46 $file $file.copy "3. FLR file"
1891 local dir=$DIR/$tdir/dir
1892 ########################### 4. PFL dir ##############################
1893 echo " ** 4. PFL dir"
1895 $LFS setstripe -E1m -S 1M -c2 -E2m -c1 -E-1 $dir ||
1896 error "4. setstripe PFL $dir failed"
1898 test_mkdir $dir.copy
1899 verify_46 $dir $dir.copy "4. PFL dir"
1901 ########################### 5. plain dir ############################
1902 echo " ** 5. plain dir"
1903 $LFS setstripe -c2 -i-1 $dir || error "5. setstripe plain $dir failed"
1905 verify_46 $dir $dir.copy "5. plain dir"
1907 ########################### 6. FLR dir ##############################
1908 echo " ** 6. FLR dir"
1909 $LFS setstripe -N -E1m -S 1M -c2 -E2m -c1 -Eeof -N -E4m -Eeof $dir ||
1910 error "6. setstripe FLR $dir failed"
1912 verify_46 $dir $dir.copy "6. FLR dir"
1914 run_test 46 "Verify setstripe --copy option"
1917 [ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs" && return
1919 local file=$DIR/$tdir/$tfile
1924 test_mkdir $DIR/$tdir
1928 # mirror1: [comp0]ost0, [comp1]ost1 and ost2
1929 # mirror2: [comp2] , [comp3] should not use ost1 or ost2
1930 $LFS mirror create -N -E2m -c1 -o0 --flags=prefer -Eeof -c2 -o1,2 \
1931 -N -E2m -c1 -Eeof -c1 $file || error "create FLR $file failed"
1932 ids=($($LFS getstripe $file | awk '/lcme_id/{print $2}' | tr '\n' ' '))
1934 dd if=/dev/zero of=$file bs=1M count=3 || error "dd $file failed"
1935 $LFS mirror resync $file || error "resync $file failed"
1937 ost=$($LFS getstripe -I${ids[2]} $file | awk '/l_ost_idx/{print $5}')
1938 if [[ x$ost == "x0," ]]; then
1939 $LFS getstripe $file
1940 error "component ${ids[2]} objects allocated on $ost " \
1944 ost=$($LFS getstripe -I${ids[3]} $file | awk '/l_ost_idx/{print $5}')
1945 if [[ x$ost == "x1," || x$ost == "x2," ]]; then
1946 $LFS getstripe $file
1947 error "component ${ids[3]} objects allocated on $ost " \
1948 "shouldn't on OST1 or on OST2"
1953 # mirror1: [comp0] [comp1]
1954 # mirror2: [comp2] [comp3]
1955 # mirror3: [comp4] [comp5]
1956 # mirror4: [comp6] [comp7]
1957 $LFS mirror create -N4 -E1m -c1 -Eeof -c1 $file ||
1958 error "create FLR $file failed"
1959 ids=($($LFS getstripe $file | awk '/lcme_id/{print $2}' | tr '\n' ' '))
1961 dd if=/dev/zero of=$file bs=1M count=3 || error "dd $file failed"
1962 $LFS mirror resync $file || error "resync $file failed"
1964 for ((i = 0; i < 6; i++)); do
1965 osts[$i]=$($LFS getstripe -I${ids[$i]} $file |
1966 awk '/l_ost_idx/{print $5}')
1968 # comp[0],comp[2],comp[4] should use different osts
1969 if [[ ${osts[0]} == ${osts[2]} || ${osts[0]} == ${osts[4]} ||
1970 ${osts[2]} == ${osts[4]} ]]; then
1971 $LFS getstripe $file
1972 error "component ${ids[0]}, ${ids[2]}, ${ids[4]} have objects "\
1973 "allocated on duplicated OSTs"
1975 # comp[1],comp[3],comp[5] should use different osts
1976 if [[ ${osts[1]} == ${osts[3]} || ${osts[1]} == ${osts[5]} ||
1977 ${osts[3]} == ${osts[5]} ]]; then
1978 $LFS getstripe $file
1979 error "component ${ids[1]}, ${ids[3]}, ${ids[5]} have objects "\
1980 "allocated on duplicated OSTs"
1985 run_test 47 "Verify mirror obj alloc"
1988 [ $MDS1_VERSION -lt $(version_code 2.11.55) ] &&
1989 skip "Need MDS version at least 2.11.55"
1991 local tf=$DIR/$tfile
1994 echo " ** create 2 mirrors FLR file $tf"
1995 $LFS mirror create -N -E2M -Eeof --flags prefer \
1996 -N -E1M -Eeof $tf ||
1997 error "create FLR file $tf failed"
2000 dd if=/dev/urandom of=$tf bs=1M count=3 || error "write $tf failed"
2001 verify_flr_state $tf "wp"
2003 local sum0=$(md5sum < $tf)
2005 echo " ** resync the file"
2006 $LFS mirror resync $tf
2008 echo " ** snapshot mirror 2"
2009 $LFS setstripe --comp-set -I 0x20003 --comp-flags=nosync $tf
2011 echo " ** write it again"
2012 dd if=/dev/urandom of=$tf bs=1M count=3 || error "write $tf failed"
2013 echo " ** resync it again"
2014 $LFS mirror resync $tf
2016 verify_flr_state $tf "wp"
2017 verify_comp_attr lcme_flags $tf 0x20003 nosync,stale
2019 local sum1=$($LFS mirror read -N1 $tf | md5sum)
2020 local sum2=$($LFS mirror read -N2 $tf | md5sum)
2022 echo " ** verify mirror 2 doesn't change"
2023 echo "original checksum: $sum0"
2024 echo "mirror 1 checksum: $sum1"
2025 echo "mirror 2 checksum: $sum2"
2026 [[ $sum0 = $sum2 ]] ||
2027 error "original checksum: $sum0, mirror 2 checksum: $sum2"
2028 echo " ** mirror 2 stripe info"
2029 $LFS getstripe -v --mirror-index=2 $tf
2031 echo " ** resync mirror 2"
2032 $LFS mirror resync --only 2 $tf
2034 verify_flr_state $tf "ro"
2035 verify_comp_attr lcme_flags $tf 0x20003 nosync,^stale
2037 sum1=$($LFS mirror read -N1 $tf | md5sum)
2038 sum2=$($LFS mirror read -N2 $tf | md5sum)
2040 echo " ** verify mirror 2 resync-ed"
2041 echo "original checksum: $sum0"
2042 echo "mirror 1 checksum: $sum1"
2043 echo "mirror 2 checksum: $sum2"
2044 [[ $sum1 = $sum2 ]] ||
2045 error "mirror 1 checksum: $sum1, mirror 2 checksum: $sum2"
2046 echo " ** mirror 2 stripe info"
2047 $LFS getstripe -v --mirror-index=2 $tf
2049 run_test 48 "Verify snapshot mirror"
2051 ctrl_file=$(mktemp /tmp/CTRL.XXXXXX)
2052 lock_file=$(mktemp /var/lock/FLR.XXXXXX)
2057 local fsize=$(stat --printf=%s $tf)
2059 while [ -f $ctrl_file ]; do
2060 local off=$((RANDOM << 8))
2061 local len=$((RANDOM << 5 + 131072))
2063 [ $((off + len)) -gt $fsize ] && {
2064 fsize=$((off + len))
2065 echo "Extending file size to $fsize .."
2068 flock -s $lock_file -c \
2069 "$MULTIOP $tf oO_WRONLY:z${off}w${len}c" ||
2071 error "failed writing to $off:$len"; }
2072 sleep 0.$((RANDOM % 2 + 1))
2079 while [ -f $ctrl_file ]; do
2080 flock -s $lock_file -c "cat $tf &> /dev/null" ||
2081 { rm -f $ctrl_file; error "read failed"; }
2082 sleep 0.$((RANDOM % 2 + 1))
2089 options=("" "-e resync_start" "-e delay_before_copy -d 1" "" "")
2091 exec 200<>$lock_file
2092 while [ -f $ctrl_file ]; do
2093 local lock_taken=false
2094 local index=$((RANDOM % ${#options[@]}))
2095 local cmd="mirror_io resync ${options[$index]}"
2097 [ "${options[$index]}" = "" ] && cmd="$LFS mirror resync"
2099 [ $((RANDOM % 4)) -eq 0 ] && {
2105 echo -n "resync file $tf with '$cmd' .."
2107 if [[ $lock_taken = "true" ]]; then
2108 flock -x 200 -c "$cmd $tf &> /dev/null" &&
2109 echo "done" || echo "failed"
2112 $cmd $tf &> /dev/null && echo "done" || echo "failed"
2115 sleep 0.$((RANDOM % 8 + 1))
2120 local tf=$DIR/$tfile
2121 local tf2=$DIR2/$tfile
2122 local tf3=$DIR3/$tfile
2124 $LFS setstripe -E 1M -S 1M -E 2M -c 2 -E 4M -E 16M -E eof $tf
2125 $LFS setstripe -E 2M -S 1M -E 6M -c 2 -E 8M -E 32M -E eof $tf-2
2126 $LFS setstripe -E 4M -c 2 -E 8M -E 64M -E eof $tf-3
2128 $LFS mirror extend -N -f $tf-2 $tf ||
2129 error "merging $tf-2 into $tf failed"
2130 $LFS mirror extend -N -f $tf-3 $tf ||
2131 error "merging $tf-3 into $tf failed"
2133 mkdir -p $MOUNT2 && mount_client $MOUNT2
2135 mkdir -p $MOUNT3 && mount_client $MOUNT3
2137 verify_flr_state $tf3 "ro"
2139 #define OBD_FAIL_FLR_RANDOM_PICK_MIRROR 0x1A03
2140 $LCTL set_param fail_loc=0x1A03
2142 local mds_idx=mds$(($($LFS getstripe -m $tf) + 1))
2143 do_facet $mds_idx $LCTL set_param fail_loc=0x1A03
2147 write_file_200 $tf &
2153 write_file_200 $tf2 &
2156 read_file_200 $tf2 &
2159 resync_file_200 $tf3 &
2163 [ "$SLOW" = "yes" ] && sleep_time=360
2164 while [ $sleep_time -gt 0 -a -f $ctrl_file ]; do
2171 echo "Waiting ${pids[@]}"
2174 umount_client $MOUNT2
2175 umount_client $MOUNT3
2179 # resync and verify mirrors
2180 mirror_io resync $tf
2183 local csum=$($LFS mirror read -N ${mirror_array[0]} $tf | md5sum)
2184 for id in ${mirror_array[@]:1}; do
2185 [ "$($LFS mirror read -N $id $tf | md5sum)" = "$csum" ] ||
2186 error "checksum error for mirror $id"
2191 run_test 200 "stress test"
2193 cleanup_test_201() {
2195 do_facet $SINGLEMDS $LCTL --device $MDT0 changelog_deregister $CL_USER
2197 umount_client $MOUNT2
2201 local delay=${RESYNC_DELAY:-5}
2203 MDT0=$($LCTL get_param -n mdc.*.mds_server_uuid |
2204 awk '{ gsub(/_UUID/,""); print $1 }' | head -n1)
2206 trap cleanup_test_201 EXIT
2208 CL_USER=$(do_facet $SINGLEMDS $LCTL --device $MDT0 \
2209 changelog_register -n)
2211 mkdir -p $MOUNT2 && mount_client $MOUNT2
2215 local log=$($LFS changelog $MDT0 $index | grep FLRW)
2216 [ -z "$log" ] && { sleep 1; continue; }
2218 index=$(echo $log | awk '{print $1}')
2219 local ts=$(date -d "$(echo $log | awk '{print $3}')" "+%s" -u)
2220 local fid=$(echo $log | awk '{print $6}' | sed -e 's/t=//')
2221 local file=$($LFS fid2path $MOUNT2 $fid 2> /dev/null)
2224 [ -z "$file" ] && continue
2226 local now=$(date +%s)
2228 echo "file: $file $fid was modified at $ts, now: $now, " \
2229 "will be resynced at $((ts+delay))"
2231 [ $now -lt $((ts + delay)) ] && sleep $((ts + delay - now))
2233 mirror_io resync $file
2234 echo "$file resync done"
2239 run_test 201 "FLR data mover"
2242 [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return
2244 local tf=$DIR/$tfile
2247 $LFS setstripe -E 1M -S 1M -c 1 $tf
2248 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
2249 verify_comp_attr stripe-count $tf ${ids[0]} 1
2251 $LFS setstripe --component-add -E 2M -c -1 $tf
2252 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
2253 verify_comp_attr stripe-count $tf ${ids[0]} 1
2254 verify_comp_attr stripe-count $tf ${ids[1]} -1
2256 dd if=/dev/zero of=$tf bs=1M count=2
2257 ids=($($LFS getstripe $tf | awk '/lcme_id/{print $2}' | tr '\n' ' '))
2258 verify_comp_attr stripe-count $tf ${ids[0]} 1
2259 verify_comp_attr stripe-count $tf ${ids[1]} $OSTCOUNT
2261 run_test 202 "lfs setstripe --add-component wide striping"
2264 [ $MDS1_VERSION -lt $(version_code 2.11.55) ] &&
2265 skip "Need MDS version at least 2.11.55"
2266 [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs"
2268 local tf=$DIR/$tfile
2271 $LFS mirror create -N2 -c1 $tf || error "create FLR file $tf"
2272 #delete first mirror
2273 $LFS mirror split --mirror-id=1 -d $tf || error "delete first mirror"
2276 local old_id=$($LFS getstripe --mirror-id=2 -I $tf)
2277 local count=$($LFS getstripe --mirror-id=2 -c $tf) ||
2278 error "getstripe count of mirror 2"
2279 [[ x$count = x1 ]] || error "mirror 2 stripe count $count is not 1"
2281 #extend a mirror with 2 OSTs
2282 $LFS mirror extend -N -c2 $tf || error "extend mirror"
2285 local new_id=$($LFS getstripe --mirror-id=2 -I $tf)
2286 count=$($LFS getstripe --mirror-id=2 -c $tf) ||
2287 error "getstripe count of mirror 2"
2288 [[ x$oldid = x$newid ]] ||
2289 error "mirror 2 changed ID from $old_id to $new_id"
2290 [[ x$count = x1 ]] || error "mirror 2 stripe count $count is not 1"
2292 count=$($LFS getstripe --mirror-id=3 -c $tf) ||
2293 error "getstripe count of mirror 3"
2294 [[ x$count = x2 ]] || error "mirror 3 stripe count $count is not 2"
2296 run_test 203 "mirror file preserve mirror ID"
2298 # Simple test of FLR + self-extending layout, SEL in non-primary mirror
2300 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
2301 skip "skipped for lustre < $SEL_VER"
2303 local comp_file=$DIR/$tdir/$tfile
2307 test_mkdir $DIR/$tdir
2309 # first mirror is 0-10M, then 10M-(-1), second mirror is 1M followed
2310 # by extension space to -1
2311 $LFS setstripe -N -E 10M -E-1 -N -E 1M -E-1 -z64M $comp_file ||
2312 error "Create $comp_file failed"
2314 # Write to first component, extending & staling second mirror
2315 dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc ||
2316 error "dd to extend + stale failed"
2318 $LFS getstripe $comp_file
2320 flg_opts="--component-flags init,stale"
2321 found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l)
2322 [ $found -eq 1 ] || error "write: Second comp end incorrect"
2324 flg_opts="--component-flags extension"
2325 found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l)
2326 [ $found -eq 1 ] || error "write: Third comp start incorrect"
2328 # mirror resync should not change the extents
2329 $LFS mirror resync $comp_file
2331 flg_opts="--component-flags init"
2332 found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l)
2333 [ $found -eq 1 ] || error "resync: Second comp end incorrect"
2335 flg_opts="--component-flags extension"
2336 found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l)
2337 [ $found -eq 1 ] || error "resync: Third comp start incorrect"
2339 sel_layout_sanity $comp_file 5
2343 run_test 204a "FLR write/stale/resync tests with self-extending mirror"
2345 # Simple test of FLR + self-extending layout, SEL in primary mirror
2347 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
2348 skip "skipped for lustre < $SEL_VER"
2350 local comp_file=$DIR/$tdir/$tfile
2354 test_mkdir $DIR/$tdir
2356 # first mirror is 1M followed by extension space to -1, second mirror
2357 # is 0-10M, then 10M-(-1),
2358 $LFS setstripe -N -E 1M -E-1 -z64M -N -E 10M -E-1 $comp_file ||
2359 error "Create $comp_file failed"
2361 # Write to first component, extending first component & staling
2363 dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc ||
2364 error "dd to extend + stale failed"
2366 $LFS getstripe $comp_file
2368 flg_opts="--component-flags init"
2369 found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l)
2370 [ $found -eq 1 ] || error "write: First comp end incorrect"
2372 flg_opts="--component-flags extension"
2373 found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l)
2374 [ $found -eq 1 ] || error "write: Second comp start incorrect"
2376 flg_opts="--component-flags init,stale"
2377 found=$($LFS find --component-end 10M $flg_opts $comp_file | wc -l)
2378 [ $found -eq 1 ] || error "write: First mirror comp flags incorrect"
2380 # This component is staled because it overlaps the extended first
2381 # component of the primary mirror, even though it doesn't overlap
2382 # the actual write - thus not inited.
2383 flg_opts="--component-flags stale"
2384 found=$($LFS find --component-start 10M $flg_opts $comp_file | wc -l)
2385 [ $found -eq 1 ] || error "write: Second mirror comp flags incorrect"
2387 # mirror resync should not change the extents
2388 $LFS mirror resync $comp_file
2390 $LFS getstripe $comp_file
2392 flg_opts="--component-flags init"
2393 found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l)
2394 [ $found -eq 1 ] || error "resync: First comp end incorrect"
2396 flg_opts="--component-flags extension"
2397 found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l)
2398 [ $found -eq 1 ] || error "resync: Second comp start incorrect"
2400 flg_opts="--component-flags init"
2401 found=$($LFS find --component-end 10M $flg_opts $comp_file | wc -l)
2402 [ $found -eq 1 ] || error "resync: First mirror comp flags incorrect"
2404 flg_opts="--component-flags init"
2405 found=$($LFS find --component-start 10M $flg_opts $comp_file | wc -l)
2406 [ $found -eq 1 ] || error "resync: Second mirror comp flags incorrect"
2408 sel_layout_sanity $comp_file 5
2412 run_test 204b "FLR write/stale/resync tests with self-extending primary"
2414 # FLR + SEL failed extension & component removal
2415 # extension space in second mirror
2417 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
2418 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
2419 skip "skipped for lustre < $SEL_VER"
2421 local comp_file=$DIR/$tdir/$tfile
2424 local ost_name=$(ostname_from_index $ost_idx1)
2426 test_mkdir $DIR/$tdir
2428 # first mirror is is 0-10M, then 10M-(-1), second mirror is 0-1M, then
2429 # extension space from 1M to 1G, then normal space to -1
2430 $LFS setstripe -N -E 10M -E-1 -N -E 1M -E 1G -i $ost_idx1 -z 64M \
2431 -E -1 $comp_file || error "Create $comp_file failed"
2433 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
2436 # write to first comp (0 - 10M) of mirror 1, extending + staling
2437 # first + second comp of mirror 2
2438 dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc
2441 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=0
2444 [ $RC -eq 0 ] || error "dd to extend + stale failed"
2446 $LFS getstripe $comp_file
2448 found=$($LFS find --component-start 0m --component-end 1m \
2449 --comp-flags init,stale $comp_file | wc -l)
2450 [ $found -eq 1 ] || error "write: First mirror comp incorrect"
2452 found=$($LFS find --component-start 1m --component-end EOF \
2453 --comp-flags stale,^init $comp_file | wc -l)
2454 [ $found -eq 1 ] || error "write: Second mirror comp incorrect"
2456 local mirror_id=$($LFS getstripe --component-start=1m \
2457 --component-end=EOF $comp_file | \
2458 grep lcme_mirror_id | awk '{ print $2 }')
2460 [[ $mirror_id -eq 2 ]] ||
2461 error "component not in correct mirror? $mirror_id"
2463 $LFS mirror resync $comp_file
2465 $LFS getstripe $comp_file
2467 # component dimensions should not change from resync
2468 found=$($LFS find --component-start 1m --component-end EOF \
2469 --component-flags init $comp_file | wc -l)
2470 [ $found -eq 1 ] || error "resync: Second mirror comp incorrect"
2472 sel_layout_sanity $comp_file 4
2476 run_test 204c "FLR write/stale/resync test with component removal"
2478 # Successful repeated component in primary mirror
2480 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
2481 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
2482 skip "skipped for lustre < $SEL_VERSION"
2484 local comp_file=$DIR/$tdir/$tfile
2487 wait_delete_completed
2489 test_mkdir $DIR/$tdir
2491 # first mirror is 64M followed by extension space to -1, second mirror
2492 # is 0-10M, then 10M-(-1)
2493 $LFS setstripe -N -E-1 -z64M -N -E 10M -E-1 $comp_file ||
2494 error "Create $comp_file failed"
2496 local ost_idx1=$($LFS getstripe -I65537 -i $comp_file)
2497 local ost_name=$(ostname_from_index $ost_idx1)
2498 # degrade OST for first comp so we won't extend there
2499 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
2500 obdfilter.$ost_name.degraded=1
2503 # Write beyond first component, causing repeat & stale second mirror
2504 dd if=/dev/zero bs=1M count=1 seek=66 of=$comp_file conv=notrunc
2507 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
2508 obdfilter.$ost_name.degraded=0
2511 [ $RC -eq 0 ] || error "dd to repeat & stale failed"
2513 $LFS getstripe $comp_file
2515 found=$($LFS find --component-start 64m --component-end 128m \
2516 --component-flags init $comp_file | wc -l)
2517 [ $found -eq 1 ] || error "write: Repeat comp incorrect"
2519 local ost_idx2=$($LFS getstripe --component-start=64m \
2520 --component-end=128m --component-flags=init \
2522 [[ $ost_idx1 -eq $ost_idx2 ]] && error "$ost_idx1 == $ost_idx2"
2523 local mirror_id=$($LFS getstripe --component-start=64m \
2524 --component-end=128m --component-flags=init \
2525 $comp_file | grep lcme_mirror_id | awk '{ print $2 }')
2526 [[ $mirror_id -eq 1 ]] ||
2527 error "component not in correct mirror: $mirror_id, not 1"
2529 $LFS mirror resync $comp_file
2531 $LFS getstripe $comp_file
2533 # component dimensions should not change from resync
2534 found=$($LFS find --component-start 0m --component-end 64m \
2535 --component-flags init $comp_file | wc -l)
2536 [ $found -eq 1 ] || error "resync: first comp incorrect"
2537 found=$($LFS find --component-start 64m --component-end 128m \
2538 --component-flags init $comp_file | wc -l)
2539 [ $found -eq 1 ] || error "resync: repeat comp incorrect"
2541 sel_layout_sanity $comp_file 5
2545 run_test 204d "FLR write/stale/resync sel test with repeated comp"
2547 # Successful repeated component, SEL in non-primary mirror
2549 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
2550 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
2551 skip "skipped for lustre < $SEL_VERSION"
2553 local comp_file=$DIR/$tdir/$tfile
2556 wait_delete_completed
2559 test_mkdir $DIR/$tdir
2561 # first mirror is is 0-100M, then 100M-(-1), second mirror is extension
2562 # space to -1 (-z 64M, so first comp is 0-64M)
2563 # Note: we have to place both 1st components on OST0, otherwise 2 OSTs
2564 # will be not enough - one will be degraded, the other is used on
2565 # an overlapping mirror.
2566 $LFS setstripe -N -E 100M -i 0 -E-1 -N -E-1 -i 0 -z 64M $comp_file ||
2567 error "Create $comp_file failed"
2569 local ost_idx1=$($LFS getstripe --component-start=0 \
2570 --component-end=64m -i $comp_file)
2571 local ost_name=$(ostname_from_index $ost_idx1)
2572 # degrade OST for first comp of 2nd mirror so we won't extend there
2573 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
2574 obdfilter.$ost_name.degraded=1
2577 $LFS getstripe $comp_file
2579 # Write to first component, stale & instantiate second mirror components
2580 # overlapping with the written component (0-100M);
2581 dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc
2584 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
2585 obdfilter.$ost_name.degraded=0
2587 $LFS getstripe $comp_file
2589 [ $RC -eq 0 ] || error "dd to repeat & stale failed"
2591 found=$($LFS find --component-start 0m --component-end 64m \
2592 --component-flags init,stale $comp_file | wc -l)
2593 [ $found -eq 1 ] || error "write: first comp incorrect"
2595 # was repeated due to degraded ost
2596 found=$($LFS find --component-start 64m --component-end 128m \
2597 --component-flags init,stale $comp_file | wc -l)
2598 [ $found -eq 1 ] || error "write: repeated comp incorrect"
2600 local ost_idx2=$($LFS getstripe --component-start=64m \
2601 --component-end=128m --component-flags=init \
2603 [[ $ost_idx1 -eq $ost_idx2 ]] && error "$ost_idx1 == $ost_idx2"
2604 local mirror_id=$($LFS getstripe --component-start=0m \
2605 --component-end=64m --component-flags=init \
2606 $comp_file | grep lcme_mirror_id | awk '{ print $2 }')
2607 [[ $mirror_id -eq 2 ]] ||
2608 error "component not in correct mirror? $mirror_id"
2610 $LFS mirror resync $comp_file
2612 $LFS getstripe $comp_file
2614 # component dimensions should not change from resync
2615 found=$($LFS find --component-start 0m --component-end 64m \
2616 --component-flags init,^stale $comp_file | wc -l)
2617 [ $found -eq 1 ] || error "resync: first comp incorrect"
2618 found=$($LFS find --component-start 64m --component-end 128m \
2619 --component-flags init,^stale $comp_file | wc -l)
2620 [ $found -eq 1 ] || error "resync: repeated comp incorrect"
2622 sel_layout_sanity $comp_file 5
2626 run_test 204e "FLR write/stale/resync sel test with repeated comp"
2628 # FLR + SEL: failed repeated component, SEL in non-primary mirror
2630 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
2631 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
2632 skip "skipped for lustre < $SEL_VERSION"
2634 local comp_file=$DIR/$tdir/$tfile
2637 wait_delete_completed
2639 test_mkdir $DIR/$tdir
2641 pool_add $TESTNAME || error "Pool creation failed"
2642 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
2644 # first mirror is is 0-100M, then 100M-(-1), second mirror is extension
2645 # space to -1 (-z 64M, so first comp is 0-64M)
2646 $LFS setstripe -N -E 100M -E-1 -N --pool="$TESTNAME" \
2647 -E-1 -c 1 -z 64M $comp_file || error "Create $comp_file failed"
2649 local ost_name0=$(ostname_from_index 0)
2650 local ost_name1=$(ostname_from_index 1)
2652 # degrade both OSTs in pool, so we'll try to repeat, then fail and
2653 # extend original comp
2654 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name0.degraded=1
2655 do_facet ost2 $LCTL set_param -n obdfilter.$ost_name1.degraded=1
2658 # a write to the 1st component, 100M length, which will try to stale
2659 # the first 100M of mirror 2, attempting to extend its 0-64M component
2660 dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc
2663 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name0.degraded=0
2664 do_facet ost2 $LCTL set_param -n obdfilter.$ost_name1.degraded=0
2667 [ $RC -eq 0 ] || error "dd to extend mirror comp failed"
2669 $LFS getstripe $comp_file
2671 found=$($LFS find --component-start 0m --component-end 128m \
2672 --component-flags init,stale $comp_file | wc -l)
2673 [ $found -eq 1 ] || error "write: First mirror comp incorrect"
2675 local mirror_id=$($LFS getstripe --component-start=0m \
2676 --component-end=128m --component-flags=init \
2677 $comp_file | grep lcme_mirror_id | awk '{ print $2 }')
2679 [[ $mirror_id -eq 2 ]] ||
2680 error "component not in correct mirror? $mirror_id, not 2"
2682 $LFS mirror resync $comp_file
2684 $LFS getstripe $comp_file
2686 # component dimensions should not change from resync
2687 found=$($LFS find --component-start 0m --component-end 128m \
2688 --component-flags init,^stale $comp_file | wc -l)
2689 [ $found -eq 1 ] || error "resync: First mirror comp incorrect"
2691 sel_layout_sanity $comp_file 4
2695 run_test 204f "FLR write/stale/resync sel w/forced extension"
2698 check_and_cleanup_lustre