Whamcloud - gitweb
LU-11243 lod: fix assertion and hang upon lod_add_device failure
[fs/lustre-release.git] / lustre / ptlrpc / recover.c
index c526e9e..4d5f28b 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -346,15 +346,17 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid, int async)
         if (rc)
                 GOTO(out, rc);
 
+       OBD_RACE(OBD_FAIL_PTLRPC_CONNECT_RACE);
+
         rc = ptlrpc_connect_import(imp);
         if (rc)
                 GOTO(out, rc);
 
         if (!async) {
                 struct l_wait_info lwi;
-                int secs = cfs_time_seconds(obd_timeout);
+               long secs = cfs_time_seconds(obd_timeout);
 
-                CDEBUG(D_HA, "%s: recovery started, waiting %u seconds\n",
+               CDEBUG(D_HA, "%s: recovery started, waiting %lu seconds\n",
                        obd2cli_tgt(imp->imp_obd), secs);
 
                 lwi = LWI_TIMEOUT(secs, NULL, NULL);
@@ -375,9 +377,8 @@ int ptlrpc_import_in_recovery(struct obd_import *imp)
        int in_recovery = 1;
 
        spin_lock(&imp->imp_lock);
-       if (imp->imp_state == LUSTRE_IMP_FULL ||
-           imp->imp_state == LUSTRE_IMP_CLOSED ||
-           imp->imp_state == LUSTRE_IMP_DISCON ||
+       if (imp->imp_state <= LUSTRE_IMP_DISCON ||
+           imp->imp_state >= LUSTRE_IMP_FULL ||
            imp->imp_obd->obd_no_recov)
                in_recovery = 0;
        spin_unlock(&imp->imp_lock);