Whamcloud - gitweb
LU-946 lprocfs: List open files in filesystem
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 2831fde..b9f8686 100644 (file)
@@ -2120,7 +2120,6 @@ test_31m() {
 run_test 31m "link to file: the same, non-existing, dir==============="
 
 test_31n() {
-       [ -e /proc/self/fd/173 ] && echo "skipping, fd 173 is in use" && return
        touch $DIR/$tfile || error "cannot create '$DIR/$tfile'"
        nlink=$(stat --format=%h $DIR/$tfile)
        [ ${nlink:--1} -eq 1 ] || error "nlink is $nlink, expected 1"
@@ -7964,11 +7963,15 @@ test_129() {
        ENOSPC=28
        EFBIG=27
 
+       rm -rf $DIR/$tdir
        test_mkdir -p $DIR/$tdir
 
-       MAX=$(stat -c%s "$DIR/$tdir")
+       # block size of mds1
+       local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/})
+       local MDSBLOCKSIZE=$($LCTL get_param -n mdc.*MDT0000*.blocksize)
+       local MAX=$((MDSBLOCKSIZE * 3))
        set_dir_limits $MAX
-       local I=0
+       local I=$(stat -c%s "$DIR/$tdir")
        local J=0
        while [ ! $I -gt $MAX ]; do
                $MULTIOP $DIR/$tdir/$J Oc
@@ -7976,18 +7979,22 @@ test_129() {
                #check two errors ENOSPC for new version of ext4 max_dir_size patch
                #mainline kernel commit df981d03eeff7971ac7e6ff37000bfa702327ef1
                #and EFBIG for previous versions
-               if [ $rc -eq $EFBIG -o $rc -eq $ENOSPC ] && [ $I -gt 0 ]; then
+               if [ $rc -eq $EFBIG -o $rc -eq $ENOSPC ]; then
                        set_dir_limits 0
                        echo "return code $rc received as expected"
-                       multiop $DIR/$tdir/$J Oc
-                       rc=$?
+                       multiop $DIR/$tdir/$J Oc ||
+                               error_exit "multiop failed w/o dir size limit"
+
                        I=$(stat -c%s "$DIR/$tdir")
-                       if [ $I -gt $MAX ] && [ $rc -eq 0 ]; then
-                               return 0
+
+                       if [ $(lustre_version_code $SINGLEMDS) -lt \
+                                       $(version_code 2.4.51) ]
+                       then
+                               [ $I -eq $MAX ] && return 0
                        else
-                               error_exit "return code $rc current dir size $I " \
-                                          "previous limit $MAX"
+                               [ $I -gt $MAX ] && return 0
                        fi
+                       error_exit "current dir size $I, previous limit $MAX"
                elif [ $rc -ne 0 ]; then
                        set_dir_limits 0
                        error_exit "return code $rc received instead of expected " \
@@ -9182,6 +9189,39 @@ test_154c() {
 }
 run_test 154c "lfs path2fid and fid2path multiple arguments"
 
+test_154d() {
+       [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] &&
+               skip "Need MDS version at least 2.5.53" && return
+
+       if remote_mds; then
+               nid=$($LCTL list_nids | sed  "s/\./\\\./g")
+       else
+               nid="0@lo"
+       fi
+       local proc_ofile="mdt.*.exports.'$nid'.open_files"
+       local fd
+       local cmd
+
+       rm -f $DIR/$tfile
+       touch $DIR/$tfile
+
+       fid=$($LFS path2fid $DIR/$tfile)
+       # Open the file
+       fd=$(free_fd)
+       cmd="exec $fd<$DIR/$tfile"
+       eval $cmd
+       fid_list=$(do_facet $SINGLEMDS $LCTL get_param $proc_ofile)
+       echo $fid_list | grep $fid
+       rc=$?
+
+       cmd="exec $fd>/dev/null"
+       eval $cmd
+       if [ $rc -ne 0 ]; then
+               error "FID $fid not found in open files list $fid_list"
+       fi
+}
+run_test 154d "Verify open file fid"
+
 test_155_small_load() {
     local temp=$TMP/$tfile
     local file=$DIR/$tfile
@@ -11233,6 +11273,10 @@ test_219() {
         dd if=/dev/zero of=$DIR/$tfile bs=4096 count=1 seek=3
         $LCTL set_param fail_loc=0x411
         dd if=/dev/zero of=$DIR/$tfile bs=1024 count=1 seek=2 conv=notrunc
+
+       # LU-4201
+       dd if=/dev/zero of=$DIR/$tfile-2 bs=1024 count=1
+       $CHECKSTAT -s 1024 $DIR/$tfile-2 || error "checkstat wrong size"
 }
 run_test 219 "LU-394: Write partial won't cause uncontiguous pages vec at LND"