Whamcloud - gitweb
- stop recovery thare in obdfilter before freeing namespace;
authoryury <yury>
Wed, 11 Oct 2006 10:24:51 +0000 (10:24 +0000)
committeryury <yury>
Wed, 11 Oct 2006 10:24:51 +0000 (10:24 +0000)
- cleanups in error messages and comments;
- more verbosity to class_config_notify_end();
- set obd->obd_configured = 0 in class_setup() before doing anything;

- do not pre-allocate seq-ranges in mdc. It usually will not do that asap
  as remote target is not yet configured. It will be allocated later in very
  first opeartion time, when you fid is needed;

- zero out lock handle in mdt_intent_lock_replace() to not confuse mdt_info_thread_fini();
- do not set obd->obd_configured if log processing finishes with error;
- do not allow gss connection if obd is not configured;
- disable FLD relay test 0c for multi MDS config.

lustre/ldlm/ldlm_lib.c
lustre/llite/llite_fid.c
lustre/llite/namei.c
lustre/lmv/lmv_obd.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/obd_config.c
lustre/obdfilter/filter.c
lustre/ptlrpc/gss/sec_gss.c
lustre/tests/replay-single.sh

index 5ef80a2..2df827f 100644 (file)
@@ -1472,6 +1472,7 @@ static int target_recovery_thread(void *arg)
                 CWARN("too long recovery - read logs\n");
                 libcfs_debug_dumplog();
         }
+
         target_finish_recovery(obd);
 
         lu_env_fini(&env);
index f6f92e0..e919e92 100644 (file)
@@ -44,7 +44,7 @@ static int ll_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
 
         rc = obd_fid_alloc(exp, fid, hint);
         if (rc) {
-                CERROR("cannot allocate new fid, rc %d\n", rc);
+                CERROR("Can't allocate new fid, rc %d\n", rc);
                 RETURN(rc);
         }
 
index f460195..f0ff372 100644 (file)
@@ -489,10 +489,8 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
                                                   .ph_opc = LUSTRE_OPC_CREATE };
 
                 rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data->fid2, &hint);
-                if (rc) {
-                        CERROR("can't allocate new fid, rc %d\n", rc);
+                if (rc)
                         LBUG();
-                }
         }
 
         it->it_create_mode &= ~current->fs->umask;
index a39b275..4d3d8e5 100644 (file)
@@ -849,7 +849,7 @@ static int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
 
         rc = lmv_placement_policy(obd, hint, &mds);
         if (rc) {
-                CERROR("can't get target for allocating fid, "
+                CERROR("Can't get target for allocating fid, "
                        "rc %d\n", rc);
                 RETURN(rc);
         }
@@ -864,7 +864,7 @@ static int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
                 rc = fld_client_create(&lmv->lmv_fld, fid_seq(fid),
                                        mds, NULL);
                 if (rc) {
-                        CERROR("can't create fld entry, rc %d\n", rc);
+                        CERROR("Can't create fld entry, rc %d\n", rc);
                         RETURN(rc);
                 }
         }
index cb1a94e..2969af4 100644 (file)
@@ -1374,13 +1374,6 @@ static int mdc_fid_init(struct obd_export *exp)
         if (rc)
                 GOTO(out_free_seq, rc);
 
-        /* pre-allocate meta-sequence */
-        rc = seq_client_alloc_meta(cli->cl_seq, NULL);
-        if (rc) {
-                CERROR("Can't allocate new meta-sequence, "
-                       "rc %d\n", rc);
-                GOTO(out_free_seq, rc);
-        }
         RETURN(rc);
 
 out_free_seq:
index a9b6a0d..e3d7c8c 100644 (file)
@@ -2075,8 +2075,10 @@ int mdt_intent_lock_replace(struct mdt_thread_info *info,
         if (new_lock == NULL)
                 new_lock = ldlm_handle2lock(&lh->mlh_lh);
 
-        if (new_lock == NULL && (flags & LDLM_FL_INTENT_ONLY))
+        if (new_lock == NULL && (flags & LDLM_FL_INTENT_ONLY)) {
+                lh->mlh_lh.cookie = 0;
                 RETURN(0);
+        }
 
         LASSERTF(new_lock != NULL,
                  "lockh "LPX64"\n", lh->mlh_lh.cookie);
@@ -2103,6 +2105,7 @@ int mdt_intent_lock_replace(struct mdt_thread_info *info,
                  */
                 LASSERT(lustre_msg_get_flags(req->rq_reqmsg) &
                         MSG_RESENT);
+                lh->mlh_lh.cookie = 0;
                 RETURN(ELDLM_LOCK_REPLACED);
         }
 
@@ -2550,6 +2553,7 @@ static int mdt_md_connect(const struct lu_env *env,
 
         RETURN(rc);
 }
+
 /*
  * Init client sequence manager which is used by local MDS to talk to sequence
  * controller on remote node.
@@ -2562,8 +2566,8 @@ static int mdt_seq_init_cli(const struct lu_env *env,
         struct obd_device *mdc;
         struct obd_uuid   *uuidp, *mdcuuidp;
         char              *uuid_str, *mdc_uuid_str;
-        int               rc;
-        int               index;
+        int                rc;
+        int                index;
         struct mdt_thread_info *info;
         char *p, *index_string = lustre_cfg_string(cfg, 2);
         ENTRY;
index e0500f6..4d39944 100644 (file)
@@ -928,8 +928,8 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
         if (lcfg->lcfg_command == LCFG_MARKER) {
                 struct cfg_marker *marker;
                 marker = lustre_cfg_buf(lcfg, 1);
-                if(!strncmp(marker->cm_comment,"add osc",7) &&
-                        (marker->cm_flags & CM_START)){
+                if (!strncmp(marker->cm_comment,"add osc",7) &&
+                    (marker->cm_flags & CM_START)){
                         got_an_osc_or_mdc = 1;
                         rc = record_start_log(obd, &mdt_llh, mti->mti_svname);
                         rc = record_marker(obd, mdt_llh, fsdb, CM_START,
@@ -938,8 +938,8 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
                         last_step = marker->cm_step;
                         RETURN(rc);
                 }
-                if(!strncmp(marker->cm_comment,"add osc",7) &&
-                        (marker->cm_flags & CM_END)){
+                if (!strncmp(marker->cm_comment,"add osc",7) &&
+                    (marker->cm_flags & CM_END)){
                         LASSERT(last_step == marker->cm_step);
                         last_step = -1;
                         got_an_osc_or_mdc = 0;
@@ -949,8 +949,8 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
                         rc = record_end_log(obd, &mdt_llh);
                         RETURN(rc);
                 }
-                if(!strncmp(marker->cm_comment,"add mdc",7) &&
-                        (marker->cm_flags & CM_START)){
+                if (!strncmp(marker->cm_comment,"add mdc",7) &&
+                    (marker->cm_flags & CM_START)){
                         got_an_osc_or_mdc = 2;
                         last_step = marker->cm_step;
                         memcpy(tmti->mti_svname, marker->cm_svname,
@@ -958,8 +958,8 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
 
                         RETURN(rc);
                 }
-                if(!strncmp(marker->cm_comment,"add mdc",7) &&
-                        (marker->cm_flags & CM_END)){
+                if (!strncmp(marker->cm_comment,"add mdc",7) &&
+                    (marker->cm_flags & CM_END)){
                         LASSERT(last_step == marker->cm_step);
                         last_step = -1;
                         got_an_osc_or_mdc = 0;
@@ -985,13 +985,11 @@ static int mgs_steal_llog_handler(struct llog_handle *llh,
 
                 target = lustre_cfg_string(lcfg, 1);
                 memcpy(tmti->mti_uuid, target, strlen(target));
-
                 RETURN(rc);
         }
 
         if (lcfg->lcfg_command == LCFG_SEC_FLAVOR) {
                 memcpy(sec_conf, lustre_cfg_buf(lcfg, 1), sizeof(*sec_conf));
-
                 RETURN(rc);
         }
 
@@ -1330,12 +1328,12 @@ static int mgs_write_log_mdt0(struct obd_device *obd, struct fs_db *fsdb,
                 RETURN(-ENOMEM);
 
         name_create(&lovname, log, "-mdtlov");
-        if (mgs_log_is_empty(obd, log)) {
+        if (mgs_log_is_empty(obd, log))
                 rc = mgs_write_log_lov(obd, fsdb, mti, log, lovname);
-        } 
 
         sprintf(uuid, "%s_UUID", log);
         sprintf(mdt_index,"%d",mti->mti_stripe_index);        
+
         /* add MDT itself */
         rc = record_start_log(obd, &llh, log);
         if (rc) 
index b37ec80..617255a 100644 (file)
@@ -248,6 +248,8 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC, "obd %p obd_magic %08x != %08x\n", 
                  obd, obd->obd_magic, OBD_DEVICE_MAGIC);
 
+        obd->obd_configured = 0;
+        
         /* have we attached a type to this device? */
         if (!obd->obd_attached) {
                 CERROR("Device %d not attached\n", obd->obd_minor);
@@ -285,6 +287,7 @@ int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 GOTO(err_exp, err);
 
         obd->obd_set_up = 1;
+        
         spin_lock(&obd->obd_dev_lock);
         /* cleanup drops this */
         class_incref(obd);
@@ -972,7 +975,9 @@ static int class_config_llog_handler(struct llog_handle * handle,
                 if (!(clli->cfg_flags & CFG_F_COMPAT146) &&
                     !(clli->cfg_flags & CFG_F_MARKER) && 
                     (lcfg->lcfg_command != LCFG_MARKER)) {
-                        CWARN("Config not inside markers, ignoring! (%#x)\n", 
+                        CWARN("Config not inside markers, ignoring! "
+                              "(inst: %s, uuid: %s, flags: %#x)\n",
+                              clli->cfg_instance, clli->cfg_uuid,
                               clli->cfg_flags);
                         clli->cfg_flags |= CFG_F_SKIP;
                 }
@@ -1062,14 +1067,17 @@ void class_config_notify_end(const char *name)
         struct obd_device *obd;
         ENTRY;
 
-        /*XXX: This is fast fix to mountconf issue when osc are set up
-         * while recovery is in progress already.
-         * The MDS should wait the end of config llog parsing before starting
-         * recovery. This is done via obd_configured flag for now
+        /*
+         * XXX: This is fast fix to mountconf issue when osc are set up while
+         * recovery is in progress already.  The MDS should wait the end of
+         * config llog parsing before starting recovery. This is done via
+         * obd_configured flag for now.
          */
         obd = class_name2obd(name);
-        if (obd) {
+        if (obd)
                 obd->obd_configured = 1;
+        else {
+                CWARN("OBD \"%s\" is not found - skipped.\n", name);
         }
         EXIT;
 }
@@ -1098,10 +1106,17 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
 
         rc = llog_process(llh, class_config_llog_handler, cfg, &cd);
 
-        class_config_notify_end(name);
-
         CDEBUG(D_CONFIG, "Processed log %s gen %d-%d (rc=%d)\n", name, 
                cd.first_idx + 1, cd.last_idx, rc);
+
+        if (rc == 0) {
+                class_config_notify_end(name);
+                CDEBUG(D_CONFIG, "Notify config log %s parse finish\n", 
+                       name);
+        } else {
+                CDEBUG(D_CONFIG, "Log %s did not parse, obd is not "
+                       "configured.\n", name);
+        }
         if (cfg)
                 cfg->cfg_last_idx = cd.last_idx;
 
index 740cedd..8827ca3 100644 (file)
@@ -1239,9 +1239,6 @@ static void filter_post(struct obd_device *obd)
          * best to start a transaction with h_sync, because we removed this
          * from lastobjid */
 
-        target_stop_recovery_thread(obd);
-        target_cleanup_recovery(obd);
-        
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         rc = filter_update_server_data(obd, filter->fo_rcvd_filp,
                                        filter->fo_fsd, 0);
@@ -2261,6 +2258,10 @@ static int filter_cleanup(struct obd_device *obd)
 
         lquota_cleanup(quota_interface, obd);
 
+        /* Stop recovery before namespace cleanup. */
+        target_stop_recovery_thread(obd);
+        target_cleanup_recovery(obd);
+        
         ldlm_namespace_free(obd->obd_namespace, obd->obd_force);
 
         if (obd->u.obt.obt_sb == NULL)
index 83025d1..de1bfbd 100644 (file)
@@ -1646,7 +1646,8 @@ int gss_svc_handle_init(struct ptlrpc_request *req,
 
         uuid = (struct obd_uuid *) uuid_obj.data;
         target = class_uuid2obd(uuid);
-        if (!target || target->obd_stopping || !target->obd_set_up) {
+        if (!target || target->obd_stopping || !target->obd_set_up || 
+            !target->obd_configured) {
                 CERROR("target '%s' is not available for context init (%s)",
                        uuid->uuid, target == NULL ? "no target" :
                        (target->obd_stopping ? "stopping" : "not set up"));
index 3126add..4b4b43d 100755 (executable)
@@ -78,8 +78,12 @@ seq_get_width()
 }
 
 test_0c() {
+    if test $MDSCOUNT != 0; then
+            echo "Skipped for LMV config"
+            return 0;
+    fi
     local label=`mdsdevlabel 1`
-    [ -z "$label" ] && echo "No label for mds1" && exit 1
+    [ -z "$label" ] && echo "No label for mds1" && return 1
 
     replay_barrier $SINGLEMDS
     local sw=`seq_get_width $label`