return 0
}
+fs_log_size() {
+ local facet=${1:-$SINGLEMDS}
+ local fstype=$(facet_fstype $facet)
+ local size=0
+ case $fstype in
+ ldiskfs) size=50;; # largest seen is 44, leave some headroom
+ zfs) size=256;;
+ esac
+
+ echo -n $size
+}
+
check_gss_daemon_nodes() {
local list=$1
dname=$2
}
fail() {
- facet_failover $* || error "failover: $?"
- clients_up || error "post-failover df: $?"
+ local facets=$1
+ local clients=${CLIENTS:-$HOSTNAME}
+
+ facet_failover $* || error "failover: $?"
+ wait_clients_import_state "$clients" "$facets" FULL
+ clients_up || error "post-failover df: $?"
}
fail_nodf() {
}
is_empty_dir() {
- [ $(find $1 -maxdepth 1 -print | wc -l) = 1 ] && return 0
- return 1
+ [ $(find $1 -maxdepth 1 -print | wc -l) = 1 ] && return 0
+ return 1
}
# empty lustre filesystem may have empty directories lost+found and .lustre
is_empty_fs() {
- [ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \
- -print | wc -l) = 1 ] || return 1
- [ ! -d $1/lost+found ] || is_empty_dir $1/lost+found && return 0
- [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre && return 0
- return 1
+ [ $(find $1 -maxdepth 1 -name lost+found -o -name .lustre -prune -o \
+ -print | wc -l) = 1 ] || return 1
+ [ ! -d $1/lost+found ] || is_empty_dir $1/lost+found || return 1
+ [ ! -d $1/.lustre ] || is_empty_dir $1/.lustre || return 1
+ return 0
}
check_and_setup_lustre() {
done
}
+# Run lfsck on server node if lfsck can't be found on client (LU-2571)
+run_lfsck_remote() {
+ local cmd="$LFSCK_BIN -c -l --mdsdb $MDSDB --ostdb $OSTDB_LIST $MOUNT"
+ local client=$1
+ local mounted=true
+ local rc=0
+
+ #Check if lustre is already mounted
+ do_rpc_nodes $client is_mounted $MOUNT || mounted=false
+ if ! $mounted; then
+ zconf_mount $client $MOUNT ||
+ error "failed to mount Lustre on $client"
+ fi
+ #Run lfsck
+ echo $cmd
+ do_node $node $cmd || rc=$?
+ #Umount if necessary
+ if ! $mounted; then
+ zconf_umount $client $MOUNT ||
+ error "failed to unmount Lustre on $client"
+ fi
+
+ [ $rc -le $FSCK_MAX_ERR ] ||
+ error "$cmd returned $rc, should be <= $FSCK_MAX_ERR"
+ echo "lfsck finished with rc=$rc"
+
+ return $rc
+}
+
run_lfsck() {
- local cmd="$LFSCK_BIN -c -l --mdsdb $MDSDB --ostdb $OSTDB_LIST $MOUNT"
- echo $cmd
- local rc=0
- eval $cmd || rc=$?
- [ $rc -le $FSCK_MAX_ERR ] || \
- error "$cmd returned $rc, should be <= $FSCK_MAX_ERR"
- echo "lfsck finished with rc=$rc"
+ local facets="client $SINGLEMDS"
+ local found=false
+ local facet
+ local node
+ local rc=0
- rm -rvf $MDSDB* $OSTDB* || true
- return 0
+ for facet in $facets; do
+ node=$(facet_active_host $facet)
+ if check_progs_installed $node $LFSCK_BIN; then
+ found=true
+ break
+ fi
+ done
+ ! $found && error "None of \"$facets\" supports lfsck"
+
+ run_lfsck_remote $node || rc=$?
+
+ rm -rvf $MDSDB* $OSTDB* || true
+ return $rc
}
check_and_cleanup_lustre() {
}
drop_update_reply() {
-# OBD_FAIL_UPDATE_OBJ_NET
+# OBD_FAIL_UPDATE_OBJ_NET_REP
local index=$1
shift 1
RC=0
- do_facet mds${index} lctl set_param fail_loc=0x1500
+ do_facet mds${index} lctl set_param fail_loc=0x1701
do_facet client "$@" || RC=$?
do_facet mds${index} lctl set_param fail_loc=0
return $RC
}
get_clientosc_proc_path() {
- echo "${1}-osc-[^M]*"
+ echo "${1}-osc-*"
}
get_lustre_version () {
local CONN_STATE
local i=0
- CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
+ CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2 | uniq)
while [ "${CONN_STATE}" != "${expected}" ]; do
if [ "${expected}" == "DISCONN" ]; then
# for disconn we can check after proc entry is removed
error "can't put import for $CONN_PROC into ${expected} state after $i sec, have ${CONN_STATE}" && \
return 1
sleep 1
- CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
+ # Add uniq for multi-mount case
+ CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2 | uniq)
i=$(($i + 1))
done
done
}
+wait_import_state_mount() {
+ if ! is_mounted $MOUNT && ! is_mounted $MOUNT2; then
+ return 0
+ fi
+
+ wait_import_state $*
+}
+
# One client request could be timed out because server was not ready
# when request was sent by client.
# The request timeout calculation details :
local expected=$3
local ost=$(get_osc_import_name $facet $ost_facet)
- local param="osc.${ost}.ost_server_uuid"
+ local param="osc.${ost}.ost_server_uuid"
+ local i=0
# 1. wait the deadline of client 1st request (it could be skipped)
# 2. wait the deadline of client 2nd request
local maxtime=$(( 2 * $(request_timeout $facet)))
+ #During setup time, the osc might not be setup, it need wait
+ #until list_param can return valid value. And also if there
+ #are mulitple osc entries we should list all of them before
+ #go to wait.
+ local params=$($LCTL list_param $param || true)
+ while [ -z "$params" ]; do
+ if [ $i -ge $maxtime ]; then
+ echo "can't get $param by list_param in $maxtime secs"
+ if [[ $facet != client* ]]; then
+ echo "Go with $param directly"
+ params=$param
+ break
+ else
+ return 1
+ fi
+ fi
+ sleep 1
+ i=$((i + 1))
+ params=$($LCTL list_param $param || true)
+ done
+
if ! do_rpc_nodes "$(facet_host $facet)" \
- _wait_import_state $expected $param $maxtime; then
+ wait_import_state $expected "$params" $maxtime; then
error "import is not in ${expected} state"
return 1
fi
local params=$(expand_list $params $proc_path)
done
- if ! do_rpc_nodes "$list" wait_import_state $expected $params; then
+ if ! do_rpc_nodes "$list" wait_import_state_mount $expected $params; then
error "import is not in ${expected} state"
return 1
fi