# buffer i/o errs sock spc runas
[ "$CPU" = "UML" ] && EXCEPT="$EXCEPT 27m 27n 27o 27p 27q 27r 31d 54a 64b 99a 99b 99c 99d 99e 99f 101a"
-case `uname -r` in
-2.4*) FSTYPE=${FSTYPE:-ext3} ;;
-2.6*) FSTYPE=${FSTYPE:-ldiskfs} ;;
-*) error "unsupported kernel" ;;
-esac
-
SRCDIR=$(cd $(dirname $0); echo $PWD)
export PATH=$PATH:/sbin
MCREATE=${MCREATE:-mcreate}
OPENFILE=${OPENFILE:-openfile}
OPENUNLINK=${OPENUNLINK:-openunlink}
+export MULTIOP=${MULTIOP:-multiop}
READS=${READS:-"reads"}
MUNLINK=${MUNLINK:-munlink}
SOCKETSERVER=${SOCKETSERVER:-socketserver}
# bug 2429 - rename foo foo foo creates invalid file
test_24l() {
f="$DIR/f24l"
- multiop $f OcNs || error
+ $MULTIOP $f OcNs || error
}
run_test 24l "Renaming a file to itself ========================"
test_24m() {
f="$DIR/f24m"
- multiop $f OcLN ${f}2 ${f}2 || error "link ${f}2 ${f}2 failed"
+ $MULTIOP $f OcLN ${f}2 ${f}2 || error "link ${f}2 ${f}2 failed"
# on ext3 this does not remove either the source or target files
# though the "expected" operation would be to remove the source
$CHECKSTAT -t file ${f} || error "${f} missing"
run_test 24t "mkdir .../R16a/b/c; rename .../R16a/b/c .../R16a ="
test_24u() { # bug12192
- multiop $DIR/$tfile C2w$((2048 * 1024))c || error
+ $MULTIOP $DIR/$tfile C2w$((2048 * 1024))c || error
$CHECKSTAT -s $((2048 * 1024)) $DIR/$tfile || error "wrong file size"
}
run_test 24u "create stripe file"
# compare lmm_object_id and lu_fid->oid
[ $lmm_oid = ${fid[2]} ] || { error "OID mismatch"; return 2; }
- [ "$FSTYPE" != "ldiskfs" ] &&
- skip "cannot check filter fid FSTYPE=$FSTYPE" && return 0
-
# check the trusted.fid attribute of the OST objects of the file
local have_obdidx=false
local stripe_nr=0
local ost=$((obdidx + 1))
local dev=$(ostdevname $ost)
+ if [ $(facet_fstype ost$ost) != ldiskfs ]; then
+ echo "Currently only works with ldiskfs-based OSTs"
+ continue
+ fi
+
log "want: stripe:$stripe_nr ost:$obdidx oid:$oid/$hex seq:$seq"
#don't unmount/remount the OSTs if we don't need to do that
test_31b() {
touch $DIR/f31 || error
ln $DIR/f31 $DIR/f31b || error
- multiop $DIR/f31b Ouc || error
+ $MULTIOP $DIR/f31b Ouc || error
$CHECKSTAT -t file $DIR/f31 || error
}
run_test 31b "unlink file with multiple links while open ======="
ln $DIR/f31 $DIR/f31c || error
multiop_bg_pause $DIR/f31 O_uc || return 1
MULTIPID=$!
- multiop $DIR/f31c Ouc
+ $MULTIOP $DIR/f31c Ouc
kill -USR1 $MULTIPID
wait $MULTIPID
}
local sz=1000
dd if=/dev/zero of=$DIR/$tfile bs=1M count=10 || error
- multiop $DIR/$tfile OG${gid}T${sz}g${gid}c &
+ $MULTIOP $DIR/$tfile OG${gid}T${sz}g${gid}c &
MULTIPID=$!
sleep 2
run_test 39i "write, rename, stat =============================="
test_39j() {
- debugsave
- lctl set_param debug=-1
+ start_full_debug_logging
touch $DIR1/$tfile
sleep 1
- multiop_bg_pause $DIR1/$tfile oO_RDWR:w2097152_c || error "multiop failed"
+ #define OBD_FAIL_OSC_DELAY_SETTIME 0x412
+ lctl set_param fail_loc=0x80000412
+ multiop_bg_pause $DIR1/$tfile oO_RDWR:w2097152_c ||
+ error "multiop failed"
local multipid=$!
local mtime1=`stat -c %Y $DIR1/$tfile`
for (( i=0; i < 2; i++ )) ; do
local mtime2=`stat -c %Y $DIR1/$tfile-1`
- [ "$mtime1" = "$mtime2" ] || \
- error "mtime is lost on close: $mtime2, should be $mtime1"
+ [ "$mtime1" = "$mtime2" ] ||
+ error "mtime is lost on close: $mtime2, " \
+ "should be $mtime1"
cancel_lru_locks osc
if [ $i = 0 ] ; then echo "repeat after cancel_lru_locks"; fi
done
- debugrestore
+ lctl set_param fail_loc=0
+ stop_full_debug_logging
}
run_test 39j "write, rename, close, stat ======================="
test_43() {
mkdir -p $DIR/$tdir
cp -p /bin/ls $DIR/$tdir/$tfile
- multiop $DIR/$tdir/$tfile Ow_c &
+ $MULTIOP $DIR/$tdir/$tfile Ow_c &
pid=$!
# give multiop a chance to open
sleep 1
test_43a() {
mkdir -p $DIR/d43
- cp -p `which multiop` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
+ cp -p `which $MULTIOP` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
MULTIOP_PROG=$DIR/d43/multiop multiop_bg_pause $TMP/test43.junk O_c || return 1
MULTIOP_PID=$!
- multiop $DIR/d43/multiop Oc && error "expected error, got success"
+ $MULTIOP $DIR/d43/multiop Oc && error "expected error, got success"
kill -USR1 $MULTIOP_PID || return 2
wait $MULTIOP_PID || return 3
rm $TMP/test43.junk
test_43b() {
mkdir -p $DIR/d43
- cp -p `which multiop` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
+ cp -p `which $MULTIOP` $DIR/d43/multiop || cp -p multiop $DIR/d43/multiop
MULTIOP_PROG=$DIR/d43/multiop multiop_bg_pause $TMP/test43.junk O_c || return 1
MULTIOP_PID=$!
$TRUNCATE $DIR/d43/multiop 0 && error "expected error, got success"
}
run_test 48e "Access to recreated parent subdir (should return errors)"
+test_49() { # LU-1030
+ # get ost1 size - lustre-OST0000
+ ost1_size=$(do_facet ost1 lfs df |grep ${ost1_svc} |awk '{print $4}')
+ # write 800M at maximum
+ [ $ost1_size -gt 819200 ] && ost1_size=819200
+
+ lfs setstripe -c 1 -i 0 $DIR/$tfile
+ dd if=/dev/zero of=$DIR/$tfile bs=4k count=$((ost1_size >> 2)) &
+ local dd_pid=$!
+
+ # change max_pages_per_rpc while writing the file
+ local osc1_mppc=osc.$(get_osc_import_name client ost1).max_pages_per_rpc
+ local orig_mppc=`$LCTL get_param -n $osc1_mppc`
+ # loop until dd process exits
+ while ps ax -opid | grep -q $dd_pid; do
+ $LCTL set_param $osc1_mppc=$((RANDOM % 256 + 1))
+ sleep $((RANDOM % 5 + 1))
+ done
+ # restore original max_pages_per_rpc
+ $LCTL set_param $osc1_mppc=$orig_mppc
+ rm $DIR/$tfile || error "rm $DIR/$tfile failed"
+}
+run_test 49 "Change max_pages_per_rpc won't break osc extent"
+
test_50() {
# bug 1485
mkdir $DIR/d50
f="$DIR/f61"
dd if=/dev/zero of=$f bs=`page_size` count=1
cancel_lru_locks osc
- multiop $f OSMWUc || error
+ $MULTIOP $f OSMWUc || error
sync
}
run_test 61 "mmap() writes don't make sync hang ================"
#define OBD_FAIL_OSC_BRW_PREP_REQ 0x406
lctl set_param fail_loc=0x80000406
- multiop $DIR/$tfile Owy && \
+ $MULTIOP $DIR/$tfile Owy && \
error "sync didn't return ENOMEM"
sync; sleep 2; sync # do a real sync this time to flush page
lctl get_param -n llite.*.dump_page_cache | grep locked && \
pid1=$!
lctl set_param fail_loc=0x80000129
- multiop $DIR/d73-1/f73-2 Oc &
+ $MULTIOP $DIR/d73-1/f73-2 Oc &
sleep 1
lctl set_param fail_loc=0
- multiop $DIR/d73-2/f73-3 Oc &
+ $MULTIOP $DIR/d73-2/f73-3 Oc &
pid3=$!
kill -USR1 $pid1
# write should trigger a retry and success
$SETSTRIPE -i 0 -c 1 $DIR/$tfile
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
if [ $RC -ne 0 ] ; then
error "write should success, but failed for $RC"
# write should retry several times and return -ENOSPC finally
$SETSTRIPE -i 0 -c 1 $DIR/$tfile
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
ENOSPC=28
if [ $RC -ne $ENOSPC ] ; then
}
run_test 81b "OST should return -ENOSPC when retry still fails ======="
+test_82() { # LU-1031
+ dd if=/dev/zero of=$DIR/$tfile bs=1M count=10
+ local gid1=14091995
+ local gid2=16022000
+
+ multiop_bg_pause $DIR/$tfile OG${gid1}_g${gid1}c || return 1
+ local MULTIPID1=$!
+ multiop_bg_pause $DIR/$tfile O_G${gid2}r10g${gid2}c || return 2
+ local MULTIPID2=$!
+ kill -USR1 $MULTIPID2
+ sleep 2
+ if [[ `ps h -o comm -p $MULTIPID2` == "" ]]; then
+ error "First grouplock does not block second one"
+ else
+ echo "Second grouplock blocks first one"
+ fi
+ kill -USR1 $MULTIPID1
+ wait $MULTIPID1
+ wait $MULTIPID2
+}
+run_test 82 "Basic grouplock test ==============================="
test_99a() {
[ -z "$(which cvs 2>/dev/null)" ] && skip_env "could not find cvs" && \
{
reset_async
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty)
WRITEBACK=$(lctl get_param -n llite.*.dump_page_cache | grep -c writeback)
#define OBD_FAIL_OST_ENOENT 0x217
set_nodes_failloc "$(osts_nodes)" 0x217
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
set_nodes_failloc "$(osts_nodes)" 0
DIRTY=$(lctl get_param -n llite.*.dump_page_cache | grep -c dirty)
# Due to the above error the OSC will issue all RPCs syncronously
# until a subsequent RPC completes successfully without error.
- multiop $DIR/$tfile Ow4096yc
+ $MULTIOP $DIR/$tfile Ow4096yc
rm -f $DIR/$tfile
return 0
set_nodes_failloc "$(osts_nodes)" 0x216
# multiop should block due to fsync until pages are written
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
MULTIPID=$!
sleep 1
#define OBD_FAIL_OST_BRW_PAUSE_BULK
set_nodes_failloc "$(osts_nodes)" 0x214
# multiop should block due to fsync until pages are written
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
MULTIPID=$!
sleep 1
lctl set_param fail_loc=0x8000040a
# Should simulate EINVAL error which is fatal
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
if [[ $RC -eq 0 ]]; then
error "Must return error due to dropped pages, rc=$RC"
lctl set_param fail_loc=0x406
# simulate local -ENOMEM
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
lctl set_param fail_loc=0
#define OBD_FAIL_OST_BRW_WRITE_BULK 0x20e
set_nodes_failloc "$(osts_nodes)" 0x20e
# Should simulate ENOMEM error which is recoverable and should be handled by timeout
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
set_nodes_failloc "$(osts_nodes)" 0
set_nodes_failloc "$(osts_nodes)" 0x20e
# Should simulate ENOMEM error which is recoverable and should be handled by timeout
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c &
PID=$!
sleep 5
set_nodes_failloc "$(osts_nodes)" 0
set_nodes_failloc "$(osts_nodes)" 0x220
# return -EIO from OST
- multiop $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
+ $MULTIOP $DIR/$tfile oO_CREAT:O_RDWR:O_SYNC:w4096c
RC=$?
set_nodes_failloc "$(osts_nodes)" 0x0
if [[ $RC -eq 0 ]]; then
{
# LU-646
mkdir -p $DIR/$tdir
- multiop $DIR/$tdir Dy || error "fsync dir failed"
+ $MULTIOP $DIR/$tdir Dy || error "fsync dir failed"
rm -rf $DIR/$tdir
}
run_test 118l "fsync dir ========="
$SETSTRIPE -c 2 $DIR/$tfile || error "setstripe failed"
dd if=/dev/zero of=$DIR/$tfile bs=1M count=1 seek=1 || error "dd failed"
sync
- multiop $DIR/$tfile oO_RDONLY:O_DIRECT:r$((2048 * 1024)) || \
+ $MULTIOP $DIR/$tfile oO_RDONLY:O_DIRECT:r$((2048 * 1024)) || \
error "direct read failed"
rm -f $DIR/$tfile
}
done
}
test_129() {
- [ "$FSTYPE" != "ldiskfs" ] && skip "not needed for FSTYPE=$FSTYPE" && return 0
+ if [ "$(facet_type_fstype MDS)" != ldiskfs ]; then
+ skip "Only applicable to ldiskfs-based MDTs"
+ return
+ fi
remote_mds_nodsh && skip "remote MDS with nodsh" && return
EFBIG=27
I=0
J=0
while [ ! $I -gt $((MAX * MDSCOUNT)) ]; do
- multiop $DIR/$tdir/$J Oc
+ $MULTIOP $DIR/$tdir/$J Oc
rc=$?
if [ $rc -eq $EFBIG ]; then
set_dir_limits 0
mkdir -p ${testdir2} || error "mkdir failed"
createmany -o $testdir1/test 512 || error "createmany failed"
- local testdir1_size=$(ls -l $DIR/${tdir} |
- awk '/stats_testdir1/ {print $5}')
- local testdir2_size=$(ls -l $DIR/${tdir} |
- awk '/stats_testdir2/ {print $5}')
- testdir1_size=$(order_2 $testdir1_size)
- testdir2_size=$(order_2 $testdir2_size)
+ # check samedir rename size
+ mv ${testdir1}/test0 ${testdir1}/test_0
- testdir1_size=$(size_in_KMGT $testdir1_size)
- testdir2_size=$(size_in_KMGT $testdir2_size)
+ local testdir1_size=$(ls -l $DIR/${tdir} |
+ awk '/stats_testdir1/ {print $5}')
+ local testdir2_size=$(ls -l $DIR/${tdir} |
+ awk '/stats_testdir2/ {print $5}')
- echo "source rename dir size: ${testdir1_size}"
- echo "target rename dir size: ${testdir2_size}"
+ testdir1_size=$(order_2 $testdir1_size)
+ testdir2_size=$(order_2 $testdir2_size)
+
+ testdir1_size=$(size_in_KMGT $testdir1_size)
+ testdir2_size=$(size_in_KMGT $testdir2_size)
+
+ echo "source rename dir size: ${testdir1_size}"
+ echo "target rename dir size: ${testdir2_size}"
- # check samedir rename size
- mv ${testdir1}/test0 ${testdir1}/test_0
local cmd="do_facet $SINGLEMDS $LCTL get_param mdt.*.rename_stats"
eval $cmd || error "$cmd failed"
local samedir=$($cmd | grep 'same_dir')
# check crossdir rename size
mv ${testdir1}/test_0 ${testdir2}/test_0
+
+ testdir1_size=$(ls -l $DIR/${tdir} |
+ awk '/stats_testdir1/ {print $5}')
+ testdir2_size=$(ls -l $DIR/${tdir} |
+ awk '/stats_testdir2/ {print $5}')
+
+ testdir1_size=$(order_2 $testdir1_size)
+ testdir2_size=$(order_2 $testdir2_size)
+
+ testdir1_size=$(size_in_KMGT $testdir1_size)
+ testdir2_size=$(size_in_KMGT $testdir2_size)
+
+ echo "source rename dir size: ${testdir1_size}"
+ echo "target rename dir size: ${testdir2_size}"
+
eval $cmd || error "$cmd failed"
local crossdir=$($cmd | grep 'crossdir')
local src_sample=$(get_rename_size $testdir1_size)
run_test 152 "test read/write with enomem ============================"
test_153() {
- multiop $DIR/$tfile Ow4096Ycu || error "multiop failed"
+ $MULTIOP $DIR/$tfile Ow4096Ycu || error "multiop failed"
}
run_test 153 "test if fdatasync does not crash ======================="
test_169() {
# do directio so as not to populate the page cache
log "creating a 10 Mb file"
- multiop $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
+ $MULTIOP $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
log "starting reads"
dd if=$DIR/$tfile of=/dev/null bs=4096 &
log "truncating the file"
- multiop $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
+ $MULTIOP $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
log "killing dd"
kill %+ || true # reads might have finished
echo "wait until dd is finished"
}
run_test 181 "Test open-unlinked dir ========================"
+test_182() {
+ # disable MDC RPC lock wouldn't crash client
+ local fcount=1000
+ local tcount=4
+
+ mkdir -p $DIR/$tdir || error "creating dir $DIR/$tdir"
+#define OBD_FAIL_MDC_RPCS_SEM 0x804
+ $LCTL set_param fail_loc=0x804
+
+ for (( i=0; i < $tcount; i++ )) ; do
+ mkdir $DIR/$tdir/$i
+ createmany -o $DIR/$tdir/$i/f- $fcount &
+ done
+ wait
+
+ for (( i=0; i < $tcount; i++ )) ; do
+ unlinkmany $DIR/$tdir/$i/f- $fcount &
+ done
+ wait
+
+ rm -rf $DIR/$tdir
+
+ $LCTL set_param fail_loc=0
+}
+run_test 182 "Disable MDC RPCs semaphore wouldn't crash client ================"
+
# OST pools tests
POOL=${POOL:-cea1}
TGT_COUNT=$OSTCOUNT
# /proc/sys/lnet/nis should look like this:
# nid status alive refs peer rtr max tx min
# where nid is a string like 192.168.1.1@tcp2, status is up/down,
- # alive is numeric (0 or >0 or <0), refs > 0, peer >= 0,
+ # alive is numeric (0 or >0 or <0), refs >= 0, peer >= 0,
# rtr >= 0, max >=0, tx and min are numeric (0 or >0 or <0).
L1="^nid +status +alive +refs +peer +rtr +max +tx +min$"
- BR="^$NID +(up|down) +$I +$P +$N +$N +$N +$I +$I$"
+ BR="^$NID +(up|down) +$I +$N +$N +$N +$N +$I +$I$"
create_lnet_proc_files "nis"
check_lnet_proc_entry "nis.out" "/proc/sys/lnet/nis" "$BR" "$L1"
check_lnet_proc_entry "nis.sys" "lnet.nis" "$BR" "$L1"
test_218() {
# do directio so as not to populate the page cache
log "creating a 10 Mb file"
- multiop $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
+ $MULTIOP $DIR/$tfile oO_CREAT:O_DIRECT:O_RDWR:w$((10*1048576))c || error "multiop failed while creating a file"
log "starting reads"
dd if=$DIR/$tfile of=/dev/null bs=4096 &
log "truncating the file"
- multiop $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
+ $MULTIOP $DIR/$tfile oO_TRUNC:c || error "multiop failed while truncating the file"
log "killing dd"
kill %+ || true # reads might have finished
echo "wait until dd is finished"