Whamcloud - gitweb
LU-3540 lod: update recovery thread
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index c038629..a2cc964 100644 (file)
@@ -1000,12 +1000,10 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
         }
 
        if (reqbody->mbo_valid & OBD_MD_FLMODEASIZE) {
-               repbody->mbo_max_cookiesize = 0;
                repbody->mbo_max_mdsize = info->mti_mdt->mdt_max_mdsize;
                repbody->mbo_valid |= OBD_MD_FLMODEASIZE;
-               CDEBUG(D_INODE, "I am going to change the MAX_MD_SIZE & "
-                      "MAX_COOKIE to : %d:%d\n", repbody->mbo_max_mdsize,
-                      repbody->mbo_max_cookiesize);
+               CDEBUG(D_INODE, "changing the max MD size to %u\n",
+                      repbody->mbo_max_mdsize);
        }
 
        if (exp_connect_rmtclient(info->mti_exp) &&
@@ -1434,11 +1432,11 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
        if (unlikely(IS_ERR(child)))
                GOTO(out_parent, rc = PTR_ERR(child));
 
+       OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_RESEND, obd_timeout * 2);
        rc = mdt_check_resent_lock(info, child, lhc);
        if (rc < 0) {
                GOTO(out_child, rc);
        } else if (rc > 0) {
-                OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_RESEND, obd_timeout*2);
                 mdt_lock_handle_init(lhc);
                mdt_lock_reg_init(lhc, LCK_PR);
                try_layout = false;
@@ -1933,14 +1931,6 @@ static int mdt_quotactl(struct tgt_session_info *tsi)
                RETURN(err_serious(rc));
 
        switch (oqctl->qc_cmd) {
-       case Q_QUOTACHECK:
-       case LUSTRE_Q_INVALIDATE:
-       case LUSTRE_Q_FINVALIDATE:
-       case Q_QUOTAON:
-       case Q_QUOTAOFF:
-       case Q_INITQUOTA:
-               /* deprecated, not used any more */
-               RETURN(-EOPNOTSUPP);
                /* master quotactl */
        case Q_SETINFO:
        case Q_SETQUOTA:
@@ -2324,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));
@@ -2808,9 +2796,10 @@ static int mdt_tgt_connect(struct tgt_session_info *tsi)
 
        if (OBD_FAIL_CHECK(OBD_FAIL_TGT_DELAY_CONDITIONAL) &&
            cfs_fail_val ==
-           tsi2mdt_info(tsi)->mti_mdt->mdt_seq_site.ss_node_id)
-               schedule_timeout_and_set_state(TASK_UNINTERRUPTIBLE,
-                       msecs_to_jiffies(3 * MSEC_PER_SEC));
+           tsi2mdt_info(tsi)->mti_mdt->mdt_seq_site.ss_node_id) {
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               schedule_timeout(msecs_to_jiffies(3 * MSEC_PER_SEC));
+       }
 
        rc = tgt_connect(tsi);
        if (rc != 0)
@@ -3514,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);
@@ -4726,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);
@@ -5017,10 +5013,11 @@ 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, NULL);
+                                 KEY_OSP_CONNECTED, NULL, NULL);
                if (rc)
                        RETURN(-EAGAIN);
                set_bit(MDT_FL_SYNCED, &mdt->mdt_state);
@@ -5579,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;
@@ -5854,6 +5852,8 @@ static void __exit mdt_mod_exit(void)
 
 MODULE_AUTHOR("Sun Microsystems, Inc. <http://www.lustre.org/>");
 MODULE_DESCRIPTION("Lustre Metadata Target ("LUSTRE_MDT_NAME")");
+MODULE_VERSION(LUSTRE_VERSION_STRING);
 MODULE_LICENSE("GPL");
 
-cfs_module(mdt, LUSTRE_VERSION_STRING, mdt_mod_init, mdt_mod_exit);
+module_init(mdt_mod_init);
+module_exit(mdt_mod_exit);