Whamcloud - gitweb
LU-11518 ptlrpc: don't reset lru_resize on idle reconnect 85/35285/7
authorAndriy Skulysh <c17819@cray.com>
Tue, 11 Jun 2019 14:44:32 +0000 (17:44 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 3 Jul 2019 03:16:41 +0000 (03:16 +0000)
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 <c17819@cray.com>
Reviewed-by: Alexander Boyko <c17825@cray.com>
Reviewed-by: Andrew Perepechko <c17827@cray.com>
Reviewed-on: https://review.whamcloud.com/35285
Reviewed-by: Alexandr Boyko <c17825@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ptlrpc/import.c
lustre/tests/sanity.sh

index 119d04c..be38128 100644 (file)
@@ -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)
index e6ef37f..2987cea 100644 (file)
@@ -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
 #