Whamcloud - gitweb
LU-10070 lod: SEL inheritance fix
[fs/lustre-release.git] / lustre / tests / sanity-pfl.sh
index 9c71449..708b3e2 100644 (file)
@@ -528,7 +528,8 @@ test_11() {
        [[ -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"
@@ -538,7 +539,7 @@ test_11() {
        [[ -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")
@@ -674,7 +675,7 @@ test_15() {
        $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"
@@ -724,6 +725,15 @@ test_15() {
        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"
 
@@ -1043,6 +1053,7 @@ test_19b() {
                skip "skipped for lustre < $SEL_VER"
 
        local comp_file=$DIR/$tdir/$tfile
+       local comp_dir=$DIR/$tdir/$tdir
        local flg_opts=""
        local found=""
 
@@ -1050,15 +1061,24 @@ test_19b() {
        $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
 }