Whamcloud - gitweb
Branch b1_5
authornathan <nathan>
Thu, 29 Jun 2006 20:37:00 +0000 (20:37 +0000)
committernathan <nathan>
Thu, 29 Jun 2006 20:37:00 +0000 (20:37 +0000)
b=8007
--writeconf only allowed a single target to regenerate it's log.

lustre/mgs/mgs_handler.c
lustre/mgs/mgs_internal.h
lustre/mgs/mgs_llog.c

index 3575d0f..5f0c11a 100644 (file)
@@ -316,7 +316,7 @@ static int mgs_put_cfg_lock(struct lustre_handle *lockh)
 
 /* rc=0 means ok
       1 means update
-     -1 means error */
+     <0 means error */
 static int mgs_check_target(struct obd_device *obd, struct mgs_target_info *mti)
 {
         int rc;
@@ -325,10 +325,11 @@ static int mgs_check_target(struct obd_device *obd, struct mgs_target_info *mti)
         rc = mgs_check_index(obd, mti);
         if (rc == 0) {
                 LCONSOLE_ERROR("%s claims to have registered, but this MGS "
-                               "does not know about it.  Resolve this issue "
-                               "with tunefs.lustre on that device\n",
+                               "does not know about it.  Assuming the log was "
+                               "lost, will regenerate.\n",
                                mti->mti_svname);
-                rc = -EINVAL;
+                mti->mti_flags |= LDD_F_UPDATE;
+                rc = 1;
         } else if (rc == -1) {
                 LCONSOLE_ERROR("Client log %s-client has disappeared! "
                                "Regenerating all logs.\n",
@@ -387,13 +388,20 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req)
         /* Log writing contention is handled by the fsdb_sem */
 
         if (mti->mti_flags & LDD_F_WRITECONF) {
-                rc = mgs_erase_logs(obd, mti->mti_fsname);
-                mti->mti_flags |= LDD_F_UPDATE;
-                LCONSOLE_WARN("%s: Logs for fs %s were removed by user request."
-                              " All servers must re-register in order to "
-                              "regenerate the client log.\n",
-                              obd->obd_name, mti->mti_fsname);
+                if (mti->mti_flags & LDD_F_SV_TYPE_MDT) {
+                        rc = mgs_erase_logs(obd, mti->mti_fsname);
+                        LCONSOLE_WARN("%s: Logs for fs %s were removed by user "
+                                      "request.  All servers must be restarted "
+                                      "in order to regenerate the client log."
+                                      "\n", obd->obd_name, mti->mti_fsname);
+                } else if (mti->mti_flags & LDD_F_SV_TYPE_OST) {
+                        rc = mgs_erase_log(obd, mti->mti_svname);
+                        LCONSOLE_WARN("%s: Regenerating %s log by user "
+                                      "request.\n",
+                                      obd->obd_name, mti->mti_fsname);
+                }
                 mti->mti_flags &= ~LDD_F_WRITECONF;
+                mti->mti_flags |= LDD_F_UPDATE;
         }
 
         /* COMPAT_146 */
@@ -411,7 +419,7 @@ static int mgs_handle_target_reg(struct ptlrpc_request *req)
         /* end COMPAT_146 */
 
         if (mti->mti_flags & LDD_F_UPDATE) {
-                CDEBUG(D_MGS, "adding %s, index=%d\n", mti->mti_svname, 
+                CDEBUG(D_MGS, "updating %s, index=%d\n", mti->mti_svname, 
                        mti->mti_stripe_index);
                 
                 /* create the log for the new target 
index 13ad46a..91996e8 100644 (file)
@@ -45,6 +45,7 @@ int mgs_check_index(struct obd_device *obd, struct mgs_target_info *mti);
 int mgs_check_failnid(struct obd_device *obd, struct mgs_target_info *mti);
 int mgs_write_log_target(struct obd_device *obd, struct mgs_target_info *mti);
 int mgs_upgrade_sv_14(struct obd_device *obd, struct mgs_target_info *mti);
+int mgs_erase_log(struct obd_device *obd, char *name);
 int mgs_erase_logs(struct obd_device *obd, char *fsname);
 int mgs_setparam(struct obd_device *obd, char *fsname, struct lustre_cfg *lcfg);
 
index 7dbf272..1ab0fd0 100644 (file)
@@ -1353,12 +1353,15 @@ int mgs_write_log_target(struct obd_device *obd,
         } else {
                 if (rc == EALREADY) {
                         /* Update a target entry in the logs */
-                        CERROR("updates not yet implemented\n");
+                        LCONSOLE_WARN("Found index %d for %s, " 
+                                      "attempting to write log anyhow\n", 
+                                      mti->mti_stripe_index, mti->mti_svname);
                         /* FIXME mark old log sections as invalid, 
                            inc config ver #, add new log sections.
                            Make sure to update client and mds logs too
                            if needed */
-                        RETURN(-ENXIO);
+                        /* in the mean time, assume all logs were lost
+                           (writeconf), and recreate this one */
                 }
         }
 
@@ -1444,7 +1447,7 @@ int mgs_upgrade_sv_14(struct obd_device *obd, struct mgs_target_info *mti)
 }
 /* end COMPAT_146 */
 
-static int mgs_clear_log(struct obd_device *obd, char *name)
+int mgs_erase_log(struct obd_device *obd, char *name)
 {
         struct lvfs_run_ctxt saved;
         struct llog_handle *llh;
@@ -1495,7 +1498,7 @@ int mgs_erase_logs(struct obd_device *obd, char *fsname)
                 list_del(&dirent->lld_list);
                 if (strncmp(fsname, dirent->lld_name, len) == 0) {
                         CDEBUG(D_MGS, "Removing log %s\n", dirent->lld_name);
-                        mgs_clear_log(obd, dirent->lld_name);
+                        mgs_erase_log(obd, dirent->lld_name);
                 }
                 OBD_FREE(dirent, sizeof(*dirent));
         }