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"
77 ost_set_temp_seq_width_all $DATA_SEQ_MAX_WIDTH
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"
122 ost_set_temp_seq_width_all $DATA_SEQ_MAX_WIDTH
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"
262 ost_set_temp_seq_width_all $DATA_SEQ_MAX_WIDTH
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"
948 local file=$DIR/$tdir/$tfile
949 local dir=$DIR/$tdir/dir
950 local temp=$DIR/$tdir/template
951 # We know OSTCOUNT < (LOV_MAX_STRIPE_COUNT / 2), so this is overstriping
952 local large_count=$((LOV_MAX_STRIPE_COUNT / 2 + 10))
955 test_mkdir $DIR/$tdir
957 #####################################################################
958 # 1. PFL file, overstriping in first comps
959 # set stripe for source file
960 $LFS setstripe -E1m -S 1M -o0,0 -E2m -o1,1 -E3m -C $large_count -E-1 \
961 $file || error "Create $file failed"
964 verify_yaml_layout $file $file.copy $temp "1. PFL file"
966 #####################################################################
967 # 2. plain file + overstriping
968 # set stripe for source file
970 $LFS setstripe -C $large_count -i1 $file || error "Create $file failed"
974 verify_yaml_layout $file $file.copy $temp "2. plain file"
976 #####################################################################
977 # 3. PFL dir + overstriping
978 # set stripe for source dir
980 $LFS setstripe -E1m -S 1M -o 0,0 -E2m -C $large_count -E-1 $dir ||
981 error "setstripe $dir failed"
985 verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
987 #####################################################################
988 # 4. plain dir + overstriping
989 # set stripe for source dir
990 $LFS setstripe -C $large_count $dir || error "setstripe $dir failed"
993 verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
995 run_test 16b "Verify setstripe/getstripe with YAML config file + overstriping"
998 (( $MDS1_VERSION >= $(version_code 2.13.53.205) )) ||
999 skip "need MDS version at least 2.13.53.205"
1001 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1003 local file=$DIR/$tdir/$tfile
1004 local dir=$DIR/$tdir/dir
1005 local temp=$DIR/$tdir/template
1007 test_mkdir $DIR/$tdir
1009 #####################################################################
1011 # set stripe for source file
1012 $LFS setstripe -E256M -S 1M -c2 -o0,1 -z 64M -E-1 -o1,0 -z 128M \
1013 $file || error "Create $file failed"
1016 verify_yaml_layout $file $file.copy $temp "1. PFL file"
1018 #####################################################################
1020 # set stripe for source dir
1022 $LFS setstripe -E256M -S 1M -c2 -z 64M -E-1 -z 128M \
1023 $dir || error "setstripe $dir failed"
1025 test_mkdir $dir.copy
1026 echo "2. SEL template on dir"
1027 verify_yaml_layout $dir $dir.copy $temp.dir "2. PFL dir"
1029 run_test 16c "Verify setstripe/getstripe for SEL layout with YAML config file"
1032 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1034 local file=$DIR/$tdir/$tfile
1035 local dir=$DIR/$tdir/dir
1036 local temp=$DIR/$tdir/template
1038 test_mkdir $DIR/$tdir
1040 #####################################################################
1042 # set stripe for source file
1043 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $file ||
1044 error "Create $file failed"
1047 verify_yaml_layout $file $file.copy $temp "1. DOM file"
1049 #####################################################################
1051 # set stripe for source dir
1053 $LFS setstripe -E1m -L mdt -E-1 -o1,0 $dir || error "Create $dir failed"
1055 test_mkdir $dir.copy
1057 verify_yaml_layout $dir $dir.copy $temp.dir "2. DOM dir"
1059 run_test 16d "Verify setstripe/getstripe for DOM layout with YAML config file"
1063 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1064 local file=$DIR/$tdir/$tfile
1065 test_mkdir -p $DIR/$tdir
1068 $LFS setstripe -E 1M -S 1M -E 2M -c 2 -E -1 -c -1 $file ||
1069 error "Create $file failed"
1071 local s1=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1072 local s2=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1073 local s3=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1074 echo "1st init: comp size 1:$s1 2:$s2 3:$s3"
1076 # init 2nd component
1077 $TRUNCATE $file $((1024*1024+1))
1078 local s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1079 local s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1080 echo "2nd init: comp size 1:$s1n 2:$s2n 3:$s3"
1082 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1083 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1085 # init 3rd component
1086 $TRUNCATE $file $((1024*1024*2+1))
1087 s1n=$($LFS getstripe -I1 -v $file | awk '/lcme_size:/{print $2}')
1088 s2n=$($LFS getstripe -I2 -v $file | awk '/lcme_size:/{print $2}')
1089 local s3n=$($LFS getstripe -I3 -v $file | awk '/lcme_size:/{print $2}')
1090 echo "3rd init: comp size 1:$s1n 2:$s2n 3:$s3n"
1092 [ $s1 -eq $s1n ] || error "1st comp size $s1 should == $s1n"
1093 [ $s2 -lt $s2n ] || error "2nd comp size $s2 should < $s2n"
1094 [ $s3 -lt $s3n ] || error "3rd comp size $s3 should < $s3n"
1096 run_test 17 "Verify LOVEA grows with more component inited"
1098 check_distribution() {
1102 local obj_min_one=$((OSTCOUNT - 1))
1104 objs=$($LFS getstripe $file |
1105 awk '/l_ost_idx:/ { print $5 }' | wc -l)
1106 let ave=$((objs / OSTCOUNT))
1108 # collect objects per OST distribution
1109 $LFS getstripe $file | awk '/l_ost_idx:/ { print $5 }' | tr -d "," |
1110 (inuse=( $(for i in $(seq 0 $obj_min_one); do echo 0; done) )
1112 let inuse[$O]=$((1 + ${inuse[$O]}))
1115 # verify object distribution varies no more than +-1
1116 for idx in $(seq 0 $obj_min_one); do
1117 let dif=$((${inuse[$idx]} - ave))
1119 if [ "$dif" -gt 1 ]; then
1120 echo "OST${idx}: ${inuse[$idx]} objects"
1121 error "bad distribution on OST${idx}"
1127 local file1=$DIR/${tfile}-1
1128 local file2=$DIR/${tfile}-2
1129 local file3=$DIR/${tfile}-3
1131 rm -f $file1 $file2 $file3
1133 $LFS setstripe -E 1m -S 1m $file1 ||
1134 error "Create $file1 failed"
1135 $LFS setstripe -E 1m -S 1m $file2 ||
1136 error "Create $file2 failed"
1137 $LFS setstripe -E 1m -S 1m $file3 ||
1138 error "Create $file3 failed"
1140 local objs=$((OSTCOUNT+1))
1141 for comp in $(seq 1 $OSTCOUNT); do
1142 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file1 ||
1143 error "Add component to $file1 failed 2"
1144 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file2 ||
1145 error "Add component to $file2 failed 2"
1146 $LFS setstripe --component-add -E $((comp+1))M -c 1 $file3 ||
1147 error "Add component to $file3 failed 2"
1150 $LFS setstripe --component-add -E -1 -c -1 $file1 ||
1151 error "Add component to $file1 failed 3"
1152 $LFS setstripe --component-add -E -1 -c -1 $file2 ||
1153 error "Add component to $file2 failed 3"
1154 $LFS setstripe --component-add -E -1 -c -1 $file3 ||
1155 error "Add component to $file3 failed 3"
1157 # Instantiate all components
1158 dd if=/dev/urandom of=$file1 bs=1M count=$((objs+1)) ||
1159 error "dd failed for $file1"
1160 dd if=/dev/urandom of=$file2 bs=1M count=$((objs+1)) ||
1161 error "dd failed for $file2"
1162 dd if=/dev/urandom of=$file3 bs=1M count=$((objs+1)) ||
1163 error "dd failed for $file3"
1165 check_distribution $file1
1166 check_distribution $file2
1167 check_distribution $file3
1170 run_test 18 "check component distribution"
1174 local already_created=${2:-0}
1175 local rw_len=$((3 * 1024 * 1024)) # 3M
1179 if [ $already_created != 1 ]; then
1180 test_mkdir -p $DIR/$tdir
1181 $LFS setstripe --extension-size 64M -c 1 -E -1 $comp_file ||
1182 error "Create $comp_file failed"
1185 # write past end of first component, so it is extended
1186 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=127 conv=notrunc ||
1187 error "dd to extend failed"
1189 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1190 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1192 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1193 [ $ost_idx2 -ne "-1" ] && error "second component init $ost_idx2"
1195 flg_opts="--comp-flags init"
1196 found=$($LFS find --comp-start 0 -E 128M $flg_opts $comp_file | wc -l)
1197 [ $found -eq 1 ] || error "Write: Extended first component not found"
1199 flg_opts="--comp-flags extension"
1200 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1201 [ $found -eq 1 ] || error "Write: second component not found"
1203 found=$($LFS find -z 64M $comp_file | wc -l)
1204 [ $found -eq 1 ] || error "component not found by ext size"
1206 found=$($LFS find --extension-size +63M $comp_file | wc -l)
1207 [ $found -eq 1 ] || error "component not found by +ext size"
1209 found=$($LFS find --ext-size -65M $comp_file | wc -l)
1210 [ $found -eq 1 ] || error "component not found by -ext size"
1212 found=$($LFS find -z 65M $comp_file | wc -l)
1213 [ $found -eq 0 ] || error "component found by wrong ext size"
1215 found=$($LFS find -z +65M $comp_file | wc -l)
1216 [ $found -eq 0 ] || error "component found by wrong +ext size"
1218 found=$($LFS find -z -63M $comp_file | wc -l)
1219 [ $found -eq 0 ] || error "component found by wrong -ext size"
1221 found=$($LFS find ! -z 64M $comp_file | wc -l)
1222 [ $found -eq 0 ] || error "component found by negation of ext size"
1224 found=$($LFS find ! -z +63M $comp_file | wc -l)
1225 [ $found -eq 0 ] || error "component found by negation of +ext size"
1227 found=$($LFS find ! -z -65M $comp_file | wc -l)
1228 [ $found -eq 0 ] || error "component found by negation of -ext size"
1230 found=$($LFS find ! -z 65M $comp_file | wc -l)
1232 error "component not found by negation of wrong ext size"
1234 found=$($LFS find ! -z +65M $comp_file | wc -l)
1236 error "component not found by negation of wrong +ext size"
1238 found=$($LFS find ! -z -63M $comp_file | wc -l)
1240 error "component not found by negation of wrong -ext size"
1242 found=$($LFS find -S +1M $comp_file | wc -l)
1243 [ $found -eq 0 ] || error "component found by wrong +stripe size"
1245 found=$($LFS find -c 1 $comp_file | wc -l)
1246 [ $found -eq 1 ] || error "component not found by stripe count"
1248 small_write $comp_file $rw_len || error "Verify RW failed"
1250 sel_layout_sanity $comp_file 2
1253 # Self-extending PFL tests
1255 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1256 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1257 skip "skipped for lustre < $SEL_VER"
1259 test19_io_base $DIR/$tdir/$tfile
1261 run_test 19a "Simple test of extension behavior"
1263 # Same as 19a, but with default layout set on directory rather than on file
1265 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1266 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1267 skip "skipped for lustre < $SEL_VER"
1269 local comp_file=$DIR/$tdir/$tfile
1270 local comp_dir=$DIR/$tdir/$tdir
1274 test_mkdir -p $DIR/$tdir
1275 $LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
1276 error "Setstripe on $DIR/$tdir failed"
1278 # check inheritance for a sub-dir and a file
1279 test_mkdir $comp_dir
1280 found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
1281 [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
1283 flg_opts="--comp-flags extension"
1284 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
1285 [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
1289 flg_opts="--comp-flags init"
1290 found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
1291 [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
1293 flg_opts="--comp-flags extension"
1294 found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
1295 [ $found -eq 1 ] || error "File Inheritance: Second component not found"
1297 test19_io_base $comp_file 1
1299 run_test 19b "Simple test of SEL as default layout"
1301 # Test behavior when seeking deep in a file
1303 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1304 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1305 skip "skipped for lustre < $SEL_VER"
1307 local comp_file=$DIR/$tdir/$tfile
1311 test_mkdir -p $DIR/$tdir
1313 $LFS setstripe -z 128M -E 1G -E -1 $comp_file ||
1314 error "Create $comp_file failed"
1316 # write past end of first component, so it is extended
1317 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 conv=notrunc ||
1318 error "dd to extend failed"
1320 flg_opts="--comp-flags init"
1321 found=$($LFS find --comp-start 0M -E 256M $flg_opts $comp_file | wc -l)
1322 [ $found -eq 1 ] || error "Write: first extension component not found"
1324 flg_opts="--comp-flags extension,^init"
1325 found=$($LFS find --comp-start 256M -E 1024M $flg_opts $comp_file |\
1327 [ $found -eq 1 ] || error "Write: second extension component not found"
1329 local end_1=$($LFS getstripe -I1 -E $comp_file)
1332 [ $end_1 -eq 268435456 ] ||
1333 error "end of first component $end_1 != 268435456"
1335 # Write past end of extension space component, in to normal component
1336 # should exhaust & remove extension component
1337 dd if=/dev/zero bs=1M count=1 seek=1100 of=$comp_file conv=notrunc ||
1338 error "dd distant seek failed"
1340 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1341 # the last component index is 3
1342 local ost_idx2=$($LFS getstripe -I3 -i $comp_file)
1344 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1346 local start1=$($LFS getstripe -I1 --comp-start $comp_file)
1347 local end1=$($LFS getstripe -I1 -E $comp_file)
1348 local start2=$($LFS getstripe -I3 --comp-start $comp_file)
1349 local end2=$($LFS getstripe -I3 -E $comp_file)
1351 [ $start1 -eq 0 ] || error "start of first component incorrect"
1352 [ $end1 -eq 1073741824 ] || error "end of first component incorrect"
1353 [ $start2 -eq 1073741824 ] ||
1354 error "start of second component incorrect"
1355 [ "$end2" = "EOF" ] || error "end of second component incorrect"
1357 flg_opts="--comp-flags extension"
1358 found=$($LFS find $flg_opts $comp_file | wc -l)
1359 [ $found -eq 0 ] || error "Seek Write: extension component exists"
1361 sel_layout_sanity $comp_file 2
1363 run_test 19c "Test self-extending layout seeking behavior"
1366 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1367 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1368 skip "skipped for lustre < $SEL_VER"
1370 local comp_file=$DIR/$tdir/$tfile
1374 test_mkdir -p $DIR/$tdir
1376 $LFS setstripe -E 128M -c 1 -z 64M -E -1 $comp_file ||
1377 error "Create $comp_file failed"
1379 # This will cause component 1 to be extended to 128M, then the
1380 # extension space component will be removed
1381 dd if=/dev/zero of=$comp_file bs=130M count=1 ||
1382 error "dd to extend failed"
1384 flg_opts="--comp-flags init"
1385 found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file | wc -l)
1386 [ $found -eq 1 ] || error "Write: first component not found"
1388 flg_opts="--comp-flags init"
1389 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
1390 [ $found -eq 1 ] || error "Write: second component not found"
1392 sel_layout_sanity $comp_file 2
1394 # always remove large files in case of DO_CLEANUP=false
1395 rm -f $comp_file || error "Delete $comp_file failed"
1397 run_test 19d "Test write which completely spans extension space component"
1402 local comp2_flags=$($LFS getstripe -I2 --comp-flags $comp_file)
1403 local comp3_flags=$($LFS getstripe -I3 --comp-flags $comp_file)
1405 [ "$comp2_flags" != "init" ] && error "$comp2_flags != init"
1406 [ "$comp3_flags" != "extension" ] && error "$comp3_flags != extension"
1408 local flg_opts=" --comp-start 2M -E 66M --comp-flags init"
1409 local found=$($LFS find $flg_opts $comp_file | wc -l)
1410 [ $found -eq 1 ] || error "Write: extended second component not found"
1412 flg_opts="--comp-start 66M -E EOF --comp-flags extension"
1413 found=$($LFS find $flg_opts $comp_file | wc -l)
1414 [ $found -eq 1 ] || error "Write: third component not found"
1416 sel_layout_sanity $comp_file 3
1420 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1421 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1422 skip "skipped for lustre < $SEL_VER"
1424 local comp_file=$DIR/$tdir/$tfile
1425 local rw_len=$((3 * 1024 * 1024)) # 3M
1429 test_mkdir -p $DIR/$tdir
1431 $LFS setstripe -E 2m -E -1 -z 64M $comp_file ||
1432 error "Create $comp_file failed"
1434 replay_barrier $SINGLEMDS
1436 #instantiate & extend second component
1437 dd if=/dev/zero of=$comp_file bs=4M count=1 ||
1438 error "dd to extend failed"
1440 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1441 local ost_idx3=$($LFS getstripe -I3 -i $comp_file)
1443 [ $ost_idx2 -eq $ost_idx3 ] && error "$ost_idx2 == $ost_idx3"
1444 [ $ost_idx3 -ne "-1" ] && error "third component init $ost_idx3"
1446 test_19e_check $comp_file
1448 local f1=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1449 echo "before MDS recovery, the ost fid of 2nd component is $f1"
1453 local f2=$($LFS getstripe -I2 $comp_file | awk '/l_fid:/ {print $7}')
1454 echo "after MDS recovery, the ost fid of 2nd component is $f2"
1455 [ "x$f1" == "x$f2" ] || error "$f1 != $f2"
1457 # simply repeat all previous checks, but also verify components are on
1458 # the same OST as before
1460 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1461 local ost_idx3_2=$($LFS getstripe -I3 -i $comp_file)
1463 [ $ost_idx2_2 -eq $ost_idx3_2 ] && error "$ost_idx2_2 == $ost_idx3_2"
1464 [ $ost_idx3_2 -ne "-1" ] && error "second component init $ost_idx3_2"
1466 # verify OST id is the same after failover
1467 [ $ost_idx2 -ne $ost_idx2_2 ] &&
1468 error "$ost_idx2 != $ost_idx2_2, changed after failover"
1470 test_19e_check $comp_file
1472 run_test 19e "Replay of layout instantiation & extension"
1475 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1476 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1477 skip "skipped for lustre < $SEL_VER"
1479 local comp_file=$DIR/$tdir/$tfile
1483 test_mkdir -p $DIR/$tdir
1485 $LFS setstripe -E 256M --comp-flags extension -E -1 $comp_file
1487 [ $? != 0 ] || error "should not be able to manually set extension flag"
1490 run_test 19f "Rejection of invalid layouts"
1493 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1494 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1495 skip "skipped for lustre < $SEL_VER"
1497 local file1=$DIR/${tfile}-1
1498 local file2=$DIR/${tfile}-2
1500 test_mkdir -p $DIR/$tdir
1501 multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1502 error "create failed $file1"
1503 multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
1504 error "create failed $file2"
1506 $LFS setstripe --component-add -E 1G -c 1 $file1 ||
1507 error "comp-add [0,1G] failed $file1"
1508 $LFS setstripe --component-add -E 512M -z 128M $file1 &&
1509 error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
1510 $LFS setstripe --component-add -E 10G -z 128M $file1 ||
1511 error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
1512 $LFS setstripe --component-add -E -1 $file1 ||
1513 error "comp-add [10G,-1] failed $file1"
1515 $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
1516 error "comp-add with smal ext size succeeded $file1"
1517 $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
1518 error "comp-add with not aligned ext size succeeded $file1"
1519 $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
1520 error "comp-add [0,128M],SEL[128M,1G] failed $file1"
1521 $LFS setstripe --component-add -E 10G $file2 ||
1522 error "comp-add [1G,10G] failed $file1"
1523 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
1524 error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
1525 $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
1526 error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
1528 $LFS getstripe $file1
1529 flg_opts="--comp-flags init"
1530 found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
1531 [ $found -eq 1 ] || error "First component not found $file1"
1533 flg_opts="--comp-flags ^init"
1534 found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
1535 [ $found -eq 1 ] || error "Second component not found $file1"
1537 flg_opts="--comp-flags ^init,extension"
1538 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
1539 [ $found -eq 1 ] || error "Third component not found $file1"
1541 flg_opts="--comp-flags ^init"
1542 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
1543 [ $found -eq 1 ] || error "Fourth component not found $file1"
1545 $LFS getstripe $file2
1546 flg_opts="--comp-flags init"
1547 found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
1548 [ $found -eq 1 ] || error "First component not found $file2"
1550 flg_opts="--comp-flags extension"
1551 found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
1552 [ $found -eq 1 ] || error "Second component not found $file2"
1554 flg_opts="--comp-flags ^init"
1555 found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
1556 [ $found -eq 1 ] || error "Third component not found $file2"
1558 flg_opts="--comp-flags ^init"
1559 found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
1560 [ $found -eq 1 ] || error "Fourth component not found $file2"
1562 flg_opts="--comp-flags ^init,extension"
1563 found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
1564 [ $found -eq 1 ] || error "Fifth component not found $file2"
1566 run_test 19g "component-add behaviour"
1568 # Test out of space behavior
1570 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1571 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1572 skip "skipped for lustre < $SEL_VER"
1574 local comp_file=$DIR/$tdir/$tfile
1578 test_mkdir -p $DIR/$tdir
1580 # without this, a previous delete can finish after we check free space
1581 wait_delete_completed
1584 # First component is on OST0
1585 $LFS setstripe -E 256M -i 0 -z 64M -E -1 -z 128M $comp_file ||
1586 error "Create $comp_file failed"
1588 # write past end of first component, so it is extended
1589 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=66 ||
1590 error "dd to extend failed"
1592 flg_opts="--comp-flags extension"
1593 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file |wc -l)
1594 [ $found -eq 1 ] || error "Write: Second component not found"
1596 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1597 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1599 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1601 flg_opts="--comp-flags extension"
1602 # Write past current init comp, but we won't extend (because no space)
1603 dd if=/dev/zero of=$comp_file bs=1M count=10 seek=200 ||
1604 error "dd write past current comp failed"
1606 $LFS getstripe $comp_file
1608 flg_opts="--comp-flags init"
1609 found=$($LFS find --comp-start 128M -E 256M $flg_opts $comp_file | \
1611 [ $found -eq 1 ] || error "Write: third component not found"
1613 flg_opts="--comp-flags extension"
1614 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file |wc -l)
1615 [ $found -eq 1 ] || error "Write: fourth extension component not found"
1617 sel_layout_sanity $comp_file 3
1619 run_test 20a "Test out of space, spillover to defined component"
1622 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1623 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1624 skip "skipped for lustre < $SEL_VER"
1626 local comp_file=$DIR/$tdir/$tfile
1630 test_mkdir -p $DIR/$tdir
1632 # Pool allows us to force use of only certain OSTs
1633 pool_add $TESTNAME || error "Pool creation failed"
1634 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1636 # normal component to 10M, extendable component to 1G
1637 # further extendable to EOF
1638 $LFS setstripe -E 10M -E 1G -p $TESTNAME -z 64M -E -1 -p "" -z 128M \
1639 $comp_file || error "Create $comp_file failed"
1641 replay_barrier $SINGLEMDS
1643 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1644 [ $found -eq 1 ] || error "Zero length component not found"
1647 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1649 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1651 # write past end of first component
1652 # This should remove the next component, since OST0 is out of space
1653 # and it is striped there (pool contains only OST0)
1654 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=14 ||
1655 error "dd to extend/remove failed"
1657 $LFS getstripe $comp_file
1659 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1660 [ $found -eq 0 ] || error "Write: zero length component still present"
1662 flg_opts="--comp-flags init"
1663 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1664 [ $found -eq 1 ] || error "Write: second component not found"
1666 flg_opts="--comp-flags extension"
1667 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1668 [ $found -eq 1 ] || error "Write: third component not found"
1672 found=$($LFS find --comp-start 10M -E 10M $flg_opts $comp_file | wc -l)
1673 [ $found -eq 0 ] || error "Failover: 0-length component still present"
1675 flg_opts="--comp-flags init"
1676 found=$($LFS find --comp-start 10M -E 138M $flg_opts $comp_file | wc -l)
1677 [ $found -eq 1 ] || error "Failover: second component not found"
1679 flg_opts="--comp-flags extension"
1680 found=$($LFS find --comp-start 138M -E EOF $flg_opts $comp_file | wc -l)
1681 [ $found -eq 1 ] || error "Failover: third component not found"
1683 sel_layout_sanity $comp_file 3
1685 run_test 20b "Remove component without instantiation when there is no space"
1688 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1689 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1690 skip "skipped for lustre < $SEL_VER"
1692 local comp_file=$DIR/$tdir/$tfile
1696 test_mkdir -p $DIR/$tdir
1698 # pool is used to limit available OSTs to 0 and 1, so we can set all
1699 # available OSTs out of space
1700 pool_add $TESTNAME || error "Pool creation failed"
1701 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
1703 # without this, a previous delete can finish after we check free space
1704 wait_delete_completed
1707 $LFS setstripe -E 100M -E -1 -p $TESTNAME -z 64M $comp_file ||
1708 error "Create $comp_file failed"
1712 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
1714 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
1716 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
1717 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
1719 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=120 &&
1720 error "dd should fail with ENOSPC"
1722 flg_opts="--comp-flags init"
1723 found=$($LFS find --comp-start 0M -E 100M $flg_opts $comp_file | wc -l)
1724 [ $found -eq 1 ] || error "Write: First component not found"
1726 flg_opts="--comp-flags ^init"
1727 found=$($LFS find --comp-start 100M -E 100M $flg_opts $comp_file |wc -l)
1728 [ $found -eq 1 ] || error "Write: 0-length component not found"
1730 flg_opts="--comp-flags extension"
1731 found=$($LFS find --comp-start 100M -E EOF $flg_opts $comp_file | wc -l)
1732 [ $found -eq 1 ] || error "Write: third extension component not found"
1734 sel_layout_sanity $comp_file 3
1736 run_test 20c "Test inability to stripe new extension component"
1739 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1740 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1741 skip "skipped for lustre < $SEL_VER"
1743 local comp_file=$DIR/$tdir/$tfile
1744 test_mkdir -p $DIR/$tdir
1746 wait_delete_completed
1749 pool_add $TESTNAME || error "Pool creation failed"
1750 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1751 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
1752 error "Create $comp_file failed"
1754 replay_barrier $SINGLEMDS
1756 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1757 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1760 ost_watermarks_clear_enospc $tfile 0 $wms
1761 [ $RC -eq 0 ] || error "dd failed: $RC"
1763 $LFS getstripe $comp_file
1764 local flg_opts="--comp-start 64M -E 128M --comp-flags init"
1765 local found=$($LFS find $flg_opts $comp_file | wc -l)
1766 [ $found -eq 1 ] || error "Write: component (64M-128M) not found"
1768 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
1769 [ "$ost_idx" != "-1" ] && error "Write: EXT component disappeared"
1773 found=$($LFS find $flg_opts $comp_file | wc -l)
1774 [ $found -eq 1 ] || error "Failover: component (64M-128M) not found"
1776 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1777 [ "$ost_idx" != "-1" ] && error "Failover: EXT component disappeared"
1779 sel_layout_sanity $comp_file 3
1781 run_test 20d "Low on space + 0-length comp: force extension"
1784 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1785 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1786 skip "skipped for lustre < $SEL_VER"
1788 local comp_file=$DIR/$tdir/$tfile
1789 test_mkdir -p $DIR/$tdir
1791 wait_delete_completed
1794 pool_add $TESTNAME || error "Pool creation failed"
1795 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
1797 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
1798 error "Create $comp_file failed"
1800 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
1802 dd if=/dev/zero bs=1M count=1 seek=100 of=$comp_file
1805 ost_watermarks_clear_enospc $tfile 0 $wms
1806 [ $RC -eq 0 ] || error "dd failed $RC"
1808 $LFS getstripe $comp_file
1809 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
1810 local found=$($LFS find $flg_opts $comp_file | wc -l)
1811 [ $found -eq 1 ] || error "Write: component (64M-EOF) not found"
1813 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
1814 [ "$ost_idx" != "" ] && error "Write: 0-length component still exists"
1815 ost_idx=$($LFS getstripe -I3 -i $comp_file)
1816 [ "$ost_idx" != "" ] && error "Write: extension component still exists"
1818 sel_layout_sanity $comp_file 2
1820 run_test 20e "ENOSPC with next real comp: spillover and backward extension"
1822 # Simple DoM interaction test
1824 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1825 skip "skipped for lustre < $SEL_VER"
1827 local comp_file=$DIR/$tdir/$tfile
1831 test_mkdir -p $DIR/$tdir
1833 # simple, correct self-extending layout after DoM component
1834 $LFS setstripe -E 1M -L mdt -E -1 -z 64m $comp_file || \
1835 error "Create $comp_file failed"
1837 # Write to DoM component & to self-extending comp after it
1838 dd if=/dev/zero bs=1M count=12 of=$comp_file ||
1839 error "dd to extend failed"
1841 flg_opts="--comp-flags init"
1842 found=$($LFS find --comp-start 1M -E 65M $flg_opts $comp_file | wc -l)
1843 [ $found -eq 1 ] || error "Write: extended component not found"
1845 flg_opts="--comp-flags extension"
1846 found=$($LFS find --comp-start 65M $flg_opts $comp_file | wc -l)
1847 [ $found -eq 1 ] || error "Write: extension component not found"
1849 sel_layout_sanity $comp_file 3
1851 run_test 21a "Simple DoM interaction tests"
1853 # DoM + extension + removal
1855 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1856 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1857 skip "skipped for lustre < $SEL_VER"
1859 local comp_file=$DIR/$tdir/$tfile
1860 local ost_name=$(ostname_from_index 0)
1864 test_mkdir -p $DIR/$tdir
1866 # DoM, extendable component, further extendable component
1867 $LFS setstripe -E 1M -L mdt -E 256M -i 0 -z 64M -E -1 -z 128M \
1868 $comp_file || error "Create $comp_file failed"
1870 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1871 [ $found -eq 1 ] || error "Write: Zero length component not found"
1873 # This also demonstrates that we will avoid degraded OSTs
1874 do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
1875 # sleep to guarantee we see the degradation
1878 # un-degrade on exit
1879 stack_trap "do_facet ost1 $LCTL set_param -n \
1880 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1882 # This should remove the first component after DoM and spill over to
1884 dd if=/dev/zero bs=1M count=2 of=$comp_file ||
1885 error "dd to remove+spill over failed"
1887 found=$($LFS find --comp-start 1M -E 1M $flg_opts $comp_file | wc -l)
1888 [ $found -eq 0 ] || error "Write: Zero length component still present"
1890 flg_opts="--comp-flags init"
1891 found=$($LFS find --comp-start 1M -E 129M $flg_opts $comp_file | wc -l)
1892 [ $found -eq 1 ] || error "Write: extended component not found"
1894 flg_opts="--comp-flags extension"
1895 found=$($LFS find --comp-start 129M -E EOF $flg_opts $comp_file |wc -l)
1896 [ $found -eq 1 ] || error "Write: extension component not found"
1898 sel_layout_sanity $comp_file 3
1900 run_test 21b "DoM followed by extendable component with removal"
1902 # Test of repeat component behavior with OOS/degraded OST
1904 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1905 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1906 skip "skipped for lustre < $SEL_VER"
1908 local comp_file=$DIR/$tdir/$tfile
1912 test_mkdir -p $DIR/$tdir
1914 $LFS setstripe -E -1 -c 1 -z 128M $comp_file ||
1915 error "Create $comp_file failed"
1917 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
1918 local ost_name=$(ostname_from_index $ost_idx1)
1920 # write past end of first component, so it is extended
1921 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1922 error "dd to extend failed"
1924 flg_opts="--comp-flags extension"
1925 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
1926 [ $found -eq 1 ] || error "Write: second component not found"
1928 # degrade OST for component 1
1929 do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1930 obdfilter.$ost_name.degraded=1
1931 # sleep to guarantee we see the degradation
1934 # un-degrade on exit
1935 stack_trap "do_facet ost$((ost_idx1+1)) $LCTL set_param -n \
1936 obdfilter.$ost_name.degraded=0; sleep_maxage" EXIT
1938 replay_barrier $SINGLEMDS
1940 # seek past the end of current comp & write, should cause a new comp
1941 # to be created (ie repeat previous comp)
1942 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
1943 error "dd to repeat failed"
1945 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
1947 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
1949 flg_opts="--comp-flags init"
1950 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
1951 [ $found -eq 1 ] || error "Write: second component not found"
1953 flg_opts="--comp-flags extension"
1954 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
1955 [ $found -eq 1 ] || error "Write: extension component not found"
1959 local ost_idx2_2=$($LFS getstripe -I2 -i $comp_file)
1960 [ $ost_idx2_2 -ne $ost_idx2 ] && error "$ost_idx2_2 != $ost_idx2"
1962 flg_opts="--comp-flags init"
1963 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
1964 [ $found -eq 1 ] || error "Failover: second component not found"
1966 flg_opts="--comp-flags extension"
1967 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
1968 [ $found -eq 1 ] || error "Failover: extension component not found"
1970 sel_layout_sanity $comp_file 3
1972 run_test 22a "Test repeat component behavior with degraded OST"
1974 # Test repeat behavior with low space
1976 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
1977 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
1978 skip "skipped for lustre < $SEL_VER"
1980 local comp_file=$DIR/$tdir/$tfile
1984 test_mkdir -p $DIR/$tdir
1986 # without this, a previous delete can finish after we check free space
1987 wait_delete_completed
1990 $LFS setstripe -E -1 -c 1 -z 128M \
1991 $comp_file || error "Create $comp_file failed"
1993 # write past end of first component, so it is extended
1994 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=130 ||
1995 error "dd to extend failed"
1997 flg_opts="--comp-flags extension"
1998 found=$($LFS find --comp-start 256M -E EOF $flg_opts $comp_file | wc -l)
1999 [ $found -eq 1 ] || error "Write: Second component not found"
2001 # set our OST low on space
2002 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2003 local wms=$(ost_watermarks_set_low_space $ost_idx1 | grep "watermarks")
2005 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2007 # Write past end of current space, fail to extend, causing repeat
2008 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 ||
2009 error "dd to repeat failed"
2011 $LFS getstripe $comp_file
2013 local ost_idx2=$($LFS getstripe -I2 -i $comp_file)
2015 [ $ost_idx1 -eq $ost_idx2 ] && error "$ost_idx1 == $ost_idx2"
2017 flg_opts="--comp-flags init"
2018 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2019 [ $found -eq 1 ] || error "Write: Second component not found"
2021 flg_opts="--comp-flags extension"
2022 found=$($LFS find --comp-start 384M -E EOF $flg_opts $comp_file | wc -l)
2023 [ $found -eq 1 ] || error "Write: Extension component not found"
2025 sel_layout_sanity $comp_file 3
2027 run_test 22b "Test simple 'out of space' condition with repeat"
2029 # This tests both "repeat" and "extend in place when repeat fails" aspects
2030 # of repeating components
2032 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2033 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2034 skip "skipped for lustre < $SEL_VER"
2036 local comp_file=$DIR/$tdir/$tfile
2040 test_mkdir -p $DIR/$tdir
2042 # pool is used to limit available OSTs to 0 and 1, so we can set all
2043 # available OSTs out of space
2044 pool_add $TESTNAME || error "Pool creation failed"
2045 pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed"
2047 # without this, a previous delete can finish after we check free space
2048 wait_delete_completed
2051 $LFS setstripe -E -1 -z 64M -c 1 -p "$TESTNAME" $comp_file || \
2052 error "Create $comp_file failed"
2054 # write past end of first component, so it is extended
2055 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=80 conv=notrunc ||
2056 error "dd to extend failed"
2058 $LFS getstripe $comp_file
2060 flg_opts="--comp-flags extension"
2061 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2062 [ $found -eq 1 ] || error "Write: second component not found"
2064 # set our OST out of space
2065 local ost_idx1=$($LFS getstripe -I1 -i $comp_file)
2066 local wms=$(ost_watermarks_set_enospc $tfile $ost_idx1 |
2068 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx1 $wms" EXIT
2070 # This should create a repeat component on a new OST
2071 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=180 conv=notrunc ||
2072 error "dd to repeat failed"
2074 $LFS getstripe $comp_file
2076 local comp_cnt=$($LFS getstripe --component-count $comp_file)
2077 [ $comp_cnt -ne 3 ] && error "component count: $comp_cnt, should be 3"
2079 # New second component should be on a different OST
2080 local ost_idx2=$($LFS getstripe --comp-start=128m \
2081 --comp-end=192m --comp-flags=init -i $comp_file)
2083 [ $ost_idx1 -eq $ost_idx2 ] && error "2nd comp: same OST $ost_idx1"
2085 local wms2=$(ost_watermarks_set_enospc $tfile $ost_idx2 |
2087 stack_trap "ost_watermarks_clear_enospc $tfile $ost_idx2 $wms2" EXIT
2089 # now that the second OST is out of space (as is the first OST), we
2090 # attempt to extend. This should result in an extension of the
2091 # existing component, rather than a new component.
2092 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=240 conv=notrunc ||
2093 error "dd for forced extension failed"
2095 $LFS getstripe $comp_file
2097 # clear out of space on first OST
2098 ost_watermarks_clear_enospc $tfile $ost_idx1 $wms
2100 # finally, now that the first OST has space again, we attempt to
2101 # extend one last time. This should create a new component on the
2103 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=300 conv=notrunc ||
2104 error "dd for repeat on first OST failed"
2106 $LFS getstripe $comp_file
2108 flg_opts="--comp-flags init"
2109 found=$($LFS find --comp-start 128M $flg_opts $comp_file | wc -l)
2110 [ $found -eq 1 ] || error "Write: second component not found"
2112 flg_opts="--comp-flags init"
2113 found=$($LFS find --comp-start 256M $flg_opts $comp_file | wc -l)
2114 [ $found -eq 1 ] || error "Write: third component not found"
2116 flg_opts="--comp-flags extension"
2117 found=$($LFS find --comp-start 320M -E EOF $flg_opts $comp_file | wc -l)
2118 [ $found -eq 1 ] || error "Write: extension component not found"
2120 sel_layout_sanity $comp_file 4
2122 run_test 22c "Test repeat with out of space on > 1 OST"
2124 test_22d_post_check() {
2127 local flg_opts="--comp-flags init"
2128 local found=$($LFS find --comp-start 0M -E 128M $flg_opts $comp_file |
2130 [ $found -eq 1 ] || {
2131 $LFS getstripe $comp_file
2132 error "$name: second component not found"
2135 flg_opts="--comp-flags extension"
2136 found=$($LFS find --comp-start 128M -E EOF $flg_opts $comp_file | wc -l)
2137 [ $found -eq 1 ] || error "$name: third extension component not found"
2139 sel_layout_sanity $comp_file 2
2147 # write past end of first component
2148 dd if=/dev/zero of=$comp_file bs=1M count=1 seek=70
2151 ost_watermarks_clear_enospc $tfile 0 $wms
2152 [ $RC -eq 0 ] || error "dd to force extend failed"
2154 test_22d_post_check $comp_file "Write"
2158 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2159 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2160 skip "skipped for lustre < $SEL_VER"
2162 local comp_file=$DIR/$tdir/$tfile
2166 test_mkdir -p $DIR/$tdir
2168 # without this, a previous delete can finish after we check free space
2169 wait_delete_completed
2172 # Pool allows us to force use of only certain OSTs
2173 pool_add $TESTNAME || error "Pool creation failed"
2174 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2176 # 1. Fail to extend due to OOS, try to repeat within the same pool,
2177 # fail to stripe (again OOS) the 0-length component, remove the
2178 # repeated one, force the extension on the original one.
2179 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2180 error "Create $comp_file failed"
2182 replay_barrier $SINGLEMDS
2184 # set our OST out of space
2185 local wms=$(ost_watermarks_set_enospc $tfile 0 | grep "watermarks")
2187 test_22d_pre $comp_file "$wms"
2189 test_22d_post_check $comp_file "Failover"
2191 # 2. repeat with low on space: 0-length repeated component will be
2192 # striped, but still fails to be extended; otherwise the same as (1).
2194 $LFS setstripe -E -1 -p $TESTNAME -z 64M $comp_file ||
2195 error "Create $comp_file failed"
2197 replay_barrier $SINGLEMDS
2199 # set our OST low on space
2200 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2202 test_22d_pre $comp_file "$wms"
2204 test_22d_post_check $comp_file "Failover"
2206 run_test 22d "out of/low on space + failed to repeat + forced extension"
2209 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2210 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2211 skip "skipped for lustre < $SEL_VER"
2213 local comp_file=$DIR/$tdir/$tfile
2214 test_mkdir -p $DIR/$tdir
2216 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2217 error "Create $comp_file failed"
2219 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2220 error "dd append failed"
2222 local flg_opts="--comp-start 0 -E EOF --comp-flags init"
2223 local found=$($LFS find $flg_opts $comp_file | wc -l)
2224 [ $found -eq 1 ] || error "Append: first component (0-EOF) not found"
2226 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2227 [ "$ost_idx" != "" ] && error "Append: second component still exists"
2229 sel_layout_sanity $comp_file 1
2231 run_test 23a "Append: remove EXT comp"
2234 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2235 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2236 skip "skipped for lustre < $SEL_VER"
2238 local comp_file=$DIR/$tdir/$tfile
2239 test_mkdir -p $DIR/$tdir
2241 $LFS setstripe -E 64m -E -1 -z 64M $comp_file ||
2242 error "Create $comp_file failed"
2244 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2245 error "dd append failed"
2247 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2248 local found=$($LFS find $flg_opts $comp_file | wc -l)
2249 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2251 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2252 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2254 sel_layout_sanity $comp_file 2
2256 run_test 23b "Append with 0-length comp: remove EXT comp"
2259 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2260 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2261 skip "skipped for lustre < $SEL_VER"
2263 local comp_file=$DIR/$tdir/$tfile
2264 test_mkdir -p $DIR/$tdir
2266 wait_delete_completed
2269 pool_add $TESTNAME || error "Pool creation failed"
2270 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2271 $LFS setstripe -E 64m -E -1 -p $TESTNAME -z 64M $comp_file ||
2272 error "Create $comp_file failed"
2274 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2275 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2278 ost_watermarks_clear_enospc $tfile 0 $wms
2279 [ $RC -eq 0 ] || error "dd append failed: $RC"
2281 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2282 local found=$($LFS find $flg_opts $comp_file | wc -l)
2283 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2285 local ost_idx=$($LFS getstripe -I3 -i $comp_file)
2286 [ "$ost_idx" != "" ] && error "Append: EXT component still exists"
2288 sel_layout_sanity $comp_file 2
2290 run_test 23c "Append with low on space + 0-length comp: force extension"
2293 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2294 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2295 skip "skipped for lustre < $SEL_VER"
2297 local comp_file=$DIR/$tdir/$tfile
2298 test_mkdir -p $DIR/$tdir
2300 $LFS setstripe -E 64m -E 640M -z 64M -E -1 $comp_file ||
2301 error "Create $comp_file failed"
2303 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file ||
2304 error "dd append failed"
2306 flg_opts="--comp-start 64M -E 640M --comp-flags init"
2307 found=$($LFS find $flg_opts $comp_file | wc -l)
2308 [ $found -eq 1 ] || error "Append: component (64M-640M) not found"
2310 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2311 [ "$ost_idx" != "" ] && error "Append: third component still exists"
2313 sel_layout_sanity $comp_file 3
2315 run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
2318 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2319 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2320 skip "skipped for lustre < $SEL_VER"
2322 local comp_file=$DIR/$tdir/$tfile
2323 test_mkdir -p $DIR/$tdir
2325 wait_delete_completed
2328 pool_add $TESTNAME || error "Pool creation failed"
2329 pool_add_targets $TESTNAME 0 || error "Pool add targets failed"
2331 $LFS setstripe -E 64m -E 640M -z 64M -p $TESTNAME -E -1 $comp_file ||
2332 error "Create $comp_file failed"
2334 local wms=$(ost_watermarks_set_low_space 0 | grep "watermarks")
2336 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2339 ost_watermarks_clear_enospc $tfile 0 $wms
2340 [ $RC -eq 0 ] || error "dd append failed $RC"
2342 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2343 local found=$($LFS find $flg_opts $comp_file | wc -l)
2344 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2346 local ost_idx=$($LFS getstripe -I2 -i $comp_file)
2347 [ "$ost_idx" != "" ] && error "Append: 0-length component still exists"
2348 ost_idx=$($LFS getstripe -I3 -i $comp_file)
2349 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2351 sel_layout_sanity $comp_file 2
2353 run_test 23e "Append with next real comp: spillover and backward extension"
2356 [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
2357 [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
2358 skip "skipped for lustre < $SEL_VER"
2360 local comp_file=$DIR/$tdir/$tfile
2361 test_mkdir -p $DIR/$tdir
2363 $LFS setstripe -z 64M -c 1 -E -1 $comp_file ||
2364 error "Create $comp_file failed"
2366 local ost_idx=$($LFS getstripe -I1 -i $comp_file)
2367 local wms=$(ost_watermarks_set_low_space $ost_idx | grep "watermarks")
2369 dd if=/dev/zero bs=1M oflag=append count=1 of=$comp_file
2372 ost_watermarks_clear_enospc $tfile $ost_idx $wms
2373 [ $RC -eq 0 ] || error "dd append failed"
2375 local flg_opts="--comp-start 64M -E EOF --comp-flags init"
2376 local found=$($LFS find $flg_opts $comp_file | wc -l)
2377 [ $found -eq 1 ] || error "Append: component (64M-EOF) not found"
2379 ost_idx=$($LFS getstripe -I2 -i $comp_file)
2380 [ "$ost_idx" != "" ] && error "Append: extension component still exists"
2382 sel_layout_sanity $comp_file 2
2384 run_test 23f "Append with low on space: repeat and remove EXT comp"
2393 [ "$OSTCOUNT" -lt "3" ] && skip_env "needs >= 3 OSTs"
2395 trap cleanup_24 EXIT RETURN
2397 local file=$DIR/$tfile
2399 $LFS setstripe -E 1m -c1 -o0 -E eof -c2 -o1,2 $file ||
2400 error "setstripe on $file"
2402 dd if=/dev/zero of=$file bs=1M count=3 || error "dd failed for $file"
2405 filefrag -ves $file || error "filefrag $file failed"
2406 filefrag_op=$(filefrag -ve -k $file |
2407 sed -n '/ext:/,/found/{/ext:/d; /found/d; p}')
2409 #Filesystem type is: bd00bd0
2410 #File size of /mnt/lustre/f24a.sanity-pfl is 3145728 (3072 blocks of 1024 bytes)
2411 # ext: device_logical: physical_offset: length: dev: flags:
2412 # 0: 0.. 1023: 1572864.. 1573887: 1024: 0000: net
2413 # 1: 0.. 1023: 1572864.. 1573887: 1024: 0002: net
2414 # 2: 1024.. 2047: 1573888.. 1574911: 1024: 0001: last,net
2415 #/mnt/lustre/f24a.sanity-pfl: 3 extents found
2417 last_lun=$(echo $filefrag_op | cut -d: -f5)
2422 for line in $filefrag_op; do
2423 frag_lun=$(echo $line | cut -d: -f5)
2424 ext_len=$(echo $line | cut -d: -f4)
2425 if [[ "$frag_lun" != "$last_lun" ]]; then
2426 if (( tot_len != 1024 )); then
2428 error "$file: OST$last_lun $tot_len != 1024"
2434 (( tot_len += ext_len ))
2437 if (( num_luns != 3 || tot_len != 1024 )); then
2439 error "$file: $num_luns != 3, $tot_len != 1024 on OST$last_lun"
2442 echo "FIEMAP on $file succeeded"
2444 run_test 24a "FIEMAP upon PFL file"
2447 local pfl_f=$DIR/$tdir/"$tfile"_pfl
2448 local dom_f=$DIR/$tdir/"$tfile"_dom
2449 local common_f=$DIR/$tdir/"$tfile"_common
2453 mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed"
2454 $LFS setstripe -E 10M -S 64k -c -1 -E 20M -S 1M -E -1 -S 2M -c 1 \
2455 $pfl_f || error "setstripe $pfl_f failed"
2456 $LFS setstripe -E 256k -L mdt -E -1 -S 1M $dom_f ||
2457 error "setstripe $dom_f failed"
2458 $LFS setstripe -S 512K -c -1 $common_f ||
2459 error "setstripe $common_f failed"
2461 #verify lov_getstripe_old with PFL file
2462 stripe_count=$(lov_getstripe_old $pfl_f |
2463 awk '/stripe_count/ { print $2 }')
2464 stripe_size=$(lov_getstripe_old $pfl_f |
2465 awk '/stripe_size/ { print $2 }')
2466 [ $stripe_count -eq 1 ] ||
2467 error "stripe_count $stripe_count !=1 for $pfl_f"
2468 [ $stripe_size -eq 2097152 ] ||
2469 error "stripe_size $stripe_size != 2097152 for $pfl_f"
2471 #verify lov_getstripe_old with DoM file
2472 stripe_count=$(lov_getstripe_old $dom_f |
2473 awk '/stripe_count/ { print $2 }')
2474 stripe_size=$(lov_getstripe_old $dom_f |
2475 awk '/stripe_size/ { print $2 }')
2476 [ $stripe_count -eq 1 ] ||
2477 error "stripe_count $stripe_count !=1 for $dom_f"
2478 [ $stripe_size -eq 1048576 ] ||
2479 error "stripe_size $stripe_size != 1048576 for $dom_f"
2481 #verify lov_getstripe_old with common file
2482 stripe_count=$(lov_getstripe_old $common_f |
2483 awk '/stripe_count/ { print $2 }')
2484 stripe_size=$(lov_getstripe_old $common_f |
2485 awk '/stripe_size/ { print $2 }')
2486 [ $stripe_count -eq $OSTCOUNT ] ||
2487 error "stripe_count $stripe_count !=$OSTCOUNT for $common_f"
2488 [ $stripe_size -eq 524288 ] ||
2489 error "stripe_size $stripe_size != 524288 for $common_f"
2491 run_test 25 "Verify old lov stripe API with PFL files"
2494 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2495 dd if=/dev/urandom bs=1M count=10 >> $DIR/$tfile
2496 [ $? != 0 ] || error "append must return an error"
2498 run_test 26a "Append to not-existent component"
2501 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2502 dd if=/dev/urandom bs=1M count=1 > $DIR/$tfile
2503 dd if=/dev/urandom bs=1M count=1 >> $DIR/$tfile
2504 [ $? != 0 ] || error "append must return an error"
2506 run_test 26b "Append to not-existend component, file size is unknown"
2509 $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
2510 dd if=/dev/urandom bs=2M count=1 >> $DIR/$tfile
2511 [ $? != 0 ] || error "append must return an error"
2513 run_test 26c "Append to not-existend component, crossing the component border"
2516 check_and_cleanup_lustre