3 # Run select tests by setting ONLY, or as arguments to the script.
4 # Skip specific tests by setting EXCEPT.
9 LUSTRE=${LUSTRE:-$(dirname $0)/..}
10 . $LUSTRE/tests/test-framework.sh
14 # bug number for skipped test:
15 ALWAYS_EXCEPT="$SANITY_PFL_EXCEPT "
16 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
18 # Skip tests for PPC that fail frequently
19 if [[ $(uname -m) = ppc64 ]]; then
20 # bug number: LU-13186 LU-13205 LU-13207 LU-13186
21 ALWAYS_EXCEPT+=" 14 16a 16b 17"
24 if [[ "$ost1_FSTYPE" == "zfs" ]]; then
30 check_and_setup_lustre
32 if [[ "$MDS1_VERSION" -lt $(version_code 2.9.51) ]]; then
33 skip_env "Need MDS version at least 2.9.51"
36 [ $UID -eq 0 -a $RUNAS_ID -eq 0 ] &&
37 error "\$RUNAS_ID set to 0, but \$UID is also 0!"
38 check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS
41 rm -rf $DIR/[Rdfs][0-9]*
46 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
48 local comp_file=$DIR/$tdir/$tfile
49 local rw_len=$((3 * 1024 * 1024)) # 3M
54 $LFS setstripe -E 1m -S 1M -c 1 -E -1 -c 1 $comp_file ||
55 error "Create $comp_file failed"
57 #instantiate all components, so that objs are allocted
58 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
60 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
61 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
63 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
65 small_write $comp_file $rw_len || error "Verify RW failed"
67 rm -f $comp_file || error "Delete $comp_file failed"
69 run_test 0a "Create full components file, no reused OSTs"
72 [[ $($LCTL get_param mdc.*.import |
73 grep "connect_flags:.*overstriping") ]] ||
74 skip "server does not support overstriping"
75 large_xattr_enabled || skip_env "no large xattr support"
79 local comp_file=$DIR/$tdir/$tfile
83 $LFS setstripe -E -1 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
84 error "Create $comp_file failed"
86 local count=$($LFS getstripe -I1 -c $comp_file)
87 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
88 error "stripe count of first component is shrinked to $count"
90 rm -f $comp_file || error "Delete $comp_file failed"
92 # Create file with 1.1*LOV_MAX_STRIPE_COUNT stripes should succeed
93 $LFS setstripe -E 1m -C $((LOV_MAX_STRIPE_COUNT / 10)) -E -1 \
94 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
95 error "Create $comp_file failed"
97 local count=$($LFS getstripe -I2 -c $comp_file)
98 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
99 error "stripe count of second component is shrinked to $count"
101 rm -f $comp_file || error "Delete $comp_file failed"
103 # Create file with 3*LOV_MAX_STRIPE_COUNT stripes should fail
104 $LFS setstripe -E 200G -C $LOV_MAX_STRIPE_COUNT \
105 -E 500G -C $LOV_MAX_STRIPE_COUNT \
106 -E -1 -C $LOV_MAX_STRIPE_COUNT $comp_file &&
107 error "Create $comp_file succeeded"
109 rm -f $comp_file || error "Delete $comp_file failed"
111 run_test 0b "Verify comp stripe count limits"
114 [[ $($LCTL get_param mdc.*.import |
115 grep "connect_flags:.*overstriping") ]] ||
116 skip "server does not support overstriping"
117 [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
118 skip "skipped for lustre < $SEL_VER"
120 large_xattr_enabled || skip_env "no large xattr support"
124 local comp_file=$DIR/$tdir/$tfile
126 test_mkdir $DIR/$tdir
128 $LFS setstripe -E -1 -C $LOV_MAX_STRIPE_COUNT -z 128M $comp_file ||
129 error "Create $comp_file failed"
131 local count=$($LFS getstripe -I1 -c $comp_file)
132 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
133 error "stripe count is shrinked to $count"
135 run_test 0c "Verify SEL comp stripe count limits"
138 (( $MDS1_VERSION > $(version_code 2.14.50.115) )) ||
139 skip_env "Need MDS version at least 2.14.50.115"
146 # Create parent directory
149 # Component end must be a multiple of stripe size
150 # and a multiple of 64KiB to align with the minimum
152 # Values below 4096 are assumed to be in KiB units.
153 $LFS setstripe -E 127 $tf-1 > /dev/null 2>&1 &&
154 error "creating $tf-1 with '-E 127' should fail"
156 $LFS setstripe -E 128 -S 512 $tf-1 > /dev/null 2>&1 &&
157 error "creating $tf-1 with '-E 128 -S 512' should fail"
159 $LFS setstripe -E 128 $tf-1 ||
160 error "creating $tf-1 failed"
162 yes | dd bs=1K count=129 iflag=fullblock of=$tf-1 &&
163 error "writing to $tf-1 should fail"
165 yes | dd bs=1K count=128 iflag=fullblock of=$tf-1 ||
166 error "writing to $tf-1 failed"
168 comp_end=$($LFS getstripe -I1 -E $tf-1)
169 stripe_size=$($LFS getstripe -I1 -S $tf-1)
171 [[ $comp_end == $((128 * 1024)) ]] ||
172 error "incorrect component end '$comp_end' for $tf-1"
174 [[ $stripe_size == $((128 * 1024)) ]] ||
175 error "incorrect stripe size '$stripe_size' for $tf-1"
177 rm $tf-1 || error "removing $tf-1 failed"
179 # The stripe size must be a multiple of 64KiB.
180 # Values below 4096 are assumed to be in KiB units.
181 $LFS setstripe -E -1 -S 2047 $tf-2 > /dev/null 2>&1 &&
182 error "creating $tf-2 with '-S 2047' should fail"
184 $LFS setstripe -E -1 -S 2048 $tf-2 ||
185 error "creating $tf-2 failed"
187 stripe_size=$($LFS getstripe -I1 -S $tf-2)
188 [[ $stripe_size == $((2048 * 1024)) ]] ||
189 error "incorrect stripe size '$stripe_size' for $tf-2"
191 rm $tf-2 || error "removing $tf-2 failed"
193 run_test 0d "Verify comp end and stripe size"
196 local comp_file=$DIR/$tdir/$tfile
197 local rw_len=$((3 * 1024 * 1024)) # 3M
199 test_mkdir $DIR/$tdir
202 $LFS setstripe -E 1m -S 1m -o 0 -E -1 -o 0 $comp_file ||
203 error "Create $comp_file failed"
205 #instantiate all components, so that objs are allocted
206 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
208 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
209 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
211 [ $ost_idx1 -ne $ost_idx2 ] && error "$ost_idx1 != $ost_idx2"
213 small_write $comp_file $rw_len || error "Verify RW failed"
215 rm -f $comp_file || error "Delete $comp_file failed"
217 run_test 1a "Create full components file, reused OSTs"
219 # test overstriping (>1 stripe/OST within a component)
221 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
222 [[ $($LCTL get_param mdc.*.import |
223 grep "connect_flags:.*overstriping") ]] ||
224 skip "server does not support overstriping"
226 local comp_file=$DIR/$tdir/$tfile
227 local rw_len=$((3 * 1024 * 1024)) # 3M
229 test_mkdir $DIR/$tdir
231 $LFS setstripe -E 1m -S 1m -o 0,0 -E -1 -o 1,1,0,0 $comp_file ||
232 error "Create $comp_file failed"
234 #instantiate all components, so that objs are allocted
235 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=1M
237 $LFS getstripe $comp_file
238 local OSTS_1=$($LFS getstripe -I1 $comp_file | grep -o 'l_ost_idx.*' |
239 awk -e '{print $2}' | tr "\n" "\0")
240 local OSTS_2=$($LFS getstripe -I2 $comp_file | grep -o 'l_ost_idx.*' |
241 awk -e '{print $2}' | tr "\n" "\0")
245 [ "$OSTS_1" = "0,0," ] || error "incorrect OSTs($OSTS_1) in component 1"
246 [ "$OSTS_2" = "1,1,0,0," ] ||
247 error "incorrect OSTs($OSTS_2) in component 2"
249 small_write $comp_file $rw_len || error "Verify RW failed"
251 rm -f $comp_file || error "Delete $comp_file failed"
253 run_test 1b "Create full components file, overstriping in components"
255 # test overstriping with max stripe count
257 [[ $($LCTL get_param mdc.*.import |
258 grep "connect_flags:.*overstriping") ]] ||
259 skip "server does not support overstriping"
260 large_xattr_enabled || skip_env "no large xattr support"
264 local comp_file=$DIR/$tdir/$tfile
265 local rw_len=$((3 * 1024 * 1024)) # 3M
267 test_mkdir $DIR/$tdir
269 $LFS setstripe -E 1m -C 10 -E 10M -C 100 -E -1 \
270 -C $LOV_MAX_STRIPE_COUNT $comp_file ||
271 error "Create $comp_file failed"
273 # Seek & write in to last component so all objects are allocated
274 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=20000
276 local count=$($LFS getstripe -c -I1 $DIR/$tdir/$tfile)
277 [ $count -eq 10 ] || error "comp1 stripe count $count, should be 10"
278 count=$($LFS getstripe -c -I2 $DIR/$tdir/$tfile)
279 [ $count -eq 100 ] || error "comp2 stripe count $count, should be 100"
280 count=$($LFS getstripe -c -I3 $DIR/$tdir/$tfile)
281 [ $count -eq $LOV_MAX_STRIPE_COUNT ] ||
282 error "comp4 stripe count $count != $LOV_MAX_STRIPE_COUNT"
284 small_write $comp_file $rw_len || error "Verify RW failed"
286 rm -f $comp_file || error "Delete $comp_file failed"
288 run_test 1c "Test overstriping w/max stripe count"
291 local comp_file=$DIR/$tdir/$tfile
292 local rw_len=$((5 * 1024 * 1024)) # 5M
295 test_mkdir $DIR/$tdir
298 multiop $comp_file oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
299 error "create failed $comp_file"
301 $LFS setstripe --component-add $params $comp_file ||
302 error "Add component to $comp_file failed"
304 check_component_count $comp_file 1
306 dd if=/dev/zero of=$comp_file bs=1M count=1 > /dev/null 2>&1 ||
307 error "Write first component failed"
308 dd if=$comp_file of=/dev/null bs=1M count=1 > /dev/null 2>&1 ||
309 error "Read first component failed"
311 dd if=/dev/zero of=$comp_file bs=1M count=2 > /dev/null 2>&1 &&
312 error "Write beyond component should fail"
313 dd if=$comp_file of=/dev/null bs=1M count=2 > /dev/null 2>&1 ||
314 error "Read beyond component should short read, not fail"
316 $LFS setstripe --component-add -E 2M -S 1M -c 1 $comp_file ||
317 error "Add component to $comp_file failed"
319 check_component_count $comp_file 2
321 $LFS setstripe --component-add -E -1 -c 3 $comp_file ||
322 error "Add last component to $comp_file failed"
324 check_component_count $comp_file 3
326 small_write $comp_file $rw_len || error "Verify RW failed"
328 rm -f $comp_file || error "Delete $comp_file failed"
332 base_test_2 "-E 1m -S 1m"
334 run_test 2a "Add components to existing file"
337 base_test_2 "-E 1m -L mdt"
339 run_test 2b "Add components w/DOM to existing file"
341 del_comp_and_verify() {
348 if [ $id == "init" -o $id == "^init" ]; then
349 opt="--component-flags="
352 $LFS setstripe --component-del $opt$id $comp_file ||
353 error "Delete component $id from $comp_file failed"
355 local comp_cnt=$($LFS getstripe --component-count $comp_file)
356 if grep -q "has no stripe info" <<< "$comp_cnt" ; then
359 [ $comp_cnt -ne $left ] && error "$comp_cnt != $left"
361 $CHECKSTAT -s $size $comp_file || error "size != $size"
365 local comp_file=$DIR/$tdir/$tfile
368 test_mkdir $DIR/$tdir
371 $LFS setstripe $params $comp_file || error "Create $comp_file failed"
373 check_component_count $comp_file 3
375 dd if=/dev/zero of=$comp_file bs=1M count=2
377 $LFS setstripe --component-del -I 2 $comp_file &&
378 error "Component deletion makes hole"
380 del_comp_and_verify $comp_file 3 2 $((2 * 1024 * 1024))
381 del_comp_and_verify $comp_file 2 1 $((1 * 1024 * 1024))
382 del_comp_and_verify $comp_file 1 0 0
384 rm -f $comp_file || error "Delete $comp_file failed"
386 $LFS setstripe -E 1M -S 1M -E 16M -E -1 $comp_file ||
387 error "Create second $comp_file failed"
389 del_comp_and_verify $comp_file "^init" 1 0
390 del_comp_and_verify $comp_file "init" 0 0
391 rm -f $comp_file || error "Delete second $comp_file failed"
395 base_test_3 "-E 1M -S 1M -E 64M -c 2 -E -1 -c 3"
397 run_test 3a "Delete components from existing file"
400 base_test_3 "-E 1M -L mdt -E 64M -S 1M -c 2 -E -1 -c 3"
402 run_test 3b "Delete components w/DOM from existing file"
405 skip "Not supported in PFL"
406 # In PFL project, only LCME_FL_INIT is supported, and it can't
407 # be altered by application.
409 run_test 4 "Modify component flags in existing file"
412 local parent=$DIR/$tdir
413 local comp_file=$DIR/$tdir/$tfile
414 local subdir=$parent/subdir
419 # set default layout to parent directory
420 $LFS setstripe -E 64M -c 2 -i 0 -E -1 -c 4 -i 0 $parent ||
421 error "Set default layout to $parent failed"
423 # create file under parent
424 touch $comp_file || error "Create $comp_file failed"
425 check_component_count $comp_file 2
427 #instantiate all components, so that objs are allocted
428 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=65k
430 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
431 [ $ost_idx -ne 0 ] &&
432 error "component 1 ost_idx $ost_idx != 0"
434 ost_idx=$($LFS getstripe -I2 -i $comp_file)
435 [ $ost_idx -ne 0 ] &&
436 error "component 2 ost_idx $ost_idx != 0"
438 # create subdir under parent
439 mkdir -p $subdir || error "Create subdir $subdir failed"
441 comp_cnt=$($LFS getstripe -d --component-count $subdir)
442 [ $comp_cnt -ne 2 ] && error "subdir $comp_cnt != 2"
444 # create file under subdir
445 touch $subdir/$tfile || error "Create $subdir/$tfile failed"
447 check_component_count $subdir/$tfile 2
449 # delete default layout setting from parent
450 $LFS setstripe -d $parent ||
451 error "Delete default layout from $parent failed"
453 comp_cnt=$($LFS getstripe -d --component-count $parent)
454 [ $comp_cnt -ne 0 ] && error "$comp_cnt isn't 0"
456 rm -f $comp_file || error "Delete $comp_file failed"
457 rm -f $subdir/$tfile || error "Delete $subdir/$tfile failed"
458 rm -r $subdir || error "Delete subdir $subdir failed"
459 rmdir $parent || error "Delete dir $parent failed"
461 run_test 5 "Inherit composite layout from parent directory"
464 local comp_file=$DIR/$tdir/$tfile
466 test_mkdir $DIR/$tdir
469 $LFS setstripe -c 1 -S 128K $comp_file ||
470 error "Create v1 $comp_file failed"
472 check_component_count $comp_file 0
474 dd if=/dev/urandom of=$comp_file bs=1M count=5 oflag=sync ||
475 error "Write to v1 $comp_file failed"
477 local old_chksum=$(md5sum $comp_file)
479 # Migrate v1 to composite
480 $LFS migrate -E 1M -S 512K -c 1 -E -1 -S 1M -c 2 $comp_file ||
481 error "Migrate(v1 -> composite) $comp_file failed"
483 check_component_count $comp_file 2
485 local chksum=$(md5sum $comp_file)
486 [ "$old_chksum" != "$chksum" ] &&
487 error "(v1 -> compsoite) $old_chksum != $chksum"
489 # Migrate composite to composite
490 $LFS migrate -E 1M -S 1M -c 2 -E 4M -S 1M -c 2 \
491 -E -1 -S 3M -c 3 $comp_file ||
492 error "Migrate(compsoite -> composite) $comp_file failed"
494 check_component_count $comp_file 3
496 chksum=$(md5sum $comp_file)
497 [ "$old_chksum" != "$chksum" ] &&
498 error "(composite -> compsoite) $old_chksum != $chksum"
500 # Migrate composite to v1
501 $LFS migrate -c 2 -S 2M $comp_file ||
502 error "Migrate(composite -> v1) $comp_file failed"
504 check_component_count $comp_file 0
506 chksum=$(md5sum $comp_file)
507 [ "$old_chksum" != "$chksum" ] &&
508 error "(composite -> v1) $old_chksum != $chksum"
510 rm -f $comp_file || error "Delete $comp_file failed"
512 run_test 6 "Migrate composite file"
515 test_mkdir $DIR/$tdir
516 chmod 0777 $DIR/$tdir || error "chmod $tdir failed"
518 local comp_file=$DIR/$tdir/$tfile
519 $RUNAS $LFS setstripe -E 1M -S 1M -c 1 $comp_file ||
520 error "Create composite file $comp_file failed"
522 $RUNAS $LFS setstripe --component-add -E 64M -c 4 $comp_file ||
523 error "Add component to $comp_file failed"
525 $RUNAS $LFS setstripe --component-del -I 2 $comp_file ||
526 error "Delete component from $comp_file failed"
528 $RUNAS $LFS setstripe --component-add -E -1 -c 5 $comp_file ||
529 error "Add last component to $comp_file failed"
531 rm $comp_file || error "Delete composite failed"
533 run_test 7 "Add/Delete/Create composite file by non-privileged user"
536 local parent=$DIR/$tdir
539 mkdir_on_mdt0 $parent
541 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c 2 -S 2M \
542 -E -1 -c 4 -S 4M $parent ||
543 error "Set default layout to $parent failed"
545 bash rundbench -C -D $parent 2 || error "dbench failed"
547 rm -fr $parent || error "Delete dir $parent failed"
549 run_test 8 "Run dbench over composite files"
552 local comp_file=$DIR/$tdir/$tfile
554 test_mkdir $DIR/$tdir
557 $LFS setstripe -E 1M -S 1M -E -1 -c 1 $comp_file ||
558 error "Create $comp_file failed"
560 check_component_count $comp_file 2
562 replay_barrier $SINGLEMDS
564 # instantiate the 2nd component
565 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
567 local f1=$($LFS getstripe -I2 $comp_file |
568 awk '/l_fid:/ {print $7}')
569 echo "before MDS recovery, the ost fid of 2nd component is $f1"
572 local f2=$($LFS getstripe -I2 $comp_file |
573 awk '/l_fid:/ {print $7}')
574 echo "after MDS recovery, the ost fid of 2nd component is $f2"
575 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
577 run_test 9 "Replay layout extend object instantiation"
580 echo $($LFS getstripe $1 |
581 awk '$1 == "lcm_entry_count:" { printf("%d", $2) }
582 $1 == "lcme_extent.e_start:" { printf("[%#lx", $2) }
583 $1 == "lcme_extent.e_end:" { printf(",%s]", $2) }')
587 local parent=$DIR/$tdir
590 save_layout_restore_at_exit $MOUNT
594 # mount root on $MOUNT2 if FILESET is set
595 if [ -n "$FILESET" ]; then
596 FILESET="" mount_client $MOUNT2 ||
597 error "mount $MOUNT2 fail"
601 $LFS setstripe -d $root || error "clear root layout"
603 # set root composite layout
604 $LFS setstripe -E 2M -c 1 -S 1M -E 16M -c2 -S 2M \
605 -E -1 -c 4 -S 4M $root ||
606 error "Set root layout failed"
608 if [ "$root" == "$MOUNT2" ]; then
609 umount_client $MOUNT2 ||
610 error "umount $MOUNT2 fail"
614 # set a different layout for parent
615 $LFS setstripe -E -1 -c 1 -S 1M $parent ||
616 error "set $parent layout failed"
619 local f1_entry=$(component_dump $parent/file1)
621 # delete parent's layout
622 $LFS setstripe -d $parent || error "Clear $parent layout failed"
625 local f2_entry=$(component_dump $parent/file2)
627 # verify layout inheritance
629 local f1_expect="1[0,EOF]"
630 local f2_expect="3[0,2097152][0x200000,16777216][0x1000000,EOF]"
632 echo "f1 expect=$f1_expect"
633 echo "f1 get =$f1_entry"
634 echo "f2 expect=$f2_expect"
635 echo "f2 get =$f2_entry"
637 [ x$f1_expect != x$f1_entry ] &&
638 error "$parent/file1 does not inherite parent layout"
639 [ x$f2_expect != x$f2_entry ] &&
640 error "$parent/file2 does not inherite root layout"
644 run_test 10 "Inherit composite template from root"
647 local comp_file=$DIR/$tdir/$tfile
648 test_mkdir $DIR/$tdir
651 # only 1st component instantiated
652 $LFS setstripe -E 1M -S 1M -E 2M -E 3M -E -1 $comp_file ||
653 error "Create $comp_file failed"
655 local f1=$($LFS getstripe -I1 $comp_file | grep "l_fid")
656 [[ -z $f1 ]] && error "1: 1st component uninstantiated"
657 local f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
658 [[ -n $f2 ]] && error "1: 2nd component instantiated"
659 local f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
660 [[ -n $f3 ]] && error "1: 3rd component instantiated"
661 local f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
662 [[ -n $f4 ]] && error "1: 4th component instantiated"
664 # the first 2 components instantiated
665 # Truncate to exact start of new component - LU-12586
666 $TRUNCATE $comp_file $((1024*1024*1))
668 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
669 [[ -z $f2 ]] && error "2: 2nd component uninstantiated"
670 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
671 [[ -n $f3 ]] && error "2: 3rd component instantiated"
672 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
673 [[ -n $f4 ]] && error "2: 4th component instantiated"
675 # the first 3 components instantiated
676 $TRUNCATE $comp_file $((1024*1024*3 - 1))
677 $TRUNCATE $comp_file $((1024*1024*1+1))
679 f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
680 [[ -z $f2 ]] && error "3: 2nd component uninstantiated"
681 f3=$($LFS getstripe -I3 $comp_file | grep "l_fid")
682 [[ -z $f3 ]] && error "3: 3rd component uninstantiated"
683 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
684 [[ -n $f4 ]] && error "3: 4th component instantiated"
686 # all 4 components instantiated, using append write
687 dd if=/dev/zero of=$comp_file bs=1k count=1 seek=2k
689 rwv -f $comp_file -w -a -n 2 $((1024*1023)) 1
692 f4=$($LFS getstripe -I4 $comp_file | grep "l_fid")
693 [[ -z $f4 ]] && error "4: 4th component uninstantiated"
697 run_test 11a "Verify component instantiation with write/truncate"
700 [ $OSTCOUNT -lt 4 ] && skip "needs >= 4 OSTs"
702 local file=$DIR/$tdir/$tfile
704 test_mkdir $DIR/$tdir
707 $LFS setstripe -E 1m -E 1g -c 4 -E eof $DIR/$tdir ||
708 error "setstripe dir $DIR/$tdir failed"
709 expand_truncate_test $file ||
710 error "expand_truncate_test failed on $file"
712 run_test 11b "truncate file set file size correctly"
715 [ $OSTCOUNT -lt 3 ] && skip "needs >= 3 OSTs"
717 local file=$DIR/$tdir/$tfile
718 test_mkdir $DIR/$tdir
721 # specify ost list for component
722 $LFS setstripe -E 1M -S 1M -c 2 -o 0,1 -E 2M -c 2 -o 1,2 \
723 -E 3M -c 2 -o 2,1 -E 4M -c 1 -i 2 -E -1 $file ||
724 error "Create $file failed"
726 # clear lod component cache
727 stop $SINGLEMDS || error "stop MDS"
728 local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
729 start $SINGLEMDS $MDT_DEV $MDS_MOUNT_OPTS || error "start MDS"
731 # instantiate all components
732 $TRUNCATE $file $((1024*1024*4+1))
734 #verify object alloc order
735 local o1=$($LFS getstripe -I1 $file |
736 awk '/l_ost_idx:/ {printf("%d",$5)}')
737 [[ $o1 != "01" ]] && error "$o1 is not 01"
739 local o2=$($LFS getstripe -I2 $file |
740 awk '/l_ost_idx:/ {printf("%d",$5)}')
741 [[ $o2 != "12" ]] && error "$o2 is not 12"
743 local o3=$($LFS getstripe -I3 $file |
744 awk '/l_ost_idx:/ {printf("%d",$5)}')
745 [[ $o3 != "21" ]] && error "$o3 is not 21"
747 local o4=$($LFS getstripe -I4 $file |
748 awk '/l_ost_idx:/ {printf("%d",$5)}')
749 [[ $o4 != "2" ]] && error "$o4 is not 2"
753 run_test 12 "Verify ost list specification"
755 test_13() { # LU-9311
756 [ $OSTCOUNT -lt 8 ] && skip "needs >= 8 OSTs"
758 local file=$DIR/$tfile
760 local dd_size=$(($dd_count * 1024 * 1024))
764 $LFS setstripe -E 1M -S 1M -c 1 -E 2M -c 2 -E -1 -c -1 -i 1 $file ||
765 error "Create $file failed"
766 dd if=/dev/zero of=$file bs=1M count=$dd_count
767 real_size=$(stat -c %s $file)
768 [ $real_size -eq $dd_size ] ||
769 error "dd actually wrote $real_size != $dd_size bytes"
773 run_test 13 "shouldn't reprocess granted resent request"
776 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
777 local file=$DIR/$tdir/$tfile
778 test_mkdir -p $DIR/$tdir
781 $LFS setstripe -E1m -c1 -S1m --pool="pool1" -E2m \
782 -E4m -c2 -S2m --pool="pool2" -E-1 $file ||
783 error "Create $file failed"
785 # check --pool inheritance
787 pool="$($LFS getstripe -I2 --pool $file)"
788 [ x"$pool" != "xpool1" ] && $LFS getstripe -I2 $file &&
789 error "$file: component 2 doesn't have poolname pool1"
790 pool="$($LFS getstripe -I4 --pool $file)"
791 [ x"$pool" != "xpool2" ] && $LFS getstripe -I4 $file &&
792 error "$file: component 4 doesn't have poolname pool2"
794 #check --stripe-count inheritance
796 count="$($LFS getstripe -I2 -c $file)"
797 [ $count -ne 1 ] && $LFS getstripe -I2 $file &&
798 error "$file: component 2 doesn't have 1 stripe_count"
799 count="$($LFS getstripe -I4 -c $file)"
800 [ $count -ne 2 ] && $LFS getstripe -I4 $file &&
801 error "$file: component 4 doesn't have 2 stripe_count"
803 #check --stripe-size inheritance
805 size="$($LFS getstripe -I2 -S $file)"
806 [ $size -ne $((1024*1024)) ] && $LFS getstripe -I2 $file &&
807 error "$file: component 2 doesn't have 1M stripe_size"
808 size="$($LFS getstripe -I4 -S $file)"
809 [ $size -ne $((1024*1024*2)) ] && $LFS getstripe -I4 $file &&
810 error "$file: component 4 doesn't have 2M stripe_size"
814 run_test 14 "Verify setstripe poolname/stripe_count/stripe_size inheritance"
817 local parent=$DIR/$tdir
822 $LFS setstripe -d $parent || error "delete default layout"
824 $LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
825 $LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
826 test_mkdir $parent/subdir
827 $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c -1 $parent/subdir ||
828 error "setstripe to subdir"
829 $LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
830 $LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
833 local found=$($LFS find --component-start +2M -E -15M $parent | wc -l)
834 [ $found -eq 0 ] || error "start+2M, end-15M, $found != 0"
837 found=$($LFS find --component-start +2M -E -35M $parent | wc -l)
838 [ $found -eq 2 ] || error "start+2M, end-35M, $found != 2"
841 found=$($LFS find --component-start +4M -E -eof $parent | wc -l)
842 [ $found -eq 1 ] || error "start+4M, end-eof, $found != 1"
844 local flg_opts="--component-flags init"
846 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
848 error "before write: start=1M, end=10M, flag=init, $found != 0"
850 dd if=/dev/zero of=$parent/f1 bs=1M count=2 ||
851 error "dd $parent/f1 failed"
854 found=$($LFS find --component-start 1M -E 10M $flg_opts $parent | wc -l)
856 error "after write: start=1M, end=10M, flag=init, $found != 1"
858 local ext_opts="--component-start -1M -E +5M"
859 # parent, subdir, f3, f4
860 found=$($LFS find $ext_opts $parent | wc -l)
861 [ $found -eq 4 ] || error "start-1M, end+5M, $found != 4"
863 local cnt_opts="--component-count +2"
865 found=$($LFS find $ext_opts $cnt_opts $parent | wc -l)
866 [ $found -eq 1 ] || error "start-1M, end+5M, count+2, $found != 1"
869 found=$($LFS find $ext_opts $cnt_opts $flg_opts $parent | wc -l)
871 error "start-1M, end+5M, count+2, flag=init, $found != 0"
874 found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
876 error "start-1M, end+5M, !count+2, flag=init, $found != 2"
878 # check last component stripe count
879 if [ $OSTCOUNT -gt 1 ]; then
880 touch $parent/subdir/f5
881 $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
882 found=$($LFS find $parent/subdir -c $OSTCOUNT)
883 [[ "$found" == "$parent/subdir/f5" ]] ||
884 error "got '$found' with stripe_count=$OSTCOUNT, not f5"
887 run_test 15 "Verify component options for lfs find"
890 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
891 large_xattr_enabled || skip_env "ea_inode feature disabled"
893 local file=$DIR/$tdir/$tfile
894 local dir=$DIR/$tdir/dir
895 local temp=$DIR/$tdir/template
897 test_mkdir $DIR/$tdir
899 #####################################################################
901 # set stripe for source file
902 $LFS setstripe -E1m -S 1M -c2 -o0,1 -E2m -c2 -E3m -o1,0 -E4m -c1 -E-1 \
903 $file || error "Create $file failed"
906 verify_yaml_layout $file $file.copy $temp "1. PFL file"
908 #####################################################################
910 # set stripe for source file
912 $LFS setstripe -c2 -o0,1 -i1 $file || error "Create $file failed"
916 verify_yaml_layout $file $file.copy $temp "2. plain file"
918 #####################################################################
920 # set stripe for source dir
922 $LFS setstripe -E1m -S 1M -c2 -E2m -c1 -E-1 $dir ||
923 error "setstripe $dir failed"
927 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
929 #####################################################################
931 # set stripe for source dir
932 $LFS setstripe -c2 -i-1 $dir || error "setstripe $dir failed"
935 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
937 run_test 16a "Verify setstripe/getstripe with YAML config file"
940 [[ $($LCTL get_param mdc.*.import |
941 grep "connect_flags:.*overstriping") ]] ||
942 skip "server does not support overstriping"
943 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
944 [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
945 skip_env "too many osts, skipping"
946 large_xattr_enabled || skip_env "ea_inode feature disabled"
950 local file=$DIR/$tdir/$tfile
951 local dir=$DIR/$tdir/dir
952 local temp=$DIR/$tdir/template
953 # We know OSTCOUNT < (LOV_MAX_STRIPE_COUNT / 2), so this is overstriping
954 local large_count=$((LOV_MAX_STRIPE_COUNT / 2 + 10))
957 test_mkdir $DIR/$tdir
959 #####################################################################
960 # 1. PFL file, overstriping in first comps
961 # set stripe for source file
962 $LFS setstripe -E1m -S 1M -o0,0 -E2m -o1,1 -E3m -C $large_count -E-1 \
963 $file || error "Create $file failed"
966 verify_yaml_layout $file $file.copy $temp "1. PFL file"
968 #####################################################################
969 # 2. plain file + overstriping
970 # set stripe for source file
972 $LFS setstripe -C $large_count -i1 $file || error "Create $file failed"
976 verify_yaml_layout $file $file.copy $temp "2. plain file"
978 #####################################################################
979 # 3. PFL dir + overstriping
980 # set stripe for source dir
982 $LFS setstripe -E1m -S 1M -o 0,0 -E2m -C $large_count -E-1 $dir ||
983 error "setstripe $dir failed"
987 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
989 #####################################################################
990 # 4. plain dir + overstriping
991 # set stripe for source dir
992 $LFS setstripe -C $large_count $dir || error "setstripe $dir failed"
995 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
997 run_test 16b "Verify setstripe/getstripe with YAML config file + overstriping"
1000 (( $MDS1_VERSION >= $(version_code 2.13.53.205) )) ||
1001 skip "need MDS version at least 2.13.53.205"
1003 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1005 local file=$DIR/$tdir/$tfile
1006 local dir=$DIR/$tdir/dir
1007 local temp=$DIR/$tdir/template
1009 test_mkdir $DIR/$tdir
1011 #####################################################################
1013 # set stripe for source file
1014 $LFS setstripe -E256M -S 1M -c2 -o0,1 -z 64M -E-1 -o1,0 -z 128M \
1015 $file || error "Create $file failed"
1018 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1020 #####################################################################
1022 # set stripe for source dir
1024 $LFS setstripe -E256M -S 1M -c2 -z 64M -E-1 -z 128M \
1025 $dir || error "setstripe $dir failed"
1027 test_mkdir $dir.copy
1028 echo "2. SEL template on dir"
1029 verify_yaml_layout $dir $dir.copy $temp.dir "2. PFL dir"
1031 run_test 16c "Verify setstripe/getstripe for SEL layout with YAML config file"
1034 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1036 local file=$DIR/$tdir/$tfile
1037 local dir=$DIR/$tdir/dir
1038 local temp=$DIR/$tdir/template
1040 test_mkdir $DIR/$tdir
1042 #####################################################################
1044 # set stripe for source file
1045 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $file ||
1046 error "Create $file failed"
1049 verify_yaml_layout $file $file.copy $temp "1. DOM file"
1051 #####################################################################
1053 # set stripe for source dir
1055 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $dir || error "Create $dir failed"
1057 test_mkdir $dir.copy
1059 verify_yaml_layout $dir $dir.copy $temp.dir "2. DOM dir"
1061 run_test 16d "Verify setstripe/getstripe for DOM layout with YAML config file"
1065 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1066 local file=$DIR/$tdir/$tfile
1067 test_mkdir -p $DIR/$tdir
1070 $LFS setstripe -E 1M -S 1M -E 2M -c 2 -E -1 -c -1 $file ||
1071 error "Create $file failed"
1073 local s1=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1074 local s2=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1075 local s3=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1076 echo "1st init: comp size 1:$s1 2:$s2 3:$s3"
1078 # init 2nd component
1079 $TRUNCATE $file $((1024*1024+1))
1080 local s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1081 local s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1082 echo "2nd init: comp size 1:$s1n 2:$s2n 3:$s3"
1084 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1085 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1087 # init 3rd component
1088 $TRUNCATE $file $((1024*1024*2+1))
1089 s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1090 s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1091 local s3n=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1092 echo "3rd init: comp size 1:$s1n 2:$s2n 3:$s3n"
1094 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1095 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1096 [ $s3 -lt $s3n ] || error "3rd comp size $s3 should < $s3n"
1098 run_test 17 "Verify LOVEA grows with more component inited"
1100 check_distribution() {
1104 local obj_min_one=$((OSTCOUNT - 1))
1106 objs=$($LFS getstripe $file |
1107 awk '/l_ost_idx:/ { print $5 }' | wc -l)
1108 let ave=$((objs / OSTCOUNT))
1110 # collect objects per OST distribution
1111 $LFS getstripe $file | awk '/l_ost_idx:/ { print $5 }' | tr -d "," |
1112 (inuse=( $(for i in $(seq 0 $obj_min_one); do echo 0; done) )
1114 let inuse[$O]=$((1 + ${inuse[$O]}))
1117 # verify object distribution varies no more than +-1
1118 for idx in $(seq 0 $obj_min_one); do
1119 let dif=$((${inuse[$idx]} - ave))
1121 if [ "$dif" -gt 1 ]; then
1122 echo "OST${idx}: ${inuse[$idx]} objects"
1123 error "bad distribution on OST${idx}"
1129 local file1=$DIR/${tfile}-1
1130 local file2=$DIR/${tfile}-2
1131 local file3=$DIR/${tfile}-3
1133 rm -f $file1 $file2 $file3
1135 $LFS setstripe -E 1m -S 1m $file1 ||
1136 error "Create $file1 failed"
1137 $LFS setstripe -E 1m -S 1m $file2 ||
1138 error "Create $file2 failed"
1139 $LFS setstripe -E 1m -S 1m $file3 ||
1140 error "Create $file3 failed"
1142 local objs=$((OSTCOUNT+1))
1143 for comp in $(seq 1 $OSTCOUNT); do
1144 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file1 ||
1145 error "Add component to $file1 failed 2"
1146 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file2 ||
1147 error "Add component to $file2 failed 2"
1148 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file3 ||
1149 error "Add component to $file3 failed 2"
1152 $LFS setstripe --component-add -E -1 -c -1 $file1 ||
1153 error "Add component to $file1 failed 3"
1154 $LFS setstripe --component-add -E -1 -c -1 $file2 ||
1155 error "Add component to $file2 failed 3"
1156 $LFS setstripe --component-add -E -1 -c -1 $file3 ||
1157 error "Add component to $file3 failed 3"
1159 # Instantiate all components
1160 dd if=/dev/urandom of=$file1 bs=1M count=$((objs+1)) ||
1161 error "dd failed for $file1"
1162 dd if=/dev/urandom of=$file2 bs=1M count=$((objs+1)) ||
1163 error "dd failed for $file2"
1164 dd if=/dev/urandom of=$file3 bs=1M count=$((objs+1)) ||
1165 error "dd failed for $file3"
1167 check_distribution $file1
1168 check_distribution $file2
1169 check_distribution $file3
1172 run_test 18 "check component distribution"
1176 local already_created=${2:-0}
1177 local rw_len=$((3 * 1024 * 1024)) # 3M
1181 if [ $already_created != 1 ]; then
1182 test_mkdir -p $DIR/$tdir
1183 $LFS setstripe --extension-size 64M -c 1 -E -1 $comp_file ||
1184 error "Create $comp_file failed"
1187 # write past end of first component, so it is extended
1188 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=127 conv=notrunc ||
1189 error "dd to extend failed"
1191 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1192 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1194 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1195 [ $ost_idx2 -ne "-1" ] && error "second component init $ost_idx2"
1197 flg_opts="--comp-flags init"
1198 found=$($LFS find --comp-start 0 -E 128M $flg_opts $comp_file | wc -l)
1199 [ $found -eq 1 ] || error "Write: Extended first component not found"
1201 flg_opts="--comp-flags extension"
1202 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1203 [ $found -eq 1 ] || error "Write: second component not found"
1205 found=$($LFS find -z 64M $comp_file | wc -l)
1206 [ $found -eq 1 ] || error "component not found by ext size"
1208 found=$($LFS find --extension-size +63M $comp_file | wc -l)
1209 [ $found -eq 1 ] || error "component not found by +ext size"
1211 found=$($LFS find --ext-size -65M $comp_file | wc -l)
1212 [ $found -eq 1 ] || error "component not found by -ext size"
1214 found=$($LFS find -z 65M $comp_file | wc -l)
1215 [ $found -eq 0 ] || error "component found by wrong ext size"
1217 found=$($LFS find -z +65M $comp_file | wc -l)
1218 [ $found -eq 0 ] || error "component found by wrong +ext size"
1220 found=$($LFS find -z -63M $comp_file | wc -l)
1221 [ $found -eq 0 ] || error "component found by wrong -ext size"
1223 found=$($LFS find ! -z 64M $comp_file | wc -l)
1224 [ $found -eq 0 ] || error "component found by negation of ext size"
1226 found=$($LFS find ! -z +63M $comp_file | wc -l)
1227 [ $found -eq 0 ] || error "component found by negation of +ext size"
1229 found=$($LFS find ! -z -65M $comp_file | wc -l)
1230 [ $found -eq 0 ] || error "component found by negation of -ext size"
1232 found=$($LFS find ! -z 65M $comp_file | wc -l)
1234 error "component not found by negation of wrong ext size"
1236 found=$($LFS find ! -z +65M $comp_file | wc -l)
1238 error "component not found by negation of wrong +ext size"
1240 found=$($LFS find ! -z -63M $comp_file | wc -l)
1242 error "component not found by negation of wrong -ext size"
1244 found=$($LFS find -S +1M $comp_file | wc -l)
1245 [ $found -eq 0 ] || error "component found by wrong +stripe size"
1247 found=$($LFS find -c 1 $comp_file | wc -l)
1248 [ $found -eq 1 ] || error "component not found by stripe count"
1250 small_write $comp_file $rw_len || error "Verify RW failed"
1252 sel_layout_sanity $comp_file 2
1255 # Self-extending PFL tests
1257 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1258 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1259 skip "skipped for lustre < $SEL_VER"
1261 test19_io_base $DIR/$tdir/$tfile
1263 run_test 19a "Simple test of extension behavior"
1265 # Same as 19a, but with default layout set on directory rather than on file
1267 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1268 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1269 skip "skipped for lustre < $SEL_VER"
1271 local comp_file=$DIR/$tdir/$tfile
1272 local comp_dir=$DIR/$tdir/$tdir
1276 test_mkdir -p $DIR/$tdir
1277 $LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
1278 error "Setstripe on $DIR/$tdir failed"
1280 # check inheritance for a sub-dir and a file
1281 test_mkdir $comp_dir
1282 found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
1283 [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
1285 flg_opts="--comp-flags extension"
1286 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
1287 [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
1291 flg_opts="--comp-flags init"
1292 found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
1293 [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
1295 flg_opts="--comp-flags extension"
1296 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
1297 [ $found -eq 1 ] || error "File Inheritance: Second component not found"
1299 test19_io_base $comp_file 1
1301 run_test 19b "Simple test of SEL as default layout"
1303 # Test behavior when seeking deep in a file
1305 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1306 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1307 skip "skipped for lustre < $SEL_VER"
1309 local comp_file=$DIR/$tdir/$tfile
1313 test_mkdir -p $DIR/$tdir
1315 $LFS setstripe -z 128M -E 1G -E -1 $comp_file ||
1316 error "Create $comp_file failed"
1318 # write past end of first component, so it is extended
1319 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 conv=notrunc ||
1320 error "dd to extend failed"
1322 flg_opts="--comp-flags init"
1323 found=$($LFS find --comp-start 0M -E 256M $flg_opts $comp_file | wc -l)
1324 [ $found -eq 1 ] || error "Write: first extension component not found"
1326 flg_opts="--comp-flags extension,^init"
1327 found=$($LFS find --comp-start 256M -E 1024M $flg_opts $comp_file |\
1329 [ $found -eq 1 ] || error "Write: second extension component not found"
1331 local end_1=$($LFS getstripe -I1 -E $comp_file)
1334 [ $end_1 -eq 268435456 ] ||
1335 error "end of first component $end_1 != 268435456"
1337 # Write past end of extension space component, in to normal component
1338 # should exhaust & remove extension component
1339 dd if=/dev/zero bs=1M count=1 seek=1100 of=$comp_file conv=notrunc ||
1340 error "dd distant seek failed"
1342 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1343 # the last component index is 3
1344 local ost_idx2=$($LFS getstripe -I3 -i $comp_file)
1346 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1348 local start1=$($LFS getstripe -I1 --comp-start $comp_file)
1349 local end1=$($LFS getstripe -I1 -E $comp_file)
1350 local start2=$($LFS getstripe -I3 --comp-start $comp_file)
1351 local end2=$($LFS getstripe -I3 -E $comp_file)
1353 [ $start1 -eq 0 ] || error "start of first component incorrect"
1354 [ $end1 -eq 1073741824 ] || error "end of first component incorrect"
1355 [ $start2 -eq 1073741824 ] ||
1356 error "start of second component incorrect"
1357 [ "$end2" = "EOF" ] || error "end of second component incorrect"
1359 flg_opts="--comp-flags extension"
1360 found=$($LFS find $flg_opts $comp_file | wc -l)
1361 [ $found -eq 0 ] || error "Seek Write: extension component exists"
1363 sel_layout_sanity $comp_file 2
1365 run_test 19c "Test self-extending layout seeking behavior"
1368 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1369 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1370 skip "skipped for lustre < $SEL_VER"
1372 local comp_file=$DIR/$tdir/$tfile
1376 test_mkdir -p $DIR/$tdir
1378 $LFS setstripe -E 128M -c 1 -z 64M -E -1 $comp_file ||
1379 error "Create $comp_file failed"
1381 # This will cause component 1 to be extended to 128M, then the
1382 # extension space component will be removed
1383 dd if=/dev/zero of=$comp_file bs=130M count=1 ||
1384 error "dd to extend failed"
1386 flg_opts="--comp-flags init"
1387 found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file | wc -l)
1388 [ $found -eq 1 ] || error "Write: first component not found"
1390 flg_opts="--comp-flags init"
1391 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1392 [ $found -eq 1 ] || error "Write: second component not found"
1394 sel_layout_sanity $comp_file 2
1396 # always remove large files in case of DO_CLEANUP=false
1397 rm -f $comp_file || error "Delete $comp_file failed"
1399 run_test 19d "Test write which completely spans extension space component"
1404 local comp2_flags=$($LFS getstripe -I2 --comp-flags $comp_file)
1405 local comp3_flags=$($LFS getstripe -I3 --comp-flags $comp_file)
1407 [ "$comp2_flags" != "init" ] && error "$comp2_flags != init"
1408 [ "$comp3_flags" != "extension" ] && error "$comp3_flags != extension"
1410 local flg_opts=" --comp-start 2M -E 66M --comp-flags init"
1411 local found=$($LFS find $flg_opts $comp_file | wc -l)
1412 [ $found -eq 1 ] || error "Write: extended second component not found"
1414 flg_opts="--comp-start 66M -E EOF --comp-flags extension"
1415 found=$($LFS find $flg_opts $comp_file | wc -l)
1416 [ $found -eq 1 ] || error "Write: third component not found"
1418 sel_layout_sanity $comp_file 3
1422 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1423 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1424 skip "skipped for lustre < $SEL_VER"
1426 local comp_file=$DIR/$tdir/$tfile
1427 local rw_len=$((3 * 1024 * 1024)) # 3M
1431 test_mkdir -p $DIR/$tdir
1433 $LFS setstripe -E 2m -E -1 -z 64M $comp_file ||
1434 error "Create $comp_file failed"
1436 replay_barrier $SINGLEMDS
1438 #instantiate & extend second component
1439 dd if=/dev/zero of=$comp_file bs=4M count=1 ||
1440 error "dd to extend failed"
1442 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1443 local ost_idx3=$($LFS getstripe -I3 -i $comp_file)
1445 [ $ost_idx2 -eq $ost_idx3 ] && error "$ost_idx2 == $ost_idx3"
1446 [ $ost_idx3 -ne "-1" ] && error "third component init $ost_idx3"
1448 test_19e_check $comp_file
1450 local f1=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1451 echo "before MDS recovery, the ost fid of 2nd component is $f1"
1455 local f2=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1456 echo "after MDS recovery, the ost fid of 2nd component is $f2"
1457 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
1459 # simply repeat all previous checks, but also verify components are on
1460 # the same OST as before
1462 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1463 local ost_idx3_2=$($LFS getstripe -I3 -i $comp_file)
1465 [ $ost_idx2_2 -eq $ost_idx3_2 ] && error "$ost_idx2_2 == $ost_idx3_2"
1466 [ $ost_idx3_2 -ne "-1" ] && error "second component init $ost_idx3_2"
1468 # verify OST id is the same after failover
1469 [ $ost_idx2 -ne $ost_idx2_2 ] &&
1470 error "$ost_idx2 != $ost_idx2_2, changed after failover"
1472 test_19e_check $comp_file
1474 run_test 19e "Replay of layout instantiation & extension"
1477 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1478 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1479 skip "skipped for lustre < $SEL_VER"
1481 local comp_file=$DIR/$tdir/$tfile
1485 test_mkdir -p $DIR/$tdir
1487 $LFS setstripe -E 256M --comp-flags extension -E -1 $comp_file
1489 [ $? != 0 ] || error "should not be able to manually set extension flag"
1492 run_test 19f "Rejection of invalid layouts"
1495 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1496 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1497 skip "skipped for lustre < $SEL_VER"
1499 local file1=$DIR/${tfile}-1
1500 local file2=$DIR/${tfile}-2
1502 test_mkdir -p $DIR/$tdir
1503 multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1504 error "create failed $file1"
1505 multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1506 error "create failed $file2"
1508 $LFS setstripe --component-add -E 1G -c 1 $file1 ||
1509 error "comp-add [0,1G] failed $file1"
1510 $LFS setstripe --component-add -E 512M -z 128M $file1 &&
1511 error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
1512 $LFS setstripe --component-add -E 10G -z 128M $file1 ||
1513 error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
1514 $LFS setstripe --component-add -E -1 $file1 ||
1515 error "comp-add [10G,-1] failed $file1"
1517 $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
1518 error "comp-add with smal ext size succeeded $file1"
1519 $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
1520 error "comp-add with not aligned ext size succeeded $file1"
1521 $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
1522 error "comp-add [0,128M],SEL[128M,1G] failed $file1"
1523 $LFS setstripe --component-add -E 10G $file2 ||
1524 error "comp-add [1G,10G] failed $file1"
1525 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
1526 error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
1527 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
1528 error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
1530 $LFS getstripe $file1
1531 flg_opts="--comp-flags init"
1532 found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
1533 [ $found -eq 1 ] || error "First component not found $file1"
1535 flg_opts="--comp-flags ^init"
1536 found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
1537 [ $found -eq 1 ] || error "Second component not found $file1"
1539 flg_opts="--comp-flags ^init,extension"
1540 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
1541 [ $found -eq 1 ] || error "Third component not found $file1"
1543 flg_opts="--comp-flags ^init"
1544 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
1545 [ $found -eq 1 ] || error "Fourth component not found $file1"
1547 $LFS getstripe $file2
1548 flg_opts="--comp-flags init"
1549 found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
1550 [ $found -eq 1 ] || error "First component not found $file2"
1552 flg_opts="--comp-flags extension"
1553 found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
1554 [ $found -eq 1 ] || error "Second component not found $file2"
1556 flg_opts="--comp-flags ^init"
1557 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
1558 [ $found -eq 1 ] || error "Third component not found $file2"
1560 flg_opts="--comp-flags ^init"
1561 found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
1562 [ $found -eq 1 ] || error "Fourth component not found $file2"
1564 flg_opts="--comp-flags ^init,extension"
1565 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
1566 [ $found -eq 1 ] || error "Fifth component not found $file2"
1568 run_test 19g "component-add behaviour"
1570 # Test out of space behavior
1572 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1573 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1574 skip "skipped for lustre < $SEL_VER"
1576 local comp_file=$DIR/$tdir/$tfile
1580 test_mkdir -p $DIR/$tdir
1582 # without this, a previous delete can finish after we check free space
1583 wait_delete_completed
1586 # First component is on OST0
1587 $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 128M $comp_file ||
1588 error "Create $comp_file failed"
1590 # write past end of first component, so it is extended
1591 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=66 ||
1592 error "dd to extend failed"
1594 flg_opts="--comp-flags extension"
1595 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file |wc -l)
1596 [ $found -eq 1 ] || error "Write: Second component not found"
1598 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1599 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1601 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1603 flg_opts="--comp-flags extension"
1604 # Write past current init comp, but we won't extend (because no space)
1605 dd if=/dev/zero of=$comp_file bs=1M count=10 seek=200 ||
1606 error "dd write past current comp failed"
1608 $LFS getstripe $comp_file
1610 flg_opts="--comp-flags init"
1611 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file | \
1613 [ $found -eq 1 ] || error "Write: third component not found"
1615 flg_opts="--comp-flags extension"
1616 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file |wc -l)
1617 [ $found -eq 1 ] || error "Write: fourth extension component not found"
1619 sel_layout_sanity $comp_file 3
1621 run_test 20a "Test out of space, spillover to defined component"
1624 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1625 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1626 skip "skipped for lustre < $SEL_VER"
1628 local comp_file=$DIR/$tdir/$tfile
1632 test_mkdir -p $DIR/$tdir
1634 # Pool allows us to force use of only certain OSTs
1635 pool_add $TESTNAME || error "Pool creation failed"
1636 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1638 # normal component to 10M, extendable component to 1G
1639 # further extendable to EOF
1640 $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 128M \
1641 $comp_file || error "Create $comp_file failed"
1643 replay_barrier $SINGLEMDS
1645 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1646 [ $found -eq 1 ] || error "Zero length component not found"
1649 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1651 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1653 # write past end of first component
1654 # This should remove the next component, since OST0 is out of space
1655 # and it is striped there (pool contains only OST0)
1656 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=14 ||
1657 error "dd to extend/remove failed"
1659 $LFS getstripe $comp_file
1661 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1662 [ $found -eq 0 ] || error "Write: zero length component still present"
1664 flg_opts="--comp-flags init"
1665 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1666 [ $found -eq 1 ] || error "Write: second component not found"
1668 flg_opts="--comp-flags extension"
1669 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1670 [ $found -eq 1 ] || error "Write: third component not found"
1674 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1675 [ $found -eq 0 ] || error "Failover: 0-length component still present"
1677 flg_opts="--comp-flags init"
1678 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1679 [ $found -eq 1 ] || error "Failover: second component not found"
1681 flg_opts="--comp-flags extension"
1682 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1683 [ $found -eq 1 ] || error "Failover: third component not found"
1685 sel_layout_sanity $comp_file 3
1687 run_test 20b "Remove component without instantiation when there is no space"
1690 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1691 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1692 skip "skipped for lustre < $SEL_VER"
1694 local comp_file=$DIR/$tdir/$tfile
1698 test_mkdir -p $DIR/$tdir
1700 # pool is used to limit available OSTs to 0 and 1, so we can set all
1701 # available OSTs out of space
1702 pool_add $TESTNAME || error "Pool creation failed"
1703 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
1705 # without this, a previous delete can finish after we check free space
1706 wait_delete_completed
1709 $LFS setstripe -E 100M -E -1 -p $TESTNAME -z 64M $comp_file ||
1710 error "Create $comp_file failed"
1714 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1716 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
1718 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1719 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
1721 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=120 &&
1722 error "dd should fail with ENOSPC"
1724 flg_opts="--comp-flags init"
1725 found=$($LFS find --comp-start 0M -E 100M $flg_opts $comp_file | wc -l)
1726 [ $found -eq 1 ] || error "Write: First component not found"
1728 flg_opts="--comp-flags ^init"
1729 found=$($LFS find --comp-start 100M -E 100M $flg_opts $comp_file |wc -l)
1730 [ $found -eq 1 ] || error "Write: 0-length component not found"
1732 flg_opts="--comp-flags extension"
1733 found=$($LFS find --comp-start 100M -E EOF $flg_opts $comp_file | wc -l)
1734 [ $found -eq 1 ] || error "Write: third extension component not found"
1736 sel_layout_sanity $comp_file 3
1738 run_test 20c "Test inability to stripe new extension component"
1741 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1742 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1743 skip "skipped for lustre < $SEL_VER"
1745 local comp_file=$DIR/$tdir/$tfile
1746 test_mkdir -p $DIR/$tdir
1748 wait_delete_completed
1751 pool_add $TESTNAME || error "Pool creation failed"
1752 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1753 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
1754 error "Create $comp_file failed"
1756 replay_barrier $SINGLEMDS
1758 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1759 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1762 ost_watermarks_clear_enospc $tfile 0 $wms
1763 [ $RC -eq 0 ] || error "dd failed: $RC"
1765 $LFS getstripe $comp_file
1766 local flg_opts="--comp-start 64M -E 128M --comp-flags init"
1767 local found=$($LFS find $flg_opts $comp_file | wc -l)
1768 [ $found -eq 1 ] || error "Write: component (64M-128M) not found"
1770 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
1771 [ "$ost_idx" != "-1" ] && error "Write: EXT component disappeared"
1775 found=$($LFS find $flg_opts $comp_file | wc -l)
1776 [ $found -eq 1 ] || error "Failover: component (64M-128M) not found"
1778 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1779 [ "$ost_idx" != "-1" ] && error "Failover: EXT component disappeared"
1781 sel_layout_sanity $comp_file 3
1783 run_test 20d "Low on space + 0-length comp: force extension"
1786 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1787 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1788 skip "skipped for lustre < $SEL_VER"
1790 local comp_file=$DIR/$tdir/$tfile
1791 test_mkdir -p $DIR/$tdir
1793 wait_delete_completed
1796 pool_add $TESTNAME || error "Pool creation failed"
1797 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1799 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
1800 error "Create $comp_file failed"
1802 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1804 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1807 ost_watermarks_clear_enospc $tfile 0 $wms
1808 [ $RC -eq 0 ] || error "dd failed $RC"
1810 $LFS getstripe $comp_file
1811 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
1812 local found=$($LFS find $flg_opts $comp_file | wc -l)
1813 [ $found -eq 1 ] || error "Write: component (64M-EOF) not found"
1815 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
1816 [ "$ost_idx" != "" ] && error "Write: 0-length component still exists"
1817 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1818 [ "$ost_idx" != "" ] && error "Write: extension component still exists"
1820 sel_layout_sanity $comp_file 2
1822 run_test 20e "ENOSPC with next real comp: spillover and backward extension"
1824 # Simple DoM interaction test
1826 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1827 skip "skipped for lustre < $SEL_VER"
1829 local comp_file=$DIR/$tdir/$tfile
1833 test_mkdir -p $DIR/$tdir
1835 # simple, correct self-extending layout after DoM component
1836 $LFS setstripe -E 1M -L mdt -E -1 -z 64m $comp_file || \
1837 error "Create $comp_file failed"
1839 # Write to DoM component & to self-extending comp after it
1840 dd if=/dev/zero bs=1M count=12 of=$comp_file ||
1841 error "dd to extend failed"
1843 flg_opts="--comp-flags init"
1844 found=$($LFS find --comp-start 1M -E 65M $flg_opts $comp_file | wc -l)
1845 [ $found -eq 1 ] || error "Write: extended component not found"
1847 flg_opts="--comp-flags extension"
1848 found=$($LFS find --comp-start 65M $flg_opts $comp_file | wc -l)
1849 [ $found -eq 1 ] || error "Write: extension component not found"
1851 sel_layout_sanity $comp_file 3
1853 run_test 21a "Simple DoM interaction tests"
1855 # DoM + extension + removal
1857 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1858 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1859 skip "skipped for lustre < $SEL_VER"
1861 local comp_file=$DIR/$tdir/$tfile
1862 local ost_name=$(ostname_from_index 0)
1866 test_mkdir -p $DIR/$tdir
1868 # DoM, extendable component, further extendable component
1869 $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \
1870 $comp_file || error "Create $comp_file failed"
1872 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1873 [ $found -eq 1 ] || error "Write: Zero length component not found"
1875 # This also demonstrates that we will avoid degraded OSTs
1876 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
1877 # sleep to guarantee we see the degradation
1880 # un-degrade on exit
1881 stack_trap "do_facet ost1 $LCTL set_param -n \
1882 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1884 # This should remove the first component after DoM and spill over to
1886 dd if=/dev/zero bs=1M count=2 of=$comp_file ||
1887 error "dd to remove+spill over failed"
1889 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1890 [ $found -eq 0 ] || error "Write: Zero length component still present"
1892 flg_opts="--comp-flags init"
1893 found=$($LFS find --comp-start 1M -E 129M $flg_opts $comp_file | wc -l)
1894 [ $found -eq 1 ] || error "Write: extended component not found"
1896 flg_opts="--comp-flags extension"
1897 found=$($LFS find --comp-start 129M -E EOF $flg_opts $comp_file |wc -l)
1898 [ $found -eq 1 ] || error "Write: extension component not found"
1900 sel_layout_sanity $comp_file 3
1902 run_test 21b "DoM followed by extendable component with removal"
1904 # Test of repeat component behavior with OOS/degraded OST
1906 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1907 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1908 skip "skipped for lustre < $SEL_VER"
1910 local comp_file=$DIR/$tdir/$tfile
1914 test_mkdir -p $DIR/$tdir
1916 $LFS setstripe -E -1 -c 1 -z 128M $comp_file ||
1917 error "Create $comp_file failed"
1919 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1920 local ost_name=$(ostname_from_index $ost_idx1)
1922 # write past end of first component, so it is extended
1923 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1924 error "dd to extend failed"
1926 flg_opts="--comp-flags extension"
1927 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
1928 [ $found -eq 1 ] || error "Write: second component not found"
1930 # degrade OST for component 1
1931 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1932 obdfilter.$ost_name.degraded=1
1933 # sleep to guarantee we see the degradation
1936 # un-degrade on exit
1937 stack_trap "do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1938 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1940 replay_barrier $SINGLEMDS
1942 # seek past the end of current comp & write, should cause a new comp
1943 # to be created (ie repeat previous comp)
1944 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
1945 error "dd to repeat failed"
1947 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1949 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1951 flg_opts="--comp-flags init"
1952 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
1953 [ $found -eq 1 ] || error "Write: second component not found"
1955 flg_opts="--comp-flags extension"
1956 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
1957 [ $found -eq 1 ] || error "Write: extension component not found"
1961 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1962 [ $ost_idx2_2 -ne $ost_idx2 ] && error "$ost_idx2_2 != $ost_idx2"
1964 flg_opts="--comp-flags init"
1965 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
1966 [ $found -eq 1 ] || error "Failover: second component not found"
1968 flg_opts="--comp-flags extension"
1969 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
1970 [ $found -eq 1 ] || error "Failover: extension component not found"
1972 sel_layout_sanity $comp_file 3
1974 run_test 22a "Test repeat component behavior with degraded OST"
1976 # Test repeat behavior with low space
1978 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1979 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1980 skip "skipped for lustre < $SEL_VER"
1982 local comp_file=$DIR/$tdir/$tfile
1986 test_mkdir -p $DIR/$tdir
1988 # without this, a previous delete can finish after we check free space
1989 wait_delete_completed
1992 $LFS setstripe -E -1 -c 1 -z 128M \
1993 $comp_file || error "Create $comp_file failed"
1995 # write past end of first component, so it is extended
1996 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1997 error "dd to extend failed"
1999 flg_opts="--comp-flags extension"
2000 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
2001 [ $found -eq 1 ] || error "Write: Second component not found"
2003 # set our OST low on space
2004 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2005 local wms=$(ost_watermarks_set_low_space $ost_idx1 | grep "watermarks")
2007 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2009 # Write past end of current space, fail to extend, causing repeat
2010 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2011 error "dd to repeat failed"
2013 $LFS getstripe $comp_file
2015 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2017 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2019 flg_opts="--comp-flags init"
2020 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2021 [ $found -eq 1 ] || error "Write: Second component not found"
2023 flg_opts="--comp-flags extension"
2024 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2025 [ $found -eq 1 ] || error "Write: Extension component not found"
2027 sel_layout_sanity $comp_file 3
2029 run_test 22b "Test simple 'out of space' condition with repeat"
2031 # This tests both "repeat" and "extend in place when repeat fails" aspects
2032 # of repeating components
2034 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2035 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2036 skip "skipped for lustre < $SEL_VER"
2038 local comp_file=$DIR/$tdir/$tfile
2042 test_mkdir -p $DIR/$tdir
2044 # pool is used to limit available OSTs to 0 and 1, so we can set all
2045 # available OSTs out of space
2046 pool_add $TESTNAME || error "Pool creation failed"
2047 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
2049 # without this, a previous delete can finish after we check free space
2050 wait_delete_completed
2053 $LFS setstripe -E -1 -z 64M -c 1 -p "$TESTNAME" $comp_file || \
2054 error "Create $comp_file failed"
2056 # write past end of first component, so it is extended
2057 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=80 conv=notrunc ||
2058 error "dd to extend failed"
2060 $LFS getstripe $comp_file
2062 flg_opts="--comp-flags extension"
2063 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2064 [ $found -eq 1 ] || error "Write: second component not found"
2066 # set our OST out of space
2067 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2068 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
2070 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2072 # This should create a repeat component on a new OST
2073 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=180 conv=notrunc ||
2074 error "dd to repeat failed"
2076 $LFS getstripe $comp_file
2078 local comp_cnt=$($LFS getstripe --component-count $comp_file)
2079 [ $comp_cnt -ne 3 ] && error "component count: $comp_cnt, should be 3"
2081 # New second component should be on a different OST
2082 local ost_idx2=$($LFS getstripe --comp-start=128m \
2083 --comp-end=192m --comp-flags=init -i $comp_file)
2085 [ $ost_idx1 -eq $ost_idx2 ] && error "2nd comp: same OST $ost_idx1"
2087 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
2089 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
2091 # now that the second OST is out of space (as is the first OST), we
2092 # attempt to extend. This should result in an extension of the
2093 # existing component, rather than a new component.
2094 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=240 conv=notrunc ||
2095 error "dd for forced extension failed"
2097 $LFS getstripe $comp_file
2099 # clear out of space on first OST
2100 ost_watermarks_clear_enospc $tfile $ost_idx1 $wms
2102 # finally, now that the first OST has space again, we attempt to
2103 # extend one last time. This should create a new component on the
2105 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 conv=notrunc ||
2106 error "dd for repeat on first OST failed"
2108 $LFS getstripe $comp_file
2110 flg_opts="--comp-flags init"
2111 found=$($LFS find --comp-start 128M $flg_opts $comp_file | wc -l)
2112 [ $found -eq 1 ] || error "Write: second component not found"
2114 flg_opts="--comp-flags init"
2115 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2116 [ $found -eq 1 ] || error "Write: third component not found"
2118 flg_opts="--comp-flags extension"
2119 found=$($LFS find --comp-start 320M -E EOF $flg_opts $comp_file | wc -l)
2120 [ $found -eq 1 ] || error "Write: extension component not found"
2122 sel_layout_sanity $comp_file 4
2124 run_test 22c "Test repeat with out of space on > 1 OST"
2126 test_22d_post_check() {
2129 local flg_opts="--comp-flags init"
2130 local found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file |
2132 [ $found -eq 1 ] || {
2133 $LFS getstripe $comp_file
2134 error "$name: second component not found"
2137 flg_opts="--comp-flags extension"
2138 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2139 [ $found -eq 1 ] || error "$name: third extension component not found"
2141 sel_layout_sanity $comp_file 2
2149 # write past end of first component
2150 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=70
2153 ost_watermarks_clear_enospc $tfile 0 $wms
2154 [ $RC -eq 0 ] || error "dd to force extend failed"
2156 test_22d_post_check $comp_file "Write"
2160 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2161 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2162 skip "skipped for lustre < $SEL_VER"
2164 local comp_file=$DIR/$tdir/$tfile
2168 test_mkdir -p $DIR/$tdir
2170 # without this, a previous delete can finish after we check free space
2171 wait_delete_completed
2174 # Pool allows us to force use of only certain OSTs
2175 pool_add $TESTNAME || error "Pool creation failed"
2176 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2178 # 1. Fail to extend due to OOS, try to repeat within the same pool,
2179 # fail to stripe (again OOS) the 0-length component, remove the
2180 # repeated one, force the extension on the original one.
2181 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2182 error "Create $comp_file failed"
2184 replay_barrier $SINGLEMDS
2186 # set our OST out of space
2187 local wms=$(ost_watermarks_set_enospc $tfile 0 | grep "watermarks")
2189 test_22d_pre $comp_file "$wms"
2191 test_22d_post_check $comp_file "Failover"
2193 # 2. repeat with low on space: 0-length repeated component will be
2194 # striped, but still fails to be extended; otherwise the same as (1).
2196 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2197 error "Create $comp_file failed"
2199 replay_barrier $SINGLEMDS
2201 # set our OST low on space
2202 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2204 test_22d_pre $comp_file "$wms"
2206 test_22d_post_check $comp_file "Failover"
2208 run_test 22d "out of/low on space + failed to repeat + forced extension"
2211 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2212 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2213 skip "skipped for lustre < $SEL_VER"
2215 local comp_file=$DIR/$tdir/$tfile
2216 test_mkdir -p $DIR/$tdir
2218 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2219 error "Create $comp_file failed"
2221 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2222 error "dd append failed"
2224 local flg_opts="--comp-start 0 -E EOF --comp-flags init"
2225 local found=$($LFS find $flg_opts $comp_file | wc -l)
2226 [ $found -eq 1 ] || error "Append: first component (0-EOF) not found"
2228 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2229 [ "$ost_idx" != "" ] && error "Append: second component still exists"
2231 sel_layout_sanity $comp_file 1
2233 run_test 23a "Append: remove EXT comp"
2236 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2237 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2238 skip "skipped for lustre < $SEL_VER"
2240 local comp_file=$DIR/$tdir/$tfile
2241 test_mkdir -p $DIR/$tdir
2243 $LFS setstripe -E 64m -E -1 -z 64M $comp_file ||
2244 error "Create $comp_file failed"
2246 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2247 error "dd append failed"
2249 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2250 local found=$($LFS find $flg_opts $comp_file | wc -l)
2251 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2253 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2254 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2256 sel_layout_sanity $comp_file 2
2258 run_test 23b "Append with 0-length comp: remove EXT comp"
2261 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2262 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2263 skip "skipped for lustre < $SEL_VER"
2265 local comp_file=$DIR/$tdir/$tfile
2266 test_mkdir -p $DIR/$tdir
2268 wait_delete_completed
2271 pool_add $TESTNAME || error "Pool creation failed"
2272 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2273 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
2274 error "Create $comp_file failed"
2276 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2277 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2280 ost_watermarks_clear_enospc $tfile 0 $wms
2281 [ $RC -eq 0 ] || error "dd append failed: $RC"
2283 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2284 local found=$($LFS find $flg_opts $comp_file | wc -l)
2285 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2287 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2288 [ "$ost_idx" != "" ] && error "Append: EXT component still exists"
2290 sel_layout_sanity $comp_file 2
2292 run_test 23c "Append with low on space + 0-length comp: force extension"
2295 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2296 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2297 skip "skipped for lustre < $SEL_VER"
2299 local comp_file=$DIR/$tdir/$tfile
2300 test_mkdir -p $DIR/$tdir
2302 $LFS setstripe -E 64m -E 640M -z 64M -E -1 $comp_file ||
2303 error "Create $comp_file failed"
2305 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2306 error "dd append failed"
2308 flg_opts="--comp-start 64M -E 640M --comp-flags init"
2309 found=$($LFS find $flg_opts $comp_file | wc -l)
2310 [ $found -eq 1 ] || error "Append: component (64M-640M) not found"
2312 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2313 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2315 sel_layout_sanity $comp_file 3
2317 run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
2320 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2321 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2322 skip "skipped for lustre < $SEL_VER"
2324 local comp_file=$DIR/$tdir/$tfile
2325 test_mkdir -p $DIR/$tdir
2327 wait_delete_completed
2330 pool_add $TESTNAME || error "Pool creation failed"
2331 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2333 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
2334 error "Create $comp_file failed"
2336 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2338 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2341 ost_watermarks_clear_enospc $tfile 0 $wms
2342 [ $RC -eq 0 ] || error "dd append failed $RC"
2344 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2345 local found=$($LFS find $flg_opts $comp_file | wc -l)
2346 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2348 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2349 [ "$ost_idx" != "" ] && error "Append: 0-length component still exists"
2350 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2351 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2353 sel_layout_sanity $comp_file 2
2355 run_test 23e "Append with next real comp: spillover and backward extension"
2358 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2359 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2360 skip "skipped for lustre < $SEL_VER"
2362 local comp_file=$DIR/$tdir/$tfile
2363 test_mkdir -p $DIR/$tdir
2365 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2366 error "Create $comp_file failed"
2368 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
2369 local wms=$(ost_watermarks_set_low_space $ost_idx | grep "watermarks")
2371 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2374 ost_watermarks_clear_enospc $tfile $ost_idx $wms
2375 [ $RC -eq 0 ] || error "dd append failed"
2377 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2378 local found=$($LFS find $flg_opts $comp_file | wc -l)
2379 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2381 ost_idx=$($LFS getstripe -I2 -i $comp_file)
2382 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2384 sel_layout_sanity $comp_file 2
2386 run_test 23f "Append with low on space: repeat and remove EXT comp"
2395 [ "$OSTCOUNT" -lt "3" ] && skip_env "needs >= 3 OSTs"
2397 trap cleanup_24 EXIT RETURN
2399 local file=$DIR/$tfile
2401 $LFS setstripe -E 1m -c1 -o0 -E eof -c2 -o1,2 $file ||
2402 error "setstripe on $file"
2404 dd if=/dev/zero of=$file bs=1M count=3 || error "dd failed for $file"
2407 filefrag -ves $file || error "filefrag $file failed"
2408 filefrag_op=$(filefrag -ve -k $file |
2409 sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
2411 #Filesystem type is: bd00bd0
2412 #File size of /mnt/lustre/f24a.sanity-pfl is 3145728 (3072 blocks of 1024 bytes)
2413 # ext: device_logical: physical_offset: length: dev: flags:
2414 # 0: 0.. 1023: 1572864.. 1573887: 1024: 0000: net
2415 # 1: 0.. 1023: 1572864.. 1573887: 1024: 0002: net
2416 # 2: 1024.. 2047: 1573888.. 1574911: 1024: 0001: last,net
2417 #/mnt/lustre/f24a.sanity-pfl: 3 extents found
2419 last_lun=$(echo $filefrag_op | cut -d: -f5)
2424 for line in $filefrag_op; do
2425 frag_lun=$(echo $line | cut -d: -f5)
2426 ext_len=$(echo $line | cut -d: -f4)
2427 if [[ "$frag_lun" != "$last_lun" ]]; then
2428 if (( tot_len != 1024 )); then
2430 error "$file: OST$last_lun $tot_len != 1024"
2436 (( tot_len += ext_len ))
2439 if (( num_luns != 3 || tot_len != 1024 )); then
2441 error "$file: $num_luns != 3, $tot_len != 1024 on OST$last_lun"
2444 echo "FIEMAP on $file succeeded"
2446 run_test 24a "FIEMAP upon PFL file"
2449 local pfl_f=$DIR/$tdir/"$tfile"_pfl
2450 local dom_f=$DIR/$tdir/"$tfile"_dom
2451 local common_f=$DIR/$tdir/"$tfile"_common
2455 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2456 $LFS setstripe -E 10M -S 64k -c -1 -E 20M -S 1M -E -1 -S 2M -c 1 \
2457 $pfl_f || error "setstripe $pfl_f failed"
2458 $LFS setstripe -E 256k -L mdt -E -1 -S 1M $dom_f ||
2459 error "setstripe $dom_f failed"
2460 $LFS setstripe -S 512K -c -1 $common_f ||
2461 error "setstripe $common_f failed"
2463 #verify lov_getstripe_old with PFL file
2464 stripe_count=$(lov_getstripe_old $pfl_f |
2465 awk '/stripe_count/ { print $2 }')
2466 stripe_size=$(lov_getstripe_old $pfl_f |
2467 awk '/stripe_size/ { print $2 }')
2468 [ $stripe_count -eq 1 ] ||
2469 error "stripe_count $stripe_count !=1 for $pfl_f"
2470 [ $stripe_size -eq 2097152 ] ||
2471 error "stripe_size $stripe_size != 2097152 for $pfl_f"
2473 #verify lov_getstripe_old with DoM file
2474 stripe_count=$(lov_getstripe_old $dom_f |
2475 awk '/stripe_count/ { print $2 }')
2476 stripe_size=$(lov_getstripe_old $dom_f |
2477 awk '/stripe_size/ { print $2 }')
2478 [ $stripe_count -eq 1 ] ||
2479 error "stripe_count $stripe_count !=1 for $dom_f"
2480 [ $stripe_size -eq 1048576 ] ||
2481 error "stripe_size $stripe_size != 1048576 for $dom_f"
2483 #verify lov_getstripe_old with common file
2484 stripe_count=$(lov_getstripe_old $common_f |
2485 awk '/stripe_count/ { print $2 }')
2486 stripe_size=$(lov_getstripe_old $common_f |
2487 awk '/stripe_size/ { print $2 }')
2488 [ $stripe_count -eq $OSTCOUNT ] ||
2489 error "stripe_count $stripe_count !=$OSTCOUNT for $common_f"
2490 [ $stripe_size -eq 524288 ] ||
2491 error "stripe_size $stripe_size != 524288 for $common_f"
2493 run_test 25 "Verify old lov stripe API with PFL files"
2496 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2497 dd if=/dev/urandom bs=1M count=10 >> $DIR/$tfile
2498 [ $? != 0 ] || error "append must return an error"
2500 run_test 26a "Append to not-existent component"
2503 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2504 dd if=/dev/urandom bs=1M count=1 > $DIR/$tfile
2505 dd if=/dev/urandom bs=1M count=1 >> $DIR/$tfile
2506 [ $? != 0 ] || error "append must return an error"
2508 run_test 26b "Append to not-existend component, file size is unknown"
2511 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2512 dd if=/dev/urandom bs=2M count=1 >> $DIR/$tfile
2513 [ $? != 0 ] || error "append must return an error"
2515 run_test 26c "Append to not-existend component, crossing the component border"
2518 check_and_cleanup_lustre