/* 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;
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",
/* 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 */
/* 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
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);
} 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 */
}
}
}
/* 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;
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));
}