Whamcloud - gitweb
set CMM_INITIALIZED when first ADD_MDC arrives
authortappro <tappro>
Fri, 23 Jun 2006 15:28:40 +0000 (15:28 +0000)
committertappro <tappro>
Fri, 23 Jun 2006 15:28:40 +0000 (15:28 +0000)
lustre/cmm/cmm_device.c
lustre/cmm/cmm_object.c
lustre/cmm/mdc_device.c
lustre/mdt/mdt_handler.c

index c96f119..c20d911 100644 (file)
@@ -156,17 +156,26 @@ static int cmm_process_config(const struct lu_context *ctx,
         switch(cfg->lcfg_command) {
         case LCFG_ADD_MDC:
                 err = cmm_add_mdc(ctx, m, cfg);
+                /* the first ADD_MDC can be counted as setup is finished */
+                if (m->cmm_flags & CMM_INITIALIZED == 0)
+                        m->cmm_flags |= CMM_INITIALIZED;
                 break;
         case LCFG_SETUP:
         {
-                const char *index = lustre_cfg_string(cfg, 2), *p;
+                const char *index = lustre_cfg_string(cfg, 2);
+                char *p;
                 LASSERT(index);
-                m->cmm_local_num = simple_strtol(index, &p, 10);
-                if (*p) {
-                        CERROR("Invalid index in lustre_cgf, offset 2\n");
-                        RETURN(-EINVAL);
+                
+                /* lower layers should be set up at first */
+                err = next->ld_ops->ldo_process_config(ctx, next, cfg);
+                if (err == 0) {
+                        m->cmm_local_num = simple_strtol(index, &p, 10);
+                        if (*p) {
+                                CERROR("Invalid index in lustre_cgf\n");
+                                RETURN(-EINVAL);
+                        }
                 }
-                /* no break; to pass cfg further */
+                break;
         }
         default:
                 err = next->ld_ops->ldo_process_config(ctx, next, cfg);
@@ -240,8 +249,7 @@ static int cmm_device_init(const struct lu_context *ctx,
         err = fld_client_init(&m->cmm_fld, LUSTRE_CLI_FLD_HASH_RRB);
         if (err) {
                 CERROR("can't init FLD, err %d\n",  err);
-        } else
-                m->cmm_flags |= CMM_INITIALIZED;
+        }
         RETURN(err);
 }
 
index e28677c..88ddf24 100644 (file)
@@ -51,7 +51,7 @@ static int cmm_fld_lookup(struct cmm_device *cm,
                 RETURN(rc);
         }
 
-        if (*mds > cm->cmm_tgt_count) {
+        if (*mds >= cm->cmm_tgt_count) {
                 CERROR("Got invalid mdsno: "LPU64" (max: %u)\n",
                        *mds, cm->cmm_tgt_count);
                 rc = -EINVAL;
index feedb68..5ea72ab 100644 (file)
@@ -60,7 +60,8 @@ static int mdc_add_obd(struct mdc_device *mc, struct lustre_cfg *cfg)
         struct obd_device *mdc, *mdt;
         const char *srv = lustre_cfg_string(cfg, 0);
         const char *uuid_str = lustre_cfg_string(cfg, 1);
-        const char *index = lustre_cfg_string(cfg, 2), *p;
+        const char *index = lustre_cfg_string(cfg, 2);
+        char *p;
         int rc = 0;
 
         ENTRY;
index 298567f..85a9e05 100644 (file)
@@ -2094,8 +2094,7 @@ static int mdt_init0(struct mdt_device *m,
         if (rc)
                 GOTO(err_free_ns, rc);
 
-        lu_context_exit(&ctx);
-        lu_context_fini(&ctx);
+        s->ls_flags |= LS_INITIALIZED;
 
         RETURN(0);