CONFIG_READ_NRPAGES = 4
};
-static int mgc_apply_recover_logs(struct obd_device *obd,
+static int mgc_apply_recover_logs(struct obd_device *mgc,
struct config_llog_data *cld,
__u64 max_version,
void *data, int datalen)
u64 prev_version = 0;
char *inst;
char *buf;
- int bufsz = CFS_PAGE_SIZE;
+ int bufsz;
int pos;
int rc = 0;
int off = 0;
-
- OBD_ALLOC(buf, CFS_PAGE_SIZE);
- if (buf == NULL)
- return -ENOMEM;
+ ENTRY;
LASSERT(cfg->cfg_instance != NULL);
LASSERT(cfg->cfg_sb == cfg->cfg_instance);
- inst = buf;
+
+ OBD_ALLOC(inst, CFS_PAGE_SIZE);
+ if (inst == NULL)
+ RETURN(-ENOMEM);
+
if (!(lsi->lsi_flags & LSI_SERVER)) {
pos = sprintf(inst, "%p", cfg->cfg_instance);
} else {
LASSERT(IS_MDT(lsi->lsi_ldd));
pos = sprintf(inst, "MDT%04x", lsi->lsi_ldd->ldd_svindex);
}
- buf += pos + 1;
- bufsz -= pos + 1;
+
+ ++pos;
+ buf = inst + pos;
+ bufsz = CFS_PAGE_SIZE - pos;
while (datalen > 0) {
int entry_len = sizeof(*entry);
strcpy(obdname, cld->cld_logname);
cname = strrchr(obdname, '-');
if (cname == NULL) {
- CERROR("mgc: invalid logname %s\n", obdname);
+ CERROR("mgc %s: invalid logname %s\n",
+ mgc->obd_name, obdname);
break;
}
/* find the obd by obdname */
obd = class_name2obd(obdname);
if (obd == NULL) {
- CDEBUG(D_INFO, "mgc: cannot find obdname %s\n",
- obdname);
+ CDEBUG(D_INFO, "mgc %s: cannot find obdname %s\n",
+ mgc->obd_name, obdname);
/* this is a safe race, when the ost is starting up...*/
continue;
}
OBD_FREE(inst, CFS_PAGE_SIZE);
- return rc;
+ RETURN(rc);
}
/**
int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld)
{
struct lustre_handle lockh = { 0 };
- int rc = 0, rcl, flags = 0;
+ int rc = 0, rcl, flags = LDLM_FL_NO_LRU;
ENTRY;
LASSERT(cld);
cld->cld_cfg.cfg_flags |= CFG_F_COMPAT146;
rc = mgc_process_log(obd, cld);
- if (rc == 0 && cld->cld_recover) {
- rc = mgc_process_log(obd, cld->cld_recover);
+ if (rc == 0 && cld->cld_recover != NULL) {
+ if (OCD_HAS_FLAG(&obd->u.cli.cl_import->
+ imp_connect_data, IMP_RECOV)) {
+ rc = mgc_process_log(obd, cld->cld_recover);
+ } else {
+ struct config_llog_data *cir = cld->cld_recover;
+ cld->cld_recover = NULL;
+ config_log_put(cir);
+ }
if (rc)
CERROR("Cannot process recover llog %d\n", rc);
}