i=tom.wang
i=yury.umanets
This patch is first step towards shifting mds-lov work to new
lustre mds stack.
- kill OBD_CLEANUP_SELF_EXP
- added rw_sem to serialize mds_notify and mds_precleanup
- kill OBD_CLEANUP_OBD
12 files changed:
/* for capability keys update */
struct lustre_capa_key *mds_capa_keys;
/* for capability keys update */
struct lustre_capa_key *mds_capa_keys;
+ struct rw_semaphore mds_notify_lock;
enum obd_cleanup_stage {
/* Special case hack for MDS LOVs */
OBD_CLEANUP_EARLY,
enum obd_cleanup_stage {
/* Special case hack for MDS LOVs */
OBD_CLEANUP_EARLY,
-/* Precleanup stage 1, we must make sure all exports (other than the
- self-export) get destroyed. */
+/* can be directly mapped to .ldto_device_fini() */
-/* Precleanup stage 2, do other type-specific cleanup requiring the
- self-export. */
- OBD_CLEANUP_SELF_EXP,
-/* FIXME we should eliminate the "precleanup" function and make them stages
- of the "cleanup" function. */
- OBD_CLEANUP_OBD,
};
/* get/set_info keys */
};
/* get/set_info keys */
/* XXX: here should be calling obd_precleanup() down to
* stack. */
break;
/* XXX: here should be calling obd_precleanup() down to
* stack. */
break;
- case OBD_CLEANUP_SELF_EXP:
+ case OBD_CLEANUP_EXPORTS:
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
}
case OBD_CLEANUP_EXPORTS:
break;
}
case OBD_CLEANUP_EXPORTS:
- break;
- case OBD_CLEANUP_SELF_EXP:
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
- case OBD_CLEANUP_OBD:
- break;
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
- case OBD_CLEANUP_SELF_EXP:
- break;
- case OBD_CLEANUP_OBD:
- break;
/* Cleanup the lov */
obd_disconnect(mds->mds_osc_exp);
class_manual_cleanup(osc);
/* Cleanup the lov */
obd_disconnect(mds->mds_osc_exp);
class_manual_cleanup(osc);
- mds->mds_osc_exp = NULL;
static int mds_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
{
int rc = 0;
static int mds_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
{
int rc = 0;
+ struct mds_obd *mds = &obd->u.mds;
ENTRY;
switch (stage) {
case OBD_CLEANUP_EARLY:
break;
case OBD_CLEANUP_EXPORTS:
ENTRY;
switch (stage) {
case OBD_CLEANUP_EARLY:
break;
case OBD_CLEANUP_EXPORTS:
- /*XXX Use this for mdd mds cleanup, so comment out
- *this target_cleanup_recovery for this tmp MDD MDS
- *Wangdi*/
- if (strncmp(obd->obd_name, MDD_OBD_NAME, strlen(MDD_OBD_NAME)))
- target_cleanup_recovery(obd);
mds_lov_early_clean(obd);
mds_lov_early_clean(obd);
- break;
- case OBD_CLEANUP_SELF_EXP:
+ down_write(&mds->mds_notify_lock);
mds_lov_disconnect(obd);
mds_lov_clean(obd);
llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT));
llog_cleanup(llog_get_context(obd, LLOG_LOVEA_ORIG_CTXT));
rc = obd_llog_finish(obd, 0);
mds_lov_disconnect(obd);
mds_lov_clean(obd);
llog_cleanup(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT));
llog_cleanup(llog_get_context(obd, LLOG_LOVEA_ORIG_CTXT));
rc = obd_llog_finish(obd, 0);
- break;
- case OBD_CLEANUP_OBD:
+ mds->mds_osc_exp = NULL;
+ up_write(&mds->mds_notify_lock);
*/
atomic_dec(&lsi->lsi_mounts);
mntput(mnt);
*/
atomic_dec(&lsi->lsi_mounts);
mntput(mnt);
+ init_rwsem(&mds->mds_notify_lock);
obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
mds_init_ctxt(obd, mnt);
obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
mds_init_ctxt(obd, mnt);
+ mds->mds_osc_exp = NULL;
+
if (obd->obd_fail)
LCONSOLE_WARN("%s: shutting down for failover; client state "
"will be preserved.\n", obd->obd_name);
if (obd->obd_fail)
LCONSOLE_WARN("%s: shutting down for failover; client state "
"will be preserved.\n", obd->obd_name);
ENTRY;
OBD_FREE(mlsi, sizeof(*mlsi));
ENTRY;
OBD_FREE(mlsi, sizeof(*mlsi));
+ down_read(&mds->mds_notify_lock);
+ if (obd->obd_stopping || obd->obd_fail)
+ GOTO(out, rc = -ENODEV);
LASSERT(obd);
LASSERT(watched);
LASSERT(obd);
LASSERT(watched);
LASSERT(uuid);
OBD_RACE(OBD_FAIL_MDS_LOV_SYNC_RACE);
LASSERT(uuid);
OBD_RACE(OBD_FAIL_MDS_LOV_SYNC_RACE);
rc = mds_lov_update_mds(obd, watched, idx);
if (rc != 0) {
CERROR("%s failed at update_mds: %d\n", obd_uuid2str(uuid), rc);
GOTO(out, rc);
}
rc = mds_lov_update_mds(obd, watched, idx);
if (rc != 0) {
CERROR("%s failed at update_mds: %d\n", obd_uuid2str(uuid), rc);
GOTO(out, rc);
}
mgi.group = FILTER_GROUP_MDS0 + mds->mds_id;
mgi.uuid = uuid;
mgi.group = FILTER_GROUP_MDS0 + mds->mds_id;
mgi.uuid = uuid;
ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
if (!ctxt)
ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
if (!ctxt)
+ GOTO(out, rc = -ENODEV);
OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT, 60);
OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT, 60);
rc = llog_connect(ctxt, obd->u.mds.mds_lov_desc.ld_tgt_count,
NULL, NULL, uuid);
llog_ctxt_put(ctxt);
rc = llog_connect(ctxt, obd->u.mds.mds_lov_desc.ld_tgt_count,
NULL, NULL, uuid);
llog_ctxt_put(ctxt);
LCONSOLE_INFO("MDS %s: %s now active, resetting orphans\n",
obd->obd_name, obd_uuid2str(uuid));
LCONSOLE_INFO("MDS %s: %s now active, resetting orphans\n",
obd->obd_name, obd_uuid2str(uuid));
- /*
- * FIXME: this obd_stopping was useless,
- * since obd in mdt layer was set
- */
- if (obd->obd_stopping)
- GOTO(out, rc = -ENODEV);
-
rc = mds_lov_clear_orphans(mds, uuid);
if (rc != 0) {
CERROR("%s failed at mds_lov_clear_orphans: %d\n",
rc = mds_lov_clear_orphans(mds, uuid);
if (rc != 0) {
CERROR("%s failed at mds_lov_clear_orphans: %d\n",
+ up_read(&mds->mds_notify_lock);
if (rc) {
/* Deactivate it for safety */
CERROR("%s sync failed %d, deactivating\n", obd_uuid2str(uuid),
if (rc) {
/* Deactivate it for safety */
CERROR("%s sync failed %d, deactivating\n", obd_uuid2str(uuid),
switch (stage) {
case OBD_CLEANUP_EARLY:
case OBD_CLEANUP_EXPORTS:
switch (stage) {
case OBD_CLEANUP_EARLY:
case OBD_CLEANUP_EXPORTS:
- break;
- case OBD_CLEANUP_SELF_EXP:
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
- case OBD_CLEANUP_OBD:
- break;
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
- case OBD_CLEANUP_SELF_EXP:
- break;
- case OBD_CLEANUP_OBD:
- break;
switch (stage) {
case OBD_CLEANUP_EARLY:
case OBD_CLEANUP_EXPORTS:
switch (stage) {
case OBD_CLEANUP_EARLY:
case OBD_CLEANUP_EXPORTS:
- break;
- case OBD_CLEANUP_SELF_EXP:
rc = obd_llog_finish(obd, 0);
break;
rc = obd_llog_finish(obd, 0);
break;
- case OBD_CLEANUP_OBD:
- break;
/* destroy a nid-stats hash body */
lustre_hash_exit(&obd->obd_nid_stats_hash_body);
/* destroy a nid-stats hash body */
lustre_hash_exit(&obd->obd_nid_stats_hash_body);
- /* Precleanup stage 1, we must make sure all exports (other than the
- self-export) get destroyed. */
+ /* Precleanup, we must make sure all exports get destroyed. */
err = obd_precleanup(obd, OBD_CLEANUP_EXPORTS);
if (err)
CERROR("Precleanup %s returned %d\n",
err = obd_precleanup(obd, OBD_CLEANUP_EXPORTS);
if (err)
CERROR("Precleanup %s returned %d\n",
CDEBUG(D_INFO, "Decref %s (%p) now %d\n", obd->obd_name, obd, refs);
if ((refs == 1) && obd->obd_stopping) {
CDEBUG(D_INFO, "Decref %s (%p) now %d\n", obd->obd_name, obd, refs);
if ((refs == 1) && obd->obd_stopping) {
- /* All exports (other than the self-export) have been
- destroyed; there should be no more in-progress ops
- by this point.*/
- /* if we're not stopping, we didn't finish setup */
- /* Precleanup stage 2, do other type-specific
- cleanup requiring the self-export. */
- err = obd_precleanup(obd, OBD_CLEANUP_SELF_EXP);
- if (err)
- CERROR("Precleanup %s returned %d\n",
- obd->obd_name, err);
-
+ /* All exports have been destroyed; there should
+ be no more in-progress ops by this point.*/
+
spin_lock(&obd->obd_self_export->exp_lock);
obd->obd_self_export->exp_flags |=
(obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
spin_lock(&obd->obd_self_export->exp_lock);
obd->obd_self_export->exp_flags |=
(obd->obd_fail ? OBD_OPT_FAILOVER : 0) |
target_cleanup_recovery(obd);
rc = filter_llog_preclean(obd);
break;
target_cleanup_recovery(obd);
rc = filter_llog_preclean(obd);
break;
- case OBD_CLEANUP_SELF_EXP:
- break;
- case OBD_CLEANUP_OBD:
- break;
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
- }
- case OBD_CLEANUP_SELF_EXP:
- break;
- case OBD_CLEANUP_OBD:
- break;