set -e
-# bug 5494 5493
-ALWAYS_EXCEPT="24 52 $RECOVERY_SMALL_EXCEPT"
+# bug 5494 5493 LU2034
+ALWAYS_EXCEPT="24 52 60 $RECOVERY_SMALL_EXCEPT"
export MULTIOP=${MULTIOP:-multiop}
PTLDEBUG=${PTLDEBUG:--1}
}
run_test 23 "client hang when close a file after mds crash"
-test_24() { # bug 11710 details correct fsync() behavior
+test_24a() { # bug 11710 details correct fsync() behavior
remote_ost_nodsh && skip "remote OST with nodsh" && return 0
mkdir -p $DIR/$tdir
client_reconnect
[ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
}
-run_test 24 "fsync error (should return error)"
+run_test 24a "fsync error (should return error)"
wait_client_evicted () {
local facet=$1
local varsvc=${facet}_svc
wait_update $(facet_active_host $facet) \
- "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" \
- $((exports - 1)) $3
+ "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" \
+ $((exports - 1)) $3
}
+test_24b() {
+ remote_ost_nodsh && skip "remote OST with nodsh" && return 0
+
+ dmesg -c
+ mkdir -p $DIR/$tdir
+ lfs setstripe $DIR/$tdir -s 0 -i 0 -c 1
+ cancel_lru_locks osc
+ multiop_bg_pause $DIR/$tdir/$tfile-1 Ow8192_yc ||
+ error "mulitop Ow8192_yc failed"
+
+ MULTI_PID1=$!
+ multiop_bg_pause $DIR/$tdir/$tfile-2 Ow8192_c ||
+ error "mulitop Ow8192_c failed"
+
+ MULTI_PID2=$!
+ ost_evict_client
+
+ kill -USR1 $MULTI_PID1
+ wait $MULTI_PID1
+ rc1=$?
+ kill -USR1 $MULTI_PID2
+ wait $MULTI_PID2
+ rc2=$?
+ lctl set_param fail_loc=0x0
+ client_reconnect
+ [ $rc1 -eq 0 -o $rc2 -eq 0 ] &&
+ error_ignore "multiop didn't fail fsync: $rc1 or close: $rc2" || true
+
+ dmesg | grep "dirty page discard:" || \
+ error "no discarded dirty page found!"
+}
+run_test 24b "test dirty page discard due to client eviction"
+
test_26a() { # was test_26 bug 5921 - evict dead exports by pinger
# this test can only run from a client on a separate node.
remote_ost || { skip "local OST" && return 0; }
lctl set_param fail_loc=0
drop_bl_callback rm -f $DIR/$tfile
wait $pid
- do_facet client "df $DIR"
+ # the first 'df' could tigger the eviction caused by
+ # 'drop_bl_callback', and it's normal case.
+ # but the next 'df' should return successfully.
+ do_facet client "df $DIR" || do_facet client "df $DIR"
}
run_test 58 "Eviction in the middle of open RPC reply processing"
st=$(do_facet $target "lctl get_param -n $recovery_proc |
awk '/IR:/{ print \\\$2}'")
- [ $st != ON -o $st != OFF ] ||
- error "Error state $st, must be ON or OFF"
+ [ $st != ON -o $st != OFF -o $st != ENABLED -o $st != DISABLED ] ||
+ error "Error state $st, must be ENABLED or DISABLED"
echo -n $st
}
test_100()
{
- do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
- { skip "MGS without IR support"; return 0; }
+ do_facet mgs $LCTL list_param mgs.*.ir_timeout ||
+ { skip "MGS without IR support"; return 0; }
- # disable IR
- set_ir_status disabled
+ # MDT was just restarted in the previous test, make sure everything
+ # is all set.
+ local cnt=30
+ while [ $cnt -gt 0 ]; do
+ nidtbl_versions_match && break
+ sleep 1
+ cnt=$((cnt - 1))
+ done
+
+ # disable IR
+ set_ir_status disabled
+
+ local prev_ver=$(nidtbl_version_client client)
local saved_FAILURE_MODE=$FAILURE_MODE
[ $(facet_host mgs) = $(facet_host ost1) ] && FAILURE_MODE="SOFT"
fail ost1
# valid check
- nidtbl_versions_match &&
- error "version must differ due to IR disabled"
+ [ $(nidtbl_version_client client) -eq $prev_ver ] ||
+ error "version must not change due to IR disabled"
target_instance_match ost1 || error "instance mismatch"
# restore env
# make sure lustre mount at $rcli disabling IR
local ir_state=$(check_cli_ir_state $rcli)
- [ $ir_state = DISABLED -o $ir_state = "OFF" ] || error "IR state must be DISABLED at $rcli"
+ [ $ir_state = "DISABLED" -o $ir_state = "OFF" ] ||
+ error "IR state must be DISABLED at $rcli"
# Since the client just mounted, its last_rcvd entry is not on disk.
# Send an RPC so exp_need_sync forces last_rcvd to commit this export
}
run_test 105 "IR: NON IR clients support"
-complete $(basename $0) $SECONDS
+cleanup_106() {
+ trap 0
+ umount_client $DIR2
+ debugrestore
+}
+
+test_106() { # LU-1789
+ [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.3.50) ]] ||
+ { skip "Need MDS version at least 2.3.50"; return 0; }
+
+#define OBD_FAIL_MDC_LIGHTWEIGHT 0x805
+ $LCTL set_param fail_loc=0x805
+
+ debugsave
+ trap cleanup_106 EXIT
+
+ # enable lightweight flag on mdc connection
+ mount_client $DIR2
+
+ local MDS_NEXP=$(do_facet $SINGLEMDS \
+ lctl get_param -n mdt.${mds1_svc}.num_exports |
+ cut -d' ' -f2)
+ $LCTL set_param fail_loc=0
+
+ touch $DIR2/$tfile || error "failed to create empty file"
+ replay_barrier $SINGLEMDS
+
+ $LCTL set_param debug=console
+ $LCTL clear
+ facet_failover $SINGLEMDS
+
+ # lightweight connection must be evicted
+ touch -c $DIR2/$tfile || true
+ $LCTL dk $TMP/lustre-log-$TESTNAME.log
+ evicted=`awk '/This client was evicted by .*MDT0000/ {
+ print;
+ }' $TMP/lustre-log-$TESTNAME.log`
+ [ -z "$evicted" ] && error "lightweight client not evicted by mds"
+
+ # and all operations performed by lightweight client should be
+ # synchronous, so the file created before mds restart should be there
+ $CHECKSTAT -t file $DIR/$tfile || error "file not present"
+ rm -f $DIR/$tfile
+
+ cleanup_106
+}
+run_test 106 "lightweight connection support"
+
+test_107 () {
+ local CLIENT_PID
+ local close_pid
+
+ mkdir -p $DIR/$tdir
+ # OBD_FAIL_MDS_REINT_NET_REP 0x119
+ do_facet $SINGLEMDS lctl set_param fail_loc=0x119
+ multiop $DIR/$tdir D_c &
+ close_pid=$!
+ mkdir $DIR/$tdir/dir_106 &
+ CLIENT_PID=$!
+ do_facet $SINGLEMDS lctl set_param fail_loc=0
+ fail $SINGLEMDS
+
+ wait $CLIENT_PID || rc=$?
+ checkstat -t dir $DIR/$tdir/dir_106 || return 1
+
+ kill -USR1 $close_pid
+ wait $close_pid || return 2
+
+ return $rc
+}
+run_test 107 "drop reint reply, then restart MDT"
+complete $SECONDS
check_and_cleanup_lustre
exit_status