Whamcloud - gitweb
LU-11269 ptlrpc: do not expose transient IDLE state 23/37523/4
authorAlex Zhuravlev <bzzz@whamcloud.com>
Mon, 10 Feb 2020 21:06:07 +0000 (00:06 +0300)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Feb 2020 07:13:53 +0000 (07:13 +0000)
to avoid cases when anyone sending an RPC observes the connection
in this state while it's going to reconnect right away.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I9ca89051c4176fe321262f8b2f52969c382e401e
Reviewed-on: https://review.whamcloud.com/37523
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/import.c

index 4b4bcab..b1e32cb 100644 (file)
@@ -1777,7 +1777,6 @@ static int ptlrpc_disconnect_idle_interpret(const struct lu_env *env,
            imp->imp_state != LUSTRE_IMP_CLOSED) {
                LASSERTF(imp->imp_state == LUSTRE_IMP_CONNECTING,
                         "%s\n", ptlrpc_import_state_name(imp->imp_state));
            imp->imp_state != LUSTRE_IMP_CLOSED) {
                LASSERTF(imp->imp_state == LUSTRE_IMP_CONNECTING,
                         "%s\n", ptlrpc_import_state_name(imp->imp_state));
-               imp->imp_state = LUSTRE_IMP_IDLE;
                memset(&imp->imp_remote_handle, 0,
                       sizeof(imp->imp_remote_handle));
                /* take our DISCONNECT into account */
                memset(&imp->imp_remote_handle, 0,
                       sizeof(imp->imp_remote_handle));
                /* take our DISCONNECT into account */
@@ -1787,6 +1786,9 @@ static int ptlrpc_disconnect_idle_interpret(const struct lu_env *env,
                        import_set_state_nolock(imp, LUSTRE_IMP_NEW);
                        ptlrpc_reset_reqs_generation(imp);
                        connect = 1;
                        import_set_state_nolock(imp, LUSTRE_IMP_NEW);
                        ptlrpc_reset_reqs_generation(imp);
                        connect = 1;
+               } else {
+                       /* do not expose transient IDLE state */
+                       import_set_state_nolock(imp, LUSTRE_IMP_IDLE);
                }
        }
 
                }
        }