* missing objects below this ID, they will be created. If it finds
* objects above this ID, they will be removed. */
memset(&oa, 0, sizeof(oa));
- oa.o_valid = OBD_MD_FLFLAGS;
+ oa.o_gr = FILTER_GROUP_FIRST_MDS + mds->mds_num;
+ oa.o_valid = OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
oa.o_flags = OBD_FL_DELORPHAN;
if (ost_uuid != NULL) {
memcpy(&oa.o_inline, ost_uuid, sizeof(*ost_uuid));
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);
}
{
struct mds_obd *mds = &obd->u.mds;
struct lustre_handle conn = {0,};
- int valsize;
- int rc, i;
+ int valsize, rc, i;
+ __u32 group;
ENTRY;
if (IS_ERR(mds->mds_osc_obd))
}
valsize = sizeof(mds->mds_lov_desc);
- rc = obd_get_info(mds->mds_osc_exp, strlen("lovdesc") + 1, "lovdesc",
+ rc = obd_get_info(mds->mds_osc_exp, strlen("lovdesc") + 1, "lovdesc",
&valsize, &mds->mds_lov_desc);
- if (rc)
+ if (rc)
GOTO(err_reg, rc);
- mds->mds_max_mdsize = lov_mds_md_size(mds->mds_lov_desc.ld_tgt_count);
+ i = lov_mds_md_size(mds->mds_lov_desc.ld_tgt_count);
+ if (i > mds->mds_max_mdsize)
+ mds->mds_max_mdsize = i;
mds->mds_max_cookiesize = mds->mds_lov_desc.ld_tgt_count*
sizeof(struct llog_cookie);
mds->mds_has_lov_desc = 1;
if (rc) {
CERROR("cannot read %s: rc = %d\n", "lov_objids", rc);
GOTO(err_reg, rc);
- }
+ }
-#ifdef ENABLE_ORPHANS
- rc = llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count);
+ rc = llog_cat_initialize(obd, &obd->obd_llogs,
+ mds->mds_lov_desc.ld_tgt_count);
if (rc) {
CERROR("failed to initialize catalog %d\n", rc);
GOTO(err_reg, rc);
}
-#endif
- /* FIXME before this set info call is made, we must initialize the logging */
+
+ /* FIXME before set info call is made, we must initialize logging */
+ group = FILTER_GROUP_FIRST_MDS + mds->mds_num;
+ valsize = sizeof(group);
rc = obd_set_info(mds->mds_osc_exp, strlen("mds_conn"), "mds_conn",
- 0, NULL);
- if (rc)
+ valsize, &group);
+ if (rc)
GOTO(err_reg, rc);
-
+
/* If we're mounting this code for the first time on an existing FS,
* we need to populate the objids array from the real OST values */
if (!mds->mds_lov_objids_valid) {
* it can use the obd_recovering flag to determine when the
* the OBD is full available. */
if (!obd->obd_recovering) {
-#ifdef ENABLE_ORPHANS
- rc = llog_connect(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT),
- obd->u.mds.mds_lov_desc.ld_tgt_count, NULL, NULL);
- if (rc != 0) {
+ struct llog_ctxt *ctxt;
+ ctxt = llog_get_context(&obd->obd_llogs, LLOG_UNLINK_ORIG_CTXT);
+ rc = llog_connect(ctxt, obd->u.mds.mds_lov_desc.ld_tgt_count,
+ NULL, NULL, NULL);
+ if (rc != 0)
CERROR("faild at llog_origin_connect: %d\n", rc);
- }
-#endif
+
rc = mds_cleanup_orphans(obd);
if (rc > 0)
CERROR("Cleanup %d orphans while MDS isn't recovering\n", rc);
RETURN(rc);
err_llog:
-#ifdef ENABLE_ORPHANS
/* cleanup all llogging subsystems */
- rc = obd_llog_finish(obd, mds->mds_lov_desc.ld_tgt_count);
- if (rc)
+ rc = obd_llog_finish(obd, &obd->obd_llogs,
+ mds->mds_lov_desc.ld_tgt_count);
+ if (rc)
CERROR("failed to cleanup llogging subsystems\n");
-#endif
err_reg:
obd_register_observer(mds->mds_osc_obd, NULL);
err_discon:
ENTRY;
if (!IS_ERR(mds->mds_osc_obd) && mds->mds_osc_exp != NULL) {
-#ifdef ENABLE_ORPHANS
/* cleanup all llogging subsystems */
- rc = obd_llog_finish(obd, mds->mds_lov_desc.ld_tgt_count);
- if (rc)
+ rc = obd_llog_finish(obd, &obd->obd_llogs,
+ mds->mds_lov_desc.ld_tgt_count);
+ if (rc)
CERROR("failed to cleanup llogging subsystems\n");
-#endif
obd_register_observer(mds->mds_osc_obd, NULL);
struct mds_obd *mds = &obd->u.mds;
struct obd_ioctl_data *data = karg;
struct obd_run_ctxt saved;
+ struct llog_ctxt *ctxt;
int rc = 0;
switch (cmd) {
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);
+ ctxt = llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
+ rc = llog_create(ctxt, &mds->mds_cfg_llh, NULL, name);
if (rc == 0)
- llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN,
+ llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN,
&cfg_uuid);
else
mds->mds_cfg_llh = NULL;
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);
+ ctxt = llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
+ rc = llog_create(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_PARSE: {
- struct llog_ctxt *ctxt =
- llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+ struct llog_ctxt *ctxt =
+ llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
push_ctxt(&saved, &obd->obd_ctxt, NULL);
rc = class_config_parse_llog(ctxt, data->ioc_inlbuf1, NULL);
pop_ctxt(&saved, &obd->obd_ctxt, NULL);
}
case OBD_IOC_DUMP_LOG: {
- struct llog_ctxt *ctxt =
- llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+ struct llog_ctxt *ctxt =
+ llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
push_ctxt(&saved, &obd->obd_ctxt, NULL);
rc = class_config_dump_llog(ctxt, data->ioc_inlbuf1, NULL);
pop_ctxt(&saved, &obd->obd_ctxt, NULL);
RETURN(rc);
}
- case OBD_IOC_LLOG_CHECK:
+ case OBD_IOC_LLOG_CHECK:
case OBD_IOC_LLOG_CANCEL:
- case OBD_IOC_LLOG_REMOVE: {
- struct llog_ctxt *ctxt =
- llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+ case OBD_IOC_LLOG_REMOVE: {
+ struct llog_ctxt *ctxt =
+ llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
+ int rc2;
-#ifdef ENABLE_ORPHANS
- obd_llog_finish(obd, mds->mds_lov_desc.ld_tgt_count);
-#endif
+ obd_llog_finish(obd, &obd->obd_llogs,
+ 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);
-
-#ifdef ENABLE_ORPHANS
- llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count);
-#endif
+ llog_cat_initialize(obd, &obd->obd_llogs,
+ 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:
case OBD_IOC_LLOG_PRINT: {
- struct llog_ctxt *ctxt =
- llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
-
+ struct llog_ctxt *ctxt =
+ llog_get_context(&obd->obd_llogs, LLOG_CONFIG_ORIG_CTXT);
+
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);
-
+
RETURN(rc);
}
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;
- CWARN("MDS %s: %s now active, resetting orphans\n",
- obd->obd_name, uuid->uuid);
- RETURN(mds_lov_clearorphans(&obd->u.mds, uuid));
+ if (obd->obd_recovering) {
+ CWARN("MDS %s: in recovery, not resetting orphans on %s\n",
+ obd->obd_name, uuid->uuid);
+ } else {
+ struct llog_ctxt *ctxt;
+
+ ctxt = llog_get_context(&obd->obd_llogs, LLOG_UNLINK_ORIG_CTXT);
+ LASSERT(ctxt != NULL);
+
+ rc = obd_set_info(obd->u.mds.mds_osc_exp, strlen("mds_conn"), "mds_conn",
+ 0, uuid);
+ if (rc != 0)
+ RETURN(rc);
+
+ ctxt = llog_get_context(&obd->obd_llogs, LLOG_UNLINK_ORIG_CTXT);
+ rc = llog_connect(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);
+ }
+ RETURN(rc);
}
/* Convert the on-disk LOV EA structre.