Whamcloud - gitweb
b=14512 Fix mistake made in original patch
[fs/lustre-release.git] / lustre / tests / sanity.sh
index e4e55e0..20cbec9 100755 (executable)
@@ -1278,6 +1278,72 @@ test_27y() {
 }
 run_test 27y "create files while OST0 is degraded and the rest inactive"
 
+check_seq_oid()
+{
+        echo check file $1
+        local old_ifs="$IFS"
+        IFS=$'\t\n :'
+        lmm=($($GETSTRIPE -v $1))
+
+        IFS=$'[:]'
+        fid=($($LFS path2fid $1))
+        IFS="$old_ifs"
+
+        # compare lmm_seq and lu_fid->f_seq
+        [ ${lmm[4]} = ${fid[1]} ] || { error "SEQ mismatch"; return 1; }
+        # compare lmm_object_id and lu_fid->oid
+        [ ${lmm[6]} = ${fid[2]} ] || { error "OID mismatch"; return 2; }
+
+        echo -e "\tseq ${fid[1]}, oid ${fid[2]} ver ${fid[3]}\n\tstripe count: ${lmm[8]}"
+
+        [ "$FSTYPE" != "ldiskfs" ] && skip "can not check trusted.fid FSTYPE=$FSTYPE" && return 0
+
+        # check the trusted.fid attribute of the OST objects of the file
+        for (( i=0, j=19; i < ${lmm[8]}; i++, j+=4 )); do
+                local obdidx=${lmm[$j]}
+                local devnum=$((obdidx + 1))
+                local objid=${lmm[$((j+1))]}
+                local group=${lmm[$((j+3))]}
+                local dev=$(ostdevname $devnum)
+                local dir=${MOUNT%/*}/ost$devnum
+                do_facet ost$devnum mount -t $FSTYPE $dev $dir $OST_MOUNT_OPTS ||
+                        { error "mounting $dev as $FSTYPE failed"; return 3; }
+
+                obj_filename=$(do_facet ost$devnum find $dir/O/$group -name $objid)
+                local ff=$(do_facet ost$devnum $LL_DECODE_FILTER_FID $obj_filename)
+                IFS=$'/= [:]'
+                ff=($(echo $ff))
+                IFS="$old_ifs"
+
+                # compare lmm_seq and filter_fid->ff_parent.f_seq
+                [ ${ff[11]} = ${lmm[4]} ] || { error "parent SEQ mismatch"; return 4; }
+                # compare lmm_object_id and filter_fid->ff_parent.f_oid
+                [ ${ff[12]} = ${lmm[6]} ] || { error "parent OID mismatch"; return 5; }
+                let stripe=${ff[13]}
+                [ $stripe -eq $i ] || { error "stripe mismatch"; return 6; }
+
+                echo -e "\t\tost $obdidx, objid $objid, group $group"
+                do_facet ost$devnum umount -d $dev
+        done
+}
+
+test_27z() {
+        mkdir -p $DIR/$tdir
+        $SETSTRIPE $DIR/$tdir/$tfile-1 -c 1 -o 0 -s 1m ||
+                { error "setstripe -c -1 failed"; return 1; }
+        dd if=/dev/zero of=$DIR/$tdir/$tfile-1 bs=1M count=1 ||
+                { error "dd 1 mb failed"; return 2; }
+        $SETSTRIPE $DIR/$tdir/$tfile-2 -c -1 -o $(($OSTCOUNT - 1)) -s 1m ||
+                { error "setstripe -c 1 failed"; return 3; }
+        dd if=/dev/zero of=$DIR/$tdir/$tfile-2 bs=1M count=$OSTCOUNT ||
+                { error "dd $OSTCOUNT mb failed"; return 4; }
+        sync
+
+        check_seq_oid $DIR/$tdir/$tfile-1 || return 5
+        check_seq_oid $DIR/$tdir/$tfile-2 || return 6
+}
+run_test 27z "check SEQ/OID on the MDT and OST filesystems"
+
 # createtest also checks that device nodes are created and
 # then visible correctly (#2091)
 test_28() { # bug 2091
@@ -1393,7 +1459,7 @@ test_31f() { # bug 4554
        $SETSTRIPE $DIR/d31f -s 1048576 -c 1
        cp /etc/hosts $DIR/d31f
        ls -l $DIR/d31f
-       $DIR/d31f/hosts
+       $GETSTRIPE $DIR/d31f/hosts
        multiop_bg_pause $DIR/d31f D_c || return 1
        MULTIPID2=$!
 
@@ -3265,8 +3331,7 @@ run_test 56q "check lfs find -gid and ! -gid ==============================="
 test_57a() {
        # note test will not do anything if MDS is not local
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
-
-       local MNTDEV="osd.*MDT*.mntdev"
+       local MNTDEV="osd*.*MDT*.mntdev"
        DEV=$(do_facet $SINGLEMDS lctl get_param -n $MNTDEV)
        [ -z "$DEV" ] && error "can't access $MNTDEV"
        for DEV in $(do_facet $SINGLEMDS lctl get_param -n $MNTDEV); do
@@ -5997,7 +6062,7 @@ set_dir_limits () {
         for node in $(mdts_nodes); do
                 devs=$(do_node $node "lctl get_param -n devices" | awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }')
                for dev in $devs; do
-                       mntdev=$(do_node $node "lctl get_param -n osd.$dev.mntdev")
+                       mntdev=$(do_node $node "lctl get_param -n osd*.$dev.mntdev")
                        do_node $node "echo $1 >$LDPROC/\\\$(basename $mntdev)/max_dir_size"
                done
        done