From 72c4f6ea45e4c9bbd63796a7642aefba87717f72 Mon Sep 17 00:00:00 2001 From: yury Date: Wed, 17 Dec 2008 22:00:14 +0000 Subject: [PATCH] b=17674 r=shadow,johann - do not reset ns_connect_flags in reconnect if server was not upgraded --- lustre/ptlrpc/import.c | 19 +++++++++++++++---- lustre/tests/conf-sanity.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 08e9f51..9d1efb3 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -761,6 +761,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, struct obd_import *imp = request->rq_import; struct client_obd *cli = &imp->imp_obd->u.cli; struct lustre_handle old_hdl; + __u64 old_connect_flags; int msg_flags; ENTRY; @@ -971,6 +972,7 @@ finish: imp->imp_obd->obd_name); GOTO(out, rc = -ENODEV); } + old_connect_flags = exp->exp_connect_flags; exp->exp_connect_flags = ocd->ocd_connect_flags; imp->imp_obd->obd_self_export->exp_connect_flags = ocd->ocd_connect_flags; @@ -1047,10 +1049,19 @@ finish: ocd->ocd_brw_size >> CFS_PAGE_SHIFT; } - imp->imp_obd->obd_namespace->ns_connect_flags = - ocd->ocd_connect_flags; - imp->imp_obd->obd_namespace->ns_orig_connect_flags = - ocd->ocd_connect_flags; + /* Reset ns_connect_flags only for initial connect. It might be + * changed in while using FS and if we reset it in reconnect + * this leads to lossing user settings done before such as + * disable lru_resize, etc. */ + if (old_connect_flags != exp->exp_connect_flags || + aa->pcaa_initial_connect) { + CWARN("Reseting ns_connect_flags to server flags: "LPU64"\n", + ocd->ocd_connect_flags); + imp->imp_obd->obd_namespace->ns_connect_flags = + ocd->ocd_connect_flags; + imp->imp_obd->obd_namespace->ns_orig_connect_flags = + ocd->ocd_connect_flags; + } if ((ocd->ocd_connect_flags & OBD_CONNECT_AT) && (imp->imp_msg_magic == LUSTRE_MSG_MAGIC_V2)) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index de84493..b1137e0 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -1532,6 +1532,44 @@ test_46a() { } run_test 46a "handle ost additional - wide striped file" +test_47() { #17674 + setup + check_mount || return 2 + $LCTL set_param ldlm.namespaces.$FSNAME-*-*-*.lru_size=100 + + local lru_size=[] + local count=0 + for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do + if echo $ns | grep "MDT[[:digit:]]*"; then + continue + fi + lrs=$(echo $ns | sed 's/.*lru_size=//') + lru_size[count]=$lrs + let count=count+1 + done + + facet_failover ost1 + facet_failover $SINGLEMDS + df -h $MOUNT || return 3 + + count=0 + for ns in $($LCTL get_param ldlm.namespaces.$FSNAME-*-*-*.lru_size); do + if echo $ns | grep "MDT[[:digit:]]*"; then + continue + fi + lrs=$(echo $ns | sed 's/.*lru_size=//') + if ! test "$lrs" -eq "${lru_size[count]}"; then + n=$(echo $ns | sed -e 's/ldlm.namespaces.//' -e 's/.lru_size=.*//') + error "$n has lost lru_size: $lrs vs. ${lru_size[count]}" + fi + let count=count+1 + done + + cleanup + return 0 +} +run_test 47 "server restart does not make client loss lru_resize settings" + cleanup_gss equals_msg `basename $0`: test complete [ -f "$TESTSUITELOG" ] && cat $TESTSUITELOG && grep -q FAIL $TESTSUITELOG && exit 1 || true -- 1.8.3.1