[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24D 27m 64b 68 71 77f 78 115 124b 230d"
if [ $(facet_fstype $SINGLEMDS) = "zfs" ]; then
- # bug number for skipped test: LU-4536 LU-5242 LU-1957 LU-2805
- ALWAYS_EXCEPT="$ALWAYS_EXCEPT 65ic 78 79 80 180 184c"
+ # bug number for skipped test: LU-4536 LU-1957 LU-2805
+ ALWAYS_EXCEPT="$ALWAYS_EXCEPT 65ic 180 184c"
[ "$SLOW" = "no" ] && EXCEPT_SLOW="$EXCEPT_SLOW 51b 51ba"
fi
echo "done"
}
-check_kernel_version() {
- WANT_VER=$1
- GOT_VER=$(lctl get_param -n version | awk '/kernel:/ {print $2}')
- case $GOT_VER in
- patchless|patchless_client) return 0;;
- *) [ $GOT_VER -ge $WANT_VER ] && return 0 ;;
- esac
- log "test needs at least kernel version $WANT_VER, running $GOT_VER"
- return 1
-}
-
check_swap_layouts_support()
{
$LCTL get_param -n llite.*.sbi_flags | grep -q layout ||
return 1
}
-if [ "$ONLY" == "cleanup" ]; then
- sh llmountcleanup.sh
- exit 0
-fi
-
check_and_setup_lustre
DIR=${DIR:-$MOUNT}
run_test 24n "Statting the old file after renaming (Posix rename 2)"
test_24o() {
- check_kernel_version 37 || return 0
test_mkdir -p $DIR/d24o
rename_many -s random -v -n 10 $DIR/d24o
}
run_test 31d "remove of open directory ========================="
test_31e() { # bug 2904
- check_kernel_version 34 || return 0
openfilleddirunlink $DIR/d31e || error
}
run_test 31e "remove of open non-empty directory ==============="
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.63) ] &&
skip "MDS prior to 2.3.63 handle ZFS dir .. incorrectly" &&
return
- check_kernel_version 34 || return 0
- test_mkdir -p $DIR/$tdir
+ test_mkdir $DIR/$tdir
cd $DIR/$tdir
- mv $DIR/$tdir $DIR/d48.new || error "move directory failed"
+ mv $DIR/$tdir $DIR/$tdir.new || error "move directory failed"
test_mkdir $DIR/$tdir || error "recreate directory failed"
touch foo || error "'touch foo' failed after recreating cwd"
- test_mkdir $DIR/$tdir/bar ||
- error "'mkdir foo' failed after recreating cwd"
- if check_kernel_version 44; then
- touch .foo || error "'touch .foo' failed after recreating cwd"
- test_mkdir $DIR/$tdir/.bar ||
- error "'mkdir .foo' failed after recreating cwd"
- fi
+ test_mkdir bar || error "'mkdir foo' failed after recreating cwd"
+ touch .foo || error "'touch .foo' failed after recreating cwd"
+ test_mkdir .bar || error "'mkdir .foo' failed after recreating cwd"
ls . > /dev/null || error "'ls .' failed after recreating cwd"
ls .. > /dev/null || error "'ls ..' failed after removing cwd"
cd . || error "'cd .' failed after recreating cwd"
run_test 48a "Access renamed working dir (should return errors)="
test_48b() { # bug 2399
- check_kernel_version 34 || return 0
rm -rf $DIR/$tdir
- test_mkdir -p $DIR/$tdir
+ test_mkdir $DIR/$tdir
cd $DIR/$tdir
rmdir $DIR/$tdir || error "remove cwd $DIR/$tdir failed"
touch foo && error "'touch foo' worked after removing cwd"
- test_mkdir $DIR/$tdir/foo &&
- error "'mkdir foo' worked after removing cwd"
- if check_kernel_version 44; then
- touch .foo && error "'touch .foo' worked after removing cwd"
- test_mkdir $DIR/$tdir/.foo &&
- error "'mkdir .foo' worked after removing cwd"
- fi
+ test_mkdir foo && error "'mkdir foo' worked after removing cwd"
+ touch .foo && error "'touch .foo' worked after removing cwd"
+ test_mkdir .foo && error "'mkdir .foo' worked after removing cwd"
ls . > /dev/null && error "'ls .' worked after removing cwd"
ls .. > /dev/null || error "'ls ..' failed after removing cwd"
is_patchless || ( cd . && error "'cd .' worked after removing cwd" )
- test_mkdir $DIR/$tdir/. && error "'mkdir .' worked after removing cwd"
+ test_mkdir . && error "'mkdir .' worked after removing cwd"
rmdir . && error "'rmdir .' worked after removing cwd"
ln -s . foo && error "'ln -s .' worked after removing cwd"
cd .. || echo "'cd ..' failed after removing cwd `pwd`" #bug 3517
run_test 48b "Access removed working dir (should return errors)="
test_48c() { # bug 2350
- check_kernel_version 36 || return 0
#lctl set_param debug=-1
#set -vx
rm -rf $DIR/$tdir
$TRACE rmdir $DIR/$tdir/dir || error "remove cwd $DIR/$tdir/dir failed"
$TRACE touch foo && error "touch foo worked after removing cwd"
$TRACE test_mkdir foo && error "'mkdir foo' worked after removing cwd"
- if check_kernel_version 44; then
- touch .foo && error "touch .foo worked after removing cwd"
- test_mkdir .foo && error "mkdir .foo worked after removing cwd"
- fi
+ touch .foo && error "touch .foo worked after removing cwd"
+ test_mkdir .foo && error "mkdir .foo worked after removing cwd"
$TRACE ls . && error "'ls .' worked after removing cwd"
$TRACE ls .. || error "'ls ..' failed after removing cwd"
is_patchless || ( $TRACE cd . &&
run_test 48c "Access removed working subdir (should return errors)"
test_48d() { # bug 2350
- check_kernel_version 36 || return 0
#lctl set_param debug=-1
#set -vx
rm -rf $DIR/$tdir
$TRACE rmdir $DIR/$tdir || error "remove parent $DIR/$tdir failed"
$TRACE touch foo && error "'touch foo' worked after removing parent"
$TRACE test_mkdir foo && error "mkdir foo worked after removing parent"
- if check_kernel_version 44; then
- touch .foo && error "'touch .foo' worked after removing parent"
- test_mkdir .foo &&
- error "mkdir .foo worked after removing parent"
- fi
+ touch .foo && error "'touch .foo' worked after removing parent"
+ test_mkdir .foo && error "mkdir .foo worked after removing parent"
$TRACE ls . && error "'ls .' worked after removing parent"
$TRACE ls .. && error "'ls ..' worked after removing parent"
is_patchless || ( $TRACE cd . &&
run_test 48d "Access removed parent subdir (should return errors)"
test_48e() { # bug 4134
- check_kernel_version 41 || return 0
#lctl set_param debug=-1
#set -vx
rm -rf $DIR/$tdir
run_test 54d "fifo device works in lustre ======================"
test_54e() {
- check_kernel_version 46 || return 0
f="$DIR/f54e"
string="aaaaaa"
cp -aL /dev/console $f
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')
+ 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"
dd if=/dev/zero of=$DIR/$tfile bs=4k count=1
rm $DIR/$tfile
+ sync # sync lest earlier test intercept the fail_loc
+
#define OBD_FAIL_OSC_BRW_PREP_REQ 0x406
lctl set_param fail_loc=0x80000406
$MULTIOP $DIR/$tfile Owy && \
[[ $F78SIZE -gt $MEMTOTAL ]] && F78SIZE=$MEMTOTAL
[[ $F78SIZE -gt 512 ]] && F78SIZE=512
[[ $F78SIZE -gt $((MAXFREE / 1024)) ]] && F78SIZE=$((MAXFREE / 1024))
- SMALLESTOST=$(lfs df $DIR | grep OST | awk '{ print $4 }' | sort -n |
+ SMALLESTOST=$($LFS df $DIR | grep OST | awk '{ print $4 }' | sort -n |
head -n1)
echo "Smallest OST: $SMALLESTOST"
[[ $SMALLESTOST -lt 10240 ]] &&
for offset in $(seq 0 $[$STRIPE_COUNT - 1]); do
local size=$((STRIPE_SIZE * num))
local file=file"$num-$offset-$count"
- stripe_size=$(lfs getstripe -S $PWD/$file)
+ stripe_size=$($LFS getstripe -S $PWD/$file)
[[ $stripe_size -ne $size ]] &&
error "$file: size $stripe_size != $size"
- stripe_count=$(lfs getstripe -c $PWD/$file)
+ stripe_count=$($LFS getstripe -c $PWD/$file)
# allow fewer stripes to be created, ORI-601
[[ $stripe_count -lt $(((3 * count + 3) / 4)) ]] &&
error "$file: count $stripe_count != $count"
- stripe_index=$(lfs getstripe -i $PWD/$file)
+ stripe_index=$($LFS getstripe -i $PWD/$file)
[[ $stripe_index -ne 0 ]] &&
stripe_index_all_zero=false
done
}
run_test 124b "lru resize (performance test) ======================="
+test_124c() {
+ [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ [ -z "$($LCTL get_param -n mdc.*.connect_flags | grep lru_resize)" ] &&
+ skip "no lru resize on server" && return 0
+
+ # cache ununsed locks on client
+ local nr=100
+ cancel_lru_locks mdc
+ test_mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir"
+ createmany -o $DIR/$tdir/f $nr ||
+ error "failed to create $nr files in $DIR/$tdir"
+ ls -l $DIR/$tdir > /dev/null
+
+ local nsdir="ldlm.namespaces.*-MDT0000-mdc-*"
+ local unused=$($LCTL get_param -n $nsdir.lock_unused_count)
+ local max_age=$($LCTL get_param -n $nsdir.lru_max_age)
+ local recalc_p=$($LCTL get_param -n $nsdir.pool.recalc_period)
+ echo "unused=$unused, max_age=$max_age, recalc_p=$recalc_p"
+
+ # set lru_max_age to 1 sec
+ $LCTL set_param $nsdir.lru_max_age=1000 # jiffies
+ echo "sleep $((recalc_p * 2)) seconds..."
+ sleep $((recalc_p * 2))
+
+ local remaining=$($LCTL get_param -n $nsdir.lock_unused_count)
+ # restore lru_max_age
+ $LCTL set_param -n $nsdir.lru_max_age $max_age
+ [ $remaining -eq 0 ] || error "$remaining locks are not canceled"
+ unlinkmany $DIR/$tdir/f $nr
+}
+run_test 124c "LRUR cancel very aged locks"
+
test_125() { # 13358
[ -z "$(lctl get_param -n llite.*.client_type | grep local)" ] && skip "must run as local client" && return
[ -z "$(lctl get_param -n mdc.*-mdc-*.connect_flags | grep acl)" ] && skip "must have acl enabled" && return
[ -z "$FID" ] && error "path2fid unable to get $DIR/$tfile FID"
# check that we get the same pathname back
- local FOUND=$($LFS fid2path $MOUNT $FID)
+ local FOUND=$($LFS fid2path $MOUNT "$FID")
[ -z "$FOUND" ] && error "fid2path unable to get $FID path"
[ "$FOUND" != "$DIR/$tfile" ] &&
error "fid2path(path2fid($DIR/$tfile)) = $FOUND != $DIR/$tfile"
N=$((N + 1))
done
- $LFS fid2path $MOUNT $FID1 $FID2 $FID3 | while read PATHNAME; do
+ $LFS fid2path $MOUNT "$FID1" "$FID2" "$FID3" | while read PATHNAME;
+ do
[ "$PATHNAME" = "$DIR/$tfile.$N" ] ||
error "fid2path pathname $PATHNAME != $DIR/$tfile.$N:"
N=$((N + 1))
rm -f $DIR/$tfile
touch $DIR/$tfile
- fid=$($LFS path2fid $DIR/$tfile)
+ local 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
+ local fid_list=$(do_facet $SINGLEMDS $LCTL get_param $proc_ofile)
+ echo "$fid_list" | grep "$fid"
rc=$?
cmd="exec $fd>/dev/null"
}
run_test 154f "get parent fids by reading link ea"
+test_154g()
+{
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.6.92) ]] ||
+ { skip "Need MDS version at least 2.6.92"; return 0; }
+
+ mkdir -p $DIR/$tdir
+ llapi_fid_test -d $DIR/$tdir
+}
+run_test 154g "various llapi FID tests"
+
test_155_small_load() {
local temp=$TMP/$tfile
local file=$DIR/$tfile
local ref2=$dir0/ref2
local file1=$dir0/file1
local file2=$dir0/file2
- # create a file large enough for the concurent test
+ # create a file large enough for the concurrent test
dd if=/dev/urandom of=$ref1 bs=1M count=$((RANDOM % 50 + 20))
dd if=/dev/urandom of=$ref2 bs=1M count=$((RANDOM % 50 + 20))
echo "ref file size: ref1($(stat -c %s $ref1))," \
local OSTIDX=0
test_mkdir -p $DIR/$tdir
- local OST=$(lfs osts | grep ${OSTIDX}": " | \
+ local OST=$($LFS osts | grep ${OSTIDX}": " | \
awk '{print $2}' | sed -e 's/_UUID$//')
# on the mdt's osc
}
run_test 224b "Don't panic on bulk IO failure"
+test_224c() { # LU-6441
+ [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+ local pages_per_rpc=$($LCTL get_param \
+ osc.*.max_pages_per_rpc)
+ local at_max=$($LCTL get_param -n at_max)
+ local timeout=$($LCTL get_param -n timeout)
+ local test_at="$LCTL get_param -n at_max"
+ local param_at="$FSNAME.sys.at_max"
+ local test_timeout="$LCTL get_param -n timeout"
+ local param_timeout="$FSNAME.sys.timeout"
+
+ $LCTL set_param -n osc.*.max_pages_per_rpc=1024
+
+ set_conf_param_and_check client "$test_at" "$param_at" 0 ||
+ error "conf_param at_max=0 failed"
+ set_conf_param_and_check client "$test_timeout" "$param_timeout" 5 ||
+ error "conf_param timeout=5 failed"
+
+ #define OBD_FAIL_PTLRPC_CLIENT_BULK_CB3 0x520
+ $LCTL set_param fail_loc=0x520
+ dd if=/dev/zero of=$DIR/$tfile bs=8MB count=1
+ sync
+ $LCTL set_param fail_loc=0
+
+ set_conf_param_and_check client "$test_at" "$param_at" $at_max ||
+ error "conf_param at_max=$at_max failed"
+ set_conf_param_and_check client "$test_timeout" "$param_timeout" \
+ $timeout || error "conf_param timeout=$timeout failed"
+
+ $LCTL set_param -n $pages_per_rpc
+}
+run_test 224c "Don't hang if one of md lost during large bulk RPC"
+
MDSSURVEY=${MDSSURVEY:-$(which mds-survey 2>/dev/null || true)}
test_225a () {
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
ln $DIR/$tfile $DIR/$tfile.lnk
touch $DIR/$tfile.new
mv $DIR/$tfile.new $DIR/$tfile
- local fid1=$(lfs path2fid $DIR/$tfile)
- local fid2=$(lfs path2fid $DIR/$tfile.lnk)
- local path1=$(lfs fid2path $FSNAME $fid1)
+ local fid1=$($LFS path2fid $DIR/$tfile)
+ local fid2=$($LFS path2fid $DIR/$tfile.lnk)
+ local path1=$($LFS fid2path $FSNAME "$fid1")
[ $tfile == $path1 ] || error "linkea inconsistent: $tfile $fid1 $path1"
- local path2=$(lfs fid2path $FSNAME $fid2)
+ local path2=$($LFS fid2path $FSNAME "$fid2")
[ $tfile.lnk == $path2 ] ||
error "linkea inconsistent: $tfile.lnk $fid2 $path2!"
rm -f $DIR/$tfile*
}
run_test 241 "bio vs dio"
+test_241b() {
+ dd if=/dev/zero of=$DIR/$tfile count=1 bs=40960
+ ls -la $DIR/$tfile
+ test_241_dio 1000 &
+ PID=$!
+ test_241_dio 1000
+ wait $PID
+}
+run_test 241b "dio vs dio"
+
test_242() {
mkdir -p $DIR/$tdir
touch $DIR/$tdir/$tfile
}
run_test 243 "various group lock tests"
+test_244()
+{
+ test_mkdir -p $DIR/$tdir
+ dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=35
+ sendfile_grouplock $DIR/$tdir/$tfile || \
+ error "sendfile+grouplock failed"
+ rm -rf $DIR/$tdir
+}
+run_test 244 "sendfile with group lock tests"
+
test_250() {
[ "$(facet_fstype ost$(($($GETSTRIPE -i $DIR/$tfile) + 1)))" = "zfs" ] \
&& skip "no 16TB file size limit on ZFS" && return
}
run_test 250 "Write above 16T limit"
+test_251() {
+ $SETSTRIPE -c -1 -S 1048576 $DIR/$tfile
+
+ #define OBD_FAIL_LLITE_LOST_LAYOUT 0x1407
+ #Skip once - writing the first stripe will succeed
+ $LCTL set_param fail_loc=0xa0001407 fail_val=1
+ $MULTIOP $DIR/$tfile o:O_RDWR:w2097152c 2>&1 | grep -q "short write" &&
+ error "short write happened"
+
+ $LCTL set_param fail_loc=0xa0001407 fail_val=1
+ $MULTIOP $DIR/$tfile or2097152c 2>&1 | grep -q "short read" &&
+ error "short read happened"
+
+ rm -f $DIR/$tfile
+}
+run_test 251 "Handling short read and write correctly"
+
cleanup_test_300() {
trap 0
umask $SAVE_UMASK
[ $(stat -c%h $DIR/$tdir/striped_dir) == '2' ] ||
error "nlink error after rmdir"
+ chattr +i $DIR/$tdir/striped_dir
+ createmany -o $DIR/$tdir/striped_dir/f 10 &&
+ error "immutable flags not working under striped dir!"
+ chattr -i $DIR/$tdir/striped_dir
+
rmdir $DIR/$tdir/striped_dir ||
error "rmdir striped dir error"
mkdir $DIR/$tdir/$dirname/{test1,test2,test3,test4} ||
error "create dirs failed"
+
+ createmany -o $DIR/$tdir/$dirname/f- 10 || error "create files failed"
+ unlinkmany $DIR/$tdir/$dirname/f- 10 || error "unlink files failed"
for dir in $(find $DIR/$tdir/$dirname/*); do
stripe_count=$($LFS getdirstripe -c $dir)
[ $stripe_count -eq $default_count ] ||