#!/bin/bash
-# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*-
-# vim:shiftwidth=4:softtabstop=4:tabstop=4:
set -e
run_test 21a "commit on sharing"
test_21b_sub () {
- local mds=$1
- do_node $CLIENT1 rm -f $MOUNT1/$tfile-*
+ local mds=$1
+ do_node $CLIENT1 rm -f $MOUNT1/$tfile-*
- do_facet $mds sync
- do_node $CLIENT1 touch $MOUNT1/$tfile-1
- do_node $CLIENT2 mv $MOUNT1/$tfile-1 $MOUNT1/$tfile-2
- do_node $CLIENT1 mv $MOUNT1/$tfile-2 $MOUNT1/$tfile-3
+ do_facet $mds sync
+ do_node $CLIENT1 touch $MOUNT1/$tfile-1
+ do_node $CLIENT2 mv $MOUNT1/$tfile-1 $MOUNT1/$tfile-2
+ do_node $CLIENT1 mv $MOUNT1/$tfile-2 $MOUNT1/$tfile-3
- replay_barrier_nosync $mds
- shutdown_client $CLIENT2 $MOUNT1
+ replay_barrier_nosync $mds
+ shutdown_client $CLIENT2 $MOUNT1
- facet_failover $mds
+ facet_failover $mds
- # were renames replayed?
- local rc=0
- echo UNLINK $MOUNT1/$tfile-3
- do_node $CLIENT1 unlink $MOUNT1/$tfile-3 || \
- { echo "unlink $tfile-3 fail!" && rc=1; }
+ # were renames replayed?
+ local rc=0
+ echo UNLINK $MOUNT1/$tfile-3
+ do_node $CLIENT1 unlink $MOUNT1/$tfile-3 ||
+ { echo "unlink $tfile-3 fail!" && rc=1; }
- boot_node $CLIENT2
- zconf_mount_clients $CLIENT2 $MOUNT1 || error "mount $CLIENT2 $MOUNT1 fail"
+ boot_node $CLIENT2
+ zconf_mount_clients $CLIENT2 $MOUNT1 ||
+ error "mount $CLIENT2 $MOUNT1 fail"
- return $rc
+ return $rc
}
test_21b() {
- [ -z "$CLIENTS" ] && skip "Need two or more clients." && return
- [ $CLIENTCOUNT -lt 2 ] && \
- { skip "Need two or more clients, have $CLIENTCOUNT" && return; }
+ [ -z "$CLIENTS" ] && skip "Need two or more clients" && return
+ [ $CLIENTCOUNT -lt 2 ] &&
+ { skip "Need 2+ clients, have $CLIENTCOUNT" && return; }
- if [ "$FAILURE_MODE" = "HARD" ] && mixed_mdt_devs; then
- skip "Several mdt services on one mds node are used with FAILURE_MODE=$FAILURE_MODE. "
- return 0
- fi
+ if [ "$FAILURE_MODE" = "HARD" ] && mixed_mdt_devs; then
+ skip "Several MDTs on one MDS with FAILURE_MODE=$FAILURE_MODE"
+ return 0
+ fi
+ zconf_umount_clients $CLIENTS $MOUNT2
+ zconf_mount_clients $CLIENTS $MOUNT1
- zconf_umount_clients $CLIENTS $MOUNT2
- zconf_mount_clients $CLIENTS $MOUNT1
+ local param_file=$TMP/$tfile-params
- local param_file=$TMP/$tfile-params
+ local mdtidx=$($LFS getstripe -M $MOUNT1)
+ local facet=mds$((mdtidx + 1))
- local num=$(get_mds_dir $MOUNT1)
+ save_lustre_params $facet "mdt.*.commit_on_sharing" > $param_file
- save_lustre_params mds$num "mdt.*.commit_on_sharing" > $param_file
+ # COS enabled
+ local COS=1
+ do_facet $facet lctl set_param mdt.*.commit_on_sharing=$COS
- # COS enabled
- local COS=1
- do_facet mds$num lctl set_param mdt.*.commit_on_sharing=$COS
+ test_21b_sub $facet || error "Not all renames are replayed. COS=$COS"
- test_21b_sub mds$num || error "Not all renames are replayed. COS=$COS"
+ # COS disabled (should fail)
+ COS=0
+ do_facet $facet lctl set_param mdt.*.commit_on_sharing=$COS
- # COS disabled (should fail)
- COS=0
- do_facet mds$num lctl set_param mdt.*.commit_on_sharing=$COS
-
- # there is still a window when transactions may be written to disk before
- # the mds device is set R/O. To avoid such a rare test failure, the check
- # is repeated several times.
- local n_attempts=1
- while true; do
- test_21b_sub mds$num || break;
- let n_attempts=n_attempts+1
- [ $n_attempts -gt 3 ] &&
- error "The test cannot check whether COS works or not: all renames are replied w/o COS"
- done
- zconf_mount_clients $CLIENTS $MOUNT2
- restore_lustre_params < $param_file
- rm -f $param_file
- return 0
+ # there is still a window when transactions may be written to disk
+ # before the mds device is set R/O. To avoid such a rare test failure,
+ # the check is repeated several times.
+ local n_attempts=1
+ while true; do
+ test_21b_sub $facet || break
+ n_attempts=$((n_attempts + 1))
+ [ $n_attempts -gt 3 ] &&
+ error "can't check if COS works: rename replied w/o COS"
+ done
+ zconf_mount_clients $CLIENTS $MOUNT2
+ restore_lustre_params < $param_file
+ rm -f $param_file
+ return 0
}
run_test 21b "commit on sharing, two clients"
test_24 () {
[[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.5.2) ]] ||
- { skip "Need MDS version newer than 2.5.2"; return 0; }
+ { skip "Need MDS version newer than 2.5.2"; return 0; }
touch $MOUNT/$tfile
stat $MOUNT/$tfile >&/dev/null
local OSTIDX=$1
local FAILLOC=$2
local FAILIDX=${3:-$OSTIDX}
+ local ofacet=ost$((OSTIDX + 1))
- test_mkdir -p $DIR/$tdir
- local MDSIDX=$(get_mds_dir "$DIR/$tdir")
- echo OSTIDX=$OSTIDX MDSIDX=$MDSIDX
+ test_mkdir -p -c1 $DIR/$tdir
+ local mdtidx=$($LFS getstripe -M $DIR/$tdir)
+ local mfacet=mds$((mdtidx + 1))
+ echo OSTIDX=$OSTIDX MDTIDX=$mdtidx
local OST=$(ostname_from_index $OSTIDX)
- local MDT_INDEX=$(lfs df | grep "\[MDT:$((MDSIDX - 1))\]" | awk '{print $1}' | \
- sed -e 's/_UUID$//;s/^.*-//')
# on the mdt's osc
- local mdtosc_proc1=$(get_mdtosc_proc_path mds${MDSIDX} $OST)
- local last_id=$(do_facet mds${MDSIDX} lctl get_param -n \
+ local mdtosc_proc1=$(get_mdtosc_proc_path $mfacet $OST)
+ local last_id=$(do_facet $mfacet lctl get_param -n \
osc.$mdtosc_proc1.prealloc_last_id)
- local next_id=$(do_facet mds${MDSIDX} lctl get_param -n \
+ local next_id=$(do_facet $mfacet lctl get_param -n \
osc.$mdtosc_proc1.prealloc_next_id)
- local mdtosc_proc2=$(get_mdtosc_proc_path mds${MDSIDX})
- do_facet mds${MDSIDX} lctl get_param osc.$mdtosc_proc2.prealloc*
+ local mdtosc_proc2=$(get_mdtosc_proc_path $mfacet)
+ do_facet $mfacet lctl get_param osc.$mdtosc_proc2.prealloc*
test_mkdir -p $DIR/$tdir/${OST}
$SETSTRIPE -i $OSTIDX -c 1 $DIR/$tdir/${OST}
#define OBD_FAIL_OST_ENOSPC 0x215
- do_facet ost$((OSTIDX + 1)) lctl set_param fail_val=$FAILIDX
- do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x215
+ do_facet $ofacet lctl set_param fail_val=$FAILIDX fail_loc=0x215
echo "Creating to objid $last_id on ost $OST..."
createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2))
- do_facet mds${MDSIDX} lctl get_param osc.$mdtosc_proc2.prealloc*
- do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=$FAILLOC
+ do_facet $mfacet lctl get_param osc.$mdtosc_proc2.prealloc*
+ do_facet $ofacet lctl set_param fail_loc=$FAILLOC
sleep_maxage
}
fi
remote_mds_nodsh && skip "remote MDS with nodsh" && return
- local dir=$DIR/d57b
+ local dir=$DIR/$tdir
local FILECOUNT=100
local FILE1=$dir/f1
local FILEN=$dir/f$FILECOUNT
rm -rf $dir || error "removing $dir"
- test_mkdir -p $dir || error "creating $dir"
- local num=$(get_mds_dir $dir)
- local mymds=mds$num
+ test_mkdir -p -c1 $dir || error "creating $dir"
+ local mdtidx=$($LFS getstripe -M $dir)
+ local mdtname=MDT$(printf %04x $mdtidx)
+ local facet=mds$((mdtidx + 1))
echo "mcreating $FILECOUNT files"
createmany -m $dir/f 1 $FILECOUNT || \
sync
sleep 1
df $dir #make sure we get new statfs data
- local MDSFREE=$(do_facet $mymds \
- lctl get_param -n osd*.*MDT000$((num -1)).kbytesfree)
- local MDCFREE=$(lctl get_param -n mdc.*MDT000$((num -1))-mdc-*.kbytesfree)
+ local MDSFREE=$(do_facet $facet \
+ lctl get_param -n osd*.*$mdtname.kbytesfree)
+ local MDCFREE=$(lctl get_param -n mdc.*$mdtname-mdc-*.kbytesfree)
echo "opening files to create objects/EAs"
local FILE
for FILE in `seq -f $dir/f%g 1 $FILECOUNT`; do
sleep 1 #make sure we get new statfs data
df $dir
- local MDSFREE2=$(do_facet $mymds \
- lctl get_param -n osd*.*MDT000$((num -1)).kbytesfree)
- local MDCFREE2=$(lctl get_param -n mdc.*MDT000$((num -1))-mdc-*.kbytesfree)
+ local MDSFREE2=$(do_facet $facet \
+ lctl get_param -n osd*.*$mdtname.kbytesfree)
+ local MDCFREE2=$(lctl get_param -n mdc.*$mdtname-mdc-*.kbytesfree)
if [[ $MDCFREE2 -lt $((MDCFREE - 16)) ]]; then
if [ "$MDSFREE" != "$MDSFREE2" ]; then
error "MDC before $MDCFREE != after $MDCFREE2"
test_132() { #1028, SOM
[ $PARALLEL == "yes" ] && skip "skip parallel run" && return
- remote_mds_nodsh && skip "remote MDS with nodsh" && return
- local num=$(get_mds_dir $DIR)
- local mymds=mds${num}
- local MOUNT_OPTS_SAVE=$MOUNT_OPTS
+ remote_mds_nodsh && skip "remote MDS with nodsh" && return
+ local mdtidx=$($LFS getstripe -M $DIR)
+ local facet=mds$((mdtidx + 1))
- dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
- cancel_lru_locks osc
+ local MOUNTOPT_SAVE=$MOUNTOPT
- som1=$(do_facet $mymds "$LCTL get_param -n mdt.*.som" | head -n 1)
+ dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
+ cancel_lru_locks osc
+ som1=$(do_facet $facet "$LCTL get_param mdt.*.som" |
+ awk -F= ' {print $2}' | head -n 1)
gl1=$(get_ost_param "ldlm_glimpse_enqueue")
stat $DIR/$tfile >/dev/null
dd if=/dev/zero of=$DIR/$tfile count=1 2>/dev/null
cancel_lru_locks osc
- som2=$(do_facet $mymds "$LCTL get_param -n mdt.*.som" | head -n 1)
+ som2=$(do_facet $facet "$LCTL get_param mdt.*.som" |
+ awk -F= ' {print $2}' | head -n 1)
if [ $som1 == $som2 ]; then
error "som is still "$som2
if [ x$som2 = x"enabled" ]; then
# Load a module on the system where this is running.
#
-# Synopsis: load_module module_name [module arguments for insmod/modprobe]
+# usage: load_module module_name [module arguments for insmod/modprobe]
#
# If module arguments are not given but MODOPTS_<MODULE> is set, then its value
# will be used as the arguments. Otherwise arguments will be obtained from
exit \\\$rc"
}
-# CMD: determine mds index where directory inode presents
-get_mds_dir() {
- local dir=$1
- local SEQ
-
- SEQ=$(lfs path2fid $dir | tr '[:]' ' '|cut -f2 -d ' ')
- if [ "$SEQ" == "" ]; then
- error "can't get sequence for $dir"
- return 1
- fi
- export SEQ
-
- do_facet mds1 "cat /proc/fs/lustre/fld/srv-*-MDT0000/fldb" | \
- tr '[)]:-' ' ' | \
- while read SS EE IDX TYP; do \
- if let "SEQ >= SS && SEQ < EE"; then \
- echo $IDX; \
- fi; \
- done
-}
-
mdsrate_cleanup () {
if [ -d $4 ]; then
mpi_run ${MACHINEFILE_OPTION} $2 -np $1 ${MDSRATE} --unlink \