Whamcloud - gitweb
- enable client connect only if mds is configured and ost is active. Port from 1_6...
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index 6d6f6dc..f4c80ee 100644 (file)
@@ -1396,7 +1396,6 @@ static int mdt_reint_internal(struct mdt_thread_info *info,
 {
         struct req_capsule      *pill = &info->mti_pill;
         struct mdt_device       *mdt = info->mti_mdt;
-        struct ptlrpc_request   *req = mdt_info_req(info);
         struct mdt_body         *repbody;
         int                      need_shrink = 0;
         int                      rc;
@@ -1443,21 +1442,12 @@ static int mdt_reint_internal(struct mdt_thread_info *info,
         if (rc != 0)
                 GOTO(out_ucred, rc = err_serious(rc));
 
-        if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) {
-                struct mdt_client_data *mcd;
-
-                mcd = req->rq_export->exp_mdt_data.med_mcd;
-                if (req_xid_is_last(req)) {
-                        need_shrink = 0;
-                        mdt_reconstruct(info, lhc);
-                        rc = lustre_msg_get_status(req->rq_repmsg);
-                        GOTO(out_ucred, rc);
-                }
-                DEBUG_REQ(D_HA, req, "no reply for RESENT (xid "LPD64")",
-                          mcd->mcd_last_xid);
-        }
-
         need_shrink = 0;
+        if (mdt_check_resent(info, mdt_reconstruct, lhc)) {
+                rc = lustre_msg_get_status(mdt_info_req(info)->rq_repmsg);
+                GOTO(out_ucred, rc);
+        }
+        
         rc = mdt_reint_rec(info, lhc);
         EXIT;
 out_ucred:
@@ -4367,6 +4357,18 @@ out:
         return rc;
 }
 
+static void mdt_allow_cli(struct mdt_device *m, unsigned int flag)
+{
+        if (flag & CONFIG_LOG)
+                m->mdt_fl_cfglog = 1;
+        if (flag & CONFIG_SYNC)
+                m->mdt_fl_synced = 1;
+
+        if (m->mdt_fl_cfglog && m->mdt_fl_synced)
+                /* Open for clients */
+                m->mdt_md_dev.md_lu_dev.ld_obd->obd_no_conn = 0;
+}
+
 static int mdt_upcall(const struct lu_env *env, struct md_device *md,
                       enum md_upcall_event ev)
 {
@@ -4383,12 +4385,17 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md,
                                         &m->mdt_max_cookiesize);
                         CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n",
                                      m->mdt_max_mdsize, m->mdt_max_cookiesize);
+                        mdt_allow_cli(m, CONFIG_SYNC);
                         break;
                 case MD_NO_TRANS:
                         mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
                         mti->mti_no_need_trans = 1;
                         CDEBUG(D_INFO, "disable mdt trans for this thread\n");
                         break;
+                case MD_LOV_CONFIG:
+                        /* Check that MDT is not yet configured */
+                        LASSERT(!m->mdt_fl_cfglog);
+                        break;
                 default:
                         CERROR("invalid event\n");
                         rc = -EINVAL;
@@ -4399,15 +4406,16 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md,
 
 static int mdt_obd_notify(struct obd_device *host,
                           struct obd_device *watched,
-                          enum obd_notify_event ev, void *owner)
+                          enum obd_notify_event ev, void *data)
 {
         ENTRY;
 
         switch (ev) {
         case OBD_NOTIFY_CONFIG:
-                host->obd_no_conn = 0;
+                mdt_allow_cli(mdt_dev(host->obd_lu_dev), (unsigned int)data);
+                break;
         default:
-                CDEBUG(D_INFO, "Notification 0x%x\n", ev);
+                CDEBUG(D_INFO, "Unhandled notification %#x\n", ev);
         }
         RETURN(0);
 }