Whamcloud - gitweb
LU-1715 ptlrpc: flock deadlock detection does not work
[fs/lustre-release.git] / lustre / tests / sanity.sh
index eae0af9..5b5b0dd 100644 (file)
@@ -638,6 +638,9 @@ test_17n() {
 run_test 17n "run e2fsck against master/slave MDT which contains remote dir"
 
 test_17o() {
+       [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.64) ]] &&
+               skip "Need MDS version at least 2.3.64" && return
+
        local WDIR=$DIR/${tdir}o
        local mdt_index
        local mdtdevname
@@ -3924,8 +3927,7 @@ run_test 54e "console/tty device works in lustre ======================"
 test_56a() {   # was test_56
         rm -rf $DIR/$tdir
         $SETSTRIPE -d $DIR
-       test_mkdir $DIR/$tdir
-        test_mkdir $DIR/$tdir/dir
+        test_mkdir -p $DIR/$tdir/dir
         NUMFILES=3
         NUMFILESx2=$(($NUMFILES * 2))
         for i in `seq 1 $NUMFILES` ; do
@@ -4511,6 +4513,34 @@ test_56x() {
 }
 run_test 56x "lfs migration support"
 
+test_56y() {
+       local res=""
+
+       local dir0=$DIR/$tdir/$testnum
+       mkdir -p $dir0 || error "creating dir $dir0"
+       local f1=$dir0/file1
+       local f2=$dir0/file2
+
+       touch $f1 || error "creating std file $f1"
+       $MULTIOP $f2 H2c || error "creating released file $f2"
+
+       # a directory can be raid0, so ask only for files
+       res=$($LFIND $dir0 -L raid0 -type f | wc -l)
+       [[ $res == 2 ]] || error "search raid0: found $res files != 2"
+
+       res=$($LFIND $dir0 \! -L raid0 -type f | wc -l)
+       [[ $res == 0 ]] || error "search !raid0: found $res files != 0"
+
+       # only files can be released, so no need to force file search
+       res=$($LFIND $dir0 -L released)
+       [[ $res == $f2 ]] || error "search released: found $res != $f2"
+
+       res=$($LFIND $dir0 \! -L released)
+       [[ $res == $f1 ]] || error "search !released: found $res != $f1"
+
+}
+run_test 56y "lfs find -L raid0|released"
+
 test_57a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        # note test will not do anything if MDS is not local
@@ -9468,20 +9498,6 @@ test_162() {
 }
 run_test 162 "path lookup sanity"
 
-test_163() {
-       [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
-       remote_mds_nodsh && skip "remote MDS with nodsh" && return
-       copytool --test $FSNAME || { skip "copytool not runnable: $?" && return; }
-       copytool $FSNAME &
-       sleep 1
-       local uuid=$($LCTL get_param -n mdc.${FSNAME}-MDT0000-mdc-*.uuid)
-       # this proc file is temporary and linux-only
-       do_facet $SINGLEMDS lctl set_param mdt.${FSNAME}-MDT0000.mdccomm=$uuid ||\
-         error "kernel->userspace send failed"
-       kill -INT $!
-}
-run_test 163 "kernel <-> userspace comms"
-
 test_169() {
        # do directio so as not to populate the page cache
        log "creating a 10 Mb file"
@@ -10676,12 +10692,13 @@ test_215() { # for bugs 18102, 21079, 21517
 
        # /proc/sys/lnet/routes should look like this:
        # Routing disabled/enabled
-       # net hops state router
-       # where net is a string like tcp0, hops >= 0, state is up/down,
+       # net hops priority state router
+       # where net is a string like tcp0, hops > 0, priority >= 0,
+       # state is up/down,
        # router is a string like 192.168.1.1@tcp2
        L1="^Routing (disabled|enabled)$"
-       L2="^net +hops +state +router$"
-       BR="^$NET +$N +(up|down) +$NID$"
+       L2="^net +hops +priority +state +router$"
+       BR="^$NET +$N +(0|1) +(up|down) +$NID$"
        create_lnet_proc_files "routes"
        check_lnet_proc_entry "routes.out" "/proc/sys/lnet/routes" "$BR" "$L1" "$L2"
        check_lnet_proc_entry "routes.sys" "lnet.routes" "$BR" "$L1" "$L2"
@@ -11256,8 +11273,7 @@ test_229() { # LU-2482, LU-3448
 
        $GETSTRIPE -v $DIR/$tfile
 
-       local pattern=$($GETSTRIPE -v $DIR/$tfile |
-                       grep lmm_stripe_pattern | awk '{print $2}')
+       local pattern=$($GETSTRIPE -L $DIR/$tfile)
        [ X"$pattern" = X"80000001" ] || error "pattern error ($pattern)"
 
        local stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe"
@@ -11421,6 +11437,45 @@ test_233() {
 }
 run_test 233 "checking that OBF of the FS root succeeds"
 
+test_234() {
+       local p="$TMP/sanityN-$TESTNAME.parameters"
+       save_lustre_params client "llite.*.xattr_cache" > $p
+       lctl set_param llite.*.xattr_cache 1 ||
+               { skip "xattr cache is not supported"; return 0; }
+
+       mkdir -p $DIR/$tdir || error "mkdir failed"
+       touch $DIR/$tdir/$tfile || error "touch failed"
+       # OBD_FAIL_LLITE_XATTR_ENOMEM
+       $LCTL set_param fail_loc=0x1405
+       setfattr -n user.attr -v value $DIR/$tdir/$tfile &&
+               error "setfattr should have failed with ENOMEM"
+       # attr pre-2.4.44-7 had a bug with rc
+       getfattr -n user.attr $DIR/$tdir/$tfile &&
+               error "getfattr should have failed with ENOMEM"
+       $LCTL set_param fail_loc=0x0
+       rm -rf $DIR/$tdir
+
+       restore_lustre_params < $p
+       rm -f $p
+}
+run_test 234 "xattr cache should not crash on ENOMEM"
+
+test_235() {
+        [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.4.52) ] &&
+               skip "Need MDS version at least 2.4.52" && return
+       flock_deadlock $DIR/$tfile
+       local RC=$?
+       case $RC in
+               0)
+               ;;
+               124) error "process hangs on a deadlock"
+               ;;
+               *) error "error executing flock_deadlock $DIR/$tfile"
+               ;;
+       esac
+}
+run_test 235 "LU-1715: flock deadlock detection does not work properly"
+
 #
 # tests that do cleanup/setup should be run at the end
 #