fi
rm -f /mnt/lustre/`hostname`/client.txt
fi
+
chown $UID $MOUNT && chmod 700 $MOUNT
if [ "$BONNIE" != "no" ]; then
mount | grep $MOUNT || sh llmount.sh
echo "iozone $VER too old for multi-thread test"
fi
fi
+
if [ "$FSX" != "no" ]; then
mount | grep $MOUNT || sh llmount.sh
$DEBUG_OFF
MOUNT1=${MOUNT1:-$MOUNT}
MOUNT2=${MOUNT2:-${MOUNT}2}
DIR=${DIR:-$MOUNT}
-DIR2=${DIR2:-$MOUNT1}
+DIR1=${DIR:-$MOUNT1}
+DIR2=${DIR2:-$MOUNT2}
MOUNTOPT=${MOUNTOPT:-"user_xattr,acl"}
TIMEOUT=${TIMEOUT:-20}
return rc;
}
-/* cocurrent mmap operations on two nodes */
+/* concurrent mmap operations on two nodes */
static int mmap_tst3(char *mnt)
{
char *ptr, mmap_file[256];
}
if (prefix)
- sprintf(cmd, "ls /proc/fs/lustre/ldlm/namespaces/%s_*/lru_size", prefix);
+ sprintf(cmd, "ls /proc/fs/lustre/ldlm/namespaces/*-%s-*/lru_size", prefix);
else
sprintf(cmd, "ls /proc/fs/lustre/ldlm/namespaces/*/lru_size");
memset(ptr, 'a', region);
/* cancel unused locks */
- cancel_lru_locks("OSC");
+ cancel_lru_locks("osc");
if (rc)
goto out_unmap;
goto out;
}
- cancel_lru_locks("OSC");
+ cancel_lru_locks("osc");
if (rc)
goto out;
struct test_case tests[] = {
{ 1, "mmap test1: basic mmap operation", mmap_tst1, 1 },
{ 2, "mmap test2: MAP_PRIVATE not write back", mmap_tst2, 1 },
- { 3, "mmap test3: cocurrent mmap ops on two nodes", mmap_tst3, 2 },
- { 4, "mmap test4: c1 write to f1 from mmaped f2, "
- "c2 write to f1 from mmaped f1", mmap_tst4, 2 },
+ { 3, "mmap test3: concurrent mmap ops on two nodes", mmap_tst3, 2 },
+ { 4, "mmap test4: c1 write to f1 from mmapped f2, "
+ "c2 write to f1 from mmapped f1", mmap_tst4, 2 },
{ 5, "mmap test5: read/write file to/from the buffer "
- "which mmaped to just this file", mmap_tst5, 1 },
+ "which mmapped to just this file", mmap_tst5, 1 },
{ 6, "mmap test6: check mmap write/read content on two nodes",
mmap_tst6, 2 },
{ 0, NULL, 0, 0 }
unload_modules
}
-REFORMAT=${REFORMAT:---reformat}
-
-format() {
+mcformat() {
stop_all
echo Formatting mds, ost, ost2
- add mds $MDS_MKFS_OPTS $REFORMAT $MDSDEV > /dev/null || exit 10
- add ost $OST_MKFS_OPTS $REFORMAT $OSTDEV > /dev/null || exit 10
- add ost2 $OST2_MKFS_OPTS $REFORMAT $OSTDEV2 > /dev/null || exit 10
+ add mds $MDS_MKFS_OPTS --reformat $MDSDEV > /dev/null || exit 10
+ add ost $OST_MKFS_OPTS --reformat $OSTDEV > /dev/null || exit 10
+ add ost2 $OST2_MKFS_OPTS --reformat $OSTDEV2 > /dev/null || exit 10
+}
+export MCFORMAT=${MCFORMAT:-"mcformat"}
+
+mount_client() {
+ grep " $1 " /proc/mounts || zconf_mount `hostname` $*
}
-format
mcsetup() {
echo Setup mds, ost, ost2
start ost2 $OSTDEV2 $OST2_MOUNT_OPTS
[ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
- grep " $MOUNT " /proc/mounts || zconf_mount `hostname` $MOUNT
+ mount_client $MOUNT
sleep 5
}
# flush cache to OST(s) so avail numbers are correct
sync; sleep 1 ; sync
-for OSC in /proc/fs/lustre/osc/OSC*MNT*; do
+for OSC in /proc/fs/lustre/osc/*-osc-*; do
AVAIL=`cat $OSC/kbytesavail`
GRANT=`cat $OSC/cur_grant_bytes`
[ $(($AVAIL - $GRANT / 1024)) -lt 400 ] && OSCFULL=full
done
if [ -z "$OSCFULL" ]; then
echo "no OSTs are close to full"
- grep "[0-9]" /proc/fs/lustre/osc/OSC*MNT*/{kbytesavail,cur*}|tee -a $LOG
+ grep "[0-9]" /proc/fs/lustre/osc/*-osc-*/{kbytesavail,cur*}|tee -a $LOG
SUCCESS=0
fi
do_facet client multiop $MOUNT/$tfile Ow || return 1
do_facet client multiop $MOUNT/$tfile or || return 2
- cancel_lru_locks OSC
+ cancel_lru_locks osc
do_facet client multiop $MOUNT/$tfile or || return 3
drop_bl_callback multiop $MOUNT/$tfile Ow || echo "evicted as expected"
#define OBD_FAIL_PTLRPC_BULK_PUT_NET 0x504 | OBD_FAIL_ONCE
sysctl -w lustre.fail_loc=0x80000504
- cancel_lru_locks OSC
+ cancel_lru_locks osc
# will get evicted here
do_facet client "cmp /etc/termcap $MOUNT/termcap" && return 1
sysctl -w lustre.fail_loc=0
do_facet client mkdir -p $MOUNT/$tdir
f=$MOUNT/$tdir/$tfile
- cancel_lru_locks OSC
+ cancel_lru_locks osc
pgcache_empty || return 1
# 1 stripe on ost2
f=$MOUNT/$tdir/$tfile
f2=$MOUNT/$tdir/${tfile}-2
- cancel_lru_locks OSC
+ cancel_lru_locks osc
pgcache_empty || return 1
# shouldn't have to set stripe size of count==1
do_facet client multiop $f Ow || return 1
do_facet client multiop $f or || return 2
- cancel_lru_locks OSC
+ cancel_lru_locks osc
do_facet client multiop $f or || return 3
drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
multiop $DIR/$tdir/${tfile} O_wc &
MULTI_PID=$!
sleep 1
- cancel_lru_locks OSC
+ cancel_lru_locks osc
#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
do_facet ost sysctl -w lustre.fail_loc=0x80000308
kill -USR1 $MULTI_PID
test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
mkdir -p $DIR/$tdir
touch $DIR/$tdir/${tfile}
- cancel_lru_locks OSC
+ cancel_lru_locks osc
#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
do_facet ost sysctl -w lustre.fail_loc=0x80000308
dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
test_24() { # bug 2248 - eviction fails writeback but app doesn't see it
mkdir -p $DIR/$tdir
- cancel_lru_locks OSC
+ cancel_lru_locks osc
multiop $DIR/$tdir/$tfile Owy_wyc &
MULTI_PID=$!
usleep 500
sleep 1
#define OBD_FAIL_LDLM_BL_CALLBACK 0x305
do_facet client sysctl -w lustre.fail_loc=0x80000305 # drop cb, evict
- cancel_lru_locks MDC
+ cancel_lru_locks mdc
usleep 500 # wait to ensure first client is one that will be evicted
openfile -f O_RDONLY $MOUNT2/$tdir/f0
wait $OPENPID
verify=$ROOT/tmp/verify-$$
dd if=/dev/urandom bs=4096 count=1280 | tee $verify > $DIR/$tfile
# invalidate cache, so that we're reading over the wire
- for i in /proc/fs/lustre/ldlm/namespaces/OSC_*MNT*; do
+ for i in /proc/fs/lustre/ldlm/namespaces/*-osc-*; do
echo -n clear > $i/lru_size
done
cmp $verify $DIR/$tfile &
run_test 5 "Fail OST during iozone"
kbytesfree() {
- awk '{total+=$1} END {print total}' /proc/fs/lustre/osc/OSC_*MNT*/kbytesfree
+ awk '{total+=$1} END {print total}' /proc/fs/lustre/osc/*-osc-*/kbytesfree
}
test_6() {
touch $DIR/$tfile
checkstat $DIR/$tfile
facet_failover mds
- cancel_lru_locks MDC
+ cancel_lru_locks mdc
if dmesg | grep "unknown lock cookie"; then
echo "cancel after replay failed"
return 1
# make sure the start of the file is ost1
lfs setstripe $f $((128 * 1024)) 0 0
do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3
- cancel_lru_locks OSC
+ cancel_lru_locks osc
# fail ost2 and read from ost1
local osc2_dev=`$LCTL device_list | \
awk '(/ost2.*client_facet/){print $4}' `
# b3764 timed out lock replay
test_52() {
touch $DIR/$tfile
- cancel_lru_locks MDC
+ cancel_lru_locks mdc
multiop $DIR/$tfile s
replay_barrier mds
echo 0 > /proc/sys/lustre/fail_loc
echo " Trigger recovery..."
- OSC0_UUID="`$LCTL dl | awk '/.* OSC_[^ ]+_OST.* / { print $1 }'`"
- [ -z "$OSC0_UUID" ] && OSC0_UUID="`$LCTL dl | awk '/.* OSC_[^ ]+_ost1.* / { print $1 }'`"
+ OSC0_UUID="`$LCTL dl | awk '/.* *-osc-* / { print $1 }'`"
for i in $OSC0_UUID; do
$LCTL --device $i activate > /dev/null 2>&1 || error "activate osc failed!"
done
fi
fi
+SANITYLOG=${SANITYLOG:-/tmp/sanity.log}
+
export NAME=${NAME:-local}
SAVE_PWD=$PWD
setup() {
echo -n "mnt.."
- $MCSETUP
-#$MCSETUP > /dev/null || exit 10
+ $MCSETUP || exit 10
echo "done"
}
SETUP=${SETUP:-:}
mounted_lustre_filesystems() {
awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts
}
+
MOUNTED="`mounted_lustre_filesystems`"
if [ -z "$MOUNTED" ]; then
+ $MCFORMAT
$MCSETUP
MOUNTED="`mounted_lustre_filesystems`"
[ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
SAVE_PWD=$PWD
-clean() {
+# for MCSETUP and MCCLEANUP
+. mountconf.sh
+
+cleanup() {
echo -n "cln.."
- sh llmountcleanup.sh ${FORCE} > /dev/null || exit 20
+ $MCCLEANUP ${FORCE} > /dev/null || { echo "FAILed to clean up"; exit 20; }
}
-CLEAN=${CLEAN:-}
+CLEANUP=${CLEANUP:-:}
-start() {
+setup() {
echo -n "mnt.."
- sh llmount.sh > /dev/null || exit 10
+ $MCSETUP || exit 10
echo "done"
}
-START=${START:-}
+SETUP=${SETUP:-:}
log() {
echo "$*"
TRACE=${TRACE:-""}
run_one() {
- if ! mount | grep -q $DIR1; then
- $START
+ if ! grep -q $DIR /proc/mounts; then
+ $SETUP
fi
testnum=$1
message=$2
unset TESTNAME
pass "($((`date +%s` - $BEFORE))s)"
cd $SAVE_PWD
- $CLEAN
+ $CLEANUP
}
build_test_filter() {
echo PASS $@
}
-export MOUNT1=`mount| awk '/ lustre/ { print $3 }'| head -n 1`
-export MOUNT2=`mount| awk '/ lustre/ { print $3 }'| tail -n 1`
+mounted_lustre_filesystems() {
+ awk '($3 ~ "lustre" && $1 ~ ":") { print $2 }' /proc/mounts
+}
+MOUNTED="`mounted_lustre_filesystems`"
+if [ -z "$MOUNTED" ]; then
+ $MCFORMAT
+ $MCSETUP
+ mount_client $MOUNT2
+ MOUNTED="`mounted_lustre_filesystems`"
+ [ -z "$MOUNTED" ] && error "NAME=$NAME not mounted"
+ I_MOUNTED=yes
+fi
+export MOUNT1=`mounted_lustre_filesystems | head -n 1`
[ -z "$MOUNT1" ] && error "NAME=$NAME not mounted once"
+export MOUNT2=`mounted_lustre_filesystems | tail -n 1`
[ "$MOUNT1" = "$MOUNT2" ] && error "NAME=$NAME not mounted twice"
-[ `mount| awk '/ lustre/ { print $3 }'| wc -l` -ne 2 ] && \
+[ `mounted_lustre_filesystems | wc -l` -ne 2 ] && \
error "NAME=$NAME mounted more than twice"
export DIR1=${DIR1:-$MOUNT1}
run_test 16 "2500 iterations of dual-mount fsx ================="
cancel_lru_locks() {
- for d in /proc/fs/lustre/ldlm/namespaces/$1*; do
+ for d in /proc/fs/lustre/ldlm/namespaces/*-$1-*; do
echo clear > $d/lru_size
done
- grep "[0-9]" /proc/fs/lustre/ldlm/namespaces/$1*/lock_unused_count /dev/null
+ grep "[0-9]" /proc/fs/lustre/ldlm/namespaces/*-$1-*/lock_unused_count /dev/null
}
test_17() { # bug 3513, 3667
[ ! -d /proc/fs/lustre/ost ] && echo "skipping OST-only test" && return
cp /etc/termcap $DIR1/f17
- cancel_lru_locks OSC > /dev/null
+ cancel_lru_locks osc > /dev/null
#define OBD_FAIL_ONCE|OBD_FAIL_LDLM_CREATE_RESOURCE 0x30a
echo 0x8000030a > /proc/sys/lustre/fail_loc
ls -ls $DIR1/f17 | awk '{ print $1,$6 }' > $DIR1/f17-1 & \
[ -d /proc/fs/lustre/obdfilter ] || return 0
MAX=`cat /proc/fs/lustre/obdfilter/*/readcache_max_filesize | head -n 1`
- for O in /proc/fs/lustre/obdfilter/OST*; do
+ for O in /proc/fs/lustre/obdfilter/*OST*; do
echo 4096 > $O/readcache_max_filesize
done
dd if=/dev/urandom of=$TMP/f19b bs=512k count=32
cp $TMP/f19b $DIR1/f19b
for i in `seq 1 20`; do
[ $((i % 5)) -eq 0 ] && log "test_18 loop $i"
- cancel_lru_locks OSC > /dev/null
+ cancel_lru_locks osc > /dev/null
cksum $DIR1/f19b | cut -d" " -f 1,2 > $TMP/sum1 & \
cksum $DIR2/f19b | cut -d" " -f 1,2 > $TMP/sum2
wait
[ "`cat $TMP/sum2`" = "$SUM" ] || \
error "$DIR2/f19b `cat $TMP/sum2` != $SUM"
done
- for O in /proc/fs/lustre/obdfilter/OST*; do
+ for O in /proc/fs/lustre/obdfilter/*OST*; do
echo $MAX > $O/readcache_max_filesize
done
rm $DIR1/f19b
test_20() {
mkdir $DIR1/d20
- cancel_lru_locks OSC
+ cancel_lru_locks osc
CNT=$((`cat /proc/fs/lustre/llite/fs0/dump_page_cache | wc -l`))
multiop $DIR1/f20 Ow8190c
multiop $DIR2/f20 Oz8194w8190c
multiop $DIR1/f20 Oz0r8190c
- cancel_lru_locks OSC
+ cancel_lru_locks osc
CNTD=$((`cat /proc/fs/lustre/llite/fs0/dump_page_cache | wc -l` - $CNT))
[ $CNTD -gt 0 ] && \
error $CNTD" page left in cache after lock cancel" || true
echo "others should see updated atime while another read" > $DIR1/f23
# clear the lock(mode: LCK_PW) gotten from creating operation
- cancel_lru_locks OSC
+ cancel_lru_locks osc
time1=`date +%s`
sleep 2
echo '=========================== finished ==============================='
[ -f "$SANITYLOG" ] && cat $SANITYLOG && exit 1 || true
+