Whamcloud - gitweb
LU-3544 fid: do open-by-fid by default
[fs/lustre-release.git] / lustre / tests / sanity.sh
index edaed12..4df82e1 100644 (file)
@@ -620,7 +620,7 @@ test_17m() {
        stop mds${mds_index}
        do_facet mds${mds_index} $cmd || rc=$?
 
-       start mds${mds_index} $devname $MDS_MOUNT_OPTS
+       start mds${mds_index} $devname $MDS_MOUNT_OPTS || error "start failed"
        df $MOUNT > /dev/null 2>&1
        [ $rc -ne 0 ] && error "e2fsck should not report error upon "\
                "short/long symlink MDT: rc=$rc"
@@ -645,7 +645,8 @@ check_fs_consistency_17n() {
                stop mds${mdt_index}
                do_facet mds${mdt_index} $cmd || rc=$?
 
-               start mds${mdt_index} $devname $MDS_MOUNT_OPTS
+               start mds${mdt_index} $devname $MDS_MOUNT_OPTS ||
+                       error "mount mds${mdt_index} failed"
                df $MOUNT > /dev/null 2>&1
                [ $rc -ne 0 ] && break
        done
@@ -722,7 +723,8 @@ test_17o() {
 
        touch $WDIR/$tfile
        stop mds${mdt_index}
-       start mds${mdt_index} $mdtdevname $MDS_MOUNT_OPTS
+       start mds${mdt_index} $mdtdevname $MDS_MOUNT_OPTS ||
+               error "mount mds${mdt_index} failed"
 
        #define OBD_FAIL_OSD_LMA_INCOMPAT 0x194
        do_facet mds${mdt_index} lctl set_param fail_loc=0x194
@@ -2561,9 +2563,9 @@ test_33b() {
         rm -fr $DIR/d33
         test_mkdir -p $DIR/d33
         chown $RUNAS_ID $DIR/d33
-        $RUNAS $OPENFILE -f 1286739555 $DIR/d33/f33 && error "create" || true
+        $RUNAS $OPENFILE -f 1286739555 $DIR/d33/f33
 }
-run_test 33b "test open file with malformed flags (No panic and return error)"
+run_test 33b "test open file with malformed flags (No panic)"
 
 test_33c() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
@@ -4069,6 +4071,23 @@ test_51d() {
 }
 run_test 51d "check object distribution ===================="
 
+test_51e() {
+       if [ "$(facet_fstype $SINGLEMDS)" != ldiskfs ]; then
+               skip "Only applicable to ldiskfs-based MDTs"
+               return
+       fi
+
+       test_mkdir -c1 $DIR/$tdir       || error "create $tdir failed"
+       test_mkdir -c1 $DIR/$tdir/d0    || error "create d0 failed"
+
+       touch $DIR/$tdir/d0/foo
+       createmany -l $DIR/$tdir/d0/foo $DIR/$tdir/d0/f- 65001 &&
+               error "file exceed 65000 nlink limit!"
+       unlinkmany $DIR/$tdir/d0/f- 65001
+       return 0
+}
+run_test 51e "check file nlink limit"
+
 test_52a() {
        [ -f $DIR/$tdir/foo ] && chattr -a $DIR/$tdir/foo
        test_mkdir -p $DIR/$tdir
@@ -4893,6 +4912,30 @@ test_56y() {
 }
 run_test 56y "lfs find -L raid0|released"
 
+test_56z() { # LU-4824
+       # This checks to make sure 'lfs find' continues after errors
+       # There are two classes of errors that should be caught:
+       # - If multiple paths are provided, all should be searched even if one
+       #   errors out
+       # - If errors are encountered during the search, it should not terminate
+       #   early
+       local i
+       test_mkdir $DIR/$tdir
+       for i in d{0..9}; do
+               test_mkdir $DIR/$tdir/$i
+       done
+       touch $DIR/$tdir/d{0..9}/$tfile
+       $LFS find $DIR/non_existent_dir $DIR/$tdir &&
+               error "$LFS find did not return an error"
+       # Make a directory unsearchable. This should NOT be the last entry in
+       # directory order.  Arbitrarily pick the 6th entry
+       chmod 700 $(lfs find $DIR/$tdir -type d | sed '6!d')
+       local count=$($RUNAS $LFS find $DIR/non_existent $DIR/$tdir | wc -l)
+       # The user should be able to see 10 directories and 9 files
+       [ $count == 19 ] || error "$LFS find did not continue after error"
+}
+run_test 56z "lfs find should continue after an error"
+
 test_57a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        # note test will not do anything if MDS is not local
@@ -9240,14 +9283,14 @@ function roc_hit_init() {
                dd if=/dev/urandom of=$file bs=4k count=4 2>&1 > /dev/null
                idx=$(printf %04x $i)
                BEFORE=$(get_osd_param $list *OST*$idx stats |
-                       awk '$1 == "cache_access" {sum += $2}
+                       awk '$1 == "cache_access" {sum += $7}
                                END { printf("%0.0f", sum) }')
 
                cancel_lru_locks osc
                cat $file >/dev/null
 
                AFTER=$(get_osd_param $list *OST*$idx stats |
-                       awk '$1 == "cache_access" {sum += $2}
+                       awk '$1 == "cache_access" {sum += $7}
                                END { printf("%0.0f", sum) }')
 
                echo BEFORE:$BEFORE AFTER:$AFTER
@@ -9264,7 +9307,7 @@ function roc_hit_init() {
 function roc_hit() {
        local list=$(comma_list $(osts_nodes))
        echo $(get_osd_param $list '' stats |
-               awk '$1 == "cache_hit" {sum += $2}
+               awk '$1 == "cache_hit" {sum += $7}
                        END { printf("%0.0f", sum) }')
 }
 
@@ -10057,6 +10100,12 @@ run_test 160b "Verify that very long rename doesn't crash in changelog"
 
 test_160c() {
        local rc=0
+       local server_version=$(lustre_version_code $SINGLEMDS)
+
+       [[ $server_version -gt $(version_code 2.5.57) ]] ||
+               [[ $server_version -gt $(version_code 2.5.1) &&
+                  $server_version -lt $(version_code 2.5.50) ]] ||
+               { skip "Need MDS version at least 2.5.58 or 2.5.2+"; return; }
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
 
        # Registration step
@@ -10446,7 +10495,7 @@ test_171() { # bug20592
 }
 run_test 171 "test libcfs_debug_dumplog_thread stuck in do_exit() ======"
 
-# it would be good to share it with obdfilter-survey/libecho code
+# it would be good to share it with obdfilter-survey/iokit-libecho code
 setup_obdecho_osc () {
         local rc=0
         local ost_nid=$1
@@ -12626,6 +12675,13 @@ run_test 237 "Verify name_to_handle_at/open_by_handle_at syscalls"
 
 # LU-4659 linkea consistency
 test_238() {
+       local server_version=$(lustre_version_code $SINGLEMDS)
+
+       [[ $server_version -gt $(version_code 2.5.57) ]] ||
+               [[ $server_version -gt $(version_code 2.5.1) &&
+                  $server_version -lt $(version_code 2.5.50) ]] ||
+               { skip "Need MDS version at least 2.5.58 or 2.5.2+"; return; }
+
        touch $DIR/$tfile
        ln $DIR/$tfile $DIR/$tfile.lnk
        touch $DIR/$tfile.new