check_and_setup_lustre
-if [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.9.51) ]]; then
+if [[ "$MDS1_VERSION" -lt $(version_code 2.9.51) ]]; then
skip_env "Need MDS version at least 2.9.51"
fi
[[ -n $f4 ]] && error "1: 4th component instantiated"
# the first 2 components instantiated
- $TRUNCATE $comp_file $((1024*1024*1+1))
+ # Truncate to exact start of new component - LU-12586
+ $TRUNCATE $comp_file $((1024*1024*1))
f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
[[ -z $f2 ]] && error "2: 2nd component uninstantiated"
[[ -n $f4 ]] && error "2: 4th component instantiated"
# the first 3 components instantiated
- $TRUNCATE $comp_file $((1024*1024*3))
+ $TRUNCATE $comp_file $((1024*1024*3 - 1))
$TRUNCATE $comp_file $((1024*1024*1+1))
f2=$($LFS getstripe -I2 $comp_file | grep "l_fid")
$LFS setstripe -E 1M -S 1M -E 10M -E eof $parent/f1 || error "create f1"
$LFS setstripe -E 4M -E 20M -E eof $parent/f2 || error "create f2"
test_mkdir $parent/subdir
- $LFS setstripe -E 6M -S 1M -E 30M -E eof $parent/subdir ||
+ $LFS setstripe -E 6M -S 1M -c1 -E 30M -c4 -E eof -c -1 $parent/subdir ||
error "setstripe to subdir"
$LFS setstripe -E 8M -E eof $parent/subdir/f3 || error "create f3"
$LFS setstripe -c 1 $parent/subdir/f4 || error "create f4"
found=$($LFS find $ext_opts ! $cnt_opts $flg_opts $parent | wc -l)
[ $found -eq 2 ] ||
error "start-1M, end+5M, !count+2, flag=init, $found != 2"
+
+ # check last component stripe count
+ if [ $OSTCOUNT -gt 1 ]; then
+ touch $parent/subdir/f5
+ $TRUNCATE $parent/subdir/f5 $((32*1024*1024))
+ found=$($LFS find $parent/subdir -c $OSTCOUNT)
+ [[ "$found" == "$parent/subdir/f5" ]] ||
+ error "got '$found' with stripe_count=$OSTCOUNT, not f5"
+ fi
}
run_test 15 "Verify component options for lfs find"
# Self-extending PFL tests
test_19a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
test19_io_base $DIR/$tdir/$tfile
# Same as 19a, but with default layout set on directory rather than on file
test_19b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
+ local comp_dir=$DIR/$tdir/$tdir
local flg_opts=""
local found=""
$LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir ||
error "Setstripe on $DIR/$tdir failed"
+ # check inheritance for a sub-dir and a file
+ test_mkdir $comp_dir
+ found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l)
+ [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l)
+ [ $found -eq 1 ] || error "Dir Inheritance: Second component not found"
+
touch $comp_file
flg_opts="--comp-flags init"
found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l)
- [ $found -eq 1 ] || error "Inheritance: wrong first component size"
+ [ $found -eq 1 ] || error "File Inheritance: wrong first component size"
flg_opts="--comp-flags extension"
found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l)
- [ $found -eq 1 ] || error "Inheritance: Second component not found"
+ [ $found -eq 1 ] || error "File Inheritance: Second component not found"
test19_io_base $comp_file 1
}
# Test behavior when seeking deep in a file
test_19c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 19c "Test self-extending layout seeking behavior"
test_19d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
}
test_19e() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 19e "Replay of layout instantiation & extension"
test_19f() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
}
run_test 19f "Rejection of invalid layouts"
+test_19g() {
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
+ skip "skipped for lustre < $SEL_VER"
+
+ local file1=$DIR/${tfile}-1
+ local file2=$DIR/${tfile}-2
+
+ test_mkdir -p $DIR/$tdir
+ multiop $file1 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
+ error "create failed $file1"
+ multiop $file2 oO_RDWR:O_CREAT:O_LOV_DELAY_CREATE:c ||
+ error "create failed $file2"
+
+ $LFS setstripe --component-add -E 1G -c 1 $file1 ||
+ error "comp-add [0,1G] failed $file1"
+ $LFS setstripe --component-add -E 512M -z 128M $file1 &&
+ error "comp-add [1G,1G],SEL[1G,512M] succeded $file1"
+ $LFS setstripe --component-add -E 10G -z 128M $file1 ||
+ error "comp-add [1G,1G],SEL[1G,10G] failed $file1"
+ $LFS setstripe --component-add -E -1 $file1 ||
+ error "comp-add [10G,-1] failed $file1"
+
+ $LFS setstripe --component-add -E 1G -z 32M -c 1 $file2 &&
+ error "comp-add with smal ext size succeeded $file1"
+ $LFS setstripe --component-add -E 1G -z 100M -c 1 $file2 &&
+ error "comp-add with not aligned ext size succeeded $file1"
+ $LFS setstripe --component-add -E 1G -z 128M -c 1 $file2 ||
+ error "comp-add [0,128M],SEL[128M,1G] failed $file1"
+ $LFS setstripe --component-add -E 10G $file2 ||
+ error "comp-add [1G,10G] failed $file1"
+ $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 ||
+ error "comp-add [10G,10G],SEL[10G,-1] failed $file1"
+ $LFS setstripe --component-add -E -1 -z 128M -c 1 $file2 &&
+ error "repeated comp-add [10G,10G],SEL[10G,-1] succeeded $file1"
+
+ $LFS getstripe $file1
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 0 -E 1G $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "First component not found $file1"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 1G -E 1G $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "Second component not found $file1"
+
+ flg_opts="--comp-flags ^init,extension"
+ found=$($LFS find --comp-start 1G -E 10G $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "Third component not found $file1"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 10G -E EOF $flg_opts $file1 | wc -l)
+ [ $found -eq 1 ] || error "Fourth component not found $file1"
+
+ $LFS getstripe $file2
+ flg_opts="--comp-flags init"
+ found=$($LFS find --comp-start 0 -E 128M $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "First component not found $file2"
+
+ flg_opts="--comp-flags extension"
+ found=$($LFS find --comp-start 128M -E 1G $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Second component not found $file2"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 1G -E 10G $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Third component not found $file2"
+
+ flg_opts="--comp-flags ^init"
+ found=$($LFS find --comp-start 10G -E 10G $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Fourth component not found $file2"
+
+ flg_opts="--comp-flags ^init,extension"
+ found=$($LFS find --comp-start 10G -E EOF $flg_opts $file2 | wc -l)
+ [ $found -eq 1 ] || error "Fifth component not found $file2"
+}
+run_test 19g "component-add behaviour"
+
# Test out of space behavior
test_20a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 20a "Test out of space, spillover to defined component"
test_20b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 20b "Remove component without instantiation when there is no space"
test_20c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 20c "Test inability to stripe new extension component"
test_20d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 20d "Low on space + 0-length comp: force extension"
test_20e() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# Simple DoM interaction test
test_21a() {
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# DoM + extension + removal
test_21b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# Test of repeat component behavior with OOS/degraded OST
test_22a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# Test repeat behavior with low space
test_22b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
# This tests both "repeat" and "extend in place when repeat fails" aspects
# of repeating components
test_22c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
}
test_22d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 22d "out of/low on space + failed to repeat + forced extension"
test_23a() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23a "Append: remove EXT comp"
test_23b() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23b "Append with 0-length comp: remove EXT comp"
test_23c() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23c "Append with low on space + 0-length comp: force extension"
test_23d() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23d "Append with 0-length comp + next real comp: remove EXT comp"
test_23e() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
run_test 23e "Append with next real comp: spillover and backward extension"
test_23f() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
+ [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile