return 0;
}
+static int mds_lov_objinit(struct mds_obd *mds, __u32 index)
+{
+ __u32 page = index / OBJID_PER_PAGE();
+ __u32 off = index % OBJID_PER_PAGE();
+ obd_id *data = mds->mds_lov_page_array[page];
+
+ return (data[off] > 0);
+}
+
int mds_lov_prepare_objids(struct obd_device *obd, struct lov_mds_md *lmm)
{
int rc = 0;
off = idx % OBJID_PER_PAGE();
data = mds->mds_lov_page_array[page];
- if (data[off] < 2 ||
+ if (data[off] < 2 ||
!(osc_exp->exp_connect_flags & OBD_CONNECT_SKIP_ORPHAN)) {
/* We never read this lastid; ask the osc */
struct obd_id_info lastid;
/* Don't let anyone else mess with mds_lov_objids now */
old_count = mds->mds_lov_desc.ld_tgt_count;
- rc = mds_lov_update_desc(obd, idx, &watched->u.cli.cl_target_uuid);
- if (rc)
- GOTO(out, rc);
+ LASSERT(mds_lov_objinit(mds, idx));
CDEBUG(D_CONFIG, "idx=%d, recov=%d/%d, cnt=%d/%d\n",
idx, obd->obd_recovering, obd->obd_async_recov, old_count,
GOTO(error_exit, rc);
}
- rc = obd_llog_init(obd, obd, NULL);
- if (rc) {
- CERROR("MDS cannot register as observer of LOV %s (%d)\n",
- lov_name, rc);
- GOTO(error_exit, rc);
- }
+ /* ask lov to generate OBD_NOTIFY_CREATE events for already registered
+ * targets */
+ obd_notify(obd->u.mds.mds_osc_obd, NULL, OBD_NOTIFY_CREATE, NULL);
OBD_ALLOC(data, sizeof(*data));
if (data == NULL)
CDEBUG(D_CONFIG, "notify %s ev=%d\n", watched->obd_name, ev);
switch (ev) {
+ case OBD_NOTIFY_CREATE:
+ CWARN("MDS %s: add target %s\n",obd->obd_name,
+ obd_uuid2str(&watched->u.cli.cl_target_uuid));
+ /* We still have to fix the lov descriptor for ost's */
+ LASSERT(data);
+ rc = mds_lov_update_desc(obd, *(__u32 *)data,
+ &watched->u.cli.cl_target_uuid);
+ RETURN(rc);
/* We only handle these: */
case OBD_NOTIFY_ACTIVE:
/* lov want one or more _active_ targets for work */
CWARN("MDS %s: in recovery, not resetting orphans on %s\n",
obd->obd_name,
obd_uuid2str(&watched->u.cli.cl_target_uuid));
- /* We still have to fix the lov descriptor for ost's added
- after the mdt in the config log. They didn't make it into
- mds_lov_connect. */
- LASSERT(data);
- rc = mds_lov_update_desc(obd, *(__u32 *)data,
- &watched->u.cli.cl_target_uuid);
-
mds_allow_cli(obd, CONFIG_SYNC);
- RETURN(rc);
+ RETURN(0);
}
rc = mds_lov_start_synchronize(obd, watched, data,