From: Andriy Skulysh Date: Tue, 11 Jun 2019 14:44:32 +0000 (+0300) Subject: LU-11518 ptlrpc: don't reset lru_resize on idle reconnect X-Git-Tag: 2.12.56~51 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=acacc9d9b1d0a869f61d7940baa0700b63dcd8f7 LU-11518 ptlrpc: don't reset lru_resize on idle reconnect ptlrpc_disconnect_idle_interpret() clears imp_remote_handle, so reconnect has pcaa_initial_connect set to 1. Update only changed ns_connect_flags bits. Fixes: 5a6ceb664f0 ("LU-7236 ptlrpc: idle connections can disconnect") Change-Id: I2368708b6381c1d772c47dc6e61c8fb39a14a2cc Cray-bug-id: LUS-7471 Signed-off-by: Andriy Skulysh Reviewed-by: Alexander Boyko Reviewed-by: Andrew Perepechko Reviewed-on: https://review.whamcloud.com/35285 Reviewed-by: Alexandr Boyko Reviewed-by: Andreas Dilger Reviewed-by: Gu Zheng Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 119d04c..be38128 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -904,13 +904,17 @@ static int ptlrpc_connect_set_flags(struct obd_import *imp, * this leads to losing user settings done before such as * disable lru_resize, etc. */ if (old_connect_flags != exp_connect_flags(exp) || init_connect) { + struct ldlm_namespace *ns = imp->imp_obd->obd_namespace; + __u64 changed_flags; + + changed_flags = + ns->ns_connect_flags ^ ns->ns_orig_connect_flags; CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server " "flags: %#llx\n", imp->imp_obd->obd_name, 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; + ns->ns_connect_flags = (ns->ns_connect_flags & changed_flags) | + (ocd->ocd_connect_flags & ~changed_flags); + ns->ns_orig_connect_flags = ocd->ocd_connect_flags; } if (ocd->ocd_connect_flags & OBD_CONNECT_AT) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index e6ef37f..2987cea 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -21342,6 +21342,27 @@ test_815() } run_test 815 "zero byte tiny write doesn't hang (LU-12382)" +test_816() { + $LFS setstripe -c 1 -i 0 $DIR/$tfile + # ensure ost1 is connected + stat $DIR/$tfile >/dev/null || error "can't stat" + wait_osc_import_state client ost1 FULL + # no locks, no reqs to let the connection idle + cancel_lru_locks osc + lru_resize_disable osc + local before + local now + before=$($LCTL get_param -n \ + ldlm.namespaces.$FSNAME-OST0000-osc-[^M]*.lru_size) + + wait_osc_import_state client ost1 IDLE + dd if=/dev/null of=$DIR/$tfile bs=1k count=1 conv=sync + now=$($LCTL get_param -n \ + ldlm.namespaces.$FSNAME-OST0000-osc-[^M]*.lru_size) + [ $before == $now ] || error "lru_size changed $before != $now" +} +run_test 816 "do not reset lru_resize on idle reconnect" + # # tests that do cleanup/setup should be run at the end #