Whamcloud - gitweb
LU-64 Modify the behavior of ioctl on directories without EA set.
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 49c4c35..ea9feda 100644 (file)
@@ -1329,6 +1329,7 @@ check_seq_oid()
                 local group=${lmm[$((j+3))]}
                 local dev=$(ostdevname $devnum)
                 local dir=${MOUNT%/*}/ost$devnum
+                local mntpt=$(facet_mntpt ost$devnum)
 
                 stop ost$devnum
                 do_facet ost$devnum mount -t $FSTYPE $dev $dir $OST_MOUNT_OPTS ||
@@ -1348,7 +1349,7 @@ check_seq_oid()
                 [ $stripe -eq $i ] || { error "stripe mismatch"; return 6; }
 
                 echo -e "\t\tost $obdidx, objid $objid, group $group"
-                do_facet ost$devnum umount -d $dev
+                do_facet ost$devnum umount -d $mntpt
                 start ost$devnum $dev $OST_MOUNT_OPTS
         done
 }
@@ -6872,21 +6873,21 @@ test_155_small_load() {
 test_155_big_load() {
     local temp=$TMP/$tfile
     local file=$DIR/$tfile
-    local list=$(comma_list $(osts_nodes))
-    local big=$(do_nodes $list grep "cache" /proc/cpuinfo | \
-        awk '{sum+=$4} END{print sum}')
-    local min_avail=$(lctl get_param -n osc.*[oO][sS][cC]-[^M]*.kbytesavail | \
-        sort -n | head -1)
-    local large_file_size=$((big * 2))
-
-    log "cache size on OSS is $big KB"
-    log "large file size is $large_file_size KB"
-    log "min available OST size is $min_avail KB"
-
-    [ $min_avail -le $large_file_size ] && \
-        skip "the minimum available OST size needs > $large_file_size KB" && \
+
+    free_min_max
+    local cache_size=$(do_facet ost$((MAXI+1)) \
+        "awk '/cache/ {sum+=\\\$4} END {print sum}' /proc/cpuinfo")
+    local large_file_size=$((cache_size * 2))
+
+    echo "OSS cache size: $cache_size KB"
+    echo "Large file size: $large_file_size KB"
+
+    [ $MAXV -le $large_file_size ] && \
+        skip_env "max available OST size needs > $large_file_size KB" && \
         return 0
 
+    $SETSTRIPE $file -c 1 -i $MAXI || error "$SETSTRIPE $file failed"
+
     dd if=/dev/urandom of=$temp bs=$large_file_size count=1k || \
         error "dd of=$temp bs=$large_file_size count=1k failed"
     cp $temp $file
@@ -7665,6 +7666,136 @@ run_test 201c "Remove a pool ============================================"
 
 cleanup_pools $FSNAME
 
+# usage: default_attr <count | size | offset>
+default_attr() {
+       $LCTL get_param -n lov.$FSNAME-clilov-\*.stripe${1}
+}
+
+# usage: trim <string>
+# Trims leading and trailing whitespace from the parameter string
+trim() {
+    echo $@
+}
+
+# usage: check_default_stripe_attr <count | size | offset>
+check_default_stripe_attr() {
+       # $GETSTRIPE returns trailing whitespace which needs to be trimmed off
+       ACTUAL=$(trim $($GETSTRIPE --$1 $DIR/$tdir))
+       if [ $1 = "count" -o $1 = "size" ]; then
+               EXPECTED=`default_attr $1`;
+       else
+               # the 'stripeoffset' parameter prints as an unsigned int, so
+               # until this is fixed we hard-code -1 here
+               EXPECTED=-1;
+       fi
+       [ "x$ACTUAL" != "x$EXPECTED" ] &&
+               error "$DIR/$tdir has stripe $1 '$ACTUAL', not '$EXPECTED'"
+}
+
+# usage: check_raw_stripe_attr <count | size | offset>
+check_raw_stripe_attr() {
+       # $GETSTRIPE returns trailing whitespace which needs to be trimmed off
+       ACTUAL=$(trim $($GETSTRIPE --raw --$1 $DIR/$tdir))
+       if [ $1 = "count" -o $1 = "size" ]; then
+               EXPECTED=0;
+       else
+               EXPECTED=-1;
+       fi
+       [ "x$ACTUAL" != "x$EXPECTED" ] &&
+               error "$DIR/$tdir has raw stripe $1 '$ACTUAL', not '$EXPECTED'"
+}
+
+
+test_204a() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --count 0 --size 0 --offset -1 $DIR/$tdir
+
+       check_default_stripe_attr count
+       check_default_stripe_attr size
+       check_default_stripe_attr offset
+
+       return 0
+}
+run_test 204a "Print default stripe attributes ================="
+
+test_204b() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --count 1 $DIR/$tdir
+
+       check_default_stripe_attr size
+       check_default_stripe_attr offset
+
+       return 0
+}
+run_test 204b "Print default stripe size and offset  ==========="
+
+test_204c() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --size 65536 $DIR/$tdir
+
+       check_default_stripe_attr count
+       check_default_stripe_attr offset
+
+       return 0
+}
+run_test 204c "Print default stripe count and offset ==========="
+
+test_204d() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --offset 0 $DIR/$tdir
+
+       check_default_stripe_attr count
+       check_default_stripe_attr size
+
+       return 0
+}
+run_test 204d "Print default stripe count and size ============="
+
+test_204e() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE -d $DIR/$tdir
+
+       check_raw_stripe_attr count
+       check_raw_stripe_attr size
+       check_raw_stripe_attr offset
+
+       return 0
+}
+run_test 204e "Print raw stripe attributes ================="
+
+test_204f() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --count 1 $DIR/$tdir
+
+       check_raw_stripe_attr size
+       check_raw_stripe_attr offset
+
+       return 0
+}
+run_test 204f "Print raw stripe size and offset  ==========="
+
+test_204g() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --size 65536 $DIR/$tdir
+
+       check_raw_stripe_attr count
+       check_raw_stripe_attr offset
+
+       return 0
+}
+run_test 204g "Print raw stripe count and offset ==========="
+
+test_204h() {
+       mkdir -p $DIR/$tdir
+       $SETSTRIPE --offset 0 $DIR/$tdir
+
+       check_raw_stripe_attr count
+       check_raw_stripe_attr size
+
+       return 0
+}
+run_test 204h "Print raw stripe count and size ============="
+
 test_212() {
        size=`date +%s`
        size=$((size % 8192 + 1))