Whamcloud - gitweb
b=22070 revert incompatible protocol change
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index ff17a56..a38edde 100644 (file)
@@ -2759,7 +2759,6 @@ static int mdt_filter_recovery_request(struct ptlrpc_request *req,
 static int mdt_recovery(struct mdt_thread_info *info)
 {
         struct ptlrpc_request *req = mdt_info_req(info);
-        int recovering;
         struct obd_device *obd;
 
         ENTRY;
@@ -2820,10 +2819,7 @@ static int mdt_recovery(struct mdt_thread_info *info)
         obd = req->rq_export->exp_obd;
 
         /* Check for aborted recovery... */
-        cfs_spin_lock_bh(&obd->obd_processing_task_lock);
-        recovering = obd->obd_recovering;
-        cfs_spin_unlock_bh(&obd->obd_processing_task_lock);
-        if (unlikely(recovering)) {
+        if (unlikely(obd->obd_recovering)) {
                 int rc;
                 int should_process;
                 DEBUG_REQ(D_INFO, req, "Got new replay");
@@ -2846,7 +2842,6 @@ static int mdt_msg_check_version(struct lustre_msg *msg)
         switch (lustre_msg_get_opc(msg)) {
         case MDS_CONNECT:
         case MDS_DISCONNECT:
-        case MDS_SET_INFO:
         case OBD_PING:
         case SEC_CTX_INIT:
         case SEC_CTX_INIT_CONT:
@@ -2872,6 +2867,7 @@ static int mdt_msg_check_version(struct lustre_msg *msg)
         case MDS_SYNC:
         case MDS_GETXATTR:
         case MDS_SETXATTR:
+        case MDS_SET_INFO:
         case MDS_GET_INFO:
         case MDS_QUOTACHECK:
         case MDS_QUOTACTL:
@@ -4502,8 +4498,6 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
         obd = class_name2obd(dev);
         LASSERT(obd != NULL);
 
-        cfs_spin_lock_init(&m->mdt_transno_lock);
-
         m->mdt_max_mdsize = MAX_MD_SIZE;
         m->mdt_max_cookiesize = sizeof(struct llog_cookie);
         m->mdt_som_conf = 0;
@@ -4543,8 +4537,6 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
         m->mdt_nosquash_strlen = 0;
         cfs_init_rwsem(&m->mdt_squash_sem);
 
-        cfs_spin_lock_init(&m->mdt_client_bitmap_lock);
-
         OBD_ALLOC_PTR(mite);
         if (mite == NULL)
                 GOTO(err_lmi, rc = -ENOMEM);
@@ -5032,14 +5024,11 @@ static int mdt_obd_connect(const struct lu_env *env,
                         memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid);
                         lexp->exp_mdt_data.med_lcd = lcd;
                         rc = mdt_client_new(env, mdt);
-                        if (rc != 0) {
-                                OBD_FREE_PTR(lcd);
-                                lexp->exp_mdt_data.med_lcd = NULL;
-                        } else {
+                        if (rc == 0)
                                 mdt_export_stats_init(obd, lexp, localdata);
-                        }
-                } else
+                } else {
                         rc = -ENOMEM;
+                }
         }
 
 out:
@@ -5215,21 +5204,30 @@ static int mdt_destroy_export(struct obd_export *exp)
         if (obd_uuid_equals(&exp->exp_client_uuid, &exp->exp_obd->obd_uuid))
                 RETURN(0);
 
+        lut_client_free(exp);
         RETURN(rc);
 }
 
 static void mdt_allow_cli(struct mdt_device *m, unsigned int flag)
 {
         if (flag & CONFIG_LOG)
-                m->mdt_fl_cfglog = 1;
+                cfs_set_bit(MDT_FL_CFGLOG, &m->mdt_state);
 
         /* also notify active event */
         if (flag & CONFIG_SYNC)
-                m->mdt_fl_synced = 1;
+                cfs_set_bit(MDT_FL_SYNCED, &m->mdt_state);
 
-        if (m->mdt_fl_cfglog && m->mdt_fl_synced)
+        if (cfs_test_bit(MDT_FL_CFGLOG, &m->mdt_state) &&
+            cfs_test_bit(MDT_FL_SYNCED, &m->mdt_state)) {
+                struct obd_device *obd = m->mdt_md_dev.md_lu_dev.ld_obd;
                 /* Open for clients */
-                m->mdt_md_dev.md_lu_dev.ld_obd->obd_no_conn = 0;
+                if (obd->obd_no_conn) {
+                        cfs_spin_lock_bh(&obd->obd_processing_task_lock);
+                        obd->obd_no_conn = 0;
+                        cfs_spin_unlock_bh(&obd->obd_processing_task_lock);
+                }
+        }
 }
 
 static int mdt_upcall(const struct lu_env *env, struct md_device *md,
@@ -5259,7 +5257,7 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md,
                         break;
                 case MD_LOV_CONFIG:
                         /* Check that MDT is not yet configured */
-                        LASSERT(!m->mdt_fl_cfglog);
+                        LASSERT(!cfs_test_bit(MDT_FL_CFGLOG, &m->mdt_state));
                         break;
 #ifdef HAVE_QUOTA_SUPPORT
                 case MD_LOV_QUOTA:
@@ -5569,7 +5567,7 @@ int mdt_obd_postrecov(struct obd_device *obd)
  */
 int mdt_hsm_copytool_send(struct obd_export *exp)
 {
-        struct lnl_hdr *lh;
+        struct kuc_hdr *lh;
         struct hsm_action_list *hal;
         struct hsm_action_item *hai;
         int rc, len;
@@ -5584,10 +5582,10 @@ int mdt_hsm_copytool_send(struct obd_export *exp)
         if (lh == NULL)
                 RETURN(-ENOMEM);
 
-        lh->lnl_magic = LNL_MAGIC;
-        lh->lnl_transport = LNL_TRANSPORT_HSM;
-        lh->lnl_msgtype = HMT_ACTION_LIST;
-        lh->lnl_msglen = len;
+        lh->kuc_magic = KUC_MAGIC;
+        lh->kuc_transport = KUC_TRANSPORT_HSM;
+        lh->kuc_msgtype = HMT_ACTION_LIST;
+        lh->kuc_msglen = len;
 
         hal = (struct hsm_action_list *)(lh + 1);
         hal->hal_version = HAL_VERSION;
@@ -5608,10 +5606,11 @@ int mdt_hsm_copytool_send(struct obd_export *exp)
 
         /* Uses the ldlm reverse import; this rpc will be seen by
           the ldlm_callback_handler */
-        rc = target_set_info_rpc(exp->exp_imp_reverse, LDLM_SET_INFO,
-                                 sizeof(KEY_HSM_COPYTOOL_SEND),
-                                 KEY_HSM_COPYTOOL_SEND,
-                                 len, lh, NULL);
+        rc = do_set_info_async(exp->exp_imp_reverse,
+                               LDLM_SET_INFO, LUSTRE_OBD_VERSION,
+                               sizeof(KEY_HSM_COPYTOOL_SEND),
+                               KEY_HSM_COPYTOOL_SEND,
+                               len, lh, NULL);
 
         OBD_FREE(lh, len);