Whamcloud - gitweb
LU-3540 lod: update recovery thread
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index 81d106a..a2cc964 100644 (file)
@@ -2314,8 +2314,6 @@ int mdt_remote_object_lock(struct mdt_thread_info *mti,
 
        LASSERT(mdt_object_remote(o));
 
-       LASSERT(ibits == MDS_INODELOCK_UPDATE);
-
        fid_build_reg_res_name(fid, res_id);
 
        memset(einfo, 0, sizeof(*einfo));
@@ -3505,20 +3503,26 @@ static int mdt_register_lwp_callback(void *data)
 
        LASSERT(mdt_seq_site(mdt)->ss_node_id != 0);
 
-       if (!likely(fld->lsf_new))
-               RETURN(0);
-
        rc = lu_env_init(&env, LCT_MD_THREAD);
-       if (rc) {
+       if (rc < 0) {
                CERROR("%s: cannot init env: rc = %d\n", mdt_obd_name(mdt), rc);
                RETURN(rc);
        }
 
-       rc = fld_update_from_controller(&env, fld);
-       if (rc != 0) {
-               CERROR("%s: cannot update controller: rc = %d\n",
-                      mdt_obd_name(mdt), rc);
+       /* Allocate new sequence now to avoid creating local transaction
+        * in the normal transaction process */
+       rc = seq_server_check_and_alloc_super(&env,
+                                             mdt_seq_site(mdt)->ss_server_seq);
+       if (rc < 0)
                GOTO(out, rc);
+
+       if (fld->lsf_new) {
+               rc = fld_update_from_controller(&env, fld);
+               if (rc != 0) {
+                       CERROR("%s: cannot update controller: rc = %d\n",
+                              mdt_obd_name(mdt), rc);
+                       GOTO(out, rc);
+               }
        }
 out:
        lu_env_fini(&env);
@@ -4717,6 +4721,7 @@ static int mdt_prepare(const struct lu_env *env,
        }
 
        LASSERT(!test_bit(MDT_FL_CFGLOG, &mdt->mdt_state));
+
        target_recovery_init(&mdt->mdt_lut, tgt_request_handle);
        set_bit(MDT_FL_CFGLOG, &mdt->mdt_state);
        LASSERT(obd->obd_no_conn);
@@ -5008,7 +5013,8 @@ static int mdt_obd_connect(const struct lu_env *env,
         *      at some point we should find a better one
         */
        if (!test_bit(MDT_FL_SYNCED, &mdt->mdt_state) && data != NULL &&
-           !(data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT)) {
+           !(data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) &&
+           !(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS)) {
                rc = obd_get_info(env, mdt->mdt_child_exp,
                                  sizeof(KEY_OSP_CONNECTED),
                                  KEY_OSP_CONNECTED, NULL, NULL);
@@ -5570,6 +5576,7 @@ static int mdt_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 break;
        case OBD_IOC_ABORT_RECOVERY:
                CERROR("%s: Aborting recovery for device\n", mdt_obd_name(mdt));
+               obd->obd_force_abort_recovery = 1;
                target_stop_recovery_thread(obd);
                rc = 0;
                break;