GOTO(out, rc);
rc = mds_lov_clearorphans(mds, NULL /* all OSTs */);
- if (rc < 0)
- GOTO(out, rc);
out:
- if (rc && mds->mds_lov_objids) {
- /* Might as well crash here, until we figure out what to do.
- * If we OBD_FREE, we'll just LASSERT the next time through this
- * function. */
- LBUG();
- OBD_FREE(mds->mds_lov_objids,
- mds->mds_lov_desc.ld_tgt_count * sizeof(obd_id));
- mds->mds_lov_objids = NULL;
- }
-
RETURN(rc);
}
if (!obd->obd_recovering) {
rc = llog_connect(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT),
obd->u.mds.mds_lov_desc.ld_tgt_count, NULL,
- NULL);
+ NULL, NULL);
if (rc != 0)
CERROR("faild at llog_origin_connect: %d\n", rc);
RETURN(rc);
}
+ case OBD_IOC_CLEAR_LOG: {
+ char *name = data->ioc_inlbuf1;
+ if (mds->mds_cfg_llh)
+ RETURN(-EBUSY);
+
+ push_ctxt(&saved, &obd->obd_ctxt, NULL);
+ rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT),
+ &mds->mds_cfg_llh, NULL, name);
+ if (rc == 0) {
+ llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN,
+ NULL);
+
+ rc = llog_destroy(mds->mds_cfg_llh);
+ llog_free_handle(mds->mds_cfg_llh);
+ }
+ pop_ctxt(&saved, &obd->obd_ctxt, NULL);
+
+ mds->mds_cfg_llh = NULL;
+ RETURN(rc);
+ }
+
case OBD_IOC_DORECORD: {
char *cfg_buf;
struct llog_rec_hdr rec;
case OBD_IOC_LLOG_REMOVE: {
struct llog_ctxt *ctxt =
llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+ int rc2;
obd_llog_finish(obd, mds->mds_lov_desc.ld_tgt_count);
push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
rc = llog_ioctl(ctxt, cmd, data);
pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count);
-
+ rc2 = obd_set_info(mds->mds_osc_exp, strlen("mds_conn"), "mds_conn",
+ 0, NULL);
+ if (!rc)
+ rc = rc2;
RETURN(rc);
}
case OBD_IOC_LLOG_INFO:
RETURN(0);
}
-int mds_notify(struct obd_device *obd, struct obd_device *watched,
- int active)
+int mds_notify(struct obd_device *obd, struct obd_device *watched, int active)
{
- struct obd_uuid *uuid;
+ struct obd_uuid *uuid;
int rc = 0;
+ ENTRY;
if (!active)
RETURN(0);
if (strcmp(watched->obd_type->typ_name, "osc")) {
CERROR("unexpected notification of %s %s!\n",
- watched->obd_type->typ_name,
- watched->obd_name);
+ watched->obd_type->typ_name, watched->obd_name);
RETURN(-EINVAL);
}
+ uuid = &watched->u.cli.cl_import->imp_target_uuid;
if (obd->obd_recovering) {
CWARN("MDS %s: in recovery, not resetting orphans on %s\n",
obd->obd_name, uuid->uuid);
} else {
- uuid = &watched->u.cli.cl_import->imp_target_uuid;
+ LASSERT(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT) != NULL);
+
+ rc = obd_set_info(obd->u.mds.mds_osc_exp, strlen("mds_conn"), "mds_conn",
+ 0, uuid);
+ if (rc != 0)
+ RETURN(rc);
+
+ rc = llog_connect(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT),
+ obd->u.mds.mds_lov_desc.ld_tgt_count,
+ NULL, NULL, uuid);
+ if (rc != 0) {
+ CERROR("faild at llog_origin_connect: %d\n", rc);
+ RETURN(rc);
+ }
+
CWARN("MDS %s: %s now active, resetting orphans\n",
obd->obd_name, uuid->uuid);
rc = mds_lov_clearorphans(&obd->u.mds, uuid);