simple_cleanup_common() {
local rc=0
trap 0
- [ -z "$DIR" -o -z "$tdir" ] && return 0
+ [ -z "$DIR" ] || [ -z "$tdir" ] && return 0
local start=$SECONDS
rm -rf $DIR/$tdir
local num_ls=$(ls $DIR/$tdir | wc -l)
local num_uniq=$(ls $DIR/$tdir | sort -u | wc -l)
local num_all=$(ls -a $DIR/$tdir | wc -l)
- if [ $num_ls -ne $nrfiles -o $num_uniq -ne $nrfiles -o \
- $num_all -ne $((nrfiles + 2)) ]; then
- error "Expected $nrfiles files, got $num_ls " \
- "($num_uniq unique $num_all .&..)"
+ if [ $num_ls -ne $nrfiles ] || [ $num_uniq -ne $nrfiles ] ||
+ [ $num_all -ne $((nrfiles + 2)) ]; then
+ error "Expected $nrfiles files, got $num_ls " \
+ "($num_uniq unique $num_all .&..)"
fi
# LU-5 large readdir
# dirent_size = 32 bytes for sizeof(struct lu_dirent) +
local t=$(ls $DIR/$tdir | wc -l)
local u=$(ls $DIR/$tdir | sort -u | wc -l)
local v=$(ls -ai $DIR/$tdir | sort -u | wc -l)
- if [ $t -ne $NFILES -o $u -ne $NFILES -o $v -ne $((NFILES + 2)) ] ; then
+ if [ $t -ne $NFILES ] || [ $u -ne $NFILES ] ||
+ [ $v -ne $((NFILES + 2)) ] ; then
error "Expected $NFILES files, got $t ($u unique $v .&..)"
fi
local skip27D
[ $MDS1_VERSION -lt $(version_code 2.8.55) ] &&
skip27D+="-s 29"
- [ $MDS1_VERSION -lt $(version_code 2.9.55) -o \
- $CLIENT_VERSION -lt $(version_code 2.9.55) ] &&
- skip27D+=" -s 30,31"
+ [ $MDS1_VERSION -lt $(version_code 2.9.55) ] ||
+ [ $CLIENT_VERSION -lt $(version_code 2.9.55) ] &&
+ skip27D+=" -s 30,31"
llapi_layout_test -d$DIR/$tdir -p$POOL -o$OSTCOUNT $skip27D ||
error "llapi_layout_test failed"
}
run_test 27H "Set specific OSTs stripe"
+test_27I() {
+ [ $PARALLEL == "yes" ] && skip "skip parallel run"
+ [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
+ local pool=$TESTNAME
+ local ostrange="1 1 1"
+
+ save_layout_restore_at_exit $MOUNT
+ $LFS setstripe -c 2 -i 0 $MOUNT
+ pool_add $pool || error "pool_add failed"
+ pool_add_targets $pool $ostrange || "pool_add_targets failed"
+ test_mkdir $DIR/$tdir
+ $LFS setstripe -p $pool $DIR/$tdir
+ $MULTIOP $DIR/$tdir/$tfile Oc || error "multiop failed"
+ $LFS getstripe $DIR/$tdir/$tfile
+}
+run_test 27I "check that root dir striping does not break parent dir one"
+
# createtest also checks that device nodes are created and
# then visible correctly (#2091)
test_28() { # bug 2091
test_43a() {
test_mkdir $DIR/$tdir
- cp -p $(which $MULTIOP) $DIR/$tdir/multiop ||
- cp -p multiop $DIR/$tdir/multiop
- MULTIOP_PROG=$DIR/$tdir/multiop multiop_bg_pause $TMP/$tfile.junk O_c ||
- error "multiop open $TMP/$tfile.junk failed"
- rm $TMP/$tfile.junk # delete junk file on close (not part of test)
- MULTIOP_PID=$!
- $MULTIOP $DIR/$tdir/multiop Oc && error "expected error, got success"
- kill -USR1 $MULTIOP_PID || error "kill -USR1 PID $MULTIOP_PID failed"
- wait $MULTIOP_PID || error "wait PID $MULTIOP_PID failed"
+ cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy"
+ $DIR/$tdir/sleep 60 &
+ SLEEP_PID=$!
+ $MULTIOP $DIR/$tdir/sleep Oc && error "expected error, got success"
+ kill $SLEEP_PID
}
run_test 43a "open(RDWR) of file being executed should return -ETXTBSY"
[ $PARALLEL == "yes" ] && skip "skip parallel run"
test_mkdir $DIR/$tdir
- cp -p $(which $MULTIOP) $DIR/$tdir/multiop ||
- cp -p multiop $DIR/$tdir/multiop
- MULTIOP_PROG=$DIR/$tdir/multiop multiop_bg_pause $TMP/$tfile.junk O_c ||
- error "multiop open $TMP/$tfile.junk failed"
- rm $TMP/$tfile.junk # delete junk file on close (not part of test)
- MULTIOP_PID=$!
- $TRUNCATE $DIR/$tdir/multiop 0 && error "expected error, got success"
- kill -USR1 $MULTIOP_PID || error "kill -USR1 PID $MULTIOP_PID failed"
- wait $MULTIOP_PID || error "wait PID $MULTIOP_PID failed"
+ cp -p $(which sleep) $DIR/$tdir/sleep || error "can't copy"
+ $DIR/$tdir/sleep 60 &
+ SLEEP_PID=$!
+ $TRUNCATE $DIR/$tdir/sleep 0 && error "expected error, got success"
+ kill $SLEEP_PID
}
run_test 43b "truncate of file being executed should return -ETXTBSY"
setup_56 $dir $NUMFILES $NUMDIRS
local expected=12
- local cmd="$LFS find -size 0 -type f $dir"
+ local cmd="$LFS find -size 0 -type f -lazy $dir"
local nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
error "'$cmd' wrong: found $nums, expected $expected"
+ cmd="$LFS find -size 0 -type f $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
+
expected=0
+ cmd="$LFS find ! -size 0 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
cmd="$LFS find ! -size 0 -type f $dir"
nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
error "'$cmd' wrong: found $nums, expected $expected"
+
echo "test" > $dir/$tfile
echo "test2" > $dir/$tfile.2 && sync
expected=1
+ cmd="$LFS find -size 5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
cmd="$LFS find -size 5 -type f $dir"
nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
error "'$cmd' wrong: found $nums, expected $expected"
+
expected=1
+ cmd="$LFS find -size +5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
cmd="$LFS find -size +5 -type f $dir"
nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
error "'$cmd' wrong: found $nums, expected $expected"
+
expected=2
+ cmd="$LFS find -size +0 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
cmd="$LFS find -size +0 -type f $dir"
nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
error "'$cmd' wrong: found $nums, expected $expected"
+
expected=2
+ cmd="$LFS find ! -size -5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
cmd="$LFS find ! -size -5 -type f $dir"
nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
error "'$cmd' wrong: found $nums, expected $expected"
+
expected=12
+ cmd="$LFS find -size -5 -type f -lazy $dir"
+ nums=$($cmd | wc -l)
+ [ $nums -eq $expected ] ||
+ error "'$cmd' wrong: found $nums, expected $expected"
cmd="$LFS find -size -5 -type f $dir"
nums=$($cmd | wc -l)
[ $nums -eq $expected ] ||
$RUNAS dd if=/dev/zero of=$DIR/$tfile bs=512 count=1 ||
error "$RUNAS dd $DIR/$tfile failed"
# See if we are still setuid/sgid
- test -u $DIR/$tfile -o -g $DIR/$tfile &&
+ [ -u $DIR/$tfile ] || [ -g $DIR/$tfile ] &&
error "S/gid is not dropped on write"
# Now test that MDS is updated too
cancel_lru_locks mdc
- test -u $DIR/$tfile -o -g $DIR/$tfile &&
+ [ -u $DIR/$tfile ] || [ -g $DIR/$tfile ] &&
error "S/gid is not dropped on MDS"
rm -f $DIR/$tfile
}
rm -f $file
wait_delete_completed
- [ $raOFF -le 1 -o $raON -lt $raOFF ] ||
+ [ $raOFF -le 1 ] || [ $raON -lt $raOFF ] ||
error "readahead ${raON}s > no-readahead ${raOFF}s ${sz_MB}M"
}
run_test 101d "file read with and without read-ahead enabled"
$LFS setstripe -i 0 -c 1 $DIR/$tfile
local orig_mb=$(do_facet ost1 $LCTL get_param -n $brw_size | head -n 1)
- if [ $OST1_VERSION -ge $(version_code 2.8.52) -o \
- \( $OST1_VERSION -ge $(version_code 2.7.17) -a \
- $OST1_VERSION -lt $(version_code 2.7.50) \) ] &&
- [ $CLIENT_VERSION -ge $(version_code 2.8.52) -o \
- \( $CLIENT_VERSION -ge $(version_code 2.7.17) -a \
- $CLIENT_VERSION -lt $(version_code 2.7.50) \) ]; then
- [ $OST1_VERSION -ge $(version_code 2.9.52) ] && suffix="M"
+
+ if { [ $OST1_VERSION -ge $(version_code 2.8.52) ] ||
+ { [ $OST1_VERSION -ge $(version_code 2.7.17) ] &&
+ [ $OST1_VERSION -lt $(version_code 2.7.50) ]; }; } &&
+ { [ $CLIENT_VERSION -ge $(version_code 2.8.52) ] ||
+ { [ $CLIENT_VERSION -ge $(version_code 2.7.17) ] &&
+ [ $CLIENT_VERSION -lt $(version_code 2.7.50) ]; }; }; then
+
+ [ $OST1_VERSION -ge $(version_code 2.9.52) ] &&
+ suffix="M"
+
if [[ $orig_mb -lt 16 ]]; then
save_lustre_params $osts "$brw_size" > $p
do_nodes $list $LCTL set_param -n $brw_size=16$suffix ||
local file=$DIR/$tfile
local value="$(generate_string $xsize)"
local xbig=trusted.big
+ local toobig=$2
touch $file
log "save $xbig on $file"
- setfattr -n $xbig -v $value $file ||
- error "saving $xbig on $file failed"
+ if [ -z "$toobig" ]
+ then
+ setfattr -n $xbig -v $value $file ||
+ error "saving $xbig on $file failed"
+ else
+ setfattr -n $xbig -v $value $file &&
+ error "saving $xbig on $file succeeded"
+ return 0
+ fi
local orig=$(get_xattr_value $xbig $file)
[[ "$orig" != "$value" ]] && error "$xbig different after saving $xbig"
test_102ha() {
large_xattr_enabled || skip_env "ea_inode feature disabled"
+ echo "setting xattr of max xattr size: $(max_xattr_size)"
grow_xattr $(max_xattr_size)
+
+ echo "setting xattr of > max xattr size: $(max_xattr_size) + 10"
+ echo "This should fail:"
+ grow_xattr $(($(max_xattr_size) + 10)) 1
}
run_test 102ha "grow xattr from inside inode to external inode"
echo "performing permissions..."
run_acl_subtest permissions || error "permissions failed"
# LU-1482 mdd: Setting xattr are properly checked with and without ACLs
- if [ $MDS1_VERSION -gt $(version_code 2.8.55) -o \
- \( $MDS1_VERSION -lt $(version_code 2.6) -a \
- $MDS1_VERSION -ge $(version_code 2.5.29) \) ]
+ if [ $MDS1_VERSION -gt $(version_code 2.8.55) ] ||
+ { [ $MDS1_VERSION -lt $(version_code 2.6) ] &&
+ [ $MDS1_VERSION -ge $(version_code 2.5.29) ]; }
then
echo "performing permissions xattr..."
run_acl_subtest permissions_xattr ||
# check two errors:
# ENOSPC for new ext4 max_dir_size (kernel commit df981d03ee)
# EFBIG for previous versions included in ldiskfs series
- if [ $rc -eq $EFBIG -o $rc -eq $ENOSPC ]; then
+ if [ $rc -eq $EFBIG ] || [ $rc -eq $ENOSPC ]; then
set_dir_limits 0 0
echo "return code $rc received as expected"
done
i=$((i - 1))
echo "The symlink depth = $i"
- [ $i -eq 5 -o $i -eq 7 -o $i -eq 8 -o $i -eq 40 ] ||
- error "Invalid symlink depth"
+ [ $i -eq 5 ] || [ $i -eq 7 ] || [ $i -eq 8 ] || [ $i -eq 40 ] ||
+ error "Invalid symlink depth"
# Test recursive symlink
ln -s symlink_self symlink_self
"test_brw $count w v $pages $id" || rc=4; }
[ $rc -eq 0 ] && { do_facet $node "$LCTL --device ec destroy $id 1" ||
rc=4; }
- [ $rc -eq 0 -o $rc -gt 2 ] && { do_facet $node "$LCTL --device ec " \
- "cleanup" || rc=5; }
- [ $rc -eq 0 -o $rc -gt 1 ] && { do_facet $node "$LCTL --device ec " \
- "detach" || rc=6; }
- [ $rc -ne 0 ] && echo "obecho_create_test failed: $rc"
- return $rc
+ [ $rc -eq 0 ] || [ $rc -gt 2 ] &&
+ { do_facet $node "$LCTL --device ec cleanup" || rc=5; }
+ [ $rc -eq 0 ] || [ $rc -gt 1 ] &&
+ { do_facet $node "$LCTL --device ec detach" || rc=6; }
+ [ $rc -ne 0 ] && echo "obecho_create_test failed: $rc"
+ return $rc
}
test_180a() {
test_252() {
remote_mds_nodsh && skip "remote MDS with nodsh"
remote_ost_nodsh && skip "remote OST with nodsh"
- if [ "$ost1_FSTYPE" != "ldiskfs" -o "$mds1_FSTYPE" != "ldiskfs" ]; then
+ if [ "$ost1_FSTYPE" != ldiskfs ] || [ "$mds1_FSTYPE" != ldiskfs ]; then
skip_env "ldiskfs only test"
fi
local rc
test_mkdir -p $DIR/$tdir
- $LFS setstripe -i 0 $DIR/$tdir
+ $LFS setstripe -i 0 -c 1 $DIR/$tdir
#test 10 returns only success/failure
i=10
}
run_test 271d "DoM: read on open (1K file in reply buffer)"
-test_271e() {
- [ $MDS1_VERSION -lt $(version_code 2.10.57) ] &&
- skip "Need MDS version at least 2.10.57"
-
- local dom=$DIR/$tdir/dom
- local tmp=$TMP/${tfile}.data
- trap "cleanup_271def_tests $tmp" EXIT
-
- mkdir -p $DIR/$tdir
-
- $LFS setstripe -E 1024K -L mdt $DIR/$tdir
-
- local mdtidx=$($LFS getstripe --mdt-index $DIR/$tdir)
-
- cancel_lru_locks mdc
- dd if=/dev/urandom of=$tmp bs=30K count=1
- dd if=$tmp of=$dom bs=30K count=1
- cancel_lru_locks mdc
- cat /etc/hosts >> $tmp
- lctl set_param -n mdc.*.stats=clear
-
- echo "Append to the same page"
- cat /etc/hosts >> $dom
-
- local num=$(get_mdc_stats $mdtidx ost_read)
- local ra=$(get_mdc_stats $mdtidx req_active)
- local rw=$(get_mdc_stats $mdtidx req_waittime)
-
- [ -z $num ] || error "$num READ RPC occured"
- # Reply buffer can be adjusted for larger buffer by resend
- echo "... DONE with $((ra - rw)) resends"
-
- # compare content
- cmp $tmp $dom || error "file miscompare"
-
- cancel_lru_locks mdc
- lctl set_param -n mdc.*.stats=clear
-
- echo "Open and read file"
- cat $dom > /dev/null
- local num=$(get_mdc_stats $mdtidx ost_read)
- local ra=$(get_mdc_stats $mdtidx req_active)
- local rw=$(get_mdc_stats $mdtidx req_waittime)
-
- [ -z $num ] || error "$num READ RPC occured"
- # Reply buffer can be adjusted for larger buffer by resend
- echo "... DONE with $((ra - rw)) resends"
-
- # compare content
- cmp $tmp $dom || error "file miscompare"
-
- return 0
-}
-run_test 271e "DoM: read on open (30K file with reply buffer adjusting)"
-
test_271f() {
[ $MDS1_VERSION -lt $(version_code 2.10.57) ] &&
skip "Need MDS version at least 2.10.57"
for dir in $(find $DIR/$tdir/$dirname/*); do
stripe_count=$($LFS getdirstripe -c $dir)
[ $stripe_count -eq $default_count ] ||
- [ $stripe_count -eq 0 -o $default_count -eq 1 ] ||
+ [ $stripe_count -eq 0 ] || [ $default_count -eq 1 ] ||
error "stripe count $default_count != $stripe_count for $dir"
stripe_index=$($LFS getdirstripe -i $dir)
- [ $default_index -eq -1 -o $stripe_index -eq $default_index ] ||
+ [ $default_index -eq -1 ] ||
+ [ $stripe_index -eq $default_index ] ||
error "$stripe_index != $default_index for $dir"
#check default stripe
numfree1=$(lctl get_param -n mdc.*MDT0000*.filesfree)
numfree2=$(lctl get_param -n mdc.*MDT0001*.filesfree)
- if [ $numfree1 -lt 66000 -o $numfree2 -lt 66000 ]; then
+ if [ $numfree1 -lt 66000 ] || [ $numfree2 -lt 66000 ]; then
skip "not enough free inodes $numfree1 $numfree2"
fi
numfree1=$(lctl get_param -n mdc.*MDT0000-mdc-*.kbytesfree)
numfree2=$(lctl get_param -n mdc.*MDT0001-mdc-*.kbytesfree)
- if [ $numfree1 -lt 300000 -o $numfree2 -lt 300000 ]; then
+ if [ $numfree1 -lt 300000 ] || [ $numfree2 -lt 300000 ]; then
skip "not enough free space $numfree1 $numfree2"
fi
test_405() {
[ -n "$FILESET" ] && skip "Not functional for FILESET set"
- [ $MDS1_VERSION -lt $(version_code 2.6.92) -o \
- [ $CLIENT_VERSION -lt $(version_code 2.6.99) ] &&
- skip "Layout swap lock is not supported"
+ [ $MDS1_VERSION -lt $(version_code 2.6.92) ] ||
+ [ $CLIENT_VERSION -lt $(version_code 2.6.99) ] &&
+ skip "Layout swap lock is not supported"
+
check_swap_layouts_support
test_mkdir $DIR/$tdir
}
run_test 418 "df and lfs df outputs match"
+test_419()
+{
+ local dir=$DIR/$tdir
+
+ mkdir -p $dir
+ touch $dir/file
+
+ cancel_lru_locks mdc
+
+ #OBD_FAIL_LLITE_OPEN_BY_NAME 0x1410
+ $LCTL set_param fail_loc=0x1410
+ cat $dir/file
+ $LCTL set_param fail_loc=0
+ rm -rf $dir
+}
+run_test 419 "Verify open file by name doesn't crash kernel"
+
prep_801() {
[[ $(lustre_version_code mds1) -lt $(version_code 2.9.55) ]] ||
[[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&
do_facet mgs $LCTL barrier_freeze $FSNAME 30
local b_status=$(barrier_stat)
- [ "$b_status" = "'expired'" -o "$b_status" = "'failed'" ] || {
+ [ "$b_status" = "'expired'" ] || [ "$b_status" = "'failed'" ] || {
do_facet mgs $LCTL barrier_thaw $FSNAME
error "(2) unexpected barrier status $b_status"
}